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