16 from DerivationFrameworkBPhys.commonBPHYMethodsCfg
import (
17 BPHY_V0ToolCfg, BPHY_InDetDetailedTrackSelectorToolCfg,
18 BPHY_VertexPointEstimatorCfg, BPHY_TrkVKalVrtFitterCfg,
20 from JpsiUpsilonTools.JpsiUpsilonToolsConfig
import PrimaryVertexRefittingToolCfg
21 acc = ComponentAccumulator()
22 isSimulation = flags.Input.isMC
23 doLRT = flags.Tracking.doLargeD0
24 if not doLRT :
print(
"BPHY14: LRT tracks disabled")
25 mainMuonInput =
"StdWithLRTMuons" if doLRT
else "Muons"
26 mainIDInput =
"InDetWithLRTTrackParticles" if doLRT
else "InDetTrackParticles"
28 from DerivationFrameworkLLP.LLPToolsConfig
import LRTMuonMergerAlg
29 from AthenaConfiguration.Enums
import LHCPeriod
30 acc.merge(LRTMuonMergerAlg( flags,
31 PromptMuonLocation =
"Muons",
32 LRTMuonLocation =
"MuonsLRT",
33 OutputMuonLocation = mainMuonInput,
34 CreateViewCollection =
True,
35 UseRun3WP = flags.GeoModel.Run == LHCPeriod.Run3))
36 from DerivationFrameworkInDet.InDetToolsConfig
import InDetLRTMergeCfg
37 acc.merge(InDetLRTMergeCfg(flags))
39 toRelink = [
"InDetTrackParticles",
"InDetLargeD0TrackParticles"]
if doLRT
else []
40 MuonReLink = [
"Muons",
"MuonsLRT" ]
if doLRT
else []
42 V0Tools = acc.popToolsAndMerge(BPHY_V0ToolCfg(flags, BPHYDerivationName))
43 vkalvrt = acc.popToolsAndMerge(BPHY_TrkVKalVrtFitterCfg(flags, BPHYDerivationName))
44 acc.addPublicTool(vkalvrt)
45 acc.addPublicTool(V0Tools)
46 trackselect = acc.popToolsAndMerge(BPHY_InDetDetailedTrackSelectorToolCfg(flags, BPHYDerivationName))
47 acc.addPublicTool(trackselect)
48 vpest = acc.popToolsAndMerge(BPHY_VertexPointEstimatorCfg(flags, BPHYDerivationName))
49 acc.addPublicTool(vpest)
50 BPHY14JpsiFinder = CompFactory.Analysis.JpsiFinder(
51 name =
"BPHY14JpsiFinder",
54 TrackAndTrack =
False,
56 invMassUpper = 15000.0,
59 muonThresholdPt = 2500.,
60 oppChargesOnly =
True,
61 atLeastOneComb =
False,
63 useCombinedMeasurement =
False,
64 muonCollectionKey =
"Muons",
65 TrackParticleCollection = mainIDInput,
67 TrkVertexFitterTool = vkalvrt,
68 V0VertexFitterTool =
None,
69 TrackSelectorTool = trackselect,
70 VertexPointEstimator = vpest,
73 acc.addPublicTool(BPHY14JpsiFinder )
75 BPHY14_Reco_mumu = CompFactory.DerivationFramework.Reco_Vertex(
76 name =
"BPHY14_Reco_mumu",
77 VertexSearchTool = BPHY14JpsiFinder,
78 OutputVtxContainerName =
"BPHY14OniaCandidates",
79 PVContainerName =
"PrimaryVertices",
81 PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
82 RelinkTracks = toRelink,
83 RelinkMuons = MuonReLink,
84 RefPVContainerName =
"BPHY14RefittedPrimaryVertices",
89 BPHY14_AugOriginalCounts = acc.popToolsAndMerge(AugOriginalCountsCfg(flags, name =
"BPHY14_AugOriginalCounts"))
91 BPHY14_Select_Jpsi2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
92 name =
"BPHY14_Select_Jpsi2mumu",
93 HypothesisName =
"Jpsi",
94 InputVtxContainerName =
"BPHY14OniaCandidates",
96 VtxMassHypo = 3096.916,
102 BPHY14_Select_Psi2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
103 name =
"BPHY14_Select_Psi2mumu",
104 HypothesisName =
"Psi",
106 InputVtxContainerName =
"BPHY14OniaCandidates",
107 VtxMassHypo = 3686.09,
113 BPHY14_Select_Upsi2mumu = CompFactory.DerivationFramework.Select_onia2mumu(
114 name =
"BPHY14_Select_Upsi2mumu",
115 HypothesisName =
"Upsi",
116 InputVtxContainerName =
"BPHY14OniaCandidates",
118 VtxMassHypo = 9460.30,
124 acc.merge(EGammaCommonCfg(flags))
125 photonRequirements =
'Photons.Tight'
126 expression =
"(count(BPHY14OniaCandidates.passed_Jpsi) > 0 || count(BPHY14OniaCandidates.passed_Psi) > 0 || count(BPHY14OniaCandidates.passed_Upsi) > 0) && count("+photonRequirements+
") >0"
127 from DerivationFrameworkTools.DerivationFrameworkToolsConfig
import xAODStringSkimmingToolCfg
128 BPHY14_SelectEvent = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(flags, name =
"BPHY14_SelectEvent",
129 expression = expression))
131 BPHY14ThinningTools = []
132 BPHY14Thin_vtxTrk = CompFactory.DerivationFramework.Thin_vtxTrk(
133 name =
"BPHY14Thin_vtxTrk",
134 StreamName = streamName,
135 TrackParticleContainerName = mainIDInput,
136 VertexContainerNames = [
"BPHY14OniaCandidates"],
137 PassFlags = [
"passed_Jpsi",
"passed_Psi",
"passed_Upsi"] )
139 BPHY14MuonTPThinningTool = CompFactory.DerivationFramework.MuonTrackParticleThinning(name =
"BPHY14MuonTPThinningTool",
140 StreamName = streamName,
142 InDetTrackParticlesKey = mainIDInput)
143 BPHY14ThinningTools.append(BPHY14MuonTPThinningTool)
145 BPHY14PhotonTPThinningTool = CompFactory.DerivationFramework.EgammaTrackParticleThinning(name =
"BPHY14PhotonTPThinningTool",
146 StreamName = streamName,
148 GSFTrackParticlesKey =
"GSFTrackParticles",
149 GSFConversionVerticesKey=
"GSFConversionVertices",
150 InDetTrackParticlesKey = mainIDInput,
151 SelectionString = photonRequirements,
152 BestMatchOnly =
False,
156 BPHY14ThinningTools.append(BPHY14PhotonTPThinningTool)
157 BPHY14TruthThinTool = CompFactory.DerivationFramework.GenericTruthThinning(name =
"BPHY14TruthThinTool",
158 StreamName = streamName,
159 ParticleSelectionString =
"TruthParticles.pdgId == 22 || TruthParticles.pdgId == 443 || TruthParticles.pdgId == 100443 || TruthParticles.pdgId == 553 || TruthParticles.pdgId == 100553 || TruthParticles.pdgId == 200553",
160 PreserveDescendants =
True,
161 PreserveAncestors =
True)
163 BPHY14ThinningTools.append(BPHY14TruthThinTool)
165 BPHY14ThinningTools += [BPHY14PhotonTPThinningTool, BPHY14MuonTPThinningTool, BPHY14Thin_vtxTrk]
166 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
167 BPHY14SlimTools = [ BPHY14_SelectEvent ]
168 BPHY14AugTools = [BPHY14_Reco_mumu, BPHY14_AugOriginalCounts, BPHY14_Select_Jpsi2mumu, BPHY14_Select_Jpsi2mumu,
169 BPHY14_Select_Psi2mumu, BPHY14_Select_Upsi2mumu]
170 for t
in BPHY14ThinningTools + BPHY14SlimTools + BPHY14AugTools: acc.addPublicTool(t)
171 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel(
"BPHY14Kernel",
172 AugmentationTools= BPHY14AugTools, SkimmingTools = BPHY14SlimTools, ThinningTools = BPHY14ThinningTools ))
173 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
174 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
175 BPHY14SlimmingHelper =
SlimmingHelper(
"BPHY14SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
176 BPHY14SlimmingHelper.SmartCollections = []
179 BPHY14SlimmingHelper.IncludeMuonTriggerContent =
True
180 BPHY14SlimmingHelper.IncludeBPhysTriggerContent =
True
181 BPHY14SlimmingHelper.IncludeEGammaTriggerContent =
True
184 BPHY14_SmartCollections = [
"PrimaryVertices"]
185 BPHY14_StaticContent = [
"xAOD::VertexContainer#BPHY14RefittedPrimaryVertices"]
186 BPHY14_StaticContent += [
"xAOD::VertexAuxContainer#BPHY14RefittedPrimaryVerticesAux."]
190 BPHY14_ExtraVariables = []
198 from DerivationFrameworkBPhys.commonBPHYMethodsCfg
import getDefaultAllVariables
199 BPHY14_AllVariables = getDefaultAllVariables()
200 BPHY14_AllVariables += [
"CombinedMuonTrackParticles"]
201 BPHY14_AllVariables += [
"ExtrapolatedMuonTrackParticles"]
204 BPHY14_AllVariables += [
"Muons"]
206 BPHY14_ExtraVariables += [
"%s.etcone30.etcone40" %
"Muons"
207 +
".momentumBalanceSignificance"
208 +
".scatteringCurvatureSignificance"
209 +
".scatteringNeighbourSignificance"
210 +
".msInnerMatchDOF.msInnerMatchChi2"
211 +
".msOuterMatchDOF.msOuterMatchChi2"
212 +
".EnergyLoss.ParamEnergyLoss.MeasEnergyLoss"
217 BPHY14_StaticContent += [
"xAOD::VertexContainer#%s" % BPHY14_Reco_mumu.OutputVtxContainerName]
218 BPHY14_StaticContent += [
"xAOD::VertexAuxContainer#%sAux" % BPHY14_Reco_mumu.OutputVtxContainerName]
220 BPHY14_StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY14_Reco_mumu.OutputVtxContainerName]
224 BPHY14_StaticContent += [
"xAOD::TruthParticleContainer#TruthMuons",
"xAOD::TruthParticleAuxContainer#TruthMuonsAux."]
225 BPHY14_StaticContent += [
"xAOD::TruthParticleContainer#TruthPhotons",
"xAOD::TruthParticleAuxContainer#TruthPhotonsAux."]
226 BPHY14_AllVariables += [
"TruthEvents",
"TruthParticles",
"TruthVertices",
"MuonTruthParticles"]
228 BPHY14_AllVariables += [
"Photons"]
230 BPHY14_SmartCollections += [
"InDetTrackParticles"]
231 BPHY14_ExtraVariables += [
"%s.vx.vy.vz" %
"InDetTrackParticles"]
233 BPHY14_AllVariables = list(
set(BPHY14_AllVariables))
235 BPHY14SlimmingHelper.AllVariables = BPHY14_AllVariables
236 BPHY14SlimmingHelper.StaticContent = BPHY14_StaticContent
237 BPHY14SlimmingHelper.SmartCollections = BPHY14_SmartCollections
238 BPHY14SlimmingHelper.ExtraVariables = BPHY14_ExtraVariables
239 BPHY14ItemList = BPHY14SlimmingHelper.GetItemList()
240 acc.merge(OutputStreamCfg(flags,
"DAOD_BPHY14", ItemList=BPHY14ItemList, AcceptAlgs=[
"BPHY14Kernel"]))
241 acc.merge(SetupMetaDataForStreamCfg(flags,
"DAOD_BPHY14", AcceptAlgs=[
"BPHY14Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
242 acc.printConfig(withDetails=
True, summariseProps=
True, onlyComponents = [], printDefaults=
True)