ATLAS Offline Software
Loading...
Searching...
No Matches
BPHY1.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3#====================================================================
4# BPHY1.py
5#====================================================================
6
7from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8from AthenaConfiguration.ComponentFactory import CompFactory
9from AthenaConfiguration.Enums import MetadataCategory
10
11BPHYDerivationName = "BPHY1"
12streamName = "StreamDAOD_BPHY1"
13
14OniaContainerName = "BPHY1OniaCandidates"
15
16def BPHY1Kernel(flags):
17 from DerivationFrameworkBPhys.commonBPHYMethodsCfg import (
18 BPHY_V0ToolCfg, BPHY_InDetDetailedTrackSelectorToolCfg,
19 BPHY_VertexPointEstimatorCfg, BPHY_TrkVKalVrtFitterCfg,
20 AugOriginalCountsCfg)
21 acc = ComponentAccumulator()
22
23 BPHY1_AugOriginalCounts = acc.popToolsAndMerge(
24 AugOriginalCountsCfg(flags, name = "BPHY1_AugOriginalCounts"))
25
26 doLRT = flags.Tracking.doLargeD0
27 mainMuonInput = "StdWithLRTMuons" if doLRT else "Muons"
28 mainIDInput = "InDetWithLRTTrackParticles" if doLRT else "InDetTrackParticles"
29 if doLRT:
30 from DerivationFrameworkLLP.LLPToolsConfig import LRTMuonMergerAlg
31 from AthenaConfiguration.Enums import LHCPeriod
32 acc.merge(LRTMuonMergerAlg( flags,
33 PromptMuonLocation = "Muons",
34 LRTMuonLocation = "MuonsLRT",
35 OutputMuonLocation = mainMuonInput,
36 CreateViewCollection = True,
37 UseRun3WP = flags.GeoModel.Run == LHCPeriod.Run3))
38 from DerivationFrameworkInDet.InDetToolsConfig import InDetLRTMergeCfg
39 acc.merge(InDetLRTMergeCfg(flags))
40
41 toRelink = ["InDetTrackParticles", "InDetLargeD0TrackParticles"] if doLRT else []
42 MuonReLink = [ "Muons", "MuonsLRT" ] if doLRT else []
43
44 V0Tools = acc.popToolsAndMerge(BPHY_V0ToolCfg(flags, BPHYDerivationName))
45 vkalvrt = acc.popToolsAndMerge(BPHY_TrkVKalVrtFitterCfg(flags, BPHYDerivationName)) # VKalVrt vertex fitter
46 acc.addPublicTool(vkalvrt)
47 acc.addPublicTool(V0Tools)
48 TrackSelector = acc.popToolsAndMerge(BPHY_InDetDetailedTrackSelectorToolCfg(flags, BPHYDerivationName))
49 acc.addPublicTool(TrackSelector)
50 vpest = acc.popToolsAndMerge(BPHY_VertexPointEstimatorCfg(flags, BPHYDerivationName))
51 acc.addPublicTool(vpest)
52 BPHY1JpsiFinder = CompFactory.Analysis.JpsiFinder(
53 name = "BPHY1JpsiFinder",
54 muAndMu = True,
55 muAndTrack = False,
56 TrackAndTrack = False,
57 assumeDiMuons = True, # If true, will assume dimu hypothesis and use PDG value for mu mass
58 invMassUpper = 100000.0,
59 invMassLower = 0.0,
60 Chi2Cut = 200.,
61 oppChargesOnly = True,
62 atLeastOneComb = True,
63 useCombinedMeasurement = False, # Only takes effect if combOnly=True
64 muonCollectionKey = mainMuonInput,
65 TrackParticleCollection = mainIDInput,
66 useV0Fitter = False, # if False a TrkVertexFitterTool will be used
67 TrkVertexFitterTool = vkalvrt,
68 V0VertexFitterTool = None,
69 TrackSelectorTool = TrackSelector,
70 VertexPointEstimator = vpest,
71 useMCPCuts = False )
72
73 from JpsiUpsilonTools.JpsiUpsilonToolsConfig import PrimaryVertexRefittingToolCfg
74 BPHY1_Reco_mumu = CompFactory.DerivationFramework.Reco_Vertex(
75 name = "BPHY1_Reco_mumu",
76 VertexSearchTool = BPHY1JpsiFinder,
77 OutputVtxContainerName = OniaContainerName,
78 PVContainerName = "PrimaryVertices",
79 RefPVContainerName = "BPHY1RefittedPrimaryVertices",
80 RefitPV = True,
81 MaxPVrefit = 100000,
82 V0Tools = V0Tools,
83 RelinkTracks = toRelink,
84 RelinkMuons = MuonReLink,
85 PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
86 DoVertexType = 7)
87
88 BPHY1_Select_Jpsi2mumu =CompFactory.DerivationFramework.Select_onia2mumu(
89 name = "BPHY1_Select_Jpsi2mumu",
90 HypothesisName = "Jpsi",
91 InputVtxContainerName = "BPHY1OniaCandidates",
92 V0Tools = V0Tools,
93 VtxMassHypo = 3096.916,
94 MassMin = 2000.0,
95 MassMax = 3600.0,
96 Chi2Max = 200,
97 DoVertexType = 7)
98 BPHY1_Select_Psi2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
99 name = "BPHY1_Select_Psi2mumu",
100 HypothesisName = "Psi",
101 InputVtxContainerName = "BPHY1OniaCandidates",
102 V0Tools = V0Tools,
103 VtxMassHypo = 3686.09,
104 MassMin = 3300.0,
105 MassMax = 4500.0,
106 Chi2Max = 200,
107 DoVertexType = 7)
108 BPHY1_Select_Upsi2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
109 name = "BPHY1_Select_Upsi2mumu",
110 HypothesisName = "Upsi",
111 InputVtxContainerName = "BPHY1OniaCandidates",
112 V0Tools = V0Tools,
113 VtxMassHypo = 9460.30,
114 MassMin = 7000.0,
115 MassMax = 12500.0,
116 Chi2Max = 200,
117 DoVertexType = 7)
118
119 augTools = [BPHY1_AugOriginalCounts, BPHY1_Reco_mumu,
120 BPHY1_Select_Jpsi2mumu, BPHY1_Select_Psi2mumu,
121 BPHY1_Select_Upsi2mumu]
122 for t in [BPHY1JpsiFinder] + augTools : acc.addPublicTool(t)
123
124 BPHY1Thin_vtxTrk = CompFactory.DerivationFramework.Thin_vtxTrk(
125 name = "BPHY1Thin_vtxTrk",
126 TrackParticleContainerName = "InDetTrackParticles",
127 StreamName = streamName,
128 VertexContainerNames = ["BPHY1OniaCandidates"],
129 PassFlags = ["passed_Jpsi", "passed_Psi", "passed_Upsi"] )
130 BPHY1MuonTPThinningTool = CompFactory.DerivationFramework.MuonTrackParticleThinning(name = "BPHY1MuonTPThinningTool",
131 MuonKey = "Muons",
132 StreamName = streamName,
133 InDetTrackParticlesKey = "InDetTrackParticles")
134 BPHY1ThinningTools = [BPHY1Thin_vtxTrk, BPHY1MuonTPThinningTool]
135 if flags.Input.isMC :
136 TruthSelection ="TruthParticles.pdgId == 443 || TruthParticles.pdgId == 100443 || TruthParticles.pdgId == 553 || TruthParticles.pdgId == 100553 || TruthParticles.pdgId == 200553"
137 BPHY1TruthThinTool = CompFactory.DerivationFramework.GenericTruthThinning(name = "BPHY1TruthThinTool",
138 StreamName = streamName,
139 ParticleSelectionString = TruthSelection,
140 PreserveDescendants = True,
141 PreserveAncestors = True)
142 BPHY1ThinningTools.append(BPHY1TruthThinTool)
143
144
145 SelectExpression = "count(BPHY1OniaCandidates.passed_Jpsi) > 0 || count(BPHY1OniaCandidates.passed_Psi) > 0 || count(BPHY1OniaCandidates.passed_Upsi) > 0"
146 BPHY1_SelectEvent = CompFactory.DerivationFramework.xAODStringSkimmingTool(name = "BPHY1_SelectEvent", expression = SelectExpression)
147 acc.addPublicTool(BPHY1_SelectEvent)
148 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel("BPHY1Kernel",
149 SkimmingTools = [BPHY1_SelectEvent],
150 ThinningTools = BPHY1ThinningTools,
151 AugmentationTools = augTools))
152 for tool in BPHY1ThinningTools : acc.addPublicTool(tool)
153 return acc
154
155def BPHY1Cfg(flags):
156 doLRT = flags.Tracking.doLargeD0
157 acc = BPHY1Kernel(flags)
158 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
159 from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
160 from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
161 from DerivationFrameworkBPhys.commonBPHYMethodsCfg import getDefaultAllVariables
162 AllVariables = getDefaultAllVariables()
163 StaticContent = []
164
165
166
167 AllVariables += ["PrimaryVertices"]
168 StaticContent += ["xAOD::VertexContainer#BPHY1RefittedPrimaryVertices"]
169 StaticContent += ["xAOD::VertexAuxContainer#BPHY1RefittedPrimaryVerticesAux."]
170
171
172 AllVariables += ["InDetTrackParticles", "InDetLargeD0TrackParticles"] if doLRT else ["InDetTrackParticles"]
173
174
177 AllVariables += ["CombinedMuonTrackParticles"]
178 AllVariables += ["ExtrapolatedMuonTrackParticles"]
179
180
181 AllVariables += ["Muons", "MuonsLRT"] if doLRT else ["Muons"]
182
183
184 StaticContent += ["xAOD::VertexContainer#%s" % OniaContainerName]
185
186 StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % OniaContainerName]
187
188 # Truth information for MC only
189 if flags.Input.isMC :
190 AllVariables += ["TruthEvents","TruthParticles","TruthVertices","MuonTruthParticles"]
191
192 BPHY1SlimmingHelper = SlimmingHelper("BPHY1SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
193 # Needed for trigger objects
194 BPHY1SlimmingHelper.IncludeMuonTriggerContent = True
195 BPHY1SlimmingHelper.IncludeBPhysTriggerContent = True
196
197 BPHY1SlimmingHelper.AllVariables = AllVariables
198 BPHY1SlimmingHelper.StaticContent = StaticContent
199 BPHY1ItemList = BPHY1SlimmingHelper.GetItemList()
200
201 acc.merge(OutputStreamCfg(flags, "DAOD_BPHY1", ItemList=BPHY1ItemList, AcceptAlgs=["BPHY1Kernel"]))
202 acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_BPHY1", AcceptAlgs=["BPHY1Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
203 acc.printConfig(withDetails=True, summariseProps=True, onlyComponents = [], printDefaults=True)
204 return acc
BPHY1Kernel(flags)
Definition BPHY1.py:16
BPHY1Cfg(flags)
Definition BPHY1.py:155