ATLAS Offline Software
BPHY6.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 #====================================================================
3 # BPHY6.py
4 #====================================================================
5 
6 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory import CompFactory
8 from AthenaConfiguration.Enums import MetadataCategory
9 
10 BPHYDerivationName = "BPHY6"
11 streamName = "StreamDAOD_BPHY6"
12 
13 def BPHY6Cfg(flags):
14  from DerivationFrameworkBPhys.commonBPHYMethodsCfg import (BPHY_V0ToolCfg, BPHY_InDetDetailedTrackSelectorToolCfg, BPHY_VertexPointEstimatorCfg, BPHY_TrkVKalVrtFitterCfg)
15  from JpsiUpsilonTools.JpsiUpsilonToolsConfig import PrimaryVertexRefittingToolCfg
16  acc = ComponentAccumulator()
17  isSimulation = flags.Input.isMC
18  # General Variables
19  dimuon_chi2_max = 50.
20  dimuon_mass_min = 100.
21  dimuon_mass_max = 150e3
22 
23  V0Tools = acc.popToolsAndMerge(BPHY_V0ToolCfg(flags, BPHYDerivationName))
24  vkalvrt = acc.popToolsAndMerge(BPHY_TrkVKalVrtFitterCfg(flags, BPHYDerivationName)) # VKalVrt vertex fitter
25  acc.addPublicTool(vkalvrt)
26  acc.addPublicTool(V0Tools)
27  trackselect = acc.popToolsAndMerge(BPHY_InDetDetailedTrackSelectorToolCfg(flags, BPHYDerivationName))
28  acc.addPublicTool(trackselect)
29  vpest = acc.popToolsAndMerge(BPHY_VertexPointEstimatorCfg(flags, BPHYDerivationName))
30  acc.addPublicTool(vpest)
31  from TrkConfig.AtlasExtrapolatorConfig import InDetExtrapolatorCfg
32  extrap = acc.popToolsAndMerge(InDetExtrapolatorCfg(flags))
33  acc.addPublicTool(extrap)
34  BPHY6_Extrap_Tool = CompFactory.DerivationFramework.MuonExtrapolationTool(name = "BPHY6_ExtrapolationTool", Extrapolator = extrap)
35  BPHY6JpsiFinder = CompFactory.Analysis.JpsiFinder(
36  name = "BPHY6JpsiFinder",
37  muAndMu = True,
38  muAndTrack = False,
39  TrackAndTrack = False,
40  assumeDiMuons = True, # If true, will assume dimu hypothesis and use PDG value for mu mass
41  invMassUpper = dimuon_mass_max,
42  invMassLower = dimuon_mass_min,
43  Chi2Cut = dimuon_chi2_max,
44  oppChargesOnly = True,
45  atLeastOneComb = True,
46  useCombinedMeasurement = False, # Only takes effect if combOnly=True
47  muonCollectionKey = "Muons",
48  TrackParticleCollection = "InDetTrackParticles",
49  V0VertexFitterTool = None, # V0 vertex fitter
50  useV0Fitter = False, # if False a TrkVertexFitterTool will be used
51  TrkVertexFitterTool = vkalvrt, # VKalVrt vertex fitter
52  TrackSelectorTool = trackselect,
53  VertexPointEstimator = vpest,
54  useMCPCuts = False )
55 
56  BPHY6_Reco_mumu = CompFactory.DerivationFramework.Reco_Vertex(
57  name = "BPHY6_Reco_mumu",
58  VertexSearchTool = BPHY6JpsiFinder,
59  OutputVtxContainerName = "BPHY6OniaCandidates",
60  V0Tools = V0Tools,
61  PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
62  PVContainerName = "PrimaryVertices",
63  RefPVContainerName = "BPHY6RefittedPrimaryVertices")
64 
65  BPHY6_Select_Jpsi2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
66  name = "BPHY6_Select_Jpsi2mumu",
67  HypothesisName = "Jpsi",
68  InputVtxContainerName = "BPHY6OniaCandidates",
69  V0Tools = V0Tools,
70  VtxMassHypo = 3096.916,
71  MassMin = 2700.0,
72  MassMax = 3500.0,
73  Chi2Max = 20)
74 
75  BPHY6_Select_Psi2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
76  name = "BPHY6_Select_Psi2mumu",
77  HypothesisName = "Psi",
78  InputVtxContainerName = "BPHY6OniaCandidates",
79  V0Tools = V0Tools,
80  VtxMassHypo = 3686.09,
81  MassMin = 3200.0,
82  MassMax = 4200.0,
83  Chi2Max = 20)
84 
85  BPHY6_Select_Upsi2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
86  name = "BPHY6_Select_Upsi2mumu",
87  HypothesisName = "Upsi",
88  InputVtxContainerName = "BPHY6OniaCandidates",
89  V0Tools = V0Tools,
90  VtxMassHypo = 9460.30,
91  MassMin = 8000.0,
92  MassMax = 12000.0,
93  Chi2Max = 20)
94 
95  BPHY6_Select_Bmumu2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
96  name = "BPHY6_Select_Bmumu2mumu",
97  HypothesisName = "Bmumu",
98  InputVtxContainerName = "BPHY6OniaCandidates",
99  V0Tools = V0Tools,
100  VtxMassHypo = 5366.77,
101  MassMin = 4200.0,
102  MassMax = 8000.0,
103  Chi2Max = 20)
104 
105  BPHY6_Select_Zmumu2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
106  name = "BPHY6_Select_Zmumu2mumu",
107  HypothesisName = "Zmumu",
108  InputVtxContainerName = "BPHY6OniaCandidates",
109  V0Tools = V0Tools,
110  VtxMassHypo = 91187.6,
111  MassMin = 60000.0,
112  MassMax = 120000.0,
113  Chi2Max = 20)
114 
115  BPHY6_Select_Onia2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
116  name = "BPHY6_Select_Onia2mumu",
117  HypothesisName = "Onia",
118  InputVtxContainerName = "BPHY6OniaCandidates",
119  V0Tools = V0Tools,
120  VtxMassHypo = 3096.916,
121  MassMin = dimuon_mass_min,
122  MassMax = dimuon_mass_max,
123  Chi2Max = 20)
124 
125  trigger_list = [r'HLT_\d?mu\d+']
126 
127  BPHY6TrigSkimmingTool = CompFactory.DerivationFramework.TriggerSkimmingTool( name = "BPHY6TrigSkimmingTool",
128  TriggerListOR = trigger_list )
129  expression = "count(BPHY6OniaCandidates.passed_Onia) > 0 "
130  BPHY6_SelectEvent = CompFactory.DerivationFramework.xAODStringSkimmingTool(name = "BPHY6_SelectEvent",
131  expression = expression)
132  BPHY6Thin_vtxTrk = CompFactory.DerivationFramework.Thin_vtxTrk(
133  name = "BPHY6Thin_vtxTrk",
134  TrackParticleContainerName = "InDetTrackParticles",
135  StreamName = streamName,
136  VertexContainerNames = ["BPHY6OniaCandidates"],
137  PassFlags = ["passed_Onia"], )
138  BPHY6MuonTPThinningTool = CompFactory.DerivationFramework.MuonTrackParticleThinning(name = "BPHY6MuonTPThinningTool",
139  MuonKey = "Muons",
140  StreamName = streamName,
141  InDetTrackParticlesKey = "InDetTrackParticles")
142 
143 
144  BPHY6ThinningTools = [BPHY6Thin_vtxTrk, BPHY6MuonTPThinningTool]
145  if isSimulation:
146  BPHY6TruthThinTool = CompFactory.DerivationFramework.GenericTruthThinning(name = "BPHY6TruthThinTool",
147  ParticleSelectionString = "TruthParticles.pdgId == 443 || TruthParticles.pdgId == 100443 || TruthParticles.pdgId == 553 || TruthParticles.pdgId == 100553 || TruthParticles.pdgId == 200553 || TruthParticles.pdgId == 23 || TruthParticles.pdgId == 531 || TruthParticles.pdgId == 511 || TruthParticles.pdgId == 521 || TruthParticles.pdgId == 541",
148  PreserveDescendants = True,
149  StreamName = streamName,
150  PreserveAncestors = True)
151  BPHY6ThinningTools.append(BPHY6TruthThinTool)
152 
153  SkimmingORTool = CompFactory.DerivationFramework.FilterCombinationOR("BPHY6SkimmingOR",
154  FilterList = [BPHY6_SelectEvent,BPHY6TrigSkimmingTool])
155 
156  augTools = [BPHY6_Reco_mumu, BPHY6_Select_Jpsi2mumu, BPHY6_Select_Psi2mumu, BPHY6_Select_Upsi2mumu,BPHY6_Select_Bmumu2mumu,
157  BPHY6_Select_Zmumu2mumu,BPHY6_Select_Onia2mumu, BPHY6_Extrap_Tool]
158  for t in augTools + BPHY6ThinningTools + [SkimmingORTool] + [BPHY6_SelectEvent,BPHY6TrigSkimmingTool]: acc.addPublicTool(t)
159  acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel("BPHY6Kernel",
160  AugmentationTools = augTools,
161  SkimmingTools = [SkimmingORTool],
162  ThinningTools = BPHY6ThinningTools ))
163 
164  from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
165  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
166  from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
167  BPHY6SlimmingHelper = SlimmingHelper("BPHY6SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
168 
169  # Needed for trigger objects
170  BPHY6SlimmingHelper.IncludeMuonTriggerContent = True
171  BPHY6SlimmingHelper.IncludeBPhysTriggerContent = True
172  from DerivationFrameworkBPhys.commonBPHYMethodsCfg import getDefaultAllVariables
173  AllVariables = getDefaultAllVariables()
174  StaticContent = []
175  AllVariables += ["LVL1MuonRoIs"]
176 
177 
178  AllVariables += ["PrimaryVertices"]
179  StaticContent += ["xAOD::VertexContainer#BPHY6RefittedPrimaryVertices"]
180  StaticContent += ["xAOD::VertexAuxContainer#BPHY6RefittedPrimaryVerticesAux."]
181 
182 
183  AllVariables += ["InDetTrackParticles"]
184 
185  AllVariables += ["HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Muon_EFID"]
186  AllVariables += ["HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Muon_IDTrig"]
187  AllVariables += ["HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Muon_FTF"]
188  AllVariables += ["HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Bphysics_FTF"]
189  AllVariables += ["HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Bphysics_IDTrig"]
190 
191 
192 
193 
196  AllVariables += ["CombinedMuonTrackParticles"]
197  AllVariables += ["ExtrapolatedMuonTrackParticles"]
198  AllVariables += ["MuonSpectrometerTrackParticles"]
199 
200 
201  AllVariables += ["Muons"]
202  AllVariables += ["HLT_xAOD__L2StandAloneMuonContainer_MuonL2SAInfo"]
203  AllVariables += ["HLT_xAOD__L2CombinedMuonContainer_MuonL2CBInfo"]
204  AllVariables += ["HLT_xAOD__MuonContainer_MuonEFInfo"]
205 
206 
207  AllVariables += ["HLT_xAOD__TrigBphysContainer_L2BMuMuXFex" ]
208  AllVariables += ["HLT_xAOD__TrigBphysContainer_EFBMuMuXFex" ]
209  AllVariables += ["HLT_xAOD__TrigBphysContainer_L2BMuMuFex" ]
210  AllVariables += ["HLT_xAOD__TrigBphysContainer_EFBMuMuFex" ]
211  AllVariables += ["HLT_xAOD__TrigBphysContainer_L2TrackMass" ]
212  AllVariables += ["HLT_xAOD__TrigBphysContainer_EFTrackMass" ]
213  AllVariables += ["HLT_xAOD__TrigBphysContainer_L2MultiMuFex"]
214  AllVariables += ["HLT_xAOD__TrigBphysContainer_EFMultiMuFex"]
215 
216 
217 
218  StaticContent += ["xAOD::VertexContainer#%s" % BPHY6_Reco_mumu.OutputVtxContainerName]
219  StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY6_Reco_mumu.OutputVtxContainerName]
220 
221  if isSimulation:
222  AllVariables += ["TruthEvents","TruthParticles","TruthVertices","MuonTruthParticles"]
223  BPHY6SlimmingHelper.AllVariables = AllVariables
224  BPHY6SlimmingHelper.StaticContent = StaticContent
225  BPHY6ItemList = BPHY6SlimmingHelper.GetItemList()
226  acc.merge(OutputStreamCfg(flags, "DAOD_BPHY6", ItemList=BPHY6ItemList, AcceptAlgs=["BPHY6Kernel"]))
227  acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_BPHY6", AcceptAlgs=["BPHY6Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
228  acc.printConfig(withDetails=True, summariseProps=True, onlyComponents = [], printDefaults=True, printComponentsOnly=False)
229  return acc
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
BPHY6.BPHY6Cfg
def BPHY6Cfg(flags)
Definition: BPHY6.py:13
commonBPHYMethodsCfg.BPHY_V0ToolCfg
def BPHY_V0ToolCfg(flags, BPHYDerivationName)
Definition: commonBPHYMethodsCfg.py:11
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.InDetTrackSelectorToolConfig.BPHY_InDetDetailedTrackSelectorToolCfg
def BPHY_InDetDetailedTrackSelectorToolCfg(flags, name='BPHY_InDetDetailedTrackSelectorTool', **kwargs)
Definition: InDetTrackSelectorToolConfig.py:215
python.AtlasExtrapolatorConfig.InDetExtrapolatorCfg
def InDetExtrapolatorCfg(flags, name='InDetExtrapolator', **kwargs)
Definition: AtlasExtrapolatorConfig.py:315
InfileMetaDataConfig.SetupMetaDataForStreamCfg
def SetupMetaDataForStreamCfg(flags, streamName="", AcceptAlgs=None, createMetadata=None, propagateMetadataFromInput=True, *args, **kwargs)
Definition: InfileMetaDataConfig.py:216
SlimmingHelper
Definition: SlimmingHelper.py:1