7 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
8 from AthenaConfiguration.ComponentFactory
import CompFactory
9 from AthenaConfiguration.Enums
import MetadataCategory
12 BPHYDerivationName =
"BPHY28"
13 streamName =
"StreamDAOD_BPHY28"
15 MuMuContainerName =
"BPHY28MuMuCandidates"
16 BsPhiMuMuContainerName =
"BPHY28BsKKMuMuCandidates"
28 from DerivationFrameworkBPhys.commonBPHYMethodsCfg
import (BPHY_V0ToolCfg, BPHY_InDetDetailedTrackSelectorToolCfg, BPHY_VertexPointEstimatorCfg, BPHY_TrkVKalVrtFitterCfg)
29 from JpsiUpsilonTools.JpsiUpsilonToolsConfig
import PrimaryVertexRefittingToolCfg
31 isSimulation = flags.Input.isMC
32 V0Tools = acc.popToolsAndMerge(
BPHY_V0ToolCfg(flags, BPHYDerivationName))
34 acc.addPublicTool(vkalvrt)
35 acc.addPublicTool(V0Tools)
37 acc.addPublicTool(trackselect)
39 acc.addPublicTool(vpest)
41 acc.addPublicTool(PVrefit)
44 doLRT = flags.Tracking.doLargeD0
45 if not doLRT :
print(
"BPHY28: LRT tracks disabled")
46 mainMuonInput =
"StdWithLRTMuons" if doLRT
else "Muons"
47 mainIDInput =
"InDetWithLRTTrackParticles" if doLRT
else "InDetTrackParticles"
49 from DerivationFrameworkLLP.LLPToolsConfig
import LRTMuonMergerAlg
50 from AthenaConfiguration.Enums
import LHCPeriod
52 PromptMuonLocation =
"Muons",
53 LRTMuonLocation =
"MuonsLRT",
54 OutputMuonLocation = mainMuonInput,
55 CreateViewCollection =
True,
56 UseRun3WP = flags.GeoModel.Run == LHCPeriod.Run3))
57 from DerivationFrameworkInDet.InDetToolsConfig
import InDetLRTMergeCfg
59 toRelink = [
"InDetTrackParticles",
"InDetLargeD0TrackParticles"]
if doLRT
else []
60 MuonReLink = [
"Muons",
"MuonsLRT" ]
if doLRT
else []
63 BPHY28_AugOriginalCounts = CompFactory.DerivationFramework.AugOriginalCounts(
64 name =
"BPHY28_AugOriginalCounts",
65 VertexContainer =
"PrimaryVertices",
66 TrackContainer =
"InDetTrackParticles",
67 TrackLRTContainer =
"InDetLargeD0TrackParticles" if doLRT
else "")
68 augList += [ BPHY28_AugOriginalCounts ]
70 BPHY28MuMuFinder = CompFactory.Analysis.JpsiFinder(
71 name =
"BPHY28MuMuFinder",
74 TrackAndTrack =
False,
76 invMassUpper = 100000.0,
79 oppChargesOnly =
True,
81 atLeastOneComb =
False,
82 useCombinedMeasurement =
False,
83 muonCollectionKey = mainMuonInput,
84 TrackParticleCollection = mainIDInput,
86 TrkVertexFitterTool = vkalvrt,
87 V0VertexFitterTool =
None,
88 TrackSelectorTool = trackselect,
89 VertexPointEstimator = vpest,
92 BPHY28MuMuSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(name =
"BPHY28MuMuSelectAndWrite",
93 VertexSearchTool = BPHY28MuMuFinder,
94 OutputVtxContainerName = MuMuContainerName,
95 PVContainerName =
"PrimaryVertices",
98 RefPVContainerName =
"SHOULDNOTBEUSED",
99 RelinkTracks = toRelink,
100 RelinkMuons = MuonReLink,
102 augList += [ BPHY28MuMuSelectAndWrite ]
103 thinTrkVtxList += [ MuMuContainerName ]
106 BPHY28_Select_Jpsi2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
107 name =
"BPHY28_Select_Jpsi2mumu",
108 HypothesisName =
"Jpsi",
109 InputVtxContainerName = MuMuContainerName,
111 VtxMassHypo = 3096.916,
114 Chi2Max = 200, Do3d =
False,
116 augList += [ BPHY28_Select_Jpsi2mumu ]
119 BPHY28BsKKMuMu = CompFactory.Analysis.JpsiPlus2Tracks(name =
"BPHY28BsKKMuMu",
120 kaonkaonHypothesis =
True,
121 pionpionHypothesis =
False,
122 kaonpionHypothesis =
False,
123 trkThresholdPt = 500.0,
127 DiTrackMassUpper = 1220,
128 DiTrackMassLower = 820,
130 TrkQuadrupletMassUpper = 6000.0,
131 TrkQuadrupletMassLower = 4800.0,
132 JpsiContainerKey = MuMuContainerName,
133 TrackParticleCollection = mainIDInput,
134 MuonsUsedInJpsi = mainMuonInput,
135 TrkVertexFitterTool = vkalvrt,
136 TrackSelectorTool = trackselect,
137 UseMassConstraint =
False)
140 BPHY28BsKKSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(name =
"BPHY28BsKKSelectAndWrite",
141 VertexSearchTool = BPHY28BsKKMuMu,
142 OutputVtxContainerName = BsPhiMuMuContainerName,
143 PVContainerName =
"PrimaryVertices",
145 PVRefitter = PVrefit,
146 RefPVContainerName =
"BPHY28RefittedPrimaryVertices",
147 RefitPV =
True, Do3d =
False,
148 RelinkTracks = toRelink,
149 MaxPVrefit = 10000, DoVertexType = 7)
150 augList += [ BPHY28BsKKSelectAndWrite ]
151 thinTrkVtxList += [ BsPhiMuMuContainerName ]
154 BPHY28_Select_Bs2KKMuMu = CompFactory.DerivationFramework.Select_onia2mumu(
155 name =
"BPHY28_Select_Bs2KKMuMu",
156 HypothesisName =
"Bs",
157 InputVtxContainerName = BsPhiMuMuContainerName,
159 TrkMasses = [105.658, 105.658, 493.677, 493.677],
160 VtxMassHypo = 5366.3,
162 MassMax = 5900.0, Do3d =
False,
164 augList += [ BPHY28_Select_Bs2KKMuMu ]
168 BPHY28_SelectBsKKMuMuEvent = CompFactory.DerivationFramework.xAODStringSkimmingTool(
169 name =
"BPHY28_SelectBsKKMuMuEvent",
170 expression =
"count(BPHY28BsKKMuMuCandidates.passed_Bs) > 0")
172 skimList += [ BPHY28_SelectBsKKMuMuEvent ]
177 BPHY28_Thin_VtxTracks = CompFactory.DerivationFramework.Thin_vtxTrk( name =
"BPHY28_Thin_VtxTracks",
178 StreamName = streamName,
179 TrackParticleContainerName =
"InDetTrackParticles",
180 VertexContainerNames = thinTrkVtxList,
182 thinList += [ BPHY28_Thin_VtxTracks ]
186 BPHY28_Thin_VtxTracks_LRT = CompFactory.DerivationFramework.Thin_vtxTrk( name =
"BPHY28_Thin_VtxTracks_LRT",
187 StreamName = streamName,
188 TrackParticleContainerName =
"InDetLargeD0TrackParticles",
189 VertexContainerNames = thinTrkVtxList,
191 thinList += [ BPHY28_Thin_VtxTracks_LRT ]
194 for t
in augList + skimList + thinList : acc.addPublicTool(t)
195 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel(
"BPHY28Kernel",
196 AugmentationTools = augList,
198 SkimmingTools = skimList,
199 ThinningTools = thinList))
205 doLRT = flags.Tracking.doLargeD0
206 isSimulation = flags.Input.isMC
208 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
209 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
210 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
211 BPHY28SlimmingHelper =
SlimmingHelper(
"BPHY28SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
212 from DerivationFrameworkBPhys.commonBPHYMethodsCfg
import getDefaultAllVariables
217 BPHY28SlimmingHelper.IncludeMuonTriggerContent =
True
218 BPHY28SlimmingHelper.IncludeBPhysTriggerContent =
True
221 AllVariables += [
"PrimaryVertices"]
222 StaticContent += [
"xAOD::VertexContainer#BPHY28RefittedPrimaryVertices"]
223 StaticContent += [
"xAOD::VertexAuxContainer#BPHY28RefittedPrimaryVerticesAux."]
227 AllVariables += [
"InDetTrackParticles",
"InDetLargeD0TrackParticles"]
if doLRT
else [
"InDetTrackParticles"]
232 AllVariables += [
"CombinedMuonTrackParticles"]
233 AllVariables += [
"ExtrapolatedMuonTrackParticles"]
236 AllVariables += [
"Muons",
"MuonsLRT"]
if doLRT
else [
"Muons"]
240 StaticContent += [
"xAOD::VertexContainer#%s" % MuMuContainerName]
242 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % MuMuContainerName]
244 StaticContent += [
"xAOD::VertexContainer#%s" % BsPhiMuMuContainerName]
245 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BsPhiMuMuContainerName]
249 AllVariables += [
"MuonSpectrometerTrackParticles" ]
250 SmartVar = [
"Photons",
"Electrons",
"LRTElectrons"]
if doLRT
else [
"Photons",
"Electrons"]
255 AllVariables += [
"TruthEvents",
"TruthParticles",
"TruthVertices",
"MuonTruthParticles",
"egammaTruthParticles" ]
258 AllVariables =
list(
set(AllVariables))
260 BPHY28SlimmingHelper.AllVariables = AllVariables
261 BPHY28SlimmingHelper.StaticContent = StaticContent
262 BPHY28SlimmingHelper.SmartCollections = SmartVar
263 BPHY28ItemList = BPHY28SlimmingHelper.GetItemList()
264 acc.merge(
OutputStreamCfg(flags,
"DAOD_BPHY28", ItemList=BPHY28ItemList, AcceptAlgs=[
"BPHY28Kernel"]))
265 acc.merge(
SetupMetaDataForStreamCfg(flags,
"DAOD_BPHY28", AcceptAlgs=[
"BPHY28Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
266 acc.printConfig(withDetails=
True, summariseProps=
True, onlyComponents = [], printDefaults=
True, printComponentsOnly=
False)