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