22 from DerivationFrameworkBPhys.commonBPHYMethodsCfg
import (BPHY_V0ToolCfg, BPHY_InDetDetailedTrackSelectorToolCfg, BPHY_VertexPointEstimatorCfg, BPHY_TrkVKalVrtFitterCfg)
23 from JpsiUpsilonTools.JpsiUpsilonToolsConfig
import PrimaryVertexRefittingToolCfg
25 isSimulation = flags.Input.isMC
27 doLRT = flags.Tracking.doLargeD0
28 if not doLRT :
print(
"BPHY5: LRT tracks disabled")
29 mainMuonInput =
"StdWithLRTMuons" if doLRT
else "Muons"
30 mainIDInput =
"InDetWithLRTTrackParticles" if doLRT
else "InDetTrackParticles"
32 from DerivationFrameworkLLP.LLPToolsConfig
import LRTMuonMergerAlg
33 from AthenaConfiguration.Enums
import LHCPeriod
35 PromptMuonLocation =
"Muons",
36 LRTMuonLocation =
"MuonsLRT",
37 OutputMuonLocation = mainMuonInput,
38 CreateViewCollection =
True,
39 UseRun3WP = flags.GeoModel.Run == LHCPeriod.Run3))
40 from DerivationFrameworkInDet.InDetToolsConfig
import InDetLRTMergeCfg
43 BPHY5_AugOriginalCounts = CompFactory.DerivationFramework.AugOriginalCounts(
44 name =
"BPHY5_AugOriginalCounts",
45 VertexContainer =
"PrimaryVertices",
46 TrackContainer =
"InDetTrackParticles",
47 TrackLRTContainer =
"InDetLargeD0TrackParticles" if doLRT
else "")
48 toRelink = [
"InDetTrackParticles",
"InDetLargeD0TrackParticles"]
if doLRT
else []
49 MuonReLink = [
"Muons",
"MuonsLRT" ]
if doLRT
else []
51 V0Tools = acc.popToolsAndMerge(
BPHY_V0ToolCfg(flags, BPHYDerivationName))
53 acc.addPublicTool(vkalvrt)
54 acc.addPublicTool(V0Tools)
56 acc.addPublicTool(trackselect)
58 acc.addPublicTool(vpest)
59 BPHY5JpsiFinder = CompFactory.Analysis.JpsiFinder(
60 name =
"BPHY5JpsiFinder",
63 TrackAndTrack =
False,
65 invMassUpper = 3600.0,
66 invMassLower = 2600.0,
68 oppChargesOnly =
True,
70 atLeastOneComb =
False,
71 useCombinedMeasurement =
False,
72 muonCollectionKey = mainMuonInput,
73 TrackParticleCollection = mainIDInput,
75 TrkVertexFitterTool = vkalvrt,
76 V0VertexFitterTool =
None,
77 TrackSelectorTool = trackselect,
78 VertexPointEstimator = vpest,
80 acc.addPublicTool(BPHY5JpsiFinder )
82 BPHY5JpsiSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(name =
"BPHY5JpsiSelectAndWrite",
83 VertexSearchTool = BPHY5JpsiFinder,
84 OutputVtxContainerName = JpsiContainerName,
85 PVContainerName =
"PrimaryVertices",
88 RefPVContainerName =
"SHOULDNOTBEUSED",
89 RelinkTracks = toRelink,
90 RelinkMuons = MuonReLink,
94 BPHY5_Select_Jpsi2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
95 name =
"BPHY5_Select_Jpsi2mumu",
96 HypothesisName =
"Jpsi",
97 InputVtxContainerName = JpsiContainerName,
99 VtxMassHypo = 3096.916,
102 Chi2Max = 200, Do3d =
False,
105 BPHY5BsJpsiKK = CompFactory.Analysis.JpsiPlus2Tracks(name =
"BPHY5BsJpsiKK",
106 kaonkaonHypothesis =
True,
107 pionpionHypothesis =
False,
108 kaonpionHypothesis =
False,
109 trkThresholdPt = 800.0,
116 TrkQuadrupletMassUpper = 6000.0,
117 TrkQuadrupletMassLower = 4800.0,
118 JpsiContainerKey = JpsiContainerName,
119 TrackParticleCollection = mainIDInput,
120 MuonsUsedInJpsi = mainMuonInput,
121 TrkVertexFitterTool = vkalvrt,
122 TrackSelectorTool = trackselect,
123 UseMassConstraint =
True)
124 acc.addPublicTool(BPHY5BsJpsiKK )
125 BPHY5BdJpsiKst = CompFactory.Analysis.JpsiPlus2Tracks(
126 name =
"BPHY5BdJpsiKst",
127 kaonkaonHypothesis =
False,
128 pionpionHypothesis =
False,
129 kaonpionHypothesis =
True,
130 trkThresholdPt = 800.0,
132 BThresholdPt = 5000.,
135 JpsiContainerKey = JpsiContainerName,
136 TrackParticleCollection = mainIDInput,
138 ExcludeCrossJpsiTracks =
False,
139 TrkVertexFitterTool = vkalvrt,
140 TrackSelectorTool = trackselect,
141 UseMassConstraint =
True,
143 TrkQuadrupletMassLower = 3500.0,
144 TrkQuadrupletMassUpper = 6800.0,
146 acc.addPublicTool(BPHY5BdJpsiKst )
147 BPHY5BplJpsiKpl = CompFactory.Analysis.JpsiPlus1Track(name =
"BPHY5BplJpsiKpl",
148 pionHypothesis =
True,
149 kaonHypothesis =
True,
150 trkThresholdPt = 750.0,
152 BThresholdPt = 4000.0,
156 TrkTrippletMassUpper = 8000,
157 TrkTrippletMassLower = 4000,
158 JpsiContainerKey = JpsiContainerName,
159 TrackParticleCollection = mainIDInput,
160 MuonsUsedInJpsi = mainMuonInput,
161 TrkVertexFitterTool = vkalvrt,
162 TrackSelectorTool = trackselect,
163 UseMassConstraint =
True,
164 ExcludeCrossJpsiTracks =
False,
165 ExcludeJpsiMuonsOnly =
True)
166 acc.addPublicTool(BPHY5BplJpsiKpl )
167 BPHY5BJpsipipiX = CompFactory.Analysis.JpsiPlus2Tracks(name =
"BPHY5BJpsipipiX",
168 kaonkaonHypothesis =
False,
169 pionpionHypothesis =
True,
170 kaonpionHypothesis =
False,
171 trkThresholdPt = 800.0,
178 TrkQuadrupletMassUpper = 5800.0,
179 TrkQuadrupletMassLower = 3400.0,
180 JpsiContainerKey = JpsiContainerName,
181 TrackParticleCollection = mainIDInput,
182 MuonsUsedInJpsi = mainMuonInput,
183 TrkVertexFitterTool = vkalvrt,
184 TrackSelectorTool = trackselect,
185 UseMassConstraint =
True,
186 ExcludeCrossJpsiTracks =
False,
187 ExcludeJpsiMuonsOnly =
True)
188 acc.addPublicTool(BPHY5BJpsipipiX )
189 BPHY5BsKKSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(name =
"BPHY5BsKKSelectAndWrite",
190 VertexSearchTool = BPHY5BsJpsiKK,
191 OutputVtxContainerName = BsJpsiPhiContainerName,
192 PVContainerName =
"PrimaryVertices",
195 RefPVContainerName =
"BPHY5RefittedPrimaryVertices",
196 RefitPV =
True, Do3d =
False,
197 RelinkTracks = toRelink,
198 MaxPVrefit = 10000, DoVertexType = 7)
200 BPHY5BplKplSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(name =
"BPHY5BplKplSelectAndWrite",
201 VertexSearchTool = BPHY5BplJpsiKpl,
202 OutputVtxContainerName = BPlusContainerName,
203 PVContainerName =
"PrimaryVertices",
206 RefPVContainerName =
"BPHY5RefBplJpsiKplPrimaryVertices",
208 RelinkTracks = toRelink,
211 BPHY5BpipiXSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(name =
"BPHY5BpipiXSelectAndWrite",
212 VertexSearchTool = BPHY5BJpsipipiX,
213 OutputVtxContainerName = BpipiContainerName,
214 PVContainerName =
"PrimaryVertices",
217 RefPVContainerName =
"BPHY5RefittedBPipiPrimaryVertices",
218 RefitPV =
True, Do3d =
False,
219 RelinkTracks = toRelink,
220 MaxPVrefit = 10000, DoVertexType = 7)
222 BPHY5BdKstSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
223 name =
"BPHY5BdKstSelectAndWrite",
224 VertexSearchTool = BPHY5BdJpsiKst,
225 OutputVtxContainerName = BdJpsiKstContainerName,
228 PVContainerName =
"PrimaryVertices",
229 RefPVContainerName =
"BPHY5RefittedKstPrimaryVertices",
231 RelinkTracks = toRelink,
235 BPHY5_Select_Bd2JpsiKst = CompFactory.DerivationFramework.Select_onia2mumu(
236 name =
"BPHY5_Select_Bd2JpsiKst",
237 HypothesisName =
"Bd",
238 InputVtxContainerName = BdJpsiKstContainerName,
240 TrkMasses = [105.658, 105.658, 493.677, 139.570],
241 VtxMassHypo = 5279.6,
246 BPHY5_Select_Bd2JpsiKstbar = CompFactory.DerivationFramework.Select_onia2mumu(
247 name =
"BPHY5_Select_Bd2JpsiKstbar",
248 HypothesisName =
"Bdbar",
249 InputVtxContainerName = BdJpsiKstContainerName,
251 TrkMasses = [105.658, 105.658, 139.570, 493.677],
252 VtxMassHypo = 5279.6,
257 BPHY5_Select_Bs2JpsiKK = CompFactory.DerivationFramework.Select_onia2mumu(
258 name =
"BPHY5_Select_Bs2JpsiKK",
259 HypothesisName =
"Bs",
260 InputVtxContainerName = BsJpsiPhiContainerName,
262 TrkMasses = [105.658, 105.658, 493.677, 493.677],
263 VtxMassHypo = 5366.3,
265 MassMax = 5800.0, Do3d =
False,
268 BPHY5_Select_Bpl2JpsiKpl = CompFactory.DerivationFramework.Select_onia2mumu(
269 name =
"BPHY5_Select_Bpl2JpsiKpl",
270 HypothesisName =
"Bplus",
271 InputVtxContainerName = BPlusContainerName,
273 TrkMasses = [105.658, 105.658, 493.677],
274 VtxMassHypo = 5279.26,
275 MassMin = 5279.26 - 500, Do3d =
False,
276 MassMax = 5279.26 + 500,
279 BPHY5_Select_Bpl2JpsiPi = CompFactory.DerivationFramework.Select_onia2mumu(
280 name =
"BPHY5_Select_Bpl2JpsiPi",
281 HypothesisName =
"Bc",
282 InputVtxContainerName = BPlusContainerName,
284 TrkMasses = [105.658, 105.658, 139.570],
285 VtxMassHypo = 6275.1, Do3d =
False,
286 MassMin = 6275.1 - 500,
287 MassMax = 6275.1 + 500,
290 BPHY5_Select_B2JpsipipiX = CompFactory.DerivationFramework.Select_onia2mumu(
291 name =
"BPHY5_Select_B2JpsipipiX",
292 HypothesisName =
"pipiJpsi",
293 InputVtxContainerName = BpipiContainerName,
295 TrkMasses = [105.658, 105.658, 139.570, 139.570],
298 MassMax = 5800.0, Do3d =
False,
302 BPHY5_Revertex_Bs_NoMassConst = CompFactory.DerivationFramework.ReVertex(
303 name =
"BPHY5_Revertex_Bs_NoMassConst",
304 InputVtxContainerName = BsJpsiPhiContainerName,
305 TrackIndices = [ 0, 1, 2, 3 ],
307 UseMassConstraint =
False,
308 TrackContainerName = mainIDInput,
309 RelinkTracks = toRelink,
311 TrkVertexFitterTool = vkalvrt,
312 OutputVtxContainerName =
"BPHY5BsJpsiKKCandidatesNoConstraint")
314 BPHY5_Revertex_Bd_NoMassConst = CompFactory.DerivationFramework.ReVertex(
315 name =
"BPHY5_Revertex_Bd_NoMassConst",
316 InputVtxContainerName =
"BPHY5BdJpsiKstCandidates",
317 TrackIndices = [ 0, 1, 2, 3 ],
319 UseMassConstraint =
False,
320 TrackContainerName = mainIDInput,
321 RelinkTracks = toRelink,
323 TrkVertexFitterTool = vkalvrt,
324 OutputVtxContainerName =
"BPHY5BdJpsiKstCandidatesNoConstraint")
326 BPHY5_Select_Bs2JpsiKKNoConstraint = CompFactory.DerivationFramework.Select_onia2mumu(
327 name =
"BPHY5_Select_Bs2JpsiKKNoConstraint",
328 HypothesisName =
"Bs",
330 InputVtxContainerName =
"BPHY5BsJpsiKKCandidatesNoConstraint",
331 TrkMasses = [105.658, 105.658, 493.677, 493.677],
332 VtxMassHypo = 5366.3,
334 MassMax = 5800.0, Do3d =
False,
337 BPHY5_Select_BdBar2JpsiKpiNoConstraint = CompFactory.DerivationFramework.Select_onia2mumu(
338 name =
"BPHY5_Select_BdBar2JpsiKpiNoConstraint",
339 HypothesisName =
"BdBar",
341 InputVtxContainerName =
"BPHY5BdJpsiKstCandidatesNoConstraint",
342 TrkMasses = [105.658, 105.658, 139.570, 493.677],
343 VtxMassHypo = 5279.6,
348 BPHY5_Select_Bd2JpsiKpiNoConstraint = CompFactory.DerivationFramework.Select_onia2mumu(
349 name =
"BPHY5_Select_Bd2JpsiKpiNoConstraint",
350 HypothesisName =
"Bd",
352 InputVtxContainerName =
"BPHY5BdJpsiKstCandidatesNoConstraint",
353 TrkMasses = [105.658, 105.658, 493.677, 139.570],
354 VtxMassHypo = 5279.6,
361 BPHY5_SelectBsJpsiKKEvent = CompFactory.DerivationFramework.xAODStringSkimmingTool(
362 name =
"BPHY5_SelectBsJpsiKKEvent",
363 expression = f
"count({BsJpsiPhiContainerName}.passed_Bs > 0) > 0")
365 BPHY5_SelectBplJpsiKplEvent = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"BPHY5_SelectBplJpsiKplEvent",
366 expression = f
"count({BPlusContainerName}.passed_Bplus>0) > 0")
368 BPHY5_SelectBplJpsiKplEventBc = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"BPHY5_SelectBplJpsiKplEventBc",
369 expression = f
"count({BPlusContainerName}.passed_Bc>0) > 0")
371 BPHY5_SelectBdKstarEventBd = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"BPHY5_SelectBdKstarEventBd",
372 expression = f
"count({BdJpsiKstContainerName}.passed_Bd>0) > 0")
374 BPHY5_SelectBdKstarEventBdBar = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"BPHY5_SelectBdKstarEventBdbar",
375 expression = f
"count({BdJpsiKstContainerName}.passed_Bdbar>0) > 0")
380 if "Bs" in Decays : filterlist.append(BPHY5_SelectBsJpsiKKEvent)
381 if "B+" in Decays : filterlist += [ BPHY5_SelectBplJpsiKplEvent,BPHY5_SelectBplJpsiKplEventBc]
382 if "BdKst" in Decays : filterlist += [BPHY5_SelectBdKstarEventBd, BPHY5_SelectBdKstarEventBdBar]
384 BPHY5SkimmingOR = CompFactory.DerivationFramework.FilterCombinationOR(
"BPHY5SkimmingOR",
385 FilterList = filterlist)
386 for t
in filterlist +[BPHY5SkimmingOR]: acc.addPublicTool(t)
388 augTools = [BPHY5JpsiSelectAndWrite, BPHY5_Select_Jpsi2mumu, BPHY5_AugOriginalCounts]
389 if "Bs" in Decays : augTools += [BPHY5BsKKSelectAndWrite, BPHY5_Select_Bs2JpsiKK, BPHY5_Revertex_Bs_NoMassConst, BPHY5_Select_Bs2JpsiKKNoConstraint]
390 if "B+" in Decays : augTools += [BPHY5BplKplSelectAndWrite, BPHY5_Select_Bpl2JpsiKpl, BPHY5_Select_Bpl2JpsiPi]
391 if "BdKst" in Decays : augTools += [ BPHY5BdKstSelectAndWrite, BPHY5_Select_Bd2JpsiKst, BPHY5_Select_Bd2JpsiKstbar, BPHY5_Revertex_Bd_NoMassConst, BPHY5_Select_BdBar2JpsiKpiNoConstraint, BPHY5_Select_Bd2JpsiKpiNoConstraint]
392 if "BpipiX" in Decays : augTools+= [ BPHY5BpipiXSelectAndWrite, BPHY5_Select_B2JpsipipiX]
393 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel(
"BPHY5Kernel",
394 AugmentationTools = augTools,
396 SkimmingTools = [BPHY5SkimmingOR]
if not isSimulation
else [],
398 for t
in augTools : acc.addPublicTool(t)