15 from DerivationFrameworkBPhys.commonBPHYMethodsCfg
import (BPHY_V0ToolCfg, BPHY_InDetDetailedTrackSelectorToolCfg, BPHY_VertexPointEstimatorCfg, BPHY_TrkVKalVrtFitterCfg)
16 from JpsiUpsilonTools.JpsiUpsilonToolsConfig
import PrimaryVertexRefittingToolCfg
17 from DerivationFrameworkEGamma.EGammaCommonConfig
import EGammaCommonCfg
19 acc = ComponentAccumulator()
20 acc.merge(EGammaCommonCfg(flags))
21 isSimulation = flags.Input.isMC
22 V0Tools = acc.popToolsAndMerge(BPHY_V0ToolCfg(flags, BPHYDerivationName))
23 vkalvrt = acc.popToolsAndMerge(BPHY_TrkVKalVrtFitterCfg(flags, BPHYDerivationName))
24 acc.addPublicTool(vkalvrt)
25 acc.addPublicTool(V0Tools)
26 trackselect = acc.popToolsAndMerge(BPHY_InDetDetailedTrackSelectorToolCfg(flags, BPHYDerivationName))
27 acc.addPublicTool(trackselect)
28 vpest = acc.popToolsAndMerge(BPHY_VertexPointEstimatorCfg(flags, BPHYDerivationName))
29 acc.addPublicTool(vpest)
30 PVrefit = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags))
31 acc.addPublicTool(PVrefit)
34 if flags.Trigger.EDMVersion >= 0:
35 BPHY18TriggerSkim = CompFactory.DerivationFramework.TriggerSkimmingTool(
36 name =
"BPHY18TriggerSkim",
38 "HLT_e5_lhvloose_e3_lhvloose_bBeeM6000_L1BKeePrimary",
39 "HLT_2e5_bBeeM6000_L1BKeePrimary",
40 "HLT_e5_lhvloose_bBeeM6000_L1BKeePrimary",
41 "HLT_e5_lhvloose_e3_lhvloose_bBeeM6000_L1BKeePrescaled",
42 "HLT_2e5_bBeeM6000_L1BKeePrescaled",
43 "HLT_e5_lhvloose_bBeeM6000_L1BKeePrescaled"
46 skimmingTools += [BPHY18TriggerSkim]
48 ElectronLHSelectorLHvloose_nod0 = CompFactory.AsgElectronLikelihoodTool(
"ElectronLHSelectorLHvloosenod0",
49 primaryVertexContainer =
"PrimaryVertices",
50 ConfigFile=
"ElectronPhotonSelectorTools/offline/mc20_20230321/ElectronLikelihoodVeryLooseOfflineConfig2017_Smooth_NoD0_NoPix.conf")
53 from DerivationFrameworkEGamma.EGammaToolsConfig
import EGElectronLikelihoodToolWrapperCfg
54 ElectronPassLHvloosenod0 = acc.addPublicTool(acc.popToolsAndMerge(EGElectronLikelihoodToolWrapperCfg(flags, name =
"ElectronPassLHvloosenod0",
55 EGammaElectronLikelihoodTool = ElectronLHSelectorLHvloose_nod0,
57 StoreGateEntryName =
"DFCommonElectronsLHVeryLoosenod0",
58 ContainerName =
"Electrons",
61 BPHY18DiElectronFinder = CompFactory.Analysis.JpsiFinder_ee(
62 name =
"BPHY18DiElectronFinder",
65 TrackAndTrack =
False,
66 assumeDiElectrons =
True,
67 elThresholdPt = 4000.0,
68 invMassUpper = 7000.0,
71 oppChargesOnly =
False,
72 allChargeCombinations =
True,
73 useElectronTrackMeasurement =
True,
74 electronCollectionKey =
"Electrons",
75 TrackParticleCollection =
"GSFTrackParticles",
77 TrkVertexFitterTool = vkalvrt,
78 TrackSelectorTool = trackselect,
79 VertexPointEstimator = vpest,
80 ElectronSelection =
"d0_or_nod0"
82 extraTools = [BPHY18DiElectronFinder]
83 BPHY18DiElectronSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
84 name =
"BPHY18DiElectronSelectAndWrite",
85 VertexSearchTool = BPHY18DiElectronFinder,
86 OutputVtxContainerName =
"BPHY18DiElectronCandidates",
87 PVContainerName =
"PrimaryVertices",
90 RefPVContainerName =
"SHOULDNOTBEUSED",
94 BPHY18_Select_DiElectrons = CompFactory.DerivationFramework.Select_onia2mumu(
95 name =
"BPHY18_Select_DiElectrons",
96 HypothesisName =
"Jpsi",
97 InputVtxContainerName =
"BPHY18DiElectronCandidates",
99 VtxMassHypo = 3096.916,
106 BPHY18BeeKst = CompFactory.Analysis.JpsiPlus2Tracks(
107 name =
"BPHY18BeeKstFinder",
108 kaonkaonHypothesis =
False,
109 pionpionHypothesis =
False,
110 kaonpionHypothesis =
True,
111 oppChargesOnly =
False,
112 SameChargesOnly =
False,
113 trkThresholdPt = 500.0,
115 BThresholdPt = 1000.,
118 JpsiContainerKey =
"BPHY18DiElectronCandidates",
119 TrackParticleCollection =
"InDetTrackParticles",
120 ExcludeCrossJpsiTracks =
False,
121 TrkVertexFitterTool = vkalvrt,
122 TrackSelectorTool = trackselect,
123 UseMassConstraint =
False,
124 DiTrackMassUpper = 1110.,
125 DiTrackMassLower = 690.,
128 TrkQuadrupletMassLower = 1000.0,
129 TrkQuadrupletMassUpper = 10000.0,
130 FinalDiTrackPt = 500.,
131 UseGSFTrackIndices = [0,1]
133 BPHY18BeeKstSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
134 name =
"BPHY18BeeKstSelectAndWrite",
135 VertexSearchTool = BPHY18BeeKst,
136 OutputVtxContainerName =
"BeeKstCandidates",
137 PVContainerName =
"PrimaryVertices",
138 RefPVContainerName =
"BPHY18RefittedPrimaryVertices",
141 PVRefitter = PVrefit,
146 BPHY18_Select_BeeKst = CompFactory.DerivationFramework.Select_onia2mumu(
147 name =
"BPHY18_Select_BeeKst",
148 HypothesisName =
"Bd",
149 InputVtxContainerName =
"BeeKstCandidates",
151 TrkMasses = [0.511, 0.511, 493.677, 139.570],
152 VtxMassHypo = 5279.6,
158 BPHY18_Select_BeeKstbar = CompFactory.DerivationFramework.Select_onia2mumu(
159 name =
"BPHY18_Select_Bd2JpsiKstbar",
160 HypothesisName =
"Bdbar",
161 InputVtxContainerName =
"BeeKstCandidates",
163 TrkMasses = [0.511, 0.511, 139.570, 493.677],
164 VtxMassHypo = 5279.6,
171 BPHY18_diMeson_revertex = CompFactory.DerivationFramework.ReVertex(
172 name =
"BPHY18_diMeson_revertex",
173 InputVtxContainerName =
"BeeKstCandidates",
175 PVRefitter = PVrefit,
176 TrackIndices = [ 2, 3 ],
177 TrkVertexFitterTool = vkalvrt,
178 OutputVtxContainerName =
"BPHY18DiMeson"
181 BPHY18_Select_Kpi = CompFactory.DerivationFramework.Select_onia2mumu(
182 name =
"BPHY18_Select_Kpi",
183 HypothesisName =
"Kpi",
184 InputVtxContainerName =
"BPHY18DiMeson",
186 TrkMasses = [ 493.677, 139.570 ],
187 VtxMassHypo = 891.66,
193 BPHY18_Select_piK = CompFactory.DerivationFramework.Select_onia2mumu(
194 name =
"BPHY18_Select_piK",
195 HypothesisName =
"piK",
196 InputVtxContainerName =
"BPHY18DiMeson",
198 TrkMasses = [ 139.570, 493.677 ],
199 VtxMassHypo = 891.66,
205 from DerivationFrameworkTools.DerivationFrameworkToolsConfig
import (
206 xAODStringSkimmingToolCfg)
207 BPHY18_SelectBeeKstEvent = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
208 flags, name =
"BPHY18_SelectBeeKstEvent",
209 expression =
"(count(BeeKstCandidates.passed_Bd > 0) + count(BeeKstCandidates.passed_Bdbar > 0)) > 0"))
210 skimmingTools += [BPHY18_SelectBeeKstEvent]
212 BPHY18SkimmingAND = CompFactory.DerivationFramework.FilterCombinationAND(
213 "BPHY18SkimmingAND", FilterList = skimmingTools)
215 BPHY18_thinningTool_Tracks = CompFactory.DerivationFramework.Thin_vtxTrk(
216 name =
"BPHY18_thinningTool_Tracks",
217 TrackParticleContainerName =
"InDetTrackParticles",
218 StreamName = streamName,
219 VertexContainerNames = [
"BeeKstCandidates"],
220 PassFlags = [
"passed_Bd",
"passed_Bdbar"] )
222 BPHY18_thinningTool_GSFTracks = CompFactory.DerivationFramework.Thin_vtxTrk(
223 name =
"BPHY18_thinningTool_GSFTracks",
224 TrackParticleContainerName =
"GSFTrackParticles",
225 StreamName = streamName,
226 VertexContainerNames = [
"BeeKstCandidates"],
227 PassFlags = [
"passed_Bd",
"passed_Bdbar"] )
229 BPHY18_thinningTool_PV = CompFactory.DerivationFramework.BPhysPVThinningTool(
230 name =
"BPHY18_thinningTool_PV",
231 StreamName = streamName,
232 CandidateCollections = [
"BeeKstCandidates"],
236 BPHY18MuonTPThinningTool = CompFactory.DerivationFramework.MuonTrackParticleThinning(
237 name =
"BPHY18MuonTPThinningTool",
238 StreamName = streamName,
240 InDetTrackParticlesKey =
"InDetTrackParticles")
242 BPHY18EgammaTPThinningTool = CompFactory.DerivationFramework.EgammaTrackParticleThinning(
243 name =
"BPHY18EgammaTPThinningTool",
244 StreamName = streamName,
246 InDetTrackParticlesKey =
"InDetTrackParticles")
248 BPHY18TruthThinTool = CompFactory.DerivationFramework.GenericTruthThinning(name =
"BPHY18TruthThinTool",
249 ParticleSelectionString =
"TruthParticles.isElectron || TruthParticles.isMuon || abs(TruthParticles.pdgId) == 10311 || abs(TruthParticles.pdgId) == 521 || abs(TruthParticles.pdgId) == 523 || abs(TruthParticles.pdgId) == 511 || abs(TruthParticles.pdgId) == 513",
250 PreserveDescendants =
True,
251 StreamName = streamName,
252 PreserveAncestors =
True)
254 BPHY18TruthThinNoChainTool = CompFactory.DerivationFramework.GenericTruthThinning(name =
"BPHY18TruthThinNoChainTool",
255 ParticleSelectionString =
"abs(TruthParticles.pdgId) == 5 || abs(TruthParticles.pdgId) == 12 || abs(TruthParticles.pdgId) == 14",
256 PreserveDescendants =
False,
257 StreamName = streamName,
258 PreserveAncestors =
False)
260 thinningCollection = [ BPHY18_thinningTool_Tracks, BPHY18_thinningTool_GSFTracks,
261 BPHY18_thinningTool_PV,
262 BPHY18EgammaTPThinningTool, BPHY18MuonTPThinningTool
266 augTools = [ElectronPassLHvloosenod0,
267 BPHY18DiElectronSelectAndWrite, BPHY18_Select_DiElectrons,
268 BPHY18BeeKstSelectAndWrite, BPHY18_Select_BeeKst, BPHY18_Select_BeeKstbar,
269 BPHY18_diMeson_revertex, BPHY18_Select_Kpi, BPHY18_Select_piK]
270 skimTools = [BPHY18SkimmingAND]
273 thinningCollection += [BPHY18TruthThinTool,BPHY18TruthThinNoChainTool]
275 for t
in (augTools + skimTools + skimmingTools + thinningCollection +
279 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel(
"BPHY18Kernel",
280 AugmentationTools = augTools,
282 SkimmingTools = skimTools,
283 ThinningTools = thinningCollection))
285 from IsolationAlgs.DerivationTrackIsoConfig
import DerivationTrackIsoCfg
286 acc.merge(DerivationTrackIsoCfg(flags, object_types=(
"Electrons",
"Muons")))
293 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
294 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
295 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
296 BPHY18SlimmingHelper =
SlimmingHelper(
"BPHY18SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
297 from DerivationFrameworkBPhys.commonBPHYMethodsCfg
import getDefaultAllVariables
298 AllVariables = getDefaultAllVariables()
301 BPHY18SlimmingHelper.SmartCollections = [
"Electrons",
"Muons",
"InDetTrackParticles" ]
304 BPHY18SlimmingHelper.IncludeMuonTriggerContent =
False
305 BPHY18SlimmingHelper.IncludeBPhysTriggerContent =
False
306 BPHY18SlimmingHelper.IncludeEGammaTriggerContent =
True
308 AllVariables += [
"PrimaryVertices"]
309 StaticContent += [
"xAOD::VertexContainer#BPHY18RefittedPrimaryVertices"]
310 StaticContent += [
"xAOD::VertexAuxContainer#BPHY18RefittedPrimaryVerticesAux."]
312 ExtraVariables += [
"Muons.etaLayer1Hits.etaLayer2Hits.etaLayer3Hits.etaLayer4Hits.phiLayer1Hits.phiLayer2Hits.phiLayer3Hits.phiLayer4Hits",
313 "Muons.numberOfTriggerEtaLayers.numberOfPhiLayers",
314 "InDetTrackParticles.numberOfTRTHits.numberOfTRTHighThresholdHits.vx.vy.vz.pixeldEdx",
315 "PrimaryVertices.chiSquared.covariance",
316 "Electrons.deltaEta1.DFCommonElectronsLHVeryLoosenod0.ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt1000.ptvarcone20_Nonprompt_All_MaxWeightTTVA_pt1000.ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt500.ptvarcone40_Nonprompt_All_MaxWeightTTVALooseCone_pt1000.ptvarcone20_Nonprompt_All_MaxWeightTTVALooseCone_pt1000",
317 "egammaClusters.calE.calEta.calPhi.e_sampl.eta_sampl.etaCalo.phiCalo.ETACALOFRAME.PHICALOFRAME",
318 "HLT_xAOD__ElectronContainer_egamma_ElectronsAuxDyn.charge"]
321 StaticContent += [
"xAOD::VertexContainer#%s" % BPHY18DiElectronSelectAndWrite.OutputVtxContainerName]
322 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY18DiElectronSelectAndWrite.OutputVtxContainerName]
324 StaticContent += [
"xAOD::VertexContainer#%s" % BPHY18BeeKstSelectAndWrite.OutputVtxContainerName]
325 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY18BeeKstSelectAndWrite.OutputVtxContainerName]
327 StaticContent += [
"xAOD::VertexContainer#%s" % BPHY18_diMeson_revertex.OutputVtxContainerName]
328 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY18_diMeson_revertex.OutputVtxContainerName]
330 AllVariables += [
"GSFTrackParticles"]
335 AllVariables += [
"TruthEvents",
"TruthParticles",
"TruthVertices",
"ElectronTruthParticles"]
337 AllVariables = list(
set(AllVariables))
339 BPHY18SlimmingHelper.AllVariables = AllVariables
340 BPHY18SlimmingHelper.ExtraVariables = ExtraVariables
342 BPHY18SlimmingHelper.StaticContent = StaticContent
344 from DerivationFrameworkEGamma.ElectronsCPDetailedContent
import ElectronsCPDetailedContent, GSFTracksCPDetailedContent
345 BPHY18SlimmingHelper.ExtraVariables += ElectronsCPDetailedContent
346 BPHY18SlimmingHelper.ExtraVariables += GSFTracksCPDetailedContent
348 BPHY18ItemList = BPHY18SlimmingHelper.GetItemList()
349 acc.merge(OutputStreamCfg(flags,
"DAOD_BPHY18", ItemList=BPHY18ItemList, AcceptAlgs=[
"BPHY18Kernel"]))
350 acc.merge(SetupMetaDataForStreamCfg(flags,
"DAOD_BPHY18", AcceptAlgs=[
"BPHY18Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
351 acc.printConfig(withDetails=
True, summariseProps=
True, onlyComponents = [], printDefaults=
True)