17 from DerivationFrameworkBPhys.commonBPHYMethodsCfg
import (
18 BPHY_V0ToolCfg, BPHY_InDetDetailedTrackSelectorToolCfg,
19 BPHY_VertexPointEstimatorCfg, BPHY_TrkVKalVrtFitterCfg,
21 acc = ComponentAccumulator()
23 BPHY1_AugOriginalCounts = acc.popToolsAndMerge(
24 AugOriginalCountsCfg(flags, name =
"BPHY1_AugOriginalCounts"))
26 doLRT = flags.Tracking.doLargeD0
27 mainMuonInput =
"StdWithLRTMuons" if doLRT
else "Muons"
28 mainIDInput =
"InDetWithLRTTrackParticles" if doLRT
else "InDetTrackParticles"
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))
41 toRelink = [
"InDetTrackParticles",
"InDetLargeD0TrackParticles"]
if doLRT
else []
42 MuonReLink = [
"Muons",
"MuonsLRT" ]
if doLRT
else []
44 V0Tools = acc.popToolsAndMerge(BPHY_V0ToolCfg(flags, BPHYDerivationName))
45 vkalvrt = acc.popToolsAndMerge(BPHY_TrkVKalVrtFitterCfg(flags, BPHYDerivationName))
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",
56 TrackAndTrack =
False,
58 invMassUpper = 100000.0,
61 oppChargesOnly =
True,
62 atLeastOneComb =
True,
63 useCombinedMeasurement =
False,
64 muonCollectionKey = mainMuonInput,
65 TrackParticleCollection = mainIDInput,
67 TrkVertexFitterTool = vkalvrt,
68 V0VertexFitterTool =
None,
69 TrackSelectorTool = TrackSelector,
70 VertexPointEstimator = vpest,
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",
83 RelinkTracks = toRelink,
84 RelinkMuons = MuonReLink,
85 PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
88 BPHY1_Select_Jpsi2mumu =CompFactory.DerivationFramework.Select_onia2mumu(
89 name =
"BPHY1_Select_Jpsi2mumu",
90 HypothesisName =
"Jpsi",
91 InputVtxContainerName =
"BPHY1OniaCandidates",
93 VtxMassHypo = 3096.916,
98 BPHY1_Select_Psi2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
99 name =
"BPHY1_Select_Psi2mumu",
100 HypothesisName =
"Psi",
101 InputVtxContainerName =
"BPHY1OniaCandidates",
103 VtxMassHypo = 3686.09,
108 BPHY1_Select_Upsi2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
109 name =
"BPHY1_Select_Upsi2mumu",
110 HypothesisName =
"Upsi",
111 InputVtxContainerName =
"BPHY1OniaCandidates",
113 VtxMassHypo = 9460.30,
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)
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",
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)
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)
156 doLRT = flags.Tracking.doLargeD0
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()
167 AllVariables += [
"PrimaryVertices"]
168 StaticContent += [
"xAOD::VertexContainer#BPHY1RefittedPrimaryVertices"]
169 StaticContent += [
"xAOD::VertexAuxContainer#BPHY1RefittedPrimaryVerticesAux."]
172 AllVariables += [
"InDetTrackParticles",
"InDetLargeD0TrackParticles"]
if doLRT
else [
"InDetTrackParticles"]
177 AllVariables += [
"CombinedMuonTrackParticles"]
178 AllVariables += [
"ExtrapolatedMuonTrackParticles"]
181 AllVariables += [
"Muons",
"MuonsLRT"]
if doLRT
else [
"Muons"]
184 StaticContent += [
"xAOD::VertexContainer#%s" % OniaContainerName]
186 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % OniaContainerName]
189 if flags.Input.isMC :
190 AllVariables += [
"TruthEvents",
"TruthParticles",
"TruthVertices",
"MuonTruthParticles"]
192 BPHY1SlimmingHelper =
SlimmingHelper(
"BPHY1SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
194 BPHY1SlimmingHelper.IncludeMuonTriggerContent =
True
195 BPHY1SlimmingHelper.IncludeBPhysTriggerContent =
True
197 BPHY1SlimmingHelper.AllVariables = AllVariables
198 BPHY1SlimmingHelper.StaticContent = StaticContent
199 BPHY1ItemList = BPHY1SlimmingHelper.GetItemList()
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)