ATLAS Offline Software
Loading...
Searching...
No Matches
BPHY22.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3#====================================================================
4# BPHY22.py
5#====================================================================
6
7from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8from AthenaConfiguration.ComponentFactory import CompFactory
9from AthenaConfiguration.Enums import MetadataCategory
10
11
12BPHYDerivationName = "BPHY22"
13streamName = "StreamDAOD_BPHY22"
14
15def BPHY22Cfg(flags):
16 from AthenaServices.PartPropSvcConfig import PartPropSvcCfg
17 from DerivationFrameworkBPhys.commonBPHYMethodsCfg import (
18 BPHY_V0ToolCfg, BPHY_InDetDetailedTrackSelectorToolCfg,
19 BPHY_VertexPointEstimatorCfg, BPHY_TrkVKalVrtFitterCfg,
20 AugOriginalCountsCfg)
21 from JpsiUpsilonTools.JpsiUpsilonToolsConfig import PrimaryVertexRefittingToolCfg
22 acc = ComponentAccumulator()
23 acc.getPrimaryAndMerge(PartPropSvcCfg(flags))
24 isSimulation = flags.Input.isMC
25 V0Tools = acc.popToolsAndMerge(BPHY_V0ToolCfg(flags, BPHYDerivationName))
26 vkalvrt = acc.popToolsAndMerge(BPHY_TrkVKalVrtFitterCfg(flags, BPHYDerivationName)) # VKalVrt vertex fitter
27 acc.addPublicTool(vkalvrt)
28 acc.addPublicTool(V0Tools)
29 trackselect = acc.popToolsAndMerge(BPHY_InDetDetailedTrackSelectorToolCfg(flags, BPHYDerivationName))
30 acc.addPublicTool(trackselect)
31 vpest = acc.popToolsAndMerge(BPHY_VertexPointEstimatorCfg(flags, BPHYDerivationName))
32 acc.addPublicTool(vpest)
33 PVrefit = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags))
34 acc.addPublicTool(PVrefit)
35
36 BPHY22MuPiFinder = CompFactory.Analysis.JpsiFinder(
37 name = "BPHY22MuPiFinder",
38 muAndMu = False,
39 muAndTrack = True, #need doTagAndProbe flag
40 TrackAndTrack = False,
41 assumeDiMuons = False,
42 muonThresholdPt = 2700,
43 trackThresholdPt = 250.0, # MeV
44 invMassUpper = 8200.0,
45 invMassLower = 200.0,
46 Chi2Cut = 10.,
47 oppChargesOnly = False,
48 allChargeCombinations = True,
49 atLeastOneComb = False, # True by default
50 useCombinedMeasurement = False, # Only takes effect if combOnly=True
51 muonCollectionKey = "Muons",
52 TrackParticleCollection = "InDetTrackParticles",
53 V0VertexFitterTool = None, # V0 vertex fitter
54 useV0Fitter = False, # if False a TrkVertexFitterTool will be used
55 TrkVertexFitterTool = vkalvrt, # VKalVrt vertex fitter
56 TrackSelectorTool = trackselect,
57 VertexPointEstimator = vpest,
58 useMCPCuts = False,
59 doTagAndProbe = True, #won't work with all/same charges combs
60 forceTagAndProbe = True) #force T&P to work with any charges combs
61
62 BPHY22MuPiSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
63 name = "BPHY22MuPiSelectAndWrite",
64 VertexSearchTool = BPHY22MuPiFinder,
65 OutputVtxContainerName = "BPHY22MuPiCandidates",
66 V0Tools = V0Tools,
67 PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
68 PVContainerName = "PrimaryVertices",
69 RefPVContainerName = "SHOULDNOTBEUSED")
70
71
72 BPHY22DiTrkFinder = CompFactory.Analysis.JpsiFinder(
73 name = "BPHY22DiTrkFinder",
74 muAndMu = False,
75 muAndTrack = False,
76 TrackAndTrack = True,
77 assumeDiMuons = False, # If true, will assume dimu hypothesis and use PDG value for mu mass
78 trackThresholdPt = 900,
79 invMassUpper = 2100.0,
80 invMassLower = 275,
81 Chi2Cut = 20., #chi2
82 oppChargesOnly = True,
83 atLeastOneComb = False,
84 useCombinedMeasurement = False, # Only takes effect if combOnly=True
85 muonCollectionKey = "Muons",
86 TrackParticleCollection = "InDetTrackParticles",
87 V0VertexFitterTool = None, # V0 vertex fitter
88 useV0Fitter = False, # if False a TrkVertexFitterTool will be used
89 TrkVertexFitterTool = vkalvrt, # VKalVrt vertex fitter
90 TrackSelectorTool = trackselect,
91 VertexPointEstimator = vpest,
92 useMCPCuts = False,
93 track1Mass = 139.571, # Not very important, only used to calculate inv. mass cut, leave it loose here
94 track2Mass = 139.571)
95
96 BPHY22DiTrkSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
97 name = "BPHY22DiTrkSelectAndWrite",
98 VertexSearchTool = BPHY22DiTrkFinder,
99 OutputVtxContainerName = "BPHY22DiTrkCandidates",
100 PVContainerName = "PrimaryVertices",
101 V0Tools = V0Tools,
102 PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
103 RefPVContainerName = "SHOULDNOTBEUSED",
104 CheckCollections = True,
105 CheckVertexContainers = ['BPHY22MuPiCandidates'])
106
107
108 BMuDstVertexFit = acc.popToolsAndMerge(BPHY_TrkVKalVrtFitterCfg(flags, BPHYDerivationName, CascadeCnstPrecision = 1e-6))
109
110 BPHY22MuDpst = CompFactory.DerivationFramework.MuPlusDpstCascade(
111 name = "BPHY22MuDpst",
112 HypothesisName = "B",
113 TrkVertexFitterTool = BMuDstVertexFit,
114 DxHypothesis = 421, # MC PID for D0
115 ApplyD0MassConstraint = True,
116 MuPiMassLowerCut = 200.,
117 MuPiMassUpperCut = 8200.,
118 V0Tools = V0Tools,
119 PVRefitter = PVrefit,
120 D0MassLowerCut = 1864.83 - 200.,
121 D0MassUpperCut = 1864.83 + 200.,
122 DstMassLowerCut = 2010.26 - 300.,
123 DstMassUpperCut = 2010.26 + 300.,
124 DstMassUpperCutAft = 2010.26 + 25., #mass cut after cascade fit
125 MassLowerCut = 0.,
126 MassUpperCut = 12500.,
127 Chi2Cut = 5, #chi2/ndf
128 RefitPV = True,
129 RefPVContainerName = "BPHY22RefittedPrimaryVertices",
130 MuPiVertices = "BPHY22MuPiCandidates",
131 CascadeVertexCollections = ["BMuDpstCascadeSV2", "BMuDpstCascadeSV1"],
132 D0Vertices = "BPHY22DiTrkCandidates",
133 DoVertexType = 15 )
134
135 BPHY22Dh3Finder = CompFactory.Analysis.JpsiPlus1Track(
136 name = "BPHY22Dh3Finder",
137 pionHypothesis = True, #false by default
138 kaonHypothesis = False, #true by default
139 trkThresholdPt = 900.0,
140 trkMaxEta = 2.7, # is this value fine?? default would be 102.5
141 BThresholdPt = 2000.0,
142 BMassUpper = 2100.0, # What is this??
143 BMassLower = 500.0,
144 TrkDeltaZ = 20.,
145 TrkTrippletMassUpper = 2200, #2100
146 TrkTrippletMassLower = 500,
147 TrkQuadrupletPt = 2000,
148 JpsiContainerKey = "BPHY22DiTrkCandidates",
149 TrackParticleCollection = "InDetTrackParticles",
150 MuonsUsedInJpsi = "NONE", # ?
151 ExcludeCrossJpsiTracks = False,
152 TrkVertexFitterTool = vkalvrt,
153 TrackSelectorTool = trackselect,
154 UseMassConstraint = False,
155 Chi2Cut = 7) #Cut on chi2/Ndeg_of_freedom 5->7
156
157 BPHY22Dh3SelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
158 name = "BPHY22Dh3SelectAndWrite",
159 VertexSearchTool = BPHY22Dh3Finder,
160 V0Tools = V0Tools,
161 PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
162 OutputVtxContainerName = "BPHY22Dh3Candidates",
163 PVContainerName = "PrimaryVertices",
164 RefPVContainerName = "SHOULDNOTBEUSED",
165 MaxPVrefit = 1000)
166
167 BMuDxVertexFit = acc.popToolsAndMerge(BPHY_TrkVKalVrtFitterCfg(flags, BPHYDerivationName+"BMuDxVertexFit", CascadeCnstPrecision = 1e-6))
168
169 BPHY22MuDs = CompFactory.DerivationFramework.MuPlusDsCascade(
170 name = "BPHY22MuDs",
171 HypothesisName = "B",
172 TrkVertexFitterTool = BMuDxVertexFit,
173 V0Tools = V0Tools,
174 PVRefitter = PVrefit,
175 DxHypothesis = 431,
176 ApplyDxMassConstraint = False,
177 DxMassLowerCut = 1968.28 - 300.,
178 DxMassUpperCut = 1968.28 + 200.,
179 MassLowerCut = 1000,
180 MassUpperCut = 12500,
181 Chi2Cut = 10,
182 RefitPV = True,
183 combOnly = True,
184 TrackSelectorTool = trackselect,
185 useMCPCuts = False,
186 muonThresholdPt = 2700,
187 muonCollectionKey = "Muons",
188 useCombinedMeasurement = False, # Only takes effect if combOnly=True
189 RefPVContainerName = "BPHY22RefittedPrimaryVertices",
190 CascadeVertexCollections = ["BMuDsCascadeSV2", "BMuDsCascadeSV1"],
191 DxVertices = "BPHY22Dh3Candidates")
192
193 BPHY22MuDp = CompFactory.DerivationFramework.MuPlusDsCascade(
194 name = "BPHY22MuDp",
195 HypothesisName = "B",
196 TrkVertexFitterTool = BMuDxVertexFit,
197 V0Tools = V0Tools,
198 PVRefitter = PVrefit,
199 DxHypothesis = 411,
200 ApplyDxMassConstraint = False,
201 DxMassLowerCut = 1869.59 - 180.,
202 DxMassUpperCut = 1869.59 + 250.,
203 MassLowerCut = 1000,
204 MassUpperCut = 12500,
205 Chi2Cut = 10,
206 RefitPV = True,
207 combOnly = True,
208 TrackSelectorTool = trackselect,
209 useMCPCuts = False,
210 muonThresholdPt = 2700,
211 muonCollectionKey = "Muons",
212 useCombinedMeasurement = False, # Only takes effect if combOnly=True
213 RefPVContainerName = "BPHY22RefittedPrimaryVertices",
214 CascadeVertexCollections = ["BMuDpCascadeSV2", "BMuDpCascadeSV1"],
215 DxVertices = "BPHY22Dh3Candidates")
216
217 BPHY22MuLambdaC = CompFactory.DerivationFramework.MuPlusDsCascade(
218 name = "BPHY22MuLambdaC",
219 HypothesisName = "B",
220 TrkVertexFitterTool = BMuDxVertexFit,
221 V0Tools = V0Tools,
222 PVRefitter = PVrefit,
223 DxHypothesis = 4122,
224 ApplyDxMassConstraint = False,
225 DxMassLowerCut = 2286.46 - 200,
226 DxMassUpperCut = 2286.46 + 220,
227 MassLowerCut = 1000,
228 MassUpperCut = 12500,
229 Chi2Cut = 10,
230 RefitPV = True,
231 combOnly = True,
232 TrackSelectorTool = trackselect,
233 useMCPCuts = False,
234 muonThresholdPt = 2700,
235 muonCollectionKey = "Muons",
236 useCombinedMeasurement = False, # Only takes effect if combOnly=True
237 RefPVContainerName = "BPHY22RefittedPrimaryVertices",
238 CascadeVertexCollections = ["BMuLambdaCCascadeSV2", "BMuLambdaCCascadeSV1"],
239 DxVertices = "BPHY22Dh3Candidates")
240
241 CascadeCollections = []
242 CascadeCollections += BPHY22MuDpst.CascadeVertexCollections
243 CascadeCollections += BPHY22MuDp.CascadeVertexCollections
244 CascadeCollections += BPHY22MuDs.CascadeVertexCollections
245 CascadeCollections += BPHY22MuLambdaC.CascadeVertexCollections
246
247 BPHY22_AugOriginalCounts = acc.popToolsAndMerge(
248 AugOriginalCountsCfg(flags, name = "BPHY22_AugOriginalCounts"))
249
250 if not isSimulation: #Only Skim Data
251 BPHY22_SelectBMuDxEvent = CompFactory.DerivationFramework.AnyVertexSkimmingTool("BPHY22_AnyVertexSkimmingTool",
252 VertexContainerNames =CascadeCollections,
253 UseHandles = True )
254 acc.addPublicTool(BPHY22_SelectBMuDxEvent)
255
256 #====================================================================
257 # Make event selection based on an OR of the input skimming tools
258 #====================================================================
259
260 BPHY22SkimmingOR = CompFactory.DerivationFramework.FilterCombinationOR(
261 "BPHY22SkimmingOR",
262 FilterList = [BPHY22_SelectBMuDxEvent] )
263 acc.addPublicTool(BPHY22SkimmingOR)
264
265 augTools = [BPHY22MuPiSelectAndWrite, #BPHY22_Select_MuPi,
266 BPHY22DiTrkSelectAndWrite, #BPHY22_Select_D0, BPHY22_Select_D0b,
267 BPHY22Dh3SelectAndWrite, #BPHY22_Select_Ds, BPHY22_Select_Dp, BPHY22_Select_Dm, BPHY22_Select_LambdaCp, BPHY22_Select_LambdaCm,
268 BPHY22MuDpst,
269 BPHY22MuDs,
270 BPHY22MuDp,
271 BPHY22MuLambdaC,
272 BPHY22_AugOriginalCounts]
273 for t in augTools : acc.addPublicTool(t)
274 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel("BPHY22Kernel",
275 AugmentationTools = augTools,
276 #Only skim if not MC
277 SkimmingTools = [BPHY22SkimmingOR] if not isSimulation else [],
278 ThinningTools = []))
279
280 from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
281 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
282 from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
283 BPHY22SlimmingHelper = SlimmingHelper("BPHY22SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
284
285 # Needed for trigger objects
286 BPHY22SlimmingHelper.IncludeMuonTriggerContent = True
287 BPHY22SlimmingHelper.IncludeBPhysTriggerContent = True
288 from DerivationFrameworkBPhys.commonBPHYMethodsCfg import getDefaultAllVariables
289 AllVariables = getDefaultAllVariables()
290 StaticContent = []
291
292 AllVariables += ["PrimaryVertices"]
293 StaticContent += ["xAOD::VertexContainer#BPHY22RefittedPrimaryVertices"]
294 StaticContent += ["xAOD::VertexAuxContainer#BPHY22RefittedPrimaryVerticesAux."]
295
296
297 AllVariables += ["InDetTrackParticles"]
298
299
302 AllVariables += ["CombinedMuonTrackParticles"]
303 AllVariables += ["ExtrapolatedMuonTrackParticles"]
304
305
306 AllVariables += ["Muons"]
307
308
309 StaticContent += ["xAOD::VertexContainer#%s" % BPHY22MuPiSelectAndWrite.OutputVtxContainerName]
310
311 StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY22MuPiSelectAndWrite.OutputVtxContainerName]
312
313
314 for cascades in CascadeCollections:
315 StaticContent += ["xAOD::VertexContainer#%s" % cascades]
316 StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % cascades]
317
318 # Tagging information (in addition to that already requested by usual algorithms)
319 AllVariables += ["MuonSpectrometerTrackParticles" ]
320
321 # Truth information for MC only
322 if isSimulation:
323 AllVariables += ["TruthEvents","TruthParticles","TruthVertices","MuonTruthParticles"]
324
325 AllVariables = list(set(AllVariables)) # remove duplicates
326 BPHY22SlimmingHelper.AllVariables = AllVariables
327 BPHY22SlimmingHelper.StaticContent = StaticContent
328 BPHY22ItemList = BPHY22SlimmingHelper.GetItemList()
329 acc.merge(OutputStreamCfg(flags, "DAOD_BPHY22", ItemList=BPHY22ItemList, AcceptAlgs=["BPHY22Kernel"]))
330 acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_BPHY22", AcceptAlgs=["BPHY22Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
331 acc.printConfig(withDetails=True, summariseProps=True, onlyComponents = [], printDefaults=True)
332 return acc
STL class.
BPHY22Cfg(flags)
Definition BPHY22.py:15