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,
56 EGammaFudgeMCTool =
"",
58 StoreGateEntryName =
"DFCommonElectronsLHVeryLoosenod0",
59 ContainerName =
"Electrons",
62 BPHY18DiElectronFinder = CompFactory.Analysis.JpsiFinder_ee(
63 name =
"BPHY18DiElectronFinder",
66 TrackAndTrack =
False,
67 assumeDiElectrons =
True,
68 elThresholdPt = 4000.0,
69 invMassUpper = 7000.0,
72 oppChargesOnly =
False,
73 allChargeCombinations =
True,
74 useElectronTrackMeasurement =
True,
75 electronCollectionKey =
"Electrons",
76 TrackParticleCollection =
"GSFTrackParticles",
78 TrkVertexFitterTool = vkalvrt,
79 TrackSelectorTool = trackselect,
80 VertexPointEstimator = vpest,
81 ElectronSelection =
"d0_or_nod0"
83 extraTools = [BPHY18DiElectronFinder]
84 BPHY18DiElectronSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
85 name =
"BPHY18DiElectronSelectAndWrite",
86 VertexSearchTool = BPHY18DiElectronFinder,
87 OutputVtxContainerName =
"BPHY18DiElectronCandidates",
88 PVContainerName =
"PrimaryVertices",
91 RefPVContainerName =
"SHOULDNOTBEUSED",
95 BPHY18_Select_DiElectrons = CompFactory.DerivationFramework.Select_onia2mumu(
96 name =
"BPHY18_Select_DiElectrons",
97 HypothesisName =
"Jpsi",
98 InputVtxContainerName =
"BPHY18DiElectronCandidates",
100 VtxMassHypo = 3096.916,
107 BPHY18BeeKst = CompFactory.Analysis.JpsiPlus2Tracks(
108 name =
"BPHY18BeeKstFinder",
109 kaonkaonHypothesis =
False,
110 pionpionHypothesis =
False,
111 kaonpionHypothesis =
True,
112 oppChargesOnly =
False,
113 SameChargesOnly =
False,
114 trkThresholdPt = 500.0,
116 BThresholdPt = 1000.,
119 JpsiContainerKey =
"BPHY18DiElectronCandidates",
120 TrackParticleCollection =
"InDetTrackParticles",
121 ExcludeCrossJpsiTracks =
False,
122 TrkVertexFitterTool = vkalvrt,
123 TrackSelectorTool = trackselect,
124 UseMassConstraint =
False,
125 DiTrackMassUpper = 1110.,
126 DiTrackMassLower = 690.,
129 TrkQuadrupletMassLower = 1000.0,
130 TrkQuadrupletMassUpper = 10000.0,
131 FinalDiTrackPt = 500.,
132 UseGSFTrackIndices = [0,1]
134 BPHY18BeeKstSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
135 name =
"BPHY18BeeKstSelectAndWrite",
136 VertexSearchTool = BPHY18BeeKst,
137 OutputVtxContainerName =
"BeeKstCandidates",
138 PVContainerName =
"PrimaryVertices",
139 RefPVContainerName =
"BPHY18RefittedPrimaryVertices",
142 PVRefitter = PVrefit,
147 BPHY18_Select_BeeKst = CompFactory.DerivationFramework.Select_onia2mumu(
148 name =
"BPHY18_Select_BeeKst",
149 HypothesisName =
"Bd",
150 InputVtxContainerName =
"BeeKstCandidates",
152 TrkMasses = [0.511, 0.511, 493.677, 139.570],
153 VtxMassHypo = 5279.6,
159 BPHY18_Select_BeeKstbar = CompFactory.DerivationFramework.Select_onia2mumu(
160 name =
"BPHY18_Select_Bd2JpsiKstbar",
161 HypothesisName =
"Bdbar",
162 InputVtxContainerName =
"BeeKstCandidates",
164 TrkMasses = [0.511, 0.511, 139.570, 493.677],
165 VtxMassHypo = 5279.6,
172 BPHY18_diMeson_revertex = CompFactory.DerivationFramework.ReVertex(
173 name =
"BPHY18_diMeson_revertex",
174 InputVtxContainerName =
"BeeKstCandidates",
176 PVRefitter = PVrefit,
177 TrackIndices = [ 2, 3 ],
178 TrkVertexFitterTool = vkalvrt,
179 OutputVtxContainerName =
"BPHY18DiMeson"
182 BPHY18_Select_Kpi = CompFactory.DerivationFramework.Select_onia2mumu(
183 name =
"BPHY18_Select_Kpi",
184 HypothesisName =
"Kpi",
185 InputVtxContainerName =
"BPHY18DiMeson",
187 TrkMasses = [ 493.677, 139.570 ],
188 VtxMassHypo = 891.66,
194 BPHY18_Select_piK = CompFactory.DerivationFramework.Select_onia2mumu(
195 name =
"BPHY18_Select_piK",
196 HypothesisName =
"piK",
197 InputVtxContainerName =
"BPHY18DiMeson",
199 TrkMasses = [ 139.570, 493.677 ],
200 VtxMassHypo = 891.66,
206 from DerivationFrameworkTools.DerivationFrameworkToolsConfig
import (
207 xAODStringSkimmingToolCfg)
208 BPHY18_SelectBeeKstEvent = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
209 flags, name =
"BPHY18_SelectBeeKstEvent",
210 expression =
"(count(BeeKstCandidates.passed_Bd > 0) + count(BeeKstCandidates.passed_Bdbar > 0)) > 0"))
211 skimmingTools += [BPHY18_SelectBeeKstEvent]
213 BPHY18SkimmingAND = CompFactory.DerivationFramework.FilterCombinationAND(
214 "BPHY18SkimmingAND", FilterList = skimmingTools)
216 BPHY18_thinningTool_Tracks = CompFactory.DerivationFramework.Thin_vtxTrk(
217 name =
"BPHY18_thinningTool_Tracks",
218 TrackParticleContainerName =
"InDetTrackParticles",
219 StreamName = streamName,
220 VertexContainerNames = [
"BeeKstCandidates"],
221 PassFlags = [
"passed_Bd",
"passed_Bdbar"] )
223 BPHY18_thinningTool_GSFTracks = CompFactory.DerivationFramework.Thin_vtxTrk(
224 name =
"BPHY18_thinningTool_GSFTracks",
225 TrackParticleContainerName =
"GSFTrackParticles",
226 StreamName = streamName,
227 VertexContainerNames = [
"BeeKstCandidates"],
228 PassFlags = [
"passed_Bd",
"passed_Bdbar"] )
230 BPHY18_thinningTool_PV = CompFactory.DerivationFramework.BPhysPVThinningTool(
231 name =
"BPHY18_thinningTool_PV",
232 StreamName = streamName,
233 CandidateCollections = [
"BeeKstCandidates"],
237 BPHY18MuonTPThinningTool = CompFactory.DerivationFramework.MuonTrackParticleThinning(
238 name =
"BPHY18MuonTPThinningTool",
239 StreamName = streamName,
241 InDetTrackParticlesKey =
"InDetTrackParticles")
243 BPHY18EgammaTPThinningTool = CompFactory.DerivationFramework.EgammaTrackParticleThinning(
244 name =
"BPHY18EgammaTPThinningTool",
245 StreamName = streamName,
247 InDetTrackParticlesKey =
"InDetTrackParticles")
249 BPHY18TruthThinTool = CompFactory.DerivationFramework.GenericTruthThinning(name =
"BPHY18TruthThinTool",
250 ParticleSelectionString =
"abs(TruthParticles.pdgId) == 11 || abs(TruthParticles.pdgId) == 13 || abs(TruthParticles.pdgId) == 10311 || abs(TruthParticles.pdgId) == 521 || abs(TruthParticles.pdgId) == 523 || abs(TruthParticles.pdgId) == 511 || abs(TruthParticles.pdgId) == 513",
251 PreserveDescendants =
True,
252 StreamName = streamName,
253 PreserveAncestors =
True)
255 BPHY18TruthThinNoChainTool = CompFactory.DerivationFramework.GenericTruthThinning(name =
"BPHY18TruthThinNoChainTool",
256 ParticleSelectionString =
"abs(TruthParticles.pdgId) == 5 || abs(TruthParticles.pdgId) == 12 || abs(TruthParticles.pdgId) == 14",
257 PreserveDescendants =
False,
258 StreamName = streamName,
259 PreserveAncestors =
False)
261 thinningCollection = [ BPHY18_thinningTool_Tracks, BPHY18_thinningTool_GSFTracks,
262 BPHY18_thinningTool_PV,
263 BPHY18EgammaTPThinningTool, BPHY18MuonTPThinningTool
267 augTools = [ElectronPassLHvloosenod0,
268 BPHY18DiElectronSelectAndWrite, BPHY18_Select_DiElectrons,
269 BPHY18BeeKstSelectAndWrite, BPHY18_Select_BeeKst, BPHY18_Select_BeeKstbar,
270 BPHY18_diMeson_revertex, BPHY18_Select_Kpi, BPHY18_Select_piK]
271 skimTools = [BPHY18SkimmingAND]
274 thinningCollection += [BPHY18TruthThinTool,BPHY18TruthThinNoChainTool]
276 for t
in (augTools + skimTools + skimmingTools + thinningCollection +
280 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel(
"BPHY18Kernel",
281 AugmentationTools = augTools,
283 SkimmingTools = skimTools,
284 ThinningTools = thinningCollection))
286 from IsolationAlgs.DerivationTrackIsoConfig
import DerivationTrackIsoCfg
287 acc.merge(DerivationTrackIsoCfg(flags, object_types=(
"Electrons",
"Muons")))
294 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
295 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
296 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
297 BPHY18SlimmingHelper =
SlimmingHelper(
"BPHY18SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
298 from DerivationFrameworkBPhys.commonBPHYMethodsCfg
import getDefaultAllVariables
299 AllVariables = getDefaultAllVariables()
302 BPHY18SlimmingHelper.SmartCollections = [
"Electrons",
"Muons",
"InDetTrackParticles" ]
305 BPHY18SlimmingHelper.IncludeMuonTriggerContent =
False
306 BPHY18SlimmingHelper.IncludeBPhysTriggerContent =
False
307 BPHY18SlimmingHelper.IncludeEGammaTriggerContent =
True
309 AllVariables += [
"PrimaryVertices"]
310 StaticContent += [
"xAOD::VertexContainer#BPHY18RefittedPrimaryVertices"]
311 StaticContent += [
"xAOD::VertexAuxContainer#BPHY18RefittedPrimaryVerticesAux."]
313 ExtraVariables += [
"Muons.etaLayer1Hits.etaLayer2Hits.etaLayer3Hits.etaLayer4Hits.phiLayer1Hits.phiLayer2Hits.phiLayer3Hits.phiLayer4Hits",
314 "Muons.numberOfTriggerEtaLayers.numberOfPhiLayers",
315 "InDetTrackParticles.numberOfTRTHits.numberOfTRTHighThresholdHits.vx.vy.vz.pixeldEdx",
316 "PrimaryVertices.chiSquared.covariance",
317 "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",
318 "egammaClusters.calE.calEta.calPhi.e_sampl.eta_sampl.etaCalo.phiCalo.ETACALOFRAME.PHICALOFRAME",
319 "HLT_xAOD__ElectronContainer_egamma_ElectronsAuxDyn.charge"]
322 StaticContent += [
"xAOD::VertexContainer#%s" % BPHY18DiElectronSelectAndWrite.OutputVtxContainerName]
323 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY18DiElectronSelectAndWrite.OutputVtxContainerName]
325 StaticContent += [
"xAOD::VertexContainer#%s" % BPHY18BeeKstSelectAndWrite.OutputVtxContainerName]
326 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY18BeeKstSelectAndWrite.OutputVtxContainerName]
328 StaticContent += [
"xAOD::VertexContainer#%s" % BPHY18_diMeson_revertex.OutputVtxContainerName]
329 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY18_diMeson_revertex.OutputVtxContainerName]
331 AllVariables += [
"GSFTrackParticles"]
336 AllVariables += [
"TruthEvents",
"TruthParticles",
"TruthVertices",
"ElectronTruthParticles"]
338 AllVariables = list(
set(AllVariables))
340 BPHY18SlimmingHelper.AllVariables = AllVariables
341 BPHY18SlimmingHelper.ExtraVariables = ExtraVariables
343 BPHY18SlimmingHelper.StaticContent = StaticContent
345 from DerivationFrameworkEGamma.ElectronsCPDetailedContent
import ElectronsCPDetailedContent, GSFTracksCPDetailedContent
346 BPHY18SlimmingHelper.ExtraVariables += ElectronsCPDetailedContent
347 BPHY18SlimmingHelper.ExtraVariables += GSFTracksCPDetailedContent
349 BPHY18ItemList = BPHY18SlimmingHelper.GetItemList()
350 acc.merge(OutputStreamCfg(flags,
"DAOD_BPHY18", ItemList=BPHY18ItemList, AcceptAlgs=[
"BPHY18Kernel"]))
351 acc.merge(SetupMetaDataForStreamCfg(flags,
"DAOD_BPHY18", AcceptAlgs=[
"BPHY18Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
352 acc.printConfig(withDetails=
True, summariseProps=
True, onlyComponents = [], printDefaults=
True)