ATLAS Offline Software
BPHY16.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 #====================================================================
3 # BPHY16.py
4 #====================================================================
5 
6 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory import CompFactory
8 from AthenaConfiguration.Enums import MetadataCategory
9 
10 
11 BPHYDerivationName = "BPHY16"
12 streamName = "StreamDAOD_BPHY16"
13 
14 def BPHY16Cfg(flags):
15  from DerivationFrameworkBPhys.commonBPHYMethodsCfg import (BPHY_V0ToolCfg, BPHY_InDetDetailedTrackSelectorToolCfg, BPHY_VertexPointEstimatorCfg, BPHY_TrkVKalVrtFitterCfg)
16  from JpsiUpsilonTools.JpsiUpsilonToolsConfig import PrimaryVertexRefittingToolCfg
17  acc = ComponentAccumulator()
18  isSimulation = flags.Input.isMC
19  V0Tools = acc.popToolsAndMerge(BPHY_V0ToolCfg(flags, BPHYDerivationName))
20  vkalvrt = acc.popToolsAndMerge(BPHY_TrkVKalVrtFitterCfg(flags, BPHYDerivationName)) # VKalVrt vertex fitter
21  acc.addPublicTool(vkalvrt)
22  acc.addPublicTool(V0Tools)
23  trackselect = acc.popToolsAndMerge(BPHY_InDetDetailedTrackSelectorToolCfg(flags, BPHYDerivationName))
24  acc.addPublicTool(trackselect)
25  vpest = acc.popToolsAndMerge(BPHY_VertexPointEstimatorCfg(flags, BPHYDerivationName))
26  acc.addPublicTool(vpest)
27  BPHY16JpsiFinder = CompFactory.Analysis.JpsiFinder(
28  name = "BPHY16JpsiFinder",
29  muAndMu = True,
30  muAndTrack = False,
31  TrackAndTrack = False,
32  assumeDiMuons = True, # If true, will assume dimu hypothesis and use PDG value for mu mass
33  invMassUpper = 12000.0,
34  invMassLower = 8000.,
35  Chi2Cut = 20.,
36  oppChargesOnly = True,
37  atLeastOneComb = True,
38  useCombinedMeasurement = False, # Only takes effect if combOnly=True
39  muonCollectionKey = "Muons",
40  TrackParticleCollection = "InDetTrackParticles",
41  V0VertexFitterTool = None, # V0 vertex fitter
42  useV0Fitter = False, # if False a TrkVertexFitterTool will be used
43  TrkVertexFitterTool = vkalvrt, # VKalVrt vertex fitter
44  TrackSelectorTool = trackselect,
45  VertexPointEstimator = vpest,
46  useMCPCuts = False )
47  acc.addPublicTool(BPHY16JpsiFinder)
48  BPHY16_Reco_mumu = CompFactory.DerivationFramework.Reco_Vertex(
49  name = "BPHY16_Reco_mumu",
50  VertexSearchTool = BPHY16JpsiFinder,
51  OutputVtxContainerName = "BPHY16OniaCandidates",
52  PVContainerName = "PrimaryVertices",
53  RefPVContainerName = "BPHY16RefittedPrimaryVertices1",
54  RefitPV = True,
55  V0Tools = V0Tools,
56  PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
57  MaxPVrefit = 100000,
58  DoVertexType = 7)
59 
60  BPHY16_Select_Upsi = CompFactory.DerivationFramework.Select_onia2mumu(
61  name = "BPHY16_Select_Upsi",
62  HypothesisName = "Upsilon",
63  InputVtxContainerName = "BPHY16OniaCandidates",
64  V0Tools = V0Tools,
65  VtxMassHypo = 9460.30,
66  MassMin = 8000.,
67  MassMax = 12000.,
68  Chi2Max = 200,
69  DoVertexType = 7)
70 
71  BPHY16Plus2Tracks = CompFactory.Analysis.JpsiPlus2Tracks(name = "BPHY16Plus2Tracks",
72  kaonkaonHypothesis = False,
73  pionpionHypothesis = False,
74  kaonpionHypothesis = False,
75  ManualMassHypo = [ 105.658, 105.658, 105.658, 105.658 ],
76  trkThresholdPt = 0.0,
77  trkMaxEta = 3.0,
78  BMassUpper = 50000.0,
79  BMassLower = 0,
80  oppChargesOnly = False,
81  Chi2Cut = 100.0,
82  JpsiContainerKey = "BPHY16OniaCandidates",
83  TrackParticleCollection = "InDetTrackParticles",
84  MuonsUsedInJpsi = "Muons",
85  ExcludeJpsiMuonsOnly = True,
86  RequireNMuonTracks = 1,
87  TrkVertexFitterTool = vkalvrt,
88  TrackSelectorTool = trackselect,
89  UseMassConstraint = False)
90 
91  BPHY16FourTrackSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(name = "BPHY16FourTrackSelectAndWrite",
92  VertexSearchTool = BPHY16Plus2Tracks,
93  OutputVtxContainerName = "BPHY16FourTrack",
94  PVContainerName = "PrimaryVertices",
95  RefPVContainerName = "BPHY16RefittedPrimaryVertices2",
96  RefitPV = True,
97  V0Tools = V0Tools,
98  PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
99  MaxPVrefit = 10000, DoVertexType = 7)
100 
101  BPHY16_Select_FourTrack = CompFactory.DerivationFramework.Select_onia2mumu(
102  name = "BPHY16_Select_FourTracks",
103  HypothesisName = "FourTracks",
104  InputVtxContainerName = "BPHY16FourTrack",
105  V0Tools = V0Tools,
106  TrkMasses = [105.658, 105.658, 105.658, 105.658],
107  VtxMassHypo = 18100.0,
108  MassMin = 0,
109  MassMax = 500000,
110  Chi2Max = BPHY16Plus2Tracks.Chi2Cut)
111  BPHY16_Revertex = CompFactory.DerivationFramework.ReVertex(
112  name = "BPHY16_ReVertex",
113  InputVtxContainerName = "BPHY16FourTrack",
114  V0Tools = V0Tools,
115  TrackIndices = [ 2, 3 ],
116  PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
117  TrkVertexFitterTool = vkalvrt,
118  OutputVtxContainerName = "BPHY16TwoTrack")
119  BPHY16_Select_TwoTrack = CompFactory.DerivationFramework.Select_onia2mumu(
120  name = "BPHY16_Select_TwoTracks",
121  HypothesisName = "TwoTracks",
122  InputVtxContainerName = "BPHY16TwoTrack",
123  V0Tools = V0Tools,
124  TrkMasses = [105.658, 105.658],
125  VtxMassHypo = 18100.0,
126  MassMin = 1,
127  MassMax = 500000,
128  Chi2Max = 90)
129 
130  BPHY16_SelectEvent = CompFactory.DerivationFramework.xAODStringSkimmingTool(name = "BPHY16_SelectEvent",
131  expression = "count(BPHY16FourTrack.passed_FourTracks) > 0")
132 
133 
134  augTools = [BPHY16_Reco_mumu, BPHY16_Select_Upsi, BPHY16FourTrackSelectAndWrite, BPHY16_Select_FourTrack, BPHY16_Revertex, BPHY16_Select_TwoTrack]
135  skimTools = [BPHY16_SelectEvent]
136  for t in augTools +skimTools : acc.addPublicTool(t)
137  acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel("BPHY16Kernel",
138  AugmentationTools = augTools,
139  #Only skim if not MC
140  SkimmingTools = skimTools,
141  ThinningTools = []))
142 
143  #====================================================================
144  # Slimming
145  #====================================================================
146 
147  from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
148  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
149  from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
150  BPHY16SlimmingHelper = SlimmingHelper("BPHY16SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
151  from DerivationFrameworkBPhys.commonBPHYMethodsCfg import getDefaultAllVariables
152  AllVariables = getDefaultAllVariables()
153  StaticContent = []
154 
155  # Needed for trigger objects
156  BPHY16SlimmingHelper.IncludeMuonTriggerContent = True
157  BPHY16SlimmingHelper.IncludeBPhysTriggerContent = True
158 
159 
160  AllVariables += ["PrimaryVertices"]
161  StaticContent += ["xAOD::VertexContainer#BPHY16RefittedPrimaryVertices1"]
162  StaticContent += ["xAOD::VertexAuxContainer#BPHY16RefittedPrimaryVertices1Aux."]
163  StaticContent += ["xAOD::VertexContainer#BPHY16RefittedPrimaryVertices2"]
164  StaticContent += ["xAOD::VertexAuxContainer#BPHY16RefittedPrimaryVertices2Aux."]
165 
166 
167  AllVariables += ["InDetTrackParticles"]
168 
169 
172  AllVariables += ["CombinedMuonTrackParticles"]
173  AllVariables += ["ExtrapolatedMuonTrackParticles"]
174 
175 
176  AllVariables += ["Muons"]
177 
178 
179  StaticContent += ["xAOD::VertexContainer#%s" % BPHY16_Reco_mumu.OutputVtxContainerName]
180 
181  StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY16_Reco_mumu.OutputVtxContainerName]
182 
183  StaticContent += ["xAOD::VertexContainer#%s" % BPHY16FourTrackSelectAndWrite.OutputVtxContainerName]
184 
185  StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY16FourTrackSelectAndWrite.OutputVtxContainerName]
186 
187  StaticContent += ["xAOD::VertexContainer#%s" % BPHY16_Revertex.OutputVtxContainerName]
188 
189  StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY16_Revertex.OutputVtxContainerName]
190 
191 
192  # Truth information for MC only
193  if isSimulation:
194  AllVariables += ["TruthEvents","TruthParticles","TruthVertices","MuonTruthParticles"]
195  BPHY16SlimmingHelper.AllVariables = AllVariables
196  BPHY16SlimmingHelper.StaticContent = StaticContent
197  BPHY16ItemList = BPHY16SlimmingHelper.GetItemList()
198  acc.merge(OutputStreamCfg(flags, "DAOD_BPHY16", ItemList=BPHY16ItemList, AcceptAlgs=["BPHY16Kernel"]))
199  acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_BPHY16", AcceptAlgs=["BPHY16Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
200  acc.printConfig(withDetails=True, summariseProps=True, onlyComponents = [], printDefaults=True, printComponentsOnly=False)
201  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
BPHY16.BPHY16Cfg
def BPHY16Cfg(flags)
Definition: BPHY16.py:14
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
InfileMetaDataConfig.SetupMetaDataForStreamCfg
def SetupMetaDataForStreamCfg(flags, streamName="", AcceptAlgs=None, createMetadata=None, propagateMetadataFromInput=True, *args, **kwargs)
Definition: InfileMetaDataConfig.py:216
SlimmingHelper
Definition: SlimmingHelper.py:1