ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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)).name
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  ElectronPassLHvloose = CompFactory.DerivationFramework.EGElectronLikelihoodToolWrapper(name = "ElectronPassLHvloose",
125  EGammaElectronLikelihoodTool = ElectronLHSelectorLHvloose,
126  EGammaFudgeMCTool = "",
127  CutType = "",
128  StoreGateEntryName = "DFCommonElectronsLHVeryLoose",
129  ContainerName = "Electrons",
130  StoreTResult=False)
131 
132  ElectronPassLHvloosenod0 = CompFactory.DerivationFramework.EGElectronLikelihoodToolWrapper(name = "ElectronPassLHvloosenod0",
133  EGammaElectronLikelihoodTool = ElectronLHSelectorLHvloose_nod0,
134  EGammaFudgeMCTool = "",
135  CutType = "",
136  StoreGateEntryName = "DFCommonElectronsLHVeryLoosenod0",
137  ContainerName = "Electrons",
138  StoreTResult=False)
139  augsList += [ElectronPassLHvloose, ElectronPassLHvloosenod0]
140 
141  BPHY24DiElectronFinder = CompFactory.Analysis.JpsiFinder_ee(
142  name = "BPHY24DiElectronFinder",
143  elAndEl = True,
144  elAndTrack = False,
145  TrackAndTrack = False,
146  assumeDiElectrons = True,
147  elThresholdPt = 4000.0,
148  invMassUpper = 7000.0,
149  invMassLower = 200.0,
150  Chi2Cut = 30.,
151  oppChargesOnly = False,
152  allChargeCombinations = True,
153  useElectronTrackMeasurement = True,
154  electronCollectionKey = "Electrons",
155  TrackParticleCollection = "GSFTrackParticles",
156  useEgammaCuts = True,
157  V0VertexFitterTool = None,
158  useV0Fitter = False,
159  TrkVertexFitterTool = vkalvrt,
160  TrackSelectorTool = trackselect,
161  VertexPointEstimator = vpest,
162  ElectronSelection = "d0_or_nod0",
163  PartPropSvc = PartPropSvcName
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 InDetConfig.InDetTrackSelectionToolConfig import isoTrackSelectionToolCfg
321  TrackSelTool = acc.popToolsAndMerge(isoTrackSelectionToolCfg(flags,
322  maxZ0SinTheta= 2,
323  minPt= 1000,
324  CutLevel= "Loose"))
325  acc.addPublicTool(TrackSelTool)
326 
327  from IsolationAlgs.IsoToolsConfig import TrackIsolationToolCfg
328  TrackIsoTool = acc.popToolsAndMerge(TrackIsolationToolCfg(flags,
329  TrackSelectionTool = TrackSelTool,
330  TTVATool = TTVATool))
331  acc.addPublicTool(TrackIsoTool)
332  BPHY24TrackIsolationDecoratorBtoKee = CompFactory.DerivationFramework.VertexTrackIsolation(
333  name = "BPHY24TrackIsolationDecoratorBtoKee",
334  TrackIsoTool = TrackIsoTool,
335  TrackContainer = "InDetTrackParticles",
336  InputVertexContainer = "BPHY24JpsieeKshortCascadeSV1",
337  FixElecExclusion = True,
338  IncludeV0 = True)
339  BPHY24TrackIsolationDecoratorBtoKmumu = CompFactory.DerivationFramework.VertexTrackIsolation(
340  name = "BPHY24TrackIsolationDecoratorBtoKmumu ",
341  TrackIsoTool = TrackIsoTool,
342  TrackContainer = "InDetTrackParticles",
343  InputVertexContainer = "BPHY24JpsimmKshortCascadeSV1",
344  FixElecExclusion = False,
345  IncludeV0 = True)
346 
347  BPHY24TrackIsolationDecoratorJpsiee = CompFactory.DerivationFramework.VertexTrackIsolation(
348  name = "BPHY24TrackIsolationDecoratorJpsiee",
349  TrackIsoTool = TrackIsoTool,
350  TrackContainer = "InDetTrackParticles",
351  InputVertexContainer = "BPHY24_DiElectron_Candidates",
352  FixElecExclusion = True,
353  IncludeV0 = False)
354 
355  BPHY24TrackIsolationDecoratorJpsimumu = CompFactory.DerivationFramework.VertexTrackIsolation(
356  name = "BPHY24TrackIsolationDecoratorJpsimumu",
357  TrackIsoTool = TrackIsoTool,
358  TrackContainer = "InDetTrackParticles",
359  InputVertexContainer = "BPHY24_DiMuon_Candidates",
360  FixElecExclusion = False,
361  IncludeV0 = False)
362 
363  augsList += [ BPHY24TrackIsolationDecoratorBtoKee,
364  BPHY24TrackIsolationDecoratorBtoKmumu,
365  BPHY24TrackIsolationDecoratorJpsiee,
366  BPHY24TrackIsolationDecoratorJpsimumu]
367 
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( name = "BPHY24TrigSkimmingTool",
419  TriggerListOR = trigger_list,
420  TriggerListORHLTOnly = ["HLT_2e5_lhvloose_nod0_bBeexM6000t","HLT_e5_lhvloose_nod0_bBeexM6000t"] )
421  acc.addPublicTool(BPHY24TrigSkimmingTool)
422  skimList += [BPHY24TrigSkimmingTool]
423 
424  # ID tracks
425  BPHY24_Thin_VtxTracks = CompFactory.DerivationFramework.Thin_vtxTrk( name = "BPHY24_Thin_VtxTracks",
426  StreamName = streamName,
427  TrackParticleContainerName = "InDetTrackParticles",
428  VertexContainerNames = finalCandidateList,
429  IgnoreFlags = True )
430  # PassFlags = thinPassFlagsList )
431  thinList += [ BPHY24_Thin_VtxTracks ]
432 
433  # LRT ID tracks
434  BPHY24_Thin_VtxTracks_LRT = CompFactory.DerivationFramework.Thin_vtxTrk( name = "BPHY24_Thin_VtxTracks_LRT",
435  StreamName = streamName,
436  TrackParticleContainerName = "InDetLargeD0TrackParticles",
437  VertexContainerNames = finalCandidateList,
438  IgnoreFlags = True )
439  # PassFlags = thinPassFlagsList )
440  thinList += [ BPHY24_Thin_VtxTracks_LRT ]
441 
442  # GSF tracks
443  BPHY24_Thin_VtxTracks_GSF = CompFactory.DerivationFramework.Thin_vtxTrk( name = "BPHY24_Thin_VtxTracks_GSF",
444  StreamName = streamName,
445  TrackParticleContainerName = "GSFTrackParticles",
446  VertexContainerNames = finalCandidateList,
447  IgnoreFlags = True )
448  thinList += [ BPHY24_Thin_VtxTracks_GSF ]
449 
450  # Muons (TODO: thinning not used muons or something else ?)
451  BPHY24_Thin_Muons = CompFactory.DerivationFramework.MuonTrackParticleThinning( name = "BPHY24_Thin_Muons",
452  MuonKey = "Muons",
453  StreamName = streamName,
454  InDetTrackParticlesKey = "InDetTrackParticles" )
455  thinList += [ BPHY24_Thin_Muons ]
456 
457  # Electrons
458  BPHY24_Thin_Egamma = CompFactory.DerivationFramework.EgammaTrackParticleThinning(
459  name = "BPHY24_Thin_Egamma",
460  SGKey = "Electrons",
461  StreamName = streamName,
462  InDetTrackParticlesKey = mainIDInput)
463  thinList += [BPHY24_Thin_Egamma]
464 
465  # Primary vertices
466  BPHY24_Thin_PV = CompFactory.DerivationFramework.BPhysPVThinningTool( name = "BPHY24_Thin_PV",
467  CandidateCollections = finalCandidateList,
468  StreamName = streamName,
469  KeepPVTracks = True )
470  thinList += [ BPHY24_Thin_PV ]
471 
472  if isSimulation:
473 
474  #Decorate Truth Particles with track parameters
475  from InDetPhysValMonitoring.InDetPhysValDecorationConfig import InDetPhysValTruthDecoratorAlgCfg
476  acc.merge(InDetPhysValTruthDecoratorAlgCfg(flags, BPHYDerivationName))
477 
478  # Keep all muons and electrons
479  keepParticles = ('abs(TruthParticles.pdgId) == 11 || ' # mu
480  'abs(TruthParticles.pdgId) == 13') # e
481  # Keep only the potentially signal b-hadrons
482 
483  keepParticles += (' || '
484  'abs(TruthParticles.pdgId) == 511 || ' # B0
485  'abs(TruthParticles.pdgId) == 513 || ' # B0*
486  'abs(TruthParticles.pdgId) == 515') # B0**
487 
488 
489  BPHY24_Thin_TruthHadrons = CompFactory.DerivationFramework.GenericTruthThinning( name = "BPHY24_Thin_TruthHadrons",
490  ParticleSelectionString = keepParticles,
491  PreserveDescendants = True,
492  StreamName = streamName,
493  PreserveAncestors = True)
494  thinList += [ BPHY24_Thin_TruthHadrons ]
495 
496  # Save also neutrinos and b-quarks, without their decay trees
497  BPHY24_Thin_TruthQuarks = CompFactory.DerivationFramework.GenericTruthThinning( name = "BPHY24_Thin_TruthQuarks",
498  ParticleSelectionString = ('abs(TruthParticles.pdgId) == 5 || '
499  'abs(TruthParticles.pdgId) == 12 || abs(TruthParticles.pdgId) == 14' ),
500  PreserveDescendants = False,
501  StreamName = streamName,
502  PreserveAncestors = False)
503  thinList += [ BPHY24_Thin_TruthQuarks ]
504 
505  for t in augsList + skimList + thinList: acc.addPublicTool(t)
506  acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel("BPHY24Kernel",
507  AugmentationTools = augsList,
508  #OutputLevel = DEBUG,
509  #Only skim if not MC
510  SkimmingTools = skimList,
511  ThinningTools = thinList))
512 
513 
514  from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
515  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
516  BPHY24SlimmingHelper = SlimmingHelper("BPHY24SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
517  from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
518  from AthenaConfiguration.Enums import MetadataCategory
519  from DerivationFrameworkBPhys.commonBPHYMethodsCfg import getDefaultAllVariables
520  AllVariables = getDefaultAllVariables()
521  StaticContent = []
522  ExtraVariables = []
523 
524  # Smart collections
525  # What is the difference w.r.t. adding them into AllVariables?
526  # AB Answer: SmarCollections trims commonly unused variables.
527  BPHY24SlimmingHelper.SmartCollections = [ "Electrons", "Muons", "InDetTrackParticles", "InDetLargeD0TrackParticles" ]
528 
529  # Full combined muon-ID tracks
530  AllVariables += ["InDetLargeD0TrackParticles"]
531  AllVariables += [ "CombinedMuonTrackParticles" ]
532  AllVariables += [ "ExtrapolatedMuonTrackParticles" ]
533  ExtraVariables += [ "Muons.etaLayer1Hits.etaLayer2Hits.etaLayer3Hits.etaLayer4Hits.phiLayer1Hits.phiLayer2Hits.phiLayer3Hits.phiLayer4Hits",
534  "Muons.numberOfTriggerEtaLayers.numberOfPhiLayers",
535  "InDetTrackParticles.numberOfTRTHits.numberOfTRTHighThresholdHits.vx.vy.vz",
536  "InDetLargeD0TrackParticles.numberOfTRTHits.numberOfTRTHighThresholdHits.vx.vy.vz",
537  "PrimaryVertices.chiSquared.covariance", "Electrons.deltaEta1.DFCommonElectronsLHVeryLoosenod0",
538  "egammaClusters.calE.calEta.calPhi.e_sampl.eta_sampl.etaCalo.phiCalo.ETACALOFRAME.PHICALOFRAME",
539  "HLT_xAOD__ElectronContainer_egamma_ElectronsAuxDyn.charge" ]
540 
541  # Include also trigger objects
542  # DONE: Test it works (HLT objects appear/not-present)
543 
544  BPHY24SlimmingHelper.IncludeMuonTriggerContent = True
545  BPHY24SlimmingHelper.IncludeEgammaTriggerContent = True
546  BPHY24SlimmingHelper.IncludeBPhysTriggerContent = True
547 
548  # Include primary vertices
549  AllVariables += [ "PrimaryVertices" ]
550  print("BPHY24: List of refitted-PV output: ", outRePVList)
551  for i in outRePVList:
552  StaticContent += [ "xAOD::VertexContainer#%s" % i ]
553  StaticContent += [ "xAOD::VertexAuxContainer#%sAux." % i ]
554 
555  # B-vertexing output
556  print("BPHY24: List of B-vertexing output: ", outVtxList)
557  for i in outVtxList:
558  StaticContent += [ "xAOD::VertexContainer#%s" % i ]
559  StaticContent += [ "xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % i ]
560 
561  print("BPHY24: Full list of B-augmentation: ", StaticContent)
562 
563  # Truth information for MC only
564  if isSimulation:
565  AllVariables += [ "TruthEvents",
566  "TruthParticles",
567  "TruthVertices",
568  "MuonTruthParticles" ]
569  AllVariables = list(set(AllVariables)) # remove duplicates
570 
571  BPHY24SlimmingHelper.AllVariables = AllVariables
572  BPHY24SlimmingHelper.StaticContent = StaticContent
573  BPHY24SlimmingHelper.ExtraVariables = ExtraVariables
574  BPHY24ItemList = BPHY24SlimmingHelper.GetItemList()
575  acc.merge(OutputStreamCfg(flags, "DAOD_BPHY24", ItemList=BPHY24ItemList, AcceptAlgs=["BPHY24Kernel"]))
576  acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_BPHY24", AcceptAlgs=["BPHY24Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
577  acc.printConfig(withDetails=True, summariseProps=True, onlyComponents = [], printDefaults=True, printComponentsOnly=False)
578  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: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:25
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