22 from DerivationFrameworkBPhys.commonBPHYMethodsCfg
import (
23 BPHY_V0ToolCfg, BPHY_InDetDetailedTrackSelectorToolCfg,
24 BPHY_VertexPointEstimatorCfg, BPHY_TrkVKalVrtFitterCfg,
26 from JpsiUpsilonTools.JpsiUpsilonToolsConfig
import PrimaryVertexRefittingToolCfg
27 acc = ComponentAccumulator()
28 isSimulation = flags.Input.isMC
30 doLRT = flags.Tracking.doLargeD0
31 if not doLRT :
print(
"BPHY5: LRT tracks disabled")
32 mainMuonInput =
"StdWithLRTMuons" if doLRT
else "Muons"
33 mainIDInput =
"InDetWithLRTTrackParticles" if doLRT
else "InDetTrackParticles"
35 from DerivationFrameworkLLP.LLPToolsConfig
import LRTMuonMergerAlg
36 from AthenaConfiguration.Enums
import LHCPeriod
37 acc.merge(LRTMuonMergerAlg( flags,
38 PromptMuonLocation =
"Muons",
39 LRTMuonLocation =
"MuonsLRT",
40 OutputMuonLocation = mainMuonInput,
41 CreateViewCollection =
True,
42 UseRun3WP = flags.GeoModel.Run == LHCPeriod.Run3))
43 from DerivationFrameworkInDet.InDetToolsConfig
import InDetLRTMergeCfg
44 acc.merge(InDetLRTMergeCfg(flags))
46 toRelink = [
"InDetTrackParticles",
"InDetLargeD0TrackParticles"]
if doLRT
else []
47 MuonReLink = [
"Muons",
"MuonsLRT" ]
if doLRT
else []
49 V0Tools = acc.popToolsAndMerge(BPHY_V0ToolCfg(flags, BPHYDerivationName))
50 vkalvrt = acc.popToolsAndMerge(BPHY_TrkVKalVrtFitterCfg(flags, BPHYDerivationName))
51 acc.addPublicTool(vkalvrt)
52 acc.addPublicTool(V0Tools)
53 trackselect = acc.popToolsAndMerge(BPHY_InDetDetailedTrackSelectorToolCfg(flags, BPHYDerivationName))
54 acc.addPublicTool(trackselect)
55 vpest = acc.popToolsAndMerge(BPHY_VertexPointEstimatorCfg(flags, BPHYDerivationName))
56 acc.addPublicTool(vpest)
57 BPHY5JpsiFinder = CompFactory.Analysis.JpsiFinder(
58 name =
"BPHY5JpsiFinder",
61 TrackAndTrack =
False,
63 invMassUpper = 3600.0,
64 invMassLower = 2600.0,
66 oppChargesOnly =
True,
68 atLeastOneComb =
False,
69 useCombinedMeasurement =
False,
70 muonCollectionKey = mainMuonInput,
71 TrackParticleCollection = mainIDInput,
73 TrkVertexFitterTool = vkalvrt,
74 V0VertexFitterTool =
None,
75 TrackSelectorTool = trackselect,
76 VertexPointEstimator = vpest,
78 acc.addPublicTool(BPHY5JpsiFinder )
80 BPHY5JpsiSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(name =
"BPHY5JpsiSelectAndWrite",
81 VertexSearchTool = BPHY5JpsiFinder,
82 OutputVtxContainerName = JpsiContainerName,
83 PVContainerName =
"PrimaryVertices",
85 PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
86 RefPVContainerName =
"SHOULDNOTBEUSED",
87 RelinkTracks = toRelink,
88 RelinkMuons = MuonReLink,
92 BPHY5_Select_Jpsi2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
93 name =
"BPHY5_Select_Jpsi2mumu",
94 HypothesisName =
"Jpsi",
95 InputVtxContainerName = JpsiContainerName,
97 VtxMassHypo = 3096.916,
100 Chi2Max = 200, Do3d =
False,
103 BPHY5_AugOriginalCounts = acc.popToolsAndMerge(
104 AugOriginalCountsCfg(flags, name =
"BPHY5_AugOriginalCounts"))
106 BPHY5BsJpsiKK = CompFactory.Analysis.JpsiPlus2Tracks(name =
"BPHY5BsJpsiKK",
107 kaonkaonHypothesis =
True,
108 pionpionHypothesis =
False,
109 kaonpionHypothesis =
False,
110 trkThresholdPt = 800.0,
117 TrkQuadrupletMassUpper = 6000.0,
118 TrkQuadrupletMassLower = 4800.0,
119 JpsiContainerKey = JpsiContainerName,
120 TrackParticleCollection = mainIDInput,
121 MuonsUsedInJpsi = mainMuonInput,
122 TrkVertexFitterTool = vkalvrt,
123 TrackSelectorTool = trackselect,
124 UseMassConstraint =
True)
125 acc.addPublicTool(BPHY5BsJpsiKK )
126 BPHY5BdJpsiKst = CompFactory.Analysis.JpsiPlus2Tracks(
127 name =
"BPHY5BdJpsiKst",
128 kaonkaonHypothesis =
False,
129 pionpionHypothesis =
False,
130 kaonpionHypothesis =
True,
131 trkThresholdPt = 800.0,
133 BThresholdPt = 5000.,
136 JpsiContainerKey = JpsiContainerName,
137 TrackParticleCollection = mainIDInput,
139 ExcludeCrossJpsiTracks =
False,
140 TrkVertexFitterTool = vkalvrt,
141 TrackSelectorTool = trackselect,
142 UseMassConstraint =
True,
144 TrkQuadrupletMassLower = 3500.0,
145 TrkQuadrupletMassUpper = 6800.0,
147 acc.addPublicTool(BPHY5BdJpsiKst )
148 BPHY5BplJpsiKpl = CompFactory.Analysis.JpsiPlus1Track(name =
"BPHY5BplJpsiKpl",
149 pionHypothesis =
True,
150 kaonHypothesis =
True,
151 trkThresholdPt = 750.0,
153 BThresholdPt = 4000.0,
157 TrkTrippletMassUpper = 8000,
158 TrkTrippletMassLower = 4000,
159 JpsiContainerKey = JpsiContainerName,
160 TrackParticleCollection = mainIDInput,
161 MuonsUsedInJpsi = mainMuonInput,
162 TrkVertexFitterTool = vkalvrt,
163 TrackSelectorTool = trackselect,
164 UseMassConstraint =
True,
165 ExcludeCrossJpsiTracks =
False,
166 ExcludeJpsiMuonsOnly =
True)
167 acc.addPublicTool(BPHY5BplJpsiKpl )
168 BPHY5BJpsipipiX = CompFactory.Analysis.JpsiPlus2Tracks(name =
"BPHY5BJpsipipiX",
169 kaonkaonHypothesis =
False,
170 pionpionHypothesis =
True,
171 kaonpionHypothesis =
False,
172 trkThresholdPt = 800.0,
179 TrkQuadrupletMassUpper = 5800.0,
180 TrkQuadrupletMassLower = 3400.0,
181 JpsiContainerKey = JpsiContainerName,
182 TrackParticleCollection = mainIDInput,
183 MuonsUsedInJpsi = mainMuonInput,
184 TrkVertexFitterTool = vkalvrt,
185 TrackSelectorTool = trackselect,
186 UseMassConstraint =
True,
187 ExcludeCrossJpsiTracks =
False,
188 ExcludeJpsiMuonsOnly =
True)
189 acc.addPublicTool(BPHY5BJpsipipiX )
190 BPHY5BsKKSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(name =
"BPHY5BsKKSelectAndWrite",
191 VertexSearchTool = BPHY5BsJpsiKK,
192 OutputVtxContainerName = BsJpsiPhiContainerName,
193 PVContainerName =
"PrimaryVertices",
195 PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
196 RefPVContainerName =
"BPHY5RefittedPrimaryVertices",
197 RefitPV =
True, Do3d =
False,
198 RelinkTracks = toRelink,
199 MaxPVrefit = 10000, DoVertexType = 7)
201 BPHY5BplKplSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(name =
"BPHY5BplKplSelectAndWrite",
202 VertexSearchTool = BPHY5BplJpsiKpl,
203 OutputVtxContainerName = BPlusContainerName,
204 PVContainerName =
"PrimaryVertices",
206 PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
207 RefPVContainerName =
"BPHY5RefBplJpsiKplPrimaryVertices",
209 RelinkTracks = toRelink,
212 BPHY5BpipiXSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(name =
"BPHY5BpipiXSelectAndWrite",
213 VertexSearchTool = BPHY5BJpsipipiX,
214 OutputVtxContainerName = BpipiContainerName,
215 PVContainerName =
"PrimaryVertices",
217 PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
218 RefPVContainerName =
"BPHY5RefittedBPipiPrimaryVertices",
219 RefitPV =
True, Do3d =
False,
220 RelinkTracks = toRelink,
221 MaxPVrefit = 10000, DoVertexType = 7)
223 BPHY5BdKstSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
224 name =
"BPHY5BdKstSelectAndWrite",
225 VertexSearchTool = BPHY5BdJpsiKst,
226 OutputVtxContainerName = BdJpsiKstContainerName,
228 PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
229 PVContainerName =
"PrimaryVertices",
230 RefPVContainerName =
"BPHY5RefittedKstPrimaryVertices",
232 RelinkTracks = toRelink,
236 BPHY5_Select_Bd2JpsiKst = CompFactory.DerivationFramework.Select_onia2mumu(
237 name =
"BPHY5_Select_Bd2JpsiKst",
238 HypothesisName =
"Bd",
239 InputVtxContainerName = BdJpsiKstContainerName,
241 TrkMasses = [105.658, 105.658, 493.677, 139.570],
242 VtxMassHypo = 5279.6,
247 BPHY5_Select_Bd2JpsiKstbar = CompFactory.DerivationFramework.Select_onia2mumu(
248 name =
"BPHY5_Select_Bd2JpsiKstbar",
249 HypothesisName =
"Bdbar",
250 InputVtxContainerName = BdJpsiKstContainerName,
252 TrkMasses = [105.658, 105.658, 139.570, 493.677],
253 VtxMassHypo = 5279.6,
258 BPHY5_Select_Bs2JpsiKK = CompFactory.DerivationFramework.Select_onia2mumu(
259 name =
"BPHY5_Select_Bs2JpsiKK",
260 HypothesisName =
"Bs",
261 InputVtxContainerName = BsJpsiPhiContainerName,
263 TrkMasses = [105.658, 105.658, 493.677, 493.677],
264 VtxMassHypo = 5366.3,
266 MassMax = 5800.0, Do3d =
False,
269 BPHY5_Select_Bpl2JpsiKpl = CompFactory.DerivationFramework.Select_onia2mumu(
270 name =
"BPHY5_Select_Bpl2JpsiKpl",
271 HypothesisName =
"Bplus",
272 InputVtxContainerName = BPlusContainerName,
274 TrkMasses = [105.658, 105.658, 493.677],
275 VtxMassHypo = 5279.26,
276 MassMin = 5279.26 - 500, Do3d =
False,
277 MassMax = 5279.26 + 500,
280 BPHY5_Select_Bpl2JpsiPi = CompFactory.DerivationFramework.Select_onia2mumu(
281 name =
"BPHY5_Select_Bpl2JpsiPi",
282 HypothesisName =
"Bc",
283 InputVtxContainerName = BPlusContainerName,
285 TrkMasses = [105.658, 105.658, 139.570],
286 VtxMassHypo = 6275.1, Do3d =
False,
287 MassMin = 6275.1 - 500,
288 MassMax = 6275.1 + 500,
291 BPHY5_Select_B2JpsipipiX = CompFactory.DerivationFramework.Select_onia2mumu(
292 name =
"BPHY5_Select_B2JpsipipiX",
293 HypothesisName =
"pipiJpsi",
294 InputVtxContainerName = BpipiContainerName,
296 TrkMasses = [105.658, 105.658, 139.570, 139.570],
299 MassMax = 5800.0, Do3d =
False,
303 BPHY5_Revertex_Bs_NoMassConst = CompFactory.DerivationFramework.ReVertex(
304 name =
"BPHY5_Revertex_Bs_NoMassConst",
305 InputVtxContainerName = BsJpsiPhiContainerName,
306 TrackIndices = [ 0, 1, 2, 3 ],
308 UseMassConstraint =
False,
309 TrackContainerName = mainIDInput,
310 RelinkTracks = toRelink,
311 PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
312 TrkVertexFitterTool = vkalvrt,
313 OutputVtxContainerName =
"BPHY5BsJpsiKKCandidatesNoConstraint")
315 BPHY5_Revertex_Bd_NoMassConst = CompFactory.DerivationFramework.ReVertex(
316 name =
"BPHY5_Revertex_Bd_NoMassConst",
317 InputVtxContainerName =
"BPHY5BdJpsiKstCandidates",
318 TrackIndices = [ 0, 1, 2, 3 ],
320 UseMassConstraint =
False,
321 TrackContainerName = mainIDInput,
322 RelinkTracks = toRelink,
323 PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
324 TrkVertexFitterTool = vkalvrt,
325 OutputVtxContainerName =
"BPHY5BdJpsiKstCandidatesNoConstraint")
327 BPHY5_Select_Bs2JpsiKKNoConstraint = CompFactory.DerivationFramework.Select_onia2mumu(
328 name =
"BPHY5_Select_Bs2JpsiKKNoConstraint",
329 HypothesisName =
"Bs",
331 InputVtxContainerName =
"BPHY5BsJpsiKKCandidatesNoConstraint",
332 TrkMasses = [105.658, 105.658, 493.677, 493.677],
333 VtxMassHypo = 5366.3,
335 MassMax = 5800.0, Do3d =
False,
338 BPHY5_Select_BdBar2JpsiKpiNoConstraint = CompFactory.DerivationFramework.Select_onia2mumu(
339 name =
"BPHY5_Select_BdBar2JpsiKpiNoConstraint",
340 HypothesisName =
"BdBar",
342 InputVtxContainerName =
"BPHY5BdJpsiKstCandidatesNoConstraint",
343 TrkMasses = [105.658, 105.658, 139.570, 493.677],
344 VtxMassHypo = 5279.6,
349 BPHY5_Select_Bd2JpsiKpiNoConstraint = CompFactory.DerivationFramework.Select_onia2mumu(
350 name =
"BPHY5_Select_Bd2JpsiKpiNoConstraint",
351 HypothesisName =
"Bd",
353 InputVtxContainerName =
"BPHY5BdJpsiKstCandidatesNoConstraint",
354 TrkMasses = [105.658, 105.658, 493.677, 139.570],
355 VtxMassHypo = 5279.6,
362 BPHY5_SelectBsJpsiKKEvent = CompFactory.DerivationFramework.xAODStringSkimmingTool(
363 name =
"BPHY5_SelectBsJpsiKKEvent",
364 expression = f
"count({BsJpsiPhiContainerName}.passed_Bs > 0) > 0")
366 BPHY5_SelectBplJpsiKplEvent = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"BPHY5_SelectBplJpsiKplEvent",
367 expression = f
"count({BPlusContainerName}.passed_Bplus>0) > 0")
369 BPHY5_SelectBplJpsiKplEventBc = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"BPHY5_SelectBplJpsiKplEventBc",
370 expression = f
"count({BPlusContainerName}.passed_Bc>0) > 0")
372 BPHY5_SelectBdKstarEventBd = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"BPHY5_SelectBdKstarEventBd",
373 expression = f
"count({BdJpsiKstContainerName}.passed_Bd>0) > 0")
375 BPHY5_SelectBdKstarEventBdBar = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"BPHY5_SelectBdKstarEventBdbar",
376 expression = f
"count({BdJpsiKstContainerName}.passed_Bdbar>0) > 0")
381 if "Bs" in Decays : filterlist.append(BPHY5_SelectBsJpsiKKEvent)
382 if "B+" in Decays : filterlist += [ BPHY5_SelectBplJpsiKplEvent,BPHY5_SelectBplJpsiKplEventBc]
383 if "BdKst" in Decays : filterlist += [BPHY5_SelectBdKstarEventBd, BPHY5_SelectBdKstarEventBdBar]
385 BPHY5SkimmingOR = CompFactory.DerivationFramework.FilterCombinationOR(
"BPHY5SkimmingOR",
386 FilterList = filterlist)
387 for t
in filterlist +[BPHY5SkimmingOR]: acc.addPublicTool(t)
389 augTools = [BPHY5JpsiSelectAndWrite, BPHY5_Select_Jpsi2mumu, BPHY5_AugOriginalCounts]
390 if "Bs" in Decays : augTools += [BPHY5BsKKSelectAndWrite, BPHY5_Select_Bs2JpsiKK, BPHY5_Revertex_Bs_NoMassConst, BPHY5_Select_Bs2JpsiKKNoConstraint]
391 if "B+" in Decays : augTools += [BPHY5BplKplSelectAndWrite, BPHY5_Select_Bpl2JpsiKpl, BPHY5_Select_Bpl2JpsiPi]
392 if "BdKst" in Decays : augTools += [ BPHY5BdKstSelectAndWrite, BPHY5_Select_Bd2JpsiKst, BPHY5_Select_Bd2JpsiKstbar, BPHY5_Revertex_Bd_NoMassConst, BPHY5_Select_BdBar2JpsiKpiNoConstraint, BPHY5_Select_Bd2JpsiKpiNoConstraint]
393 if "BpipiX" in Decays : augTools+= [ BPHY5BpipiXSelectAndWrite, BPHY5_Select_B2JpsipipiX]
394 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel(
"BPHY5Kernel",
395 AugmentationTools = augTools,
397 SkimmingTools = [BPHY5SkimmingOR]
if not isSimulation
else [],
399 for t
in augTools : acc.addPublicTool(t)