ATLAS Offline Software
Loading...
Searching...
No Matches
BPHY24.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3#====================================================================
4# BPHY24.py
5#====================================================================
6
7from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8from AthenaConfiguration.ComponentFactory import CompFactory
9
10
11BPHYDerivationName = "BPHY24"
12streamName = "StreamDAOD_BPHY24"
13
14def BPHY24Cfg(flags):
15
16 # Lists for better code organization
17 augsList = [] # List of active augmentation tools
18 skimList = [] # List of active skimming algorithms
19 thinList = [] # List of active thinning algorithms
20 outVtxList = [] # List of reconstructed candidates to store
21 outRePVList = [] # List of candidates holding refitted primary vertices
22 thinTrkVtxList = [] # List of reconstructed candidates to use for the thinning of tracks from vertices
23 thinPassFlagsList = [] # List of pass-flags in the reconstructed candidates to se for the thinning
24 finalCandidateList = []
25
26 from DerivationFrameworkBPhys.commonBPHYMethodsCfg import (
27 BPHY_V0ToolCfg, BPHY_InDetDetailedTrackSelectorToolCfg,
28 BPHY_VertexPointEstimatorCfg, BPHY_TrkVKalVrtFitterCfg,
29 AugOriginalCountsCfg)
30 from JpsiUpsilonTools.JpsiUpsilonToolsConfig import PrimaryVertexRefittingToolCfg
31 acc = ComponentAccumulator()
32 isSimulation = flags.Input.isMC
33 V0Tools = acc.popToolsAndMerge(BPHY_V0ToolCfg(flags, BPHYDerivationName))
34 vkalvrt = acc.popToolsAndMerge(BPHY_TrkVKalVrtFitterCfg(flags, BPHYDerivationName)) # VKalVrt vertex fitter
35 acc.addPublicTool(vkalvrt)
36 acc.addPublicTool(V0Tools)
37 trackselect = acc.popToolsAndMerge(BPHY_InDetDetailedTrackSelectorToolCfg(flags, BPHYDerivationName))
38 acc.addPublicTool(trackselect)
39 vpest = acc.popToolsAndMerge(BPHY_VertexPointEstimatorCfg(flags, BPHYDerivationName))
40 acc.addPublicTool(vpest)
41 PVrefit = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags))
42 acc.addPublicTool(PVrefit)
43
44 bSkim = "(count(BPHY24JpsimmKshortCascadeSV1.Bd_mass) + count(BPHY24JpsieeKshortCascadeSV1.Bd_mass)) > 0"
45
46 from DerivationFrameworkTools.DerivationFrameworkToolsConfig import (
47 xAODStringSkimmingToolCfg)
48 BPHY24_Skim_Bcandidates = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
49 flags, name = "BPHY24_Skim_Bcandidates", expression = bSkim ))
50 skimList += [ BPHY24_Skim_Bcandidates ]
51
52 BPHY24_AugOriginalCounts = acc.popToolsAndMerge(
53 AugOriginalCountsCfg(flags, name = "BPHY24_AugOriginalCounts"))
54 augsList += [ BPHY24_AugOriginalCounts ]
55
56 mainIDInput = "InDetTrackParticles"
57 originalTrackCond = ["InDetTrackParticles", "GSFTrackParticles"]
58 if flags.Tracking.doLargeD0:
59 # LRT track merge
60 from DerivationFrameworkInDet.InDetToolsConfig import InDetLRTMergeCfg
61 acc.merge(InDetLRTMergeCfg(flags))
62
63 mainIDInput = "InDetWithLRTTrackParticles"
64 originalTrackCond += ["InDetLargeD0TrackParticles"]
65
66 BPHY24_Finder_DiMuon = CompFactory.Analysis.JpsiFinder( name = "BPHY24_Finder_DiMuon",
67 muAndMu = True,
68 muAndTrack = False,
69 TrackAndTrack = False,
70 assumeDiMuons = True,
71 muonThresholdPt = 3000.,
72 higherPt = 3500.,
73 invMassUpper = 7000.,
74 invMassLower = 1.,
75 Chi2Cut = 30.,
76 oppChargesOnly = False,
77 allChargeCombinations = True,
78 atLeastOneComb = True,
79 useCombinedMeasurement = False, # Only takes effect if combOnly=True
80 muonCollectionKey = "Muons",
81 TrackParticleCollection = "InDetTrackParticles",
82 TrkVertexFitterTool = vkalvrt,
83 TrackSelectorTool = trackselect,
84 VertexPointEstimator = vpest,
85 useMCPCuts = False )
86
87
88 BPHY24_SelectAndWrite_DiMuon = CompFactory.DerivationFramework.Reco_mumu( name = "BPHY24_SelectAndWrite_DiMuon",
89 JpsiFinder = BPHY24_Finder_DiMuon,
90 V0Tools = V0Tools,
91 PVRefitter = PVrefit,
92 OutputVtxContainerName = "BPHY24_DiMuon_Candidates",
93 PVContainerName = "PrimaryVertices",
94 RefPVContainerName = "SHOULDNOTBEUSED", # The container would be created if PV refit was requested (not needed at this point)
95 DoVertexType = 7 ) # Vertex type marking our own reconstruced secondary candidates
96
97 augsList += [ BPHY24_SelectAndWrite_DiMuon ]
98 # Final selection of the di-muon candidates
99 thinTrkVtxList += [ "BPHY24_DiMuon_Candidates" ]
100 outVtxList += [ "BPHY24_DiMuon_Candidates" ]
101 thinPassFlagsList += [ "passed_Jpsi" ] # TODO: is this really needed?
102
103 BPHY24_Select_DiMuons = CompFactory.DerivationFramework.Select_onia2mumu( name = "BPHY24_Select_DiMuons",
104 HypothesisName = "Jpsi",
105 InputVtxContainerName = "BPHY24_DiMuon_Candidates",
106 V0Tools = V0Tools,
107 VtxMassHypo = 3096.916, # used only for pseudo-proper decay time etc. calculations
108 MassMax = 10000., # loose cut to keep selection from BPHY24_Finder_DiMuon
109 MassMin = 0., # loose cut to keep selection from BPHY24_Finder_DiMuon
110 Chi2Max = 1000., # loose cut to keep selection from BPHY24_Finder_DiMuon (chi2, not chi2/NDF)
111 DoVertexType = 7 ) # Vertex type marking our own reconstruced secondary candidates
112
113 augsList += [ BPHY24_Select_DiMuons ]
114
115 ElectronLHSelectorLHvloose = CompFactory.AsgElectronLikelihoodTool("ElectronLHSelectorLHvloose",
116 primaryVertexContainer = "PrimaryVertices",
117 ConfigFile="ElectronPhotonSelectorTools/offline/mc20_20210514/ElectronLikelihoodVeryLooseOfflineConfig2017_Smooth.conf")
118
119
120
121 ElectronLHSelectorLHvloose_nod0 = CompFactory.AsgElectronLikelihoodTool("ElectronLHSelectorLHvloosenod0", primaryVertexContainer = "PrimaryVertices",
122 ConfigFile="ElectronPhotonSelectorTools/offline/mc16_20190328_nod0/ElectronLikelihoodVeryLooseOfflineConfig2017_Smooth_nod0.conf") # Still OK to use in Run3?
123
124
125 # decorate electrons with the output of LH vloose (nod0)
126 from DerivationFrameworkEGamma.EGammaToolsConfig import EGElectronLikelihoodToolWrapperCfg
127 ElectronPassLHvloose = acc.addPublicTool(acc.popToolsAndMerge(EGElectronLikelihoodToolWrapperCfg(flags, name = "ElectronPassLHvloose",
128 EGammaElectronLikelihoodTool = ElectronLHSelectorLHvloose,
129 CutType = "",
130 StoreGateEntryName = "DFCommonElectronsLHVeryLoose",
131 ContainerName = "Electrons",
132 StoreTResult=False)))
133
134 ElectronPassLHvloosenod0 = acc.addPublicTool(acc.popToolsAndMerge(EGElectronLikelihoodToolWrapperCfg(flags, name = "ElectronPassLHvloosenod0",
135 EGammaElectronLikelihoodTool = ElectronLHSelectorLHvloose_nod0,
136 CutType = "",
137 StoreGateEntryName = "DFCommonElectronsLHVeryLoosenod0",
138 ContainerName = "Electrons",
139 StoreTResult=False)))
140 augsList += [ElectronPassLHvloose, ElectronPassLHvloosenod0]
141
142 BPHY24DiElectronFinder = CompFactory.Analysis.JpsiFinder_ee(
143 name = "BPHY24DiElectronFinder",
144 elAndEl = True,
145 elAndTrack = False,
146 TrackAndTrack = False,
147 assumeDiElectrons = True,
148 elThresholdPt = 4000.0,
149 invMassUpper = 7000.0,
150 invMassLower = 200.0,
151 Chi2Cut = 30.,
152 oppChargesOnly = False,
153 allChargeCombinations = True,
154 useElectronTrackMeasurement = True,
155 electronCollectionKey = "Electrons",
156 TrackParticleCollection = "GSFTrackParticles",
157 useEgammaCuts = True,
158 TrkVertexFitterTool = vkalvrt,
159 TrackSelectorTool = trackselect,
160 VertexPointEstimator = vpest,
161 ElectronSelection = "d0_or_nod0"
162 )
163
164 BPHY24_SelectAndWrite_DiElectron = CompFactory.DerivationFramework.Reco_mumu(
165 name = "BPHY24_SelectAndWrite_DiElectron",
166 JpsiFinder = BPHY24DiElectronFinder,
167 V0Tools = V0Tools,
168 PVRefitter = PVrefit,
169 OutputVtxContainerName = "BPHY24_DiElectron_Candidates",
170 PVContainerName = "PrimaryVertices",
171 RefPVContainerName = "SHOULDNOTBEUSED",
172 DoVertexType = 7
173 )
174
175 augsList += [ BPHY24_SelectAndWrite_DiElectron ]
176
177 BPHY24_Select_DiElectrons = CompFactory.DerivationFramework.Select_onia2mumu(
178 name = "BPHY24_Select_DiElectrons",
179 HypothesisName = "Jpsi",
180 InputVtxContainerName = "BPHY24_DiElectron_Candidates",
181 V0Tools = V0Tools,
182 VtxMassHypo = 3096.916,
183 MassMin = 400.0,
184 MassMax = 7000.0,
185 Chi2Max = 30,
186 DoVertexType = 7
187 )
188
189 thinTrkVtxList += [ "BPHY24_DiElectron_Candidates" ]
190 outVtxList += [ "BPHY24_DiElectron_Candidates" ]
191
192 augsList += [ BPHY24_Select_DiElectrons ]
193
194 V0ContainerName = "BPHY24RecoV0Candidates"
195 KshortContainerName = "BPHY24RecoKshortCandidates"
196 LambdaContainerName = "BPHY24RecoLambdaCandidates"
197 LambdabarContainerName = "BPHY24RecoLambdabarCandidates"
198
199 from DerivationFrameworkBPhys.V0ToolConfig import (
200 BPHY_InDetV0FinderToolCfg, BPHY_Reco_V0FinderCfg)
201
202 BPHY24_V0FinderTool = acc.popToolsAndMerge(BPHY_InDetV0FinderToolCfg(
203 flags, BPHYDerivationName,
204 TrackParticleCollection = mainIDInput,
205 V0ContainerName = V0ContainerName,
206 KshortContainerName = KshortContainerName,
207 LambdaContainerName = LambdaContainerName,
208 LambdabarContainerName = LambdabarContainerName,
209 RelinkTracks = originalTrackCond,
210 use_innerPixHits = True,
211 errmass = 99999,
212 uksmin = 400,
213 uksmax = 600,
214 ksmin = 400,
215 ksmax = 600,
216 ulamin = -1,
217 ulamax = -1,
218 lamin = -1,
219 lamax = -1,
220 d0_cut = -1,
221 max_d0_cut = 50,
222 max_z0_cut = 250,
223 ptTRT = 0,
224 minConstrVertProb = 0.000001,
225 useBDT = True,
226 BDTCut = 0.1,
227 use_TrackSelector = False))
228
229 BPHY24_Reco_V0Finder = acc.popToolsAndMerge(BPHY_Reco_V0FinderCfg(
230 flags, derivation = BPHYDerivationName,
231 V0ContainerName = V0ContainerName,
232 KshortContainerName = KshortContainerName,
233 LambdaContainerName = LambdaContainerName,
234 LambdabarContainerName = LambdabarContainerName,
235 VxPrimaryCandidateName = "BPHY24_DiMuon_Candidates",
236 CheckVertexContainers = ['BPHY24_DiMuon_Candidates',
237 'BPHY24_DiElectron_Candidates'],
238 V0FinderTool = BPHY24_V0FinderTool))
239
240 augsList += [BPHY24_Reco_V0Finder]
241 outVtxList += ['BPHY24RecoKshortCandidates']
242 outVtxList += ["BPHY24RecoV0Candidates"]
243 thinTrkVtxList += ['BPHY24RecoKshortCandidates']
244 thinPassFlagsList += [ "" ] # TODO: is this really needed?
245 finalCandidateList += ["BPHY24RecoKshortCandidates"]
246 finalCandidateList += ["BPHY24RecoV0Candidates"]
247 from TrkConfig.TrkVKalVrtFitterConfig import JpsiV0VertexFitCfg
248 JpsiV0VertexFit = acc.popToolsAndMerge(JpsiV0VertexFitCfg(flags))
249 acc.addPublicTool(JpsiV0VertexFit)
250
251 BPHY24JpsimmKshort = CompFactory.DerivationFramework.JpsiPlusV0Cascade(
252 name = "BPHY24mmKshort",
253 V0Tools = V0Tools,
254 HypothesisName = "Bd",
255 TrkVertexFitterTool = JpsiV0VertexFit,
256 PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
257 V0Hypothesis = 310,
258 JpsiMassLowerCut = 1.,
259 JpsiMassUpperCut = 7000.,
260 ApplyJpsiMassConstraint = False,
261 V0MassLowerCut = 400.,
262 V0MassUpperCut = 600.,
263 MassLowerCut = 4300.,
264 MassUpperCut = 6300.,
265 RefitPV = True,
266 RefPVContainerName = "BPHY24RefittedPrimaryVertices_mm",
267 JpsiVertices = "BPHY24_DiMuon_Candidates",
268 CascadeVertexCollections= ["BPHY24JpsimmKshortCascadeSV2", "BPHY24JpsimmKshortCascadeSV1"],
269 V0Vertices = "BPHY24RecoV0Candidates",
270 V0TrackContainerName = mainIDInput,
271 RelinkTracks = originalTrackCond)
272
273 augsList += [BPHY24JpsimmKshort]
274 outVtxList += BPHY24JpsimmKshort.CascadeVertexCollections
275 outVtxList += ["BPHY24RefittedPrimaryVertices_mm"]
276 thinTrkVtxList += BPHY24JpsimmKshort.CascadeVertexCollections
277 finalCandidateList += BPHY24JpsimmKshort.CascadeVertexCollections
278
279 BPHY24JpsieeKshort = CompFactory.DerivationFramework.JpsiPlusV0Cascade(
280 name = "BPHY24eeKshort",
281 V0Tools = V0Tools,
282 HypothesisName = "Bd",
283 TrkVertexFitterTool = JpsiV0VertexFit,
284 PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
285 V0Hypothesis = 310,
286 JpsiMassLowerCut = 100.,
287 JpsiMassUpperCut = 7000.,
288 ApplyJpsiMassConstraint = False,
289 V0MassLowerCut = 400.,
290 V0MassUpperCut = 600.,
291 MassLowerCut = 4300.,
292 MassUpperCut = 6300.,
293 JpsiTrackPDGID = 11,
294 JpsiTrackContainerName = "GSFTrackParticles",
295 RefitPV = True,
296 RefPVContainerName = "BPHY24RefittedPrimaryVertices_ee",
297 JpsiVertices = "BPHY24_DiElectron_Candidates",
298 CascadeVertexCollections= ["BPHY24JpsieeKshortCascadeSV2", "BPHY24JpsieeKshortCascadeSV1"],
299 V0Vertices = "BPHY24RecoV0Candidates",
300 V0TrackContainerName = mainIDInput,
301 RelinkTracks = originalTrackCond)
302
303 augsList += [BPHY24JpsieeKshort]
304 finalCandidateList += BPHY24JpsieeKshort.CascadeVertexCollections
305 outVtxList += BPHY24JpsieeKshort.CascadeVertexCollections
306 outVtxList += ["BPHY24RefittedPrimaryVertices_ee"]
307 thinTrkVtxList += BPHY24JpsieeKshort.CascadeVertexCollections
308
309 from TrackVertexAssociationTool.TrackVertexAssociationToolConfig import isoTTVAToolCfg
310 TTVATool = acc.popToolsAndMerge(isoTTVAToolCfg(flags,
311 WorkingPoint = "Custom",
312 d0_cut = -1,
313 d0sig_cut = -1,
314 dzSinTheta_cut = -1,
315 doUsedInFit = False))
316 acc.addPublicTool(TTVATool)
317
318 from InDetTrackSelectionTool.InDetTrackSelectionToolConfig import (
319 isoTrackSelectionToolCfg)
320 TrackSelTool = acc.popToolsAndMerge(isoTrackSelectionToolCfg(flags,
321 maxZ0SinTheta= 2,
322 minPt= 1000,
323 CutLevel= "Loose"))
324 acc.addPublicTool(TrackSelTool)
325
326 from IsolationAlgs.IsoToolsConfig import TrackIsolationToolCfg
327 TrackIsoTool = acc.popToolsAndMerge(TrackIsolationToolCfg(flags,
328 TrackSelectionTool = TrackSelTool,
329 TTVATool = TTVATool))
330 acc.addPublicTool(TrackIsoTool)
331 BPHY24TrackIsolationDecoratorBtoKee = CompFactory.DerivationFramework.VertexTrackIsolation(
332 name = "BPHY24TrackIsolationDecoratorBtoKee",
333 TrackIsoTool = TrackIsoTool,
334 TrackContainer = "InDetTrackParticles",
335 InputVertexContainer = "BPHY24JpsieeKshortCascadeSV1",
336 FixElecExclusion = True,
337 IncludeV0 = True)
338 BPHY24TrackIsolationDecoratorBtoKmumu = CompFactory.DerivationFramework.VertexTrackIsolation(
339 name = "BPHY24TrackIsolationDecoratorBtoKmumu ",
340 TrackIsoTool = TrackIsoTool,
341 TrackContainer = "InDetTrackParticles",
342 InputVertexContainer = "BPHY24JpsimmKshortCascadeSV1",
343 FixElecExclusion = False,
344 IncludeV0 = True)
345
346 BPHY24TrackIsolationDecoratorJpsiee = CompFactory.DerivationFramework.VertexTrackIsolation(
347 name = "BPHY24TrackIsolationDecoratorJpsiee",
348 TrackIsoTool = TrackIsoTool,
349 TrackContainer = "InDetTrackParticles",
350 InputVertexContainer = "BPHY24_DiElectron_Candidates",
351 FixElecExclusion = True,
352 IncludeV0 = False)
353
354 BPHY24TrackIsolationDecoratorJpsimumu = CompFactory.DerivationFramework.VertexTrackIsolation(
355 name = "BPHY24TrackIsolationDecoratorJpsimumu",
356 TrackIsoTool = TrackIsoTool,
357 TrackContainer = "InDetTrackParticles",
358 InputVertexContainer = "BPHY24_DiMuon_Candidates",
359 FixElecExclusion = False,
360 IncludeV0 = False)
361
362 augsList += [ BPHY24TrackIsolationDecoratorBtoKee,
363 BPHY24TrackIsolationDecoratorBtoKmumu,
364 BPHY24TrackIsolationDecoratorJpsiee,
365 BPHY24TrackIsolationDecoratorJpsimumu]
366
367 if flags.Trigger.EDMVersion >= 0:
368 trigger_list = [ # Pure muon triggers
369 "HLT_mu11_mu6_bDimu",
370 "HLT_mu11_mu6_bDimu2700",
371 "HLT_mu11_mu6_bDimu_L1LFV-MU11",
372 "HLT_mu11_mu6_bDimu2700_L1LFV-MU11",
373 "HLT_mu11_mu6_bBmumuxv2",
374 "HLT_mu10_mu6_bBmumuxv2",
375 "HLT_mu10_mu6_bBmumuxv2_delayed",
376 "HLT_2mu6_bBmumuxv2",
377 "HLT_2mu6_bBmumuxv2_delayed",
378 "HLT_2mu6_bBmumuxv2_L1LFV-MU6",
379 "HLT_mu6_mu4_bBmumuxv2",
380 "HLT_mu6_mu4_bBmumuxv2_delayed",
381 "HLT_2mu4_bBmumuxv2",
382 "HLT_mu11_mu6_bJpsimumu",
383 "HLT_2mu10_bJpsimumu",
384 "HLT_mu11_mu6_bJpsimumu_L1LFV-MU11",
385 "HLT_2mu6_bJpsimumu_L1BPH-2M9-2MU6_BPH-2DR15-2MU6",
386 "HLT_2mu6_bJpsimumu_delayed_L1BPH-2M9-2MU6_BPH-2DR15-2MU6",
387 "HLT_2mu10_bJpsimumu_noL2",
388 "HLT_mu10_mu6_bJpsimumu",
389 "HLT_mu10_mu6_bJpsimumu_delayed",
390 "HLT_2mu6_bJpsimumu",
391 "HLT_2mu6_bJpsimumu_delayed",
392 "HLT_mu6_mu4_bJpsimumu",
393 "HLT_mu6_mu4_bJpsimumu_Lxy0_L1BPH-2M9-MU6MU4_BPH-0DR15-MU6MU4",
394 "HLT_2mu4_bJpsimumu",
395 "HLT_mu6_2mu4_bJpsi",
396 "HLT_mu6_2mu4_bJpsi_delayed",
397 "HLT_2mu14",
398 "HLT_2mu10",
399 # dielectron triggers
400 "HLT_2e5_lhvloose_nod0_bBeexM6000t", #37,143,877 inb
401 "HLT_e5_lhvloose_nod0_bBeexM6000t", #37,143,877
402 "HLT_e5_lhvloose_nod0_bBeexM6000t_2mu4_nomucomb_L1BPH-0DR3-EM7J15_2MU4", #37,312,506
403 "HLT_e5_lhvloose_nod0_bBeexM6000t_mu6_nomucomb_L1BPH-0DR3-EM7J15_MU6", #27,041,892
404 "HLT_e5_lhvloose_nod0_bBeexM6000_mu6_nomucomb_L1BPH-0DR3-EM7J15_MU6", #149,100
405 "HLT_e9_lhloose_bBeexM2700_2mu4_nomucomb_L1BPH-0DR3-EM7J15_2MU4", #2,681,764
406 "HLT_e9_lhloose_bBeexM2700_mu6_nomucomb_L1BPH-0DR3-EM7J15_MU6", #1,979,362
407 "HLT_e9_lhloose_bBeexM6000_2mu4_nomucomb_L1BPH-0DR3-EM7J15_2MU4", #3,359,105
408 "HLT_e9_lhloose_bBeexM6000_mu6_nomucomb_L1BPH-0DR3-EM7J15_MU6", #2,426,663
409 "HLT_e9_lhloose_e5_lhloose_bBeexM2700_2mu4_nomucomb_L1BPH-0M9-EM7-EM5_2MU4", #2,950,935
410 "HLT_e9_lhloose_e5_lhloose_bBeexM2700_mu6_nomucomb_L1BPH-0M9-EM7-EM5_MU6", #2,928,030
411 "HLT_e9_lhloose_e5_lhloose_bBeexM6000_2mu4_nomucomb_L1BPH-0M9-EM7-EM5_2MU4", #3,647,507
412 "HLT_e9_lhloose_e5_lhloose_bBeexM6000_mu6_nomucomb_L1BPH-0M9-EM7-EM5_MU6", #3,605,371
413 "HLT_e9_lhvloose_nod0_e5_lhvloose_nod0_bBeexM6000t_2mu4_nomucomb_L1BPH-0M9-EM7-EM5_2MU4", #40,169,436
414 "HLT_e9_lhvloose_nod0_e5_lhvloose_nod0_bBeexM6000t_mu6_nomucomb_L1BPH-0M9-EM7-EM5_MU6", #37,312,506
415 "HLT_e9_lhvloose_nod0_e5_lhvloose_nod0_bBeexM6000_mu6_nomucomb_L1BPH-0M9-EM7-EM5_MU6", #677,340
416 ]
417
418 BPHY24TrigSkimmingTool = CompFactory.DerivationFramework.TriggerSkimmingTool(
419 name = "BPHY24TrigSkimmingTool",
420 TriggerListOR = trigger_list,
421 TriggerListORHLTOnly = ["HLT_2e5_lhvloose_nod0_bBeexM6000t","HLT_e5_lhvloose_nod0_bBeexM6000t"] )
422 acc.addPublicTool(BPHY24TrigSkimmingTool)
423 skimList += [BPHY24TrigSkimmingTool]
424
425 # ID tracks
426 BPHY24_Thin_VtxTracks = CompFactory.DerivationFramework.Thin_vtxTrk( name = "BPHY24_Thin_VtxTracks",
427 StreamName = streamName,
428 TrackParticleContainerName = "InDetTrackParticles",
429 VertexContainerNames = finalCandidateList,
430 IgnoreFlags = True )
431 # PassFlags = thinPassFlagsList )
432 thinList += [ BPHY24_Thin_VtxTracks ]
433
434 # LRT ID tracks
435 if flags.Tracking.doLargeD0:
436 BPHY24_Thin_VtxTracks_LRT = CompFactory.DerivationFramework.Thin_vtxTrk(
437 name = "BPHY24_Thin_VtxTracks_LRT",
438 StreamName = streamName,
439 TrackParticleContainerName = "InDetLargeD0TrackParticles",
440 VertexContainerNames = finalCandidateList,
441 IgnoreFlags = True )
442 thinList += [ BPHY24_Thin_VtxTracks_LRT ]
443
444 # GSF tracks
445 BPHY24_Thin_VtxTracks_GSF = CompFactory.DerivationFramework.Thin_vtxTrk( name = "BPHY24_Thin_VtxTracks_GSF",
446 StreamName = streamName,
447 TrackParticleContainerName = "GSFTrackParticles",
448 VertexContainerNames = finalCandidateList,
449 IgnoreFlags = True )
450 thinList += [ BPHY24_Thin_VtxTracks_GSF ]
451
452 # Muons (TODO: thinning not used muons or something else ?)
453 BPHY24_Thin_Muons = CompFactory.DerivationFramework.MuonTrackParticleThinning( name = "BPHY24_Thin_Muons",
454 MuonKey = "Muons",
455 StreamName = streamName,
456 InDetTrackParticlesKey = "InDetTrackParticles" )
457 thinList += [ BPHY24_Thin_Muons ]
458
459 # Electrons
460 BPHY24_Thin_Egamma = CompFactory.DerivationFramework.EgammaTrackParticleThinning(
461 name = "BPHY24_Thin_Egamma",
462 SGKey = "Electrons",
463 StreamName = streamName,
464 InDetTrackParticlesKey = mainIDInput)
465 thinList += [BPHY24_Thin_Egamma]
466
467 # Primary vertices
468 BPHY24_Thin_PV = CompFactory.DerivationFramework.BPhysPVThinningTool( name = "BPHY24_Thin_PV",
469 CandidateCollections = finalCandidateList,
470 StreamName = streamName,
471 KeepPVTracks = True )
472 thinList += [ BPHY24_Thin_PV ]
473
474 if isSimulation:
475
476 #Decorate Truth Particles with track parameters
477 from InDetPhysValMonitoring.InDetPhysValDecorationConfig import InDetPhysValTruthDecoratorAlgCfg
478 acc.merge(InDetPhysValTruthDecoratorAlgCfg(flags, BPHYDerivationName))
479
480 # Keep all muons and electrons
481 keepParticles = ('TruthParticles.isElectron || ' # e
482 'TruthParticles.isMuon') # mu
483 # Keep only the potentially signal b-hadrons
484
485 keepParticles += (' || '
486 'abs(TruthParticles.pdgId) == 511 || ' # B0
487 'abs(TruthParticles.pdgId) == 513 || ' # B0*
488 'abs(TruthParticles.pdgId) == 515') # B0**
489
490
491 BPHY24_Thin_TruthHadrons = CompFactory.DerivationFramework.GenericTruthThinning( name = "BPHY24_Thin_TruthHadrons",
492 ParticleSelectionString = keepParticles,
493 PreserveDescendants = True,
494 StreamName = streamName,
495 PreserveAncestors = True)
496 thinList += [ BPHY24_Thin_TruthHadrons ]
497
498 # Save also neutrinos and b-quarks, without their decay trees
499 BPHY24_Thin_TruthQuarks = CompFactory.DerivationFramework.GenericTruthThinning( name = "BPHY24_Thin_TruthQuarks",
500 ParticleSelectionString = ('abs(TruthParticles.pdgId) == 5 || '
501 'abs(TruthParticles.pdgId) == 12 || abs(TruthParticles.pdgId) == 14' ),
502 PreserveDescendants = False,
503 StreamName = streamName,
504 PreserveAncestors = False)
505 thinList += [ BPHY24_Thin_TruthQuarks ]
506
507 for t in augsList + skimList + thinList: acc.addPublicTool(t)
508 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel("BPHY24Kernel",
509 AugmentationTools = augsList,
510 #OutputLevel = DEBUG,
511 #Only skim if not MC
512 SkimmingTools = skimList,
513 ThinningTools = thinList))
514
515
516 from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
517 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
518 BPHY24SlimmingHelper = SlimmingHelper("BPHY24SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
519 from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
520 from AthenaConfiguration.Enums import MetadataCategory
521 from DerivationFrameworkBPhys.commonBPHYMethodsCfg import getDefaultAllVariables
522 AllVariables = getDefaultAllVariables()
523 StaticContent = []
524 ExtraVariables = []
525
526 # Smart collections
527 # What is the difference w.r.t. adding them into AllVariables?
528 # AB Answer: SmarCollections trims commonly unused variables.
529 BPHY24SlimmingHelper.SmartCollections = [ "Electrons", "Muons", "InDetTrackParticles", "InDetLargeD0TrackParticles" ]
530
531 # Full combined muon-ID tracks
532 AllVariables += ["InDetLargeD0TrackParticles"]
533 AllVariables += [ "CombinedMuonTrackParticles" ]
534 AllVariables += [ "ExtrapolatedMuonTrackParticles" ]
535 ExtraVariables += [ "Muons.etaLayer1Hits.etaLayer2Hits.etaLayer3Hits.etaLayer4Hits.phiLayer1Hits.phiLayer2Hits.phiLayer3Hits.phiLayer4Hits",
536 "Muons.numberOfTriggerEtaLayers.numberOfPhiLayers",
537 "InDetTrackParticles.numberOfTRTHits.numberOfTRTHighThresholdHits.vx.vy.vz",
538 "InDetLargeD0TrackParticles.numberOfTRTHits.numberOfTRTHighThresholdHits.vx.vy.vz",
539 "PrimaryVertices.chiSquared.covariance", "Electrons.deltaEta1.DFCommonElectronsLHVeryLoosenod0",
540 "egammaClusters.calE.calEta.calPhi.e_sampl.eta_sampl.etaCalo.phiCalo.ETACALOFRAME.PHICALOFRAME",
541 "HLT_xAOD__ElectronContainer_egamma_ElectronsAuxDyn.charge" ]
542
543 # Include also trigger objects
544 # DONE: Test it works (HLT objects appear/not-present)
545
546 BPHY24SlimmingHelper.IncludeMuonTriggerContent = True
547 BPHY24SlimmingHelper.IncludeEgammaTriggerContent = True
548 BPHY24SlimmingHelper.IncludeBPhysTriggerContent = True
549
550 # Include primary vertices
551 AllVariables += [ "PrimaryVertices" ]
552 print("BPHY24: List of refitted-PV output: ", outRePVList)
553 for i in outRePVList:
554 StaticContent += [ "xAOD::VertexContainer#%s" % i ]
555 StaticContent += [ "xAOD::VertexAuxContainer#%sAux." % i ]
556
557 # B-vertexing output
558 print("BPHY24: List of B-vertexing output: ", outVtxList)
559 for i in outVtxList:
560 StaticContent += [ "xAOD::VertexContainer#%s" % i ]
561 StaticContent += [ "xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % i ]
562
563 print("BPHY24: Full list of B-augmentation: ", StaticContent)
564
565 # Truth information for MC only
566 if isSimulation:
567 AllVariables += [ "TruthEvents",
568 "TruthParticles",
569 "TruthVertices",
570 "MuonTruthParticles" ]
571 AllVariables = list(set(AllVariables)) # remove duplicates
572
573 BPHY24SlimmingHelper.AllVariables = AllVariables
574 BPHY24SlimmingHelper.StaticContent = StaticContent
575 BPHY24SlimmingHelper.ExtraVariables = ExtraVariables
576 BPHY24ItemList = BPHY24SlimmingHelper.GetItemList()
577 acc.merge(OutputStreamCfg(flags, "DAOD_BPHY24", ItemList=BPHY24ItemList, AcceptAlgs=["BPHY24Kernel"]))
578 acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_BPHY24", AcceptAlgs=["BPHY24Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
579 acc.printConfig(withDetails=True, summariseProps=True, onlyComponents = [], printDefaults=True)
580 return acc
void print(char *figname, TCanvas *c1)
STL class.
BPHY24Cfg(flags)
Definition BPHY24.py:14