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