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 EGammaFudgeMCTool = "",
130 CutType = "",
131 StoreGateEntryName = "DFCommonElectronsLHVeryLoose",
132 ContainerName = "Electrons",
133 StoreTResult=False)))
134
135 ElectronPassLHvloosenod0 = acc.addPublicTool(acc.popToolsAndMerge(EGElectronLikelihoodToolWrapperCfg(flags, name = "ElectronPassLHvloosenod0",
136 EGammaElectronLikelihoodTool = ElectronLHSelectorLHvloose_nod0,
137 EGammaFudgeMCTool = "",
138 CutType = "",
139 StoreGateEntryName = "DFCommonElectronsLHVeryLoosenod0",
140 ContainerName = "Electrons",
141 StoreTResult=False)))
142 augsList += [ElectronPassLHvloose, ElectronPassLHvloosenod0]
143
144 BPHY24DiElectronFinder = CompFactory.Analysis.JpsiFinder_ee(
145 name = "BPHY24DiElectronFinder",
146 elAndEl = True,
147 elAndTrack = False,
148 TrackAndTrack = False,
149 assumeDiElectrons = True,
150 elThresholdPt = 4000.0,
151 invMassUpper = 7000.0,
152 invMassLower = 200.0,
153 Chi2Cut = 30.,
154 oppChargesOnly = False,
155 allChargeCombinations = True,
156 useElectronTrackMeasurement = True,
157 electronCollectionKey = "Electrons",
158 TrackParticleCollection = "GSFTrackParticles",
159 useEgammaCuts = True,
160 TrkVertexFitterTool = vkalvrt,
161 TrackSelectorTool = trackselect,
162 VertexPointEstimator = vpest,
163 ElectronSelection = "d0_or_nod0"
164 )
165
166 BPHY24_SelectAndWrite_DiElectron = CompFactory.DerivationFramework.Reco_mumu(
167 name = "BPHY24_SelectAndWrite_DiElectron",
168 JpsiFinder = BPHY24DiElectronFinder,
169 V0Tools = V0Tools,
170 PVRefitter = PVrefit,
171 OutputVtxContainerName = "BPHY24_DiElectron_Candidates",
172 PVContainerName = "PrimaryVertices",
173 RefPVContainerName = "SHOULDNOTBEUSED",
174 DoVertexType = 7
175 )
176
177 augsList += [ BPHY24_SelectAndWrite_DiElectron ]
178
179 BPHY24_Select_DiElectrons = CompFactory.DerivationFramework.Select_onia2mumu(
180 name = "BPHY24_Select_DiElectrons",
181 HypothesisName = "Jpsi",
182 InputVtxContainerName = "BPHY24_DiElectron_Candidates",
183 V0Tools = V0Tools,
184 VtxMassHypo = 3096.916,
185 MassMin = 400.0,
186 MassMax = 7000.0,
187 Chi2Max = 30,
188 DoVertexType = 7
189 )
190
191 thinTrkVtxList += [ "BPHY24_DiElectron_Candidates" ]
192 outVtxList += [ "BPHY24_DiElectron_Candidates" ]
193
194 augsList += [ BPHY24_Select_DiElectrons ]
195
196 V0ContainerName = "BPHY24RecoV0Candidates"
197 KshortContainerName = "BPHY24RecoKshortCandidates"
198 LambdaContainerName = "BPHY24RecoLambdaCandidates"
199 LambdabarContainerName = "BPHY24RecoLambdabarCandidates"
200
201 from DerivationFrameworkBPhys.V0ToolConfig import (
202 BPHY_InDetV0FinderToolCfg, BPHY_Reco_V0FinderCfg)
203
204 BPHY24_V0FinderTool = acc.popToolsAndMerge(BPHY_InDetV0FinderToolCfg(
205 flags, BPHYDerivationName,
206 TrackParticleCollection = mainIDInput,
207 V0ContainerName = V0ContainerName,
208 KshortContainerName = KshortContainerName,
209 LambdaContainerName = LambdaContainerName,
210 LambdabarContainerName = LambdabarContainerName,
211 RelinkTracks = originalTrackCond,
212 use_innerPixHits = True,
213 errmass = 99999,
214 uksmin = 400,
215 uksmax = 600,
216 ksmin = 400,
217 ksmax = 600,
218 ulamin = -1,
219 ulamax = -1,
220 lamin = -1,
221 lamax = -1,
222 d0_cut = -1,
223 max_d0_cut = 50,
224 max_z0_cut = 250,
225 ptTRT = 0,
226 minConstrVertProb = 0.000001,
227 useBDT = True,
228 BDTCut = 0.1,
229 use_TrackSelector = False))
230
231 BPHY24_Reco_V0Finder = acc.popToolsAndMerge(BPHY_Reco_V0FinderCfg(
232 flags, derivation = BPHYDerivationName,
233 V0ContainerName = V0ContainerName,
234 KshortContainerName = KshortContainerName,
235 LambdaContainerName = LambdaContainerName,
236 LambdabarContainerName = LambdabarContainerName,
237 VxPrimaryCandidateName = "BPHY24_DiMuon_Candidates",
238 CheckVertexContainers = ['BPHY24_DiMuon_Candidates',
239 'BPHY24_DiElectron_Candidates'],
240 V0FinderTool = BPHY24_V0FinderTool))
241
242 augsList += [BPHY24_Reco_V0Finder]
243 outVtxList += ['BPHY24RecoKshortCandidates']
244 outVtxList += ["BPHY24RecoV0Candidates"]
245 thinTrkVtxList += ['BPHY24RecoKshortCandidates']
246 thinPassFlagsList += [ "" ] # TODO: is this really needed?
247 finalCandidateList += ["BPHY24RecoKshortCandidates"]
248 finalCandidateList += ["BPHY24RecoV0Candidates"]
249 from TrkConfig.TrkVKalVrtFitterConfig import JpsiV0VertexFitCfg
250 JpsiV0VertexFit = acc.popToolsAndMerge(JpsiV0VertexFitCfg(flags))
251 acc.addPublicTool(JpsiV0VertexFit)
252
253 BPHY24JpsimmKshort = CompFactory.DerivationFramework.JpsiPlusV0Cascade(
254 name = "BPHY24mmKshort",
255 V0Tools = V0Tools,
256 HypothesisName = "Bd",
257 TrkVertexFitterTool = JpsiV0VertexFit,
258 PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
259 V0Hypothesis = 310,
260 JpsiMassLowerCut = 1.,
261 JpsiMassUpperCut = 7000.,
262 ApplyJpsiMassConstraint = False,
263 V0MassLowerCut = 400.,
264 V0MassUpperCut = 600.,
265 MassLowerCut = 4300.,
266 MassUpperCut = 6300.,
267 RefitPV = True,
268 RefPVContainerName = "BPHY24RefittedPrimaryVertices_mm",
269 JpsiVertices = "BPHY24_DiMuon_Candidates",
270 CascadeVertexCollections= ["BPHY24JpsimmKshortCascadeSV2", "BPHY24JpsimmKshortCascadeSV1"],
271 V0Vertices = "BPHY24RecoV0Candidates",
272 V0TrackContainerName = mainIDInput,
273 RelinkTracks = originalTrackCond)
274
275 augsList += [BPHY24JpsimmKshort]
276 outVtxList += BPHY24JpsimmKshort.CascadeVertexCollections
277 outVtxList += ["BPHY24RefittedPrimaryVertices_mm"]
278 thinTrkVtxList += BPHY24JpsimmKshort.CascadeVertexCollections
279 finalCandidateList += BPHY24JpsimmKshort.CascadeVertexCollections
280
281 BPHY24JpsieeKshort = CompFactory.DerivationFramework.JpsiPlusV0Cascade(
282 name = "BPHY24eeKshort",
283 V0Tools = V0Tools,
284 HypothesisName = "Bd",
285 TrkVertexFitterTool = JpsiV0VertexFit,
286 PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
287 V0Hypothesis = 310,
288 JpsiMassLowerCut = 100.,
289 JpsiMassUpperCut = 7000.,
290 ApplyJpsiMassConstraint = False,
291 V0MassLowerCut = 400.,
292 V0MassUpperCut = 600.,
293 MassLowerCut = 4300.,
294 MassUpperCut = 6300.,
295 JpsiTrackPDGID = 11,
296 JpsiTrackContainerName = "GSFTrackParticles",
297 RefitPV = True,
298 RefPVContainerName = "BPHY24RefittedPrimaryVertices_ee",
299 JpsiVertices = "BPHY24_DiElectron_Candidates",
300 CascadeVertexCollections= ["BPHY24JpsieeKshortCascadeSV2", "BPHY24JpsieeKshortCascadeSV1"],
301 V0Vertices = "BPHY24RecoV0Candidates",
302 V0TrackContainerName = mainIDInput,
303 RelinkTracks = originalTrackCond)
304
305 augsList += [BPHY24JpsieeKshort]
306 finalCandidateList += BPHY24JpsieeKshort.CascadeVertexCollections
307 outVtxList += BPHY24JpsieeKshort.CascadeVertexCollections
308 outVtxList += ["BPHY24RefittedPrimaryVertices_ee"]
309 thinTrkVtxList += BPHY24JpsieeKshort.CascadeVertexCollections
310
311 from TrackVertexAssociationTool.TrackVertexAssociationToolConfig import isoTTVAToolCfg
312 TTVATool = acc.popToolsAndMerge(isoTTVAToolCfg(flags,
313 WorkingPoint = "Custom",
314 d0_cut = -1,
315 d0sig_cut = -1,
316 dzSinTheta_cut = -1,
317 doUsedInFit = False))
318 acc.addPublicTool(TTVATool)
319
320 from InDetTrackSelectionTool.InDetTrackSelectionToolConfig import (
321 isoTrackSelectionToolCfg)
322 TrackSelTool = acc.popToolsAndMerge(isoTrackSelectionToolCfg(flags,
323 maxZ0SinTheta= 2,
324 minPt= 1000,
325 CutLevel= "Loose"))
326 acc.addPublicTool(TrackSelTool)
327
328 from IsolationAlgs.IsoToolsConfig import TrackIsolationToolCfg
329 TrackIsoTool = acc.popToolsAndMerge(TrackIsolationToolCfg(flags,
330 TrackSelectionTool = TrackSelTool,
331 TTVATool = TTVATool))
332 acc.addPublicTool(TrackIsoTool)
333 BPHY24TrackIsolationDecoratorBtoKee = CompFactory.DerivationFramework.VertexTrackIsolation(
334 name = "BPHY24TrackIsolationDecoratorBtoKee",
335 TrackIsoTool = TrackIsoTool,
336 TrackContainer = "InDetTrackParticles",
337 InputVertexContainer = "BPHY24JpsieeKshortCascadeSV1",
338 FixElecExclusion = True,
339 IncludeV0 = True)
340 BPHY24TrackIsolationDecoratorBtoKmumu = CompFactory.DerivationFramework.VertexTrackIsolation(
341 name = "BPHY24TrackIsolationDecoratorBtoKmumu ",
342 TrackIsoTool = TrackIsoTool,
343 TrackContainer = "InDetTrackParticles",
344 InputVertexContainer = "BPHY24JpsimmKshortCascadeSV1",
345 FixElecExclusion = False,
346 IncludeV0 = True)
347
348 BPHY24TrackIsolationDecoratorJpsiee = CompFactory.DerivationFramework.VertexTrackIsolation(
349 name = "BPHY24TrackIsolationDecoratorJpsiee",
350 TrackIsoTool = TrackIsoTool,
351 TrackContainer = "InDetTrackParticles",
352 InputVertexContainer = "BPHY24_DiElectron_Candidates",
353 FixElecExclusion = True,
354 IncludeV0 = False)
355
356 BPHY24TrackIsolationDecoratorJpsimumu = CompFactory.DerivationFramework.VertexTrackIsolation(
357 name = "BPHY24TrackIsolationDecoratorJpsimumu",
358 TrackIsoTool = TrackIsoTool,
359 TrackContainer = "InDetTrackParticles",
360 InputVertexContainer = "BPHY24_DiMuon_Candidates",
361 FixElecExclusion = False,
362 IncludeV0 = False)
363
364 augsList += [ BPHY24TrackIsolationDecoratorBtoKee,
365 BPHY24TrackIsolationDecoratorBtoKmumu,
366 BPHY24TrackIsolationDecoratorJpsiee,
367 BPHY24TrackIsolationDecoratorJpsimumu]
368
369 if flags.Trigger.EDMVersion >= 0:
370 trigger_list = [ # Pure muon triggers
371 "HLT_mu11_mu6_bDimu",
372 "HLT_mu11_mu6_bDimu2700",
373 "HLT_mu11_mu6_bDimu_L1LFV-MU11",
374 "HLT_mu11_mu6_bDimu2700_L1LFV-MU11",
375 "HLT_mu11_mu6_bBmumuxv2",
376 "HLT_mu10_mu6_bBmumuxv2",
377 "HLT_mu10_mu6_bBmumuxv2_delayed",
378 "HLT_2mu6_bBmumuxv2",
379 "HLT_2mu6_bBmumuxv2_delayed",
380 "HLT_2mu6_bBmumuxv2_L1LFV-MU6",
381 "HLT_mu6_mu4_bBmumuxv2",
382 "HLT_mu6_mu4_bBmumuxv2_delayed",
383 "HLT_2mu4_bBmumuxv2",
384 "HLT_mu11_mu6_bJpsimumu",
385 "HLT_2mu10_bJpsimumu",
386 "HLT_mu11_mu6_bJpsimumu_L1LFV-MU11",
387 "HLT_2mu6_bJpsimumu_L1BPH-2M9-2MU6_BPH-2DR15-2MU6",
388 "HLT_2mu6_bJpsimumu_delayed_L1BPH-2M9-2MU6_BPH-2DR15-2MU6",
389 "HLT_2mu10_bJpsimumu_noL2",
390 "HLT_mu10_mu6_bJpsimumu",
391 "HLT_mu10_mu6_bJpsimumu_delayed",
392 "HLT_2mu6_bJpsimumu",
393 "HLT_2mu6_bJpsimumu_delayed",
394 "HLT_mu6_mu4_bJpsimumu",
395 "HLT_mu6_mu4_bJpsimumu_Lxy0_L1BPH-2M9-MU6MU4_BPH-0DR15-MU6MU4",
396 "HLT_2mu4_bJpsimumu",
397 "HLT_mu6_2mu4_bJpsi",
398 "HLT_mu6_2mu4_bJpsi_delayed",
399 "HLT_2mu14",
400 "HLT_2mu10",
401 # dielectron triggers
402 "HLT_2e5_lhvloose_nod0_bBeexM6000t", #37,143,877 inb
403 "HLT_e5_lhvloose_nod0_bBeexM6000t", #37,143,877
404 "HLT_e5_lhvloose_nod0_bBeexM6000t_2mu4_nomucomb_L1BPH-0DR3-EM7J15_2MU4", #37,312,506
405 "HLT_e5_lhvloose_nod0_bBeexM6000t_mu6_nomucomb_L1BPH-0DR3-EM7J15_MU6", #27,041,892
406 "HLT_e5_lhvloose_nod0_bBeexM6000_mu6_nomucomb_L1BPH-0DR3-EM7J15_MU6", #149,100
407 "HLT_e9_lhloose_bBeexM2700_2mu4_nomucomb_L1BPH-0DR3-EM7J15_2MU4", #2,681,764
408 "HLT_e9_lhloose_bBeexM2700_mu6_nomucomb_L1BPH-0DR3-EM7J15_MU6", #1,979,362
409 "HLT_e9_lhloose_bBeexM6000_2mu4_nomucomb_L1BPH-0DR3-EM7J15_2MU4", #3,359,105
410 "HLT_e9_lhloose_bBeexM6000_mu6_nomucomb_L1BPH-0DR3-EM7J15_MU6", #2,426,663
411 "HLT_e9_lhloose_e5_lhloose_bBeexM2700_2mu4_nomucomb_L1BPH-0M9-EM7-EM5_2MU4", #2,950,935
412 "HLT_e9_lhloose_e5_lhloose_bBeexM2700_mu6_nomucomb_L1BPH-0M9-EM7-EM5_MU6", #2,928,030
413 "HLT_e9_lhloose_e5_lhloose_bBeexM6000_2mu4_nomucomb_L1BPH-0M9-EM7-EM5_2MU4", #3,647,507
414 "HLT_e9_lhloose_e5_lhloose_bBeexM6000_mu6_nomucomb_L1BPH-0M9-EM7-EM5_MU6", #3,605,371
415 "HLT_e9_lhvloose_nod0_e5_lhvloose_nod0_bBeexM6000t_2mu4_nomucomb_L1BPH-0M9-EM7-EM5_2MU4", #40,169,436
416 "HLT_e9_lhvloose_nod0_e5_lhvloose_nod0_bBeexM6000t_mu6_nomucomb_L1BPH-0M9-EM7-EM5_MU6", #37,312,506
417 "HLT_e9_lhvloose_nod0_e5_lhvloose_nod0_bBeexM6000_mu6_nomucomb_L1BPH-0M9-EM7-EM5_MU6", #677,340
418 ]
419
420 BPHY24TrigSkimmingTool = CompFactory.DerivationFramework.TriggerSkimmingTool(
421 name = "BPHY24TrigSkimmingTool",
422 TriggerListOR = trigger_list,
423 TriggerListORHLTOnly = ["HLT_2e5_lhvloose_nod0_bBeexM6000t","HLT_e5_lhvloose_nod0_bBeexM6000t"] )
424 acc.addPublicTool(BPHY24TrigSkimmingTool)
425 skimList += [BPHY24TrigSkimmingTool]
426
427 # ID tracks
428 BPHY24_Thin_VtxTracks = CompFactory.DerivationFramework.Thin_vtxTrk( name = "BPHY24_Thin_VtxTracks",
429 StreamName = streamName,
430 TrackParticleContainerName = "InDetTrackParticles",
431 VertexContainerNames = finalCandidateList,
432 IgnoreFlags = True )
433 # PassFlags = thinPassFlagsList )
434 thinList += [ BPHY24_Thin_VtxTracks ]
435
436 # LRT ID tracks
437 if flags.Tracking.doLargeD0:
438 BPHY24_Thin_VtxTracks_LRT = CompFactory.DerivationFramework.Thin_vtxTrk(
439 name = "BPHY24_Thin_VtxTracks_LRT",
440 StreamName = streamName,
441 TrackParticleContainerName = "InDetLargeD0TrackParticles",
442 VertexContainerNames = finalCandidateList,
443 IgnoreFlags = True )
444 thinList += [ BPHY24_Thin_VtxTracks_LRT ]
445
446 # GSF tracks
447 BPHY24_Thin_VtxTracks_GSF = CompFactory.DerivationFramework.Thin_vtxTrk( name = "BPHY24_Thin_VtxTracks_GSF",
448 StreamName = streamName,
449 TrackParticleContainerName = "GSFTrackParticles",
450 VertexContainerNames = finalCandidateList,
451 IgnoreFlags = True )
452 thinList += [ BPHY24_Thin_VtxTracks_GSF ]
453
454 # Muons (TODO: thinning not used muons or something else ?)
455 BPHY24_Thin_Muons = CompFactory.DerivationFramework.MuonTrackParticleThinning( name = "BPHY24_Thin_Muons",
456 MuonKey = "Muons",
457 StreamName = streamName,
458 InDetTrackParticlesKey = "InDetTrackParticles" )
459 thinList += [ BPHY24_Thin_Muons ]
460
461 # Electrons
462 BPHY24_Thin_Egamma = CompFactory.DerivationFramework.EgammaTrackParticleThinning(
463 name = "BPHY24_Thin_Egamma",
464 SGKey = "Electrons",
465 StreamName = streamName,
466 InDetTrackParticlesKey = mainIDInput)
467 thinList += [BPHY24_Thin_Egamma]
468
469 # Primary vertices
470 BPHY24_Thin_PV = CompFactory.DerivationFramework.BPhysPVThinningTool( name = "BPHY24_Thin_PV",
471 CandidateCollections = finalCandidateList,
472 StreamName = streamName,
473 KeepPVTracks = True )
474 thinList += [ BPHY24_Thin_PV ]
475
476 if isSimulation:
477
478 #Decorate Truth Particles with track parameters
479 from InDetPhysValMonitoring.InDetPhysValDecorationConfig import InDetPhysValTruthDecoratorAlgCfg
480 acc.merge(InDetPhysValTruthDecoratorAlgCfg(flags, BPHYDerivationName))
481
482 # Keep all muons and electrons
483 keepParticles = ('abs(TruthParticles.pdgId) == 11 || ' # mu
484 'abs(TruthParticles.pdgId) == 13') # e
485 # Keep only the potentially signal b-hadrons
486
487 keepParticles += (' || '
488 'abs(TruthParticles.pdgId) == 511 || ' # B0
489 'abs(TruthParticles.pdgId) == 513 || ' # B0*
490 'abs(TruthParticles.pdgId) == 515') # B0**
491
492
493 BPHY24_Thin_TruthHadrons = CompFactory.DerivationFramework.GenericTruthThinning( name = "BPHY24_Thin_TruthHadrons",
494 ParticleSelectionString = keepParticles,
495 PreserveDescendants = True,
496 StreamName = streamName,
497 PreserveAncestors = True)
498 thinList += [ BPHY24_Thin_TruthHadrons ]
499
500 # Save also neutrinos and b-quarks, without their decay trees
501 BPHY24_Thin_TruthQuarks = CompFactory.DerivationFramework.GenericTruthThinning( name = "BPHY24_Thin_TruthQuarks",
502 ParticleSelectionString = ('abs(TruthParticles.pdgId) == 5 || '
503 'abs(TruthParticles.pdgId) == 12 || abs(TruthParticles.pdgId) == 14' ),
504 PreserveDescendants = False,
505 StreamName = streamName,
506 PreserveAncestors = False)
507 thinList += [ BPHY24_Thin_TruthQuarks ]
508
509 for t in augsList + skimList + thinList: acc.addPublicTool(t)
510 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel("BPHY24Kernel",
511 AugmentationTools = augsList,
512 #OutputLevel = DEBUG,
513 #Only skim if not MC
514 SkimmingTools = skimList,
515 ThinningTools = thinList))
516
517
518 from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
519 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
520 BPHY24SlimmingHelper = SlimmingHelper("BPHY24SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
521 from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
522 from AthenaConfiguration.Enums import MetadataCategory
523 from DerivationFrameworkBPhys.commonBPHYMethodsCfg import getDefaultAllVariables
524 AllVariables = getDefaultAllVariables()
525 StaticContent = []
526 ExtraVariables = []
527
528 # Smart collections
529 # What is the difference w.r.t. adding them into AllVariables?
530 # AB Answer: SmarCollections trims commonly unused variables.
531 BPHY24SlimmingHelper.SmartCollections = [ "Electrons", "Muons", "InDetTrackParticles", "InDetLargeD0TrackParticles" ]
532
533 # Full combined muon-ID tracks
534 AllVariables += ["InDetLargeD0TrackParticles"]
535 AllVariables += [ "CombinedMuonTrackParticles" ]
536 AllVariables += [ "ExtrapolatedMuonTrackParticles" ]
537 ExtraVariables += [ "Muons.etaLayer1Hits.etaLayer2Hits.etaLayer3Hits.etaLayer4Hits.phiLayer1Hits.phiLayer2Hits.phiLayer3Hits.phiLayer4Hits",
538 "Muons.numberOfTriggerEtaLayers.numberOfPhiLayers",
539 "InDetTrackParticles.numberOfTRTHits.numberOfTRTHighThresholdHits.vx.vy.vz",
540 "InDetLargeD0TrackParticles.numberOfTRTHits.numberOfTRTHighThresholdHits.vx.vy.vz",
541 "PrimaryVertices.chiSquared.covariance", "Electrons.deltaEta1.DFCommonElectronsLHVeryLoosenod0",
542 "egammaClusters.calE.calEta.calPhi.e_sampl.eta_sampl.etaCalo.phiCalo.ETACALOFRAME.PHICALOFRAME",
543 "HLT_xAOD__ElectronContainer_egamma_ElectronsAuxDyn.charge" ]
544
545 # Include also trigger objects
546 # DONE: Test it works (HLT objects appear/not-present)
547
548 BPHY24SlimmingHelper.IncludeMuonTriggerContent = True
549 BPHY24SlimmingHelper.IncludeEgammaTriggerContent = True
550 BPHY24SlimmingHelper.IncludeBPhysTriggerContent = True
551
552 # Include primary vertices
553 AllVariables += [ "PrimaryVertices" ]
554 print("BPHY24: List of refitted-PV output: ", outRePVList)
555 for i in outRePVList:
556 StaticContent += [ "xAOD::VertexContainer#%s" % i ]
557 StaticContent += [ "xAOD::VertexAuxContainer#%sAux." % i ]
558
559 # B-vertexing output
560 print("BPHY24: List of B-vertexing output: ", outVtxList)
561 for i in outVtxList:
562 StaticContent += [ "xAOD::VertexContainer#%s" % i ]
563 StaticContent += [ "xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % i ]
564
565 print("BPHY24: Full list of B-augmentation: ", StaticContent)
566
567 # Truth information for MC only
568 if isSimulation:
569 AllVariables += [ "TruthEvents",
570 "TruthParticles",
571 "TruthVertices",
572 "MuonTruthParticles" ]
573 AllVariables = list(set(AllVariables)) # remove duplicates
574
575 BPHY24SlimmingHelper.AllVariables = AllVariables
576 BPHY24SlimmingHelper.StaticContent = StaticContent
577 BPHY24SlimmingHelper.ExtraVariables = ExtraVariables
578 BPHY24ItemList = BPHY24SlimmingHelper.GetItemList()
579 acc.merge(OutputStreamCfg(flags, "DAOD_BPHY24", ItemList=BPHY24ItemList, AcceptAlgs=["BPHY24Kernel"]))
580 acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_BPHY24", AcceptAlgs=["BPHY24Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
581 acc.printConfig(withDetails=True, summariseProps=True, onlyComponents = [], printDefaults=True)
582 return acc
void print(char *figname, TCanvas *c1)
STL class.
BPHY24Cfg(flags)
Definition BPHY24.py:14