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