ATLAS Offline Software
BPHY10.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 #====================================================================
4 # BPHY10.py
5 #====================================================================
6 
7 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8 from AthenaConfiguration.ComponentFactory import CompFactory
9 from AthenaConfiguration.Enums import MetadataCategory
10 
11 BPHYDerivationName = "BPHY10"
12 streamName = "StreamDAOD_BPHY10"
13 
14 def BPHY10Cfg(flags):
15  from DerivationFrameworkBPhys.commonBPHYMethodsCfg import (BPHY_V0ToolCfg, BPHY_InDetDetailedTrackSelectorToolCfg, BPHY_VertexPointEstimatorCfg, BPHY_TrkVKalVrtFitterCfg)
16  from JpsiUpsilonTools.JpsiUpsilonToolsConfig import PrimaryVertexRefittingToolCfg
17 
18  acc = ComponentAccumulator()
19  isSimulation = flags.Input.isMC
20  BPHY10_AugOriginalCounts = CompFactory.DerivationFramework.AugOriginalCounts(
21  name = "BPHY10_AugOriginalCounts",
22  VertexContainer = "PrimaryVertices",
23  TrackContainer = "InDetTrackParticles" )
24  V0Tools = acc.popToolsAndMerge(BPHY_V0ToolCfg(flags, BPHYDerivationName))
25  vkalvrt = acc.popToolsAndMerge(BPHY_TrkVKalVrtFitterCfg(flags, BPHYDerivationName)) # VKalVrt vertex fitter
26  acc.addPublicTool(vkalvrt)
27  acc.addPublicTool(V0Tools)
28  trackselect = acc.popToolsAndMerge(BPHY_InDetDetailedTrackSelectorToolCfg(flags, BPHYDerivationName))
29  acc.addPublicTool(trackselect)
30  vpest = acc.popToolsAndMerge(BPHY_VertexPointEstimatorCfg(flags, BPHYDerivationName))
31  acc.addPublicTool(vpest)
32  BPHY10JpsiFinder = CompFactory.Analysis.JpsiFinder(
33  name = "BPHY10JpsiFinder",
34  muAndMu = True,
35  muAndTrack = False,
36  TrackAndTrack = False,
37  assumeDiMuons = True,
38  invMassUpper = 4000.0,
39  invMassLower = 2600.0,
40  Chi2Cut = 200.,
41  oppChargesOnly = True,
42  combOnly = True,
43  atLeastOneComb = False,
44  useCombinedMeasurement = False, # Only takes effect if combOnly=True
45  muonCollectionKey = "Muons",
46  TrackParticleCollection = "InDetTrackParticles",
47  V0VertexFitterTool = None, # V0 vertex fitter
48  useV0Fitter = False, # if False a TrkVertexFitterTool will be used
49  TrkVertexFitterTool = vkalvrt, # VKalVrt vertex fitter
50  TrackSelectorTool = trackselect,
51  VertexPointEstimator = vpest,
52  useMCPCuts = False)
53 
54  BPHY10JpsiSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
55  name = "BPHY10JpsiSelectAndWrite",
56  VertexSearchTool = BPHY10JpsiFinder,
57  OutputVtxContainerName = "BPHY10JpsiCandidates",
58  PVContainerName = "PrimaryVertices",
59  V0Tools = V0Tools,
60  PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
61  RefPVContainerName = "SHOULDNOTBEUSED",
62  DoVertexType = 1)
63  BPHY10_Select_Jpsi2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
64  name = "BPHY10_Select_Jpsi2mumu",
65  HypothesisName = "Jpsi",
66  InputVtxContainerName = "BPHY10JpsiCandidates",
67  V0Tools = V0Tools,
68  VtxMassHypo = 3096.916,
69  MassMin = 2600.0,
70  MassMax = 4000.0,
71  Chi2Max = 200,
72  DoVertexType =1)
73 
74  BPHY10BdJpsiKst = CompFactory.Analysis.JpsiPlus2Tracks(
75  name = "BPHY10BdJpsiKst",
76  kaonkaonHypothesis = False,
77  pionpionHypothesis = False,
78  kaonpionHypothesis = True,
79  trkThresholdPt = 500.0,
80  trkMaxEta = 3.0,
81  BThresholdPt = 5000.,
82  BMassLower = 4300.0,
83  BMassUpper = 6300.0,
84  JpsiContainerKey = "BPHY10JpsiCandidates",
85  TrackParticleCollection = "InDetTrackParticles",
86  ExcludeCrossJpsiTracks = False, #setting this to False rejects the muons from J/psi candidate
87  TrkVertexFitterTool = vkalvrt,
88  TrackSelectorTool = trackselect,
89  UseMassConstraint = True,
90  Chi2Cut = 10.0,
91  DiTrackPt = 500.,
92  TrkQuadrupletMassLower = 3500.0,
93  TrkQuadrupletMassUpper = 6800.0,
94  FinalDiTrackPt = 500.
95  )
96  BPHY10V0ContainerName = "BPHY10RecoV0Candidates"
97  BPHY10KshortContainerName = "BPHY10RecoKshortCandidates"
98  BPHY10LambdaContainerName = "BPHY10RecoLambdaCandidates"
99  BPHY10LambdabarContainerName = "BPHY10RecoLambdabarCandidates"
100 
101  BPHY10BdKstSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
102  name = "BPHY10BdKstSelectAndWrite",
103  VertexSearchTool = BPHY10BdJpsiKst,
104  OutputVtxContainerName = "BPHY10BdJpsiKstCandidates",
105  PVContainerName = "PrimaryVertices",
106  V0Tools = V0Tools,
107  PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
108  RefPVContainerName = "BPHY10RefittedPrimaryVertices1",
109  RefitPV = True,
110  MaxPVrefit = 10000,
111  DoVertexType = 7)
112 
113  BPHY10_Select_Bd2JpsiKst = CompFactory.DerivationFramework.Select_onia2mumu(
114  name = "BPHY10_Select_Bd2JpsiKst",
115  HypothesisName = "Bd",
116  InputVtxContainerName = "BPHY10BdJpsiKstCandidates",
117  V0Tools = V0Tools,
118  TrkMasses = [105.658, 105.658, 493.677, 139.570],
119  VtxMassHypo = 5279.6,
120  MassMin = 100.0, #no mass cuts here
121  MassMax = 100000.0, #no mass cuts here
122  Chi2Max = 200)
123 
124  BPHY10_Select_Bd2JpsiKstbar = CompFactory.DerivationFramework.Select_onia2mumu(
125  name = "BPHY10_Select_Bd2JpsiKstbar",
126  HypothesisName = "Bdbar",
127  InputVtxContainerName = "BPHY10BdJpsiKstCandidates",
128  V0Tools = V0Tools,
129  TrkMasses = [105.658, 105.658, 139.570, 493.677],
130  VtxMassHypo = 5279.6,
131  MassMin = 100.0, #no mass cuts here
132  MassMax = 100000.0, #no mass cuts here
133  Chi2Max = 200)
134 
135  from DerivationFrameworkBPhys.V0ToolConfig import BPHY_Reco_V0FinderCfg
136  BPHY10_Reco_V0Finder = acc.popToolsAndMerge(BPHY_Reco_V0FinderCfg(
137  flags, derivation = BPHYDerivationName,
138  V0ContainerName = BPHY10V0ContainerName,
139  KshortContainerName = BPHY10KshortContainerName,
140  LambdaContainerName = BPHY10LambdaContainerName,
141  LambdabarContainerName = BPHY10LambdabarContainerName,
142  CheckVertexContainers = ['BPHY10JpsiCandidates']))
143 
144  from TrkConfig.TrkVKalVrtFitterConfig import JpsiV0VertexFitCfg
145  JpsiV0VertexFit = acc.popToolsAndMerge(JpsiV0VertexFitCfg(flags))
146  acc.addPublicTool(JpsiV0VertexFit)
147 
148  BPHY10JpsiKshort = CompFactory.DerivationFramework.JpsiPlusV0Cascade(
149  name = "BPHY10JpsiKshort",
150  V0Tools = V0Tools,
151  HypothesisName = "Bd",
152  TrkVertexFitterTool = JpsiV0VertexFit,
153  V0Hypothesis = 310,
154  PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
155  JpsiMassLowerCut = 2800.,
156  JpsiMassUpperCut = 4000.,
157  V0MassLowerCut = 400.,
158  V0MassUpperCut = 600.,
159  MassLowerCut = 4300.,
160  MassUpperCut = 6300.,
161  RefitPV = True,
162  RefPVContainerName = "BPHY10RefittedPrimaryVertices2",
163  JpsiVertices = "BPHY10JpsiCandidates",
164  CascadeVertexCollections= ["BPHY10JpsiKshortCascadeSV2", "BPHY10JpsiKshortCascadeSV1"],
165  V0Vertices = BPHY10V0ContainerName)
166 
167  BPHY10JpsiLambda = CompFactory.DerivationFramework.JpsiPlusV0Cascade(
168  name = "BPHY10JpsiLambda",
169  V0Tools = V0Tools,
170  HypothesisName = "Lambda_b",
171  TrkVertexFitterTool = JpsiV0VertexFit,
172  PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
173  V0Hypothesis = 3122,
174  JpsiMassLowerCut = 2800.,
175  JpsiMassUpperCut = 4000.,
176  V0MassLowerCut = 1050.,
177  V0MassUpperCut = 1250.,
178  MassLowerCut = 4600.,
179  MassUpperCut = 6600.,
180  RefitPV = True,
181  RefPVContainerName = "BPHY10RefittedPrimaryVertices3",
182  JpsiVertices = "BPHY10JpsiCandidates",
183  CascadeVertexCollections= ["BPHY10JpsiLambdaCascadeSV2", "BPHY10JpsiLambdaCascadeSV1"],
184  V0Vertices = BPHY10V0ContainerName)
185 
186  BPHY10JpsiLambdabar = CompFactory.DerivationFramework.JpsiPlusV0Cascade(
187  name = "BPHY10JpsiLambdabar",
188  HypothesisName = "Lambda_bbar",
189  V0Tools = V0Tools,
190  TrkVertexFitterTool = JpsiV0VertexFit,
191  PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
192  V0Hypothesis = -3122,
193  JpsiMassLowerCut = 2800.,
194  JpsiMassUpperCut = 4000.,
195  V0MassLowerCut = 1050.,
196  V0MassUpperCut = 1250.,
197  MassLowerCut = 4600.,
198  MassUpperCut = 6600.,
199  RefitPV = True,
200  RefPVContainerName = "BPHY10RefittedPrimaryVertices4",
201  JpsiVertices = "BPHY10JpsiCandidates",
202  CascadeVertexCollections= ["BPHY10JpsiLambdabarCascadeSV2", "BPHY10JpsiLambdabarCascadeSV1"],
203  V0Vertices = BPHY10V0ContainerName)
204 
205  CascadeCollections = []
206  CascadeCollections += BPHY10JpsiKshort.CascadeVertexCollections
207  CascadeCollections += BPHY10JpsiLambda.CascadeVertexCollections
208  CascadeCollections += BPHY10JpsiLambdabar.CascadeVertexCollections
209 
210  if not isSimulation: #Only Skim Data
211  BPHY10_SelectBdJpsiKstEvent = CompFactory.DerivationFramework.xAODStringSkimmingTool(
212  name = "BPHY10_SelectBdJpsiKstEvent",
213  expression = "(count(BPHY10BdJpsiKstCandidates.passed_Bd > 0) + count(BPHY10BdJpsiKstCandidates.passed_Bdbar > 0)) >0")
214 
215  BPHY10_cascadeCheck = CompFactory.DerivationFramework.AnyVertexSkimmingTool("BPHY10_AnyVertexSkimmingTool",
216  VertexContainerNames =CascadeCollections,
217  UseHandles = True )
218  BPHY10SkimmingOR = CompFactory.DerivationFramework.FilterCombinationOR(
219  "BPHY10SkimmingOR",
220  FilterList = [BPHY10_cascadeCheck, BPHY10_SelectBdJpsiKstEvent])
221  acc.addPublicTool(BPHY10_cascadeCheck)
222  acc.addPublicTool(BPHY10_SelectBdJpsiKstEvent)
223  acc.addPublicTool(BPHY10SkimmingOR)
224 
225 
226  augTools = [BPHY10JpsiSelectAndWrite, BPHY10_Select_Jpsi2mumu,
227  BPHY10BdKstSelectAndWrite, BPHY10_Select_Bd2JpsiKst, BPHY10_Select_Bd2JpsiKstbar,
228  BPHY10_Reco_V0Finder, BPHY10JpsiKshort, BPHY10JpsiLambda, BPHY10JpsiLambdabar,
229  BPHY10_AugOriginalCounts]
230  for t in augTools : acc.addPublicTool(t)
231  #from AthenaCommon.Constants import DEBUG
232  acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel("BPHY10Kernel",
233  AugmentationTools = augTools,
234  #OutputLevel = DEBUG,
235  #Only skim if not MC
236  SkimmingTools = [BPHY10SkimmingOR] if not isSimulation else [],
237  ThinningTools = []))
238  from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
239  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
240  from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
241  BPHY10SlimmingHelper = SlimmingHelper("BPHY10SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
242  from DerivationFrameworkBPhys.commonBPHYMethodsCfg import getDefaultAllVariables
243  AllVariables = getDefaultAllVariables()
244  StaticContent = []
245 
246  # Needed for trigger objects
247  BPHY10SlimmingHelper.IncludeMuonTriggerContent = True
248  BPHY10SlimmingHelper.IncludeBPhysTriggerContent = True
249 
250 
251  AllVariables += ["PrimaryVertices"]
252 
253  for x in range(1,5):
254  StaticContent += ["xAOD::VertexContainer#BPHY10RefittedPrimaryVertices%s" % str(x)]
255  StaticContent += ["xAOD::VertexAuxContainer#BPHY10RefittedPrimaryVertices%sAux." % str(x)]
256 
257 
258  AllVariables += ["InDetTrackParticles"]
259 
260 
263  AllVariables += ["CombinedMuonTrackParticles"]
264  AllVariables += ["ExtrapolatedMuonTrackParticles"]
265 
266 
267  AllVariables += ["Muons", "MuonsLRT"]
268 
269 
270 
271  StaticContent += ["xAOD::VertexContainer#%s" % BPHY10JpsiSelectAndWrite.OutputVtxContainerName]
272 
273  StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY10JpsiSelectAndWrite.OutputVtxContainerName]
274 
275  StaticContent += ["xAOD::VertexContainer#%s" % BPHY10BdKstSelectAndWrite.OutputVtxContainerName]
276  StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY10BdKstSelectAndWrite.OutputVtxContainerName]
277 
278  StaticContent += ["xAOD::VertexContainer#%s" % BPHY10V0ContainerName]
279  StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY10V0ContainerName]
280  StaticContent += ["xAOD::VertexContainer#%s" % BPHY10KshortContainerName]
281  StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY10KshortContainerName]
282  StaticContent += ["xAOD::VertexContainer#%s" % BPHY10LambdaContainerName]
283  StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY10LambdaContainerName]
284  StaticContent += ["xAOD::VertexContainer#%s" % BPHY10LambdabarContainerName]
285  StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY10LambdabarContainerName]
286 
287  for cascades in CascadeCollections:
288  StaticContent += ["xAOD::VertexContainer#%s" % cascades]
289  StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % cascades]
290 
291  # Tagging information (in addition to that already requested by usual algorithms)
292  AllVariables += ["GSFTrackParticles", "MuonSpectrometerTrackParticles" ]
293 
294  # Truth information for MC only
295  if isSimulation:
296  AllVariables += ["TruthEvents","TruthParticles","TruthVertices","MuonTruthParticles"]
297 
298  AllVariables = list(set(AllVariables)) # remove duplicates
299 
300  BPHY10SlimmingHelper.AllVariables = AllVariables
301  BPHY10SlimmingHelper.StaticContent = StaticContent
302  BPHY10SlimmingHelper.SmartCollections = []
303  BPHY10ItemList = BPHY10SlimmingHelper.GetItemList()
304  acc.merge(OutputStreamCfg(flags, "DAOD_BPHY10", ItemList=BPHY10ItemList, AcceptAlgs=["BPHY10Kernel"]))
305  acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_BPHY10", AcceptAlgs=["BPHY10Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
306  acc.printConfig(withDetails=True, summariseProps=True, onlyComponents = [], printDefaults=True, printComponentsOnly=False)
307  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
BPHY10.BPHY10Cfg
def BPHY10Cfg(flags)
Definition: BPHY10.py:14
V0ToolConfig.BPHY_Reco_V0FinderCfg
def BPHY_Reco_V0FinderCfg(flags, derivation="", suffix="", V0ContainerName="", KshortContainerName="", LambdaContainerName="", LambdabarContainerName="", CheckVertexContainers=[], **kwargs)
Definition: V0ToolConfig.py:46
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
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.InDetConversionFinderToolsConfig.BPHY_VertexPointEstimatorCfg
def BPHY_VertexPointEstimatorCfg(flags, name="BPHY_VertexPointEstimator", **kwargs)
Definition: InDetConversionFinderToolsConfig.py:69
commonBPHYMethodsCfg.getDefaultAllVariables
def getDefaultAllVariables()
Definition: commonBPHYMethodsCfg.py:32
str
Definition: BTagTrackIpAccessor.cxx:11
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