14def BPHY10Cfg(flags):
15 from DerivationFrameworkBPhys.commonBPHYMethodsCfg import (
16 BPHY_V0ToolCfg, BPHY_InDetDetailedTrackSelectorToolCfg,
17 BPHY_VertexPointEstimatorCfg, BPHY_TrkVKalVrtFitterCfg,
18 AugOriginalCountsCfg)
19 from JpsiUpsilonTools.JpsiUpsilonToolsConfig import PrimaryVertexRefittingToolCfg
20 acc = ComponentAccumulator()
21 PVrefit = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags))
22 acc.addPublicTool(PVrefit)
23 isSimulation = flags.Input.isMC
24
25 V0Tools = acc.popToolsAndMerge(BPHY_V0ToolCfg(flags, BPHYDerivationName))
26 vkalvrt = acc.popToolsAndMerge(BPHY_TrkVKalVrtFitterCfg(flags, BPHYDerivationName))
27 acc.addPublicTool(vkalvrt)
28 acc.addPublicTool(V0Tools)
29 trackselect = acc.popToolsAndMerge(BPHY_InDetDetailedTrackSelectorToolCfg(flags, BPHYDerivationName))
30 acc.addPublicTool(trackselect)
31 vpest = acc.popToolsAndMerge(BPHY_VertexPointEstimatorCfg(flags, BPHYDerivationName))
32 acc.addPublicTool(vpest)
33 BPHY10JpsiFinder = CompFactory.Analysis.JpsiFinder(
34 name = "BPHY10JpsiFinder",
35 muAndMu = True,
36 muAndTrack = False,
37 TrackAndTrack = False,
38 assumeDiMuons = True,
39 invMassUpper = 4000.0,
40 invMassLower = 2600.0,
41 Chi2Cut = 200.,
42 oppChargesOnly = True,
43 combOnly = True,
44 atLeastOneComb = False,
45 useCombinedMeasurement = False,
46 muonCollectionKey = "Muons",
47 TrackParticleCollection = "InDetTrackParticles",
48 TrkVertexFitterTool = vkalvrt,
49 TrackSelectorTool = trackselect,
50 VertexPointEstimator = vpest,
51 useMCPCuts = False)
52
53 BPHY10JpsiSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
54 name = "BPHY10JpsiSelectAndWrite",
55 VertexSearchTool = BPHY10JpsiFinder,
56 OutputVtxContainerName = "BPHY10JpsiCandidates",
57 PVContainerName = "PrimaryVertices",
58 V0Tools = V0Tools,
59 PVRefitter = PVrefit,
60 RefPVContainerName = "SHOULDNOTBEUSED",
61 DoVertexType = 1)
62 BPHY10_Select_Jpsi2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
63 name = "BPHY10_Select_Jpsi2mumu",
64 HypothesisName = "Jpsi",
65 InputVtxContainerName = "BPHY10JpsiCandidates",
66 V0Tools = V0Tools,
67 VtxMassHypo = 3096.916,
68 MassMin = 2600.0,
69 MassMax = 4000.0,
70 Chi2Max = 200,
71 DoVertexType =1)
72
73 BPHY10BdJpsiKst = CompFactory.Analysis.JpsiPlus2Tracks(
74 name = "BPHY10BdJpsiKst",
75 kaonkaonHypothesis = False,
76 pionpionHypothesis = False,
77 kaonpionHypothesis = True,
78 trkThresholdPt = 500.0,
79 trkMaxEta = 3.0,
80 BThresholdPt = 5000.,
81 BMassLower = 4300.0,
82 BMassUpper = 6300.0,
83 JpsiContainerKey = "BPHY10JpsiCandidates",
84 TrackParticleCollection = "InDetTrackParticles",
85 ExcludeCrossJpsiTracks = False,
86 TrkVertexFitterTool = vkalvrt,
87 TrackSelectorTool = trackselect,
88 UseMassConstraint = True,
89 Chi2Cut = 10.0,
90 DiTrackPt = 500.,
91 TrkQuadrupletMassLower = 3500.0,
92 TrkQuadrupletMassUpper = 6800.0,
93 FinalDiTrackPt = 500.
94 )
95 BPHY10V0ContainerName = "BPHY10RecoV0Candidates"
96 BPHY10KshortContainerName = "BPHY10RecoKshortCandidates"
97 BPHY10LambdaContainerName = "BPHY10RecoLambdaCandidates"
98 BPHY10LambdabarContainerName = "BPHY10RecoLambdabarCandidates"
99
100 BPHY10BdKstSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
101 name = "BPHY10BdKstSelectAndWrite",
102 VertexSearchTool = BPHY10BdJpsiKst,
103 OutputVtxContainerName = "BPHY10BdJpsiKstCandidates",
104 PVContainerName = "PrimaryVertices",
105 V0Tools = V0Tools,
106 PVRefitter = PVrefit,
107 RefPVContainerName = "BPHY10RefittedPrimaryVertices1",
108 RefitPV = True,
109 MaxPVrefit = 10000,
110 DoVertexType = 7)
111
112 BPHY10_Select_Bd2JpsiKst = CompFactory.DerivationFramework.Select_onia2mumu(
113 name = "BPHY10_Select_Bd2JpsiKst",
114 HypothesisName = "Bd",
115 InputVtxContainerName = "BPHY10BdJpsiKstCandidates",
116 V0Tools = V0Tools,
117 TrkMasses = [105.658, 105.658, 493.677, 139.570],
118 VtxMassHypo = 5279.6,
119 MassMin = 100.0,
120 MassMax = 100000.0,
121 Chi2Max = 200)
122
123 BPHY10_Select_Bd2JpsiKstbar = CompFactory.DerivationFramework.Select_onia2mumu(
124 name = "BPHY10_Select_Bd2JpsiKstbar",
125 HypothesisName = "Bdbar",
126 InputVtxContainerName = "BPHY10BdJpsiKstCandidates",
127 V0Tools = V0Tools,
128 TrkMasses = [105.658, 105.658, 139.570, 493.677],
129 VtxMassHypo = 5279.6,
130 MassMin = 100.0,
131 MassMax = 100000.0,
132 Chi2Max = 200)
133
134 from DerivationFrameworkBPhys.V0ToolConfig import BPHY_Reco_V0FinderCfg
135 BPHY10_Reco_V0Finder = acc.popToolsAndMerge(BPHY_Reco_V0FinderCfg(
136 flags, derivation = BPHYDerivationName,
137 V0ContainerName = BPHY10V0ContainerName,
138 KshortContainerName = BPHY10KshortContainerName,
139 LambdaContainerName = BPHY10LambdaContainerName,
140 LambdabarContainerName = BPHY10LambdabarContainerName,
141 CheckVertexContainers = ['BPHY10JpsiCandidates']))
142
143 from TrkConfig.TrkVKalVrtFitterConfig import JpsiV0VertexFitCfg
144 JpsiV0VertexFit = acc.popToolsAndMerge(JpsiV0VertexFitCfg(flags))
145 acc.addPublicTool(JpsiV0VertexFit)
146
147 BPHY10JpsiKshort = CompFactory.DerivationFramework.JpsiPlusV0Cascade(
148 name = "BPHY10JpsiKshort",
149 V0Tools = V0Tools,
150 HypothesisName = "Bd",
151 TrkVertexFitterTool = JpsiV0VertexFit,
152 V0Hypothesis = 310,
153 PVRefitter = PVrefit,
154 JpsiMassLowerCut = 2800.,
155 JpsiMassUpperCut = 4000.,
156 V0MassLowerCut = 400.,
157 V0MassUpperCut = 600.,
158 MassLowerCut = 4300.,
159 MassUpperCut = 6300.,
160 RefitPV = True,
161 RefPVContainerName = "BPHY10RefittedPrimaryVertices2",
162 JpsiVertices = "BPHY10JpsiCandidates",
163 CascadeVertexCollections= ["BPHY10JpsiKshortCascadeSV2", "BPHY10JpsiKshortCascadeSV1"],
164 V0Vertices = BPHY10V0ContainerName)
165
166 BPHY10JpsiLambda = CompFactory.DerivationFramework.JpsiPlusV0Cascade(
167 name = "BPHY10JpsiLambda",
168 V0Tools = V0Tools,
169 HypothesisName = "Lambda_b",
170 TrkVertexFitterTool = JpsiV0VertexFit,
171 PVRefitter = PVrefit,
172 V0Hypothesis = 3122,
173 JpsiMassLowerCut = 2800.,
174 JpsiMassUpperCut = 4000.,
175 V0MassLowerCut = 1050.,
176 V0MassUpperCut = 1250.,
177 MassLowerCut = 4600.,
178 MassUpperCut = 6600.,
179 RefitPV = True,
180 RefPVContainerName = "BPHY10RefittedPrimaryVertices3",
181 JpsiVertices = "BPHY10JpsiCandidates",
182 CascadeVertexCollections= ["BPHY10JpsiLambdaCascadeSV2", "BPHY10JpsiLambdaCascadeSV1"],
183 V0Vertices = BPHY10V0ContainerName)
184
185 BPHY10JpsiLambdabar = CompFactory.DerivationFramework.JpsiPlusV0Cascade(
186 name = "BPHY10JpsiLambdabar",
187 HypothesisName = "Lambda_bbar",
188 V0Tools = V0Tools,
189 TrkVertexFitterTool = JpsiV0VertexFit,
190 PVRefitter = PVrefit,
191 V0Hypothesis = -3122,
192 JpsiMassLowerCut = 2800.,
193 JpsiMassUpperCut = 4000.,
194 V0MassLowerCut = 1050.,
195 V0MassUpperCut = 1250.,
196 MassLowerCut = 4600.,
197 MassUpperCut = 6600.,
198 RefitPV = True,
199 RefPVContainerName = "BPHY10RefittedPrimaryVertices4",
200 JpsiVertices = "BPHY10JpsiCandidates",
201 CascadeVertexCollections= ["BPHY10JpsiLambdabarCascadeSV2", "BPHY10JpsiLambdabarCascadeSV1"],
202 V0Vertices = BPHY10V0ContainerName)
203
204 CascadeCollections = []
205 CascadeCollections += BPHY10JpsiKshort.CascadeVertexCollections
206 CascadeCollections += BPHY10JpsiLambda.CascadeVertexCollections
207 CascadeCollections += BPHY10JpsiLambdabar.CascadeVertexCollections
208
209 BPHY10_AugOriginalCounts = acc.popToolsAndMerge(
210 AugOriginalCountsCfg(flags, name = "BPHY10_AugOriginalCounts"))
211
212 if not isSimulation:
213 from DerivationFrameworkTools.DerivationFrameworkToolsConfig import (
214 xAODStringSkimmingToolCfg)
215 BPHY10_SelectBdJpsiKstEvent = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
216 flags, name = "BPHY10_SelectBdJpsiKstEvent",
217 expression = "(count(BPHY10BdJpsiKstCandidates.passed_Bd > 0) + count(BPHY10BdJpsiKstCandidates.passed_Bdbar > 0)) >0"))
218
219 BPHY10_cascadeCheck = CompFactory.DerivationFramework.AnyVertexSkimmingTool(
220 "BPHY10_AnyVertexSkimmingTool",
221 VertexContainerNames =CascadeCollections )
222 BPHY10SkimmingOR = CompFactory.DerivationFramework.FilterCombinationOR(
223 "BPHY10SkimmingOR",
224 FilterList = [BPHY10_cascadeCheck, BPHY10_SelectBdJpsiKstEvent])
225 acc.addPublicTool(BPHY10_cascadeCheck)
226 acc.addPublicTool(BPHY10SkimmingOR)
227
228 augTools = [BPHY10JpsiSelectAndWrite, BPHY10_Select_Jpsi2mumu,
229 BPHY10BdKstSelectAndWrite, BPHY10_Select_Bd2JpsiKst, BPHY10_Select_Bd2JpsiKstbar,
230 BPHY10_Reco_V0Finder, BPHY10JpsiKshort, BPHY10JpsiLambda, BPHY10JpsiLambdabar,
231 BPHY10_AugOriginalCounts]
232 for t in augTools : acc.addPublicTool(t)
233
234 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel("BPHY10Kernel",
235 AugmentationTools = augTools,
236
237
238 SkimmingTools = [BPHY10SkimmingOR] if not isSimulation else [],
239 ThinningTools = []))
240 from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
241 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
242 from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
243 BPHY10SlimmingHelper =
SlimmingHelper(
"BPHY10SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
244 from DerivationFrameworkBPhys.commonBPHYMethodsCfg import getDefaultAllVariables
245 AllVariables = getDefaultAllVariables()
246 StaticContent = []
247
248
249 BPHY10SlimmingHelper.IncludeMuonTriggerContent = True
250 BPHY10SlimmingHelper.IncludeBPhysTriggerContent = True
251
252
253 AllVariables += ["PrimaryVertices"]
254
255 for x in range(1,5):
256 StaticContent += ["xAOD::VertexContainer#BPHY10RefittedPrimaryVertices%s" % str(x)]
257 StaticContent += ["xAOD::VertexAuxContainer#BPHY10RefittedPrimaryVertices%sAux." % str(x)]
258
259
260 AllVariables += ["InDetTrackParticles"]
261
262
265 AllVariables += ["CombinedMuonTrackParticles"]
266 AllVariables += ["ExtrapolatedMuonTrackParticles"]
267
268
269 AllVariables += ["Muons", "MuonsLRT"]
270
271
272
273 StaticContent += ["xAOD::VertexContainer#%s" % BPHY10JpsiSelectAndWrite.OutputVtxContainerName]
274
275 StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY10JpsiSelectAndWrite.OutputVtxContainerName]
276
277 StaticContent += ["xAOD::VertexContainer#%s" % BPHY10BdKstSelectAndWrite.OutputVtxContainerName]
278 StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY10BdKstSelectAndWrite.OutputVtxContainerName]
279
280 StaticContent += ["xAOD::VertexContainer#%s" % BPHY10V0ContainerName]
281 StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY10V0ContainerName]
282 StaticContent += ["xAOD::VertexContainer#%s" % BPHY10KshortContainerName]
283 StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY10KshortContainerName]
284 StaticContent += ["xAOD::VertexContainer#%s" % BPHY10LambdaContainerName]
285 StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY10LambdaContainerName]
286 StaticContent += ["xAOD::VertexContainer#%s" % BPHY10LambdabarContainerName]
287 StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY10LambdabarContainerName]
288
289 for cascades in CascadeCollections:
290 StaticContent += ["xAOD::VertexContainer#%s" % cascades]
291 StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % cascades]
292
293
294 AllVariables += ["GSFTrackParticles", "MuonSpectrometerTrackParticles" ]
295
296
297 if isSimulation:
298 AllVariables += ["TruthEvents","TruthParticles","TruthVertices","MuonTruthParticles"]
299
300 AllVariables = list(
set(AllVariables))
301
302 BPHY10SlimmingHelper.AllVariables = AllVariables
303 BPHY10SlimmingHelper.StaticContent = StaticContent
304 BPHY10SlimmingHelper.SmartCollections = []
305 BPHY10ItemList = BPHY10SlimmingHelper.GetItemList()
306 acc.merge(OutputStreamCfg(flags, "DAOD_BPHY10", ItemList=BPHY10ItemList, AcceptAlgs=["BPHY10Kernel"]))
307 acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_BPHY10", AcceptAlgs=["BPHY10Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
308 acc.printConfig(withDetails=True, summariseProps=True, onlyComponents = [], printDefaults=True)
309 return acc