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
18 from AthenaServices.PartPropSvcConfig
import PartPropSvcCfg
20 acc = ComponentAccumulator()
21 PartPropSvcName = acc.getPrimaryAndMerge(PartPropSvcCfg(flags))
22 acc.merge(EGammaCommonCfg(flags))
23 isSimulation = flags.Input.isMC
24 V0Tools = acc.popToolsAndMerge(BPHY_V0ToolCfg(flags, BPHYDerivationName))
25 vkalvrt = acc.popToolsAndMerge(BPHY_TrkVKalVrtFitterCfg(flags, BPHYDerivationName))
26 acc.addPublicTool(vkalvrt)
27 acc.addPublicTool(V0Tools)
28 trackselect = acc.popToolsAndMerge(BPHY_InDetDetailedTrackSelectorToolCfg(flags, BPHYDerivationName))
29 acc.addPublicTool(trackselect)
30 vpest = acc.popToolsAndMerge(BPHY_VertexPointEstimatorCfg(flags, BPHYDerivationName))
31 acc.addPublicTool(vpest)
32 PVrefit = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags))
33 acc.addPublicTool(PVrefit)
36 if flags.Trigger.EDMVersion >= 0:
37 BPHY18TriggerSkim = CompFactory.DerivationFramework.TriggerSkimmingTool(
38 name =
"BPHY18TriggerSkim",
40 "HLT_e5_lhvloose_e3_lhvloose_bBeeM6000_L1BKeePrimary",
41 "HLT_2e5_bBeeM6000_L1BKeePrimary",
42 "HLT_e5_lhvloose_bBeeM6000_L1BKeePrimary",
43 "HLT_e5_lhvloose_e3_lhvloose_bBeeM6000_L1BKeePrescaled",
44 "HLT_2e5_bBeeM6000_L1BKeePrescaled",
45 "HLT_e5_lhvloose_bBeeM6000_L1BKeePrescaled"
48 skimmingTools += [BPHY18TriggerSkim]
50 ElectronLHSelectorLHvloose_nod0 = CompFactory.AsgElectronLikelihoodTool(
"ElectronLHSelectorLHvloosenod0",
51 primaryVertexContainer =
"PrimaryVertices",
52 ConfigFile=
"ElectronPhotonSelectorTools/offline/mc20_20230321/ElectronLikelihoodVeryLooseOfflineConfig2017_Smooth_NoD0_NoPix.conf")
55 from DerivationFrameworkEGamma.EGammaToolsConfig
import EGElectronLikelihoodToolWrapperCfg
56 ElectronPassLHvloosenod0 = acc.addPublicTool(acc.popToolsAndMerge(EGElectronLikelihoodToolWrapperCfg(flags, name =
"ElectronPassLHvloosenod0",
57 EGammaElectronLikelihoodTool = ElectronLHSelectorLHvloose_nod0,
58 EGammaFudgeMCTool =
"",
60 StoreGateEntryName =
"DFCommonElectronsLHVeryLoosenod0",
61 ContainerName =
"Electrons",
64 BPHY18DiElectronFinder = CompFactory.Analysis.JpsiFinder_ee(
65 name =
"BPHY18DiElectronFinder",
68 TrackAndTrack =
False,
69 assumeDiElectrons =
True,
70 elThresholdPt = 4000.0,
71 invMassUpper = 7000.0,
74 oppChargesOnly =
False,
75 allChargeCombinations =
True,
76 useElectronTrackMeasurement =
True,
77 electronCollectionKey =
"Electrons",
78 TrackParticleCollection =
"GSFTrackParticles",
80 TrkVertexFitterTool = vkalvrt,
81 TrackSelectorTool = trackselect,
82 VertexPointEstimator = vpest,
83 ElectronSelection =
"d0_or_nod0",
84 PartPropSvc = PartPropSvcName
86 extraTools = [BPHY18DiElectronFinder]
87 BPHY18DiElectronSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
88 name =
"BPHY18DiElectronSelectAndWrite",
89 VertexSearchTool = BPHY18DiElectronFinder,
90 OutputVtxContainerName =
"BPHY18DiElectronCandidates",
91 PVContainerName =
"PrimaryVertices",
94 RefPVContainerName =
"SHOULDNOTBEUSED",
98 BPHY18_Select_DiElectrons = CompFactory.DerivationFramework.Select_onia2mumu(
99 name =
"BPHY18_Select_DiElectrons",
100 HypothesisName =
"Jpsi",
101 InputVtxContainerName =
"BPHY18DiElectronCandidates",
103 VtxMassHypo = 3096.916,
110 BPHY18BeeKst = CompFactory.Analysis.JpsiPlus2Tracks(
111 name =
"BPHY18BeeKstFinder",
112 kaonkaonHypothesis =
False,
113 pionpionHypothesis =
False,
114 kaonpionHypothesis =
True,
115 oppChargesOnly =
False,
116 SameChargesOnly =
False,
117 trkThresholdPt = 500.0,
119 BThresholdPt = 1000.,
122 JpsiContainerKey =
"BPHY18DiElectronCandidates",
123 TrackParticleCollection =
"InDetTrackParticles",
124 ExcludeCrossJpsiTracks =
False,
125 TrkVertexFitterTool = vkalvrt,
126 TrackSelectorTool = trackselect,
127 UseMassConstraint =
False,
128 DiTrackMassUpper = 1110.,
129 DiTrackMassLower = 690.,
132 TrkQuadrupletMassLower = 1000.0,
133 TrkQuadrupletMassUpper = 10000.0,
134 FinalDiTrackPt = 500.,
135 UseGSFTrackIndices = [0,1]
137 BPHY18BeeKstSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
138 name =
"BPHY18BeeKstSelectAndWrite",
139 VertexSearchTool = BPHY18BeeKst,
140 OutputVtxContainerName =
"BeeKstCandidates",
141 PVContainerName =
"PrimaryVertices",
142 RefPVContainerName =
"BPHY18RefittedPrimaryVertices",
145 PVRefitter = PVrefit,
150 BPHY18_Select_BeeKst = CompFactory.DerivationFramework.Select_onia2mumu(
151 name =
"BPHY18_Select_BeeKst",
152 HypothesisName =
"Bd",
153 InputVtxContainerName =
"BeeKstCandidates",
155 TrkMasses = [0.511, 0.511, 493.677, 139.570],
156 VtxMassHypo = 5279.6,
162 BPHY18_Select_BeeKstbar = CompFactory.DerivationFramework.Select_onia2mumu(
163 name =
"BPHY18_Select_Bd2JpsiKstbar",
164 HypothesisName =
"Bdbar",
165 InputVtxContainerName =
"BeeKstCandidates",
167 TrkMasses = [0.511, 0.511, 139.570, 493.677],
168 VtxMassHypo = 5279.6,
175 BPHY18_diMeson_revertex = CompFactory.DerivationFramework.ReVertex(
176 name =
"BPHY18_diMeson_revertex",
177 InputVtxContainerName =
"BeeKstCandidates",
179 PVRefitter = PVrefit,
180 TrackIndices = [ 2, 3 ],
181 TrkVertexFitterTool = vkalvrt,
182 OutputVtxContainerName =
"BPHY18DiMeson"
185 BPHY18_Select_Kpi = CompFactory.DerivationFramework.Select_onia2mumu(
186 name =
"BPHY18_Select_Kpi",
187 HypothesisName =
"Kpi",
188 InputVtxContainerName =
"BPHY18DiMeson",
190 TrkMasses = [ 493.677, 139.570 ],
191 VtxMassHypo = 891.66,
197 BPHY18_Select_piK = CompFactory.DerivationFramework.Select_onia2mumu(
198 name =
"BPHY18_Select_piK",
199 HypothesisName =
"piK",
200 InputVtxContainerName =
"BPHY18DiMeson",
202 TrkMasses = [ 139.570, 493.677 ],
203 VtxMassHypo = 891.66,
209 from DerivationFrameworkTools.DerivationFrameworkToolsConfig
import (
210 xAODStringSkimmingToolCfg)
211 BPHY18_SelectBeeKstEvent = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
212 flags, name =
"BPHY18_SelectBeeKstEvent",
213 expression =
"(count(BeeKstCandidates.passed_Bd > 0) + count(BeeKstCandidates.passed_Bdbar > 0)) > 0"))
214 skimmingTools += [BPHY18_SelectBeeKstEvent]
216 BPHY18SkimmingAND = CompFactory.DerivationFramework.FilterCombinationAND(
217 "BPHY18SkimmingAND", FilterList = skimmingTools)
219 BPHY18_thinningTool_Tracks = CompFactory.DerivationFramework.Thin_vtxTrk(
220 name =
"BPHY18_thinningTool_Tracks",
221 TrackParticleContainerName =
"InDetTrackParticles",
222 StreamName = streamName,
223 VertexContainerNames = [
"BeeKstCandidates"],
224 PassFlags = [
"passed_Bd",
"passed_Bdbar"] )
226 BPHY18_thinningTool_GSFTracks = CompFactory.DerivationFramework.Thin_vtxTrk(
227 name =
"BPHY18_thinningTool_GSFTracks",
228 TrackParticleContainerName =
"GSFTrackParticles",
229 StreamName = streamName,
230 VertexContainerNames = [
"BeeKstCandidates"],
231 PassFlags = [
"passed_Bd",
"passed_Bdbar"] )
233 BPHY18_thinningTool_PV = CompFactory.DerivationFramework.BPhysPVThinningTool(
234 name =
"BPHY18_thinningTool_PV",
235 StreamName = streamName,
236 CandidateCollections = [
"BeeKstCandidates"],
240 BPHY18MuonTPThinningTool = CompFactory.DerivationFramework.MuonTrackParticleThinning(
241 name =
"BPHY18MuonTPThinningTool",
242 StreamName = streamName,
244 InDetTrackParticlesKey =
"InDetTrackParticles")
246 BPHY18EgammaTPThinningTool = CompFactory.DerivationFramework.EgammaTrackParticleThinning(
247 name =
"BPHY18EgammaTPThinningTool",
248 StreamName = streamName,
250 InDetTrackParticlesKey =
"InDetTrackParticles")
252 BPHY18TruthThinTool = CompFactory.DerivationFramework.GenericTruthThinning(name =
"BPHY18TruthThinTool",
253 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",
254 PreserveDescendants =
True,
255 StreamName = streamName,
256 PreserveAncestors =
True)
258 BPHY18TruthThinNoChainTool = CompFactory.DerivationFramework.GenericTruthThinning(name =
"BPHY18TruthThinNoChainTool",
259 ParticleSelectionString =
"abs(TruthParticles.pdgId) == 5 || abs(TruthParticles.pdgId) == 12 || abs(TruthParticles.pdgId) == 14",
260 PreserveDescendants =
False,
261 StreamName = streamName,
262 PreserveAncestors =
False)
264 thinningCollection = [ BPHY18_thinningTool_Tracks, BPHY18_thinningTool_GSFTracks,
265 BPHY18_thinningTool_PV,
266 BPHY18EgammaTPThinningTool, BPHY18MuonTPThinningTool
270 augTools = [ElectronPassLHvloosenod0,
271 BPHY18DiElectronSelectAndWrite, BPHY18_Select_DiElectrons,
272 BPHY18BeeKstSelectAndWrite, BPHY18_Select_BeeKst, BPHY18_Select_BeeKstbar,
273 BPHY18_diMeson_revertex, BPHY18_Select_Kpi, BPHY18_Select_piK]
274 skimTools = [BPHY18SkimmingAND]
277 thinningCollection += [BPHY18TruthThinTool,BPHY18TruthThinNoChainTool]
279 for t
in (augTools + skimTools + skimmingTools + thinningCollection +
283 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel(
"BPHY18Kernel",
284 AugmentationTools = augTools,
286 SkimmingTools = skimTools,
287 ThinningTools = thinningCollection))
289 from IsolationAlgs.DerivationTrackIsoConfig
import DerivationTrackIsoCfg
290 acc.merge(DerivationTrackIsoCfg(flags, object_types=(
"Electrons",
"Muons")))
297 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
298 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
299 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
300 BPHY18SlimmingHelper =
SlimmingHelper(
"BPHY18SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
301 from DerivationFrameworkBPhys.commonBPHYMethodsCfg
import getDefaultAllVariables
302 AllVariables = getDefaultAllVariables()
305 BPHY18SlimmingHelper.SmartCollections = [
"Electrons",
"Muons",
"InDetTrackParticles" ]
308 BPHY18SlimmingHelper.IncludeMuonTriggerContent =
False
309 BPHY18SlimmingHelper.IncludeBPhysTriggerContent =
False
310 BPHY18SlimmingHelper.IncludeEGammaTriggerContent =
True
312 AllVariables += [
"PrimaryVertices"]
313 StaticContent += [
"xAOD::VertexContainer#BPHY18RefittedPrimaryVertices"]
314 StaticContent += [
"xAOD::VertexAuxContainer#BPHY18RefittedPrimaryVerticesAux."]
316 ExtraVariables += [
"Muons.etaLayer1Hits.etaLayer2Hits.etaLayer3Hits.etaLayer4Hits.phiLayer1Hits.phiLayer2Hits.phiLayer3Hits.phiLayer4Hits",
317 "Muons.numberOfTriggerEtaLayers.numberOfPhiLayers",
318 "InDetTrackParticles.numberOfTRTHits.numberOfTRTHighThresholdHits.vx.vy.vz.pixeldEdx",
319 "PrimaryVertices.chiSquared.covariance",
320 "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",
321 "egammaClusters.calE.calEta.calPhi.e_sampl.eta_sampl.etaCalo.phiCalo.ETACALOFRAME.PHICALOFRAME",
322 "HLT_xAOD__ElectronContainer_egamma_ElectronsAuxDyn.charge"]
325 StaticContent += [
"xAOD::VertexContainer#%s" % BPHY18DiElectronSelectAndWrite.OutputVtxContainerName]
326 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY18DiElectronSelectAndWrite.OutputVtxContainerName]
328 StaticContent += [
"xAOD::VertexContainer#%s" % BPHY18BeeKstSelectAndWrite.OutputVtxContainerName]
329 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY18BeeKstSelectAndWrite.OutputVtxContainerName]
331 StaticContent += [
"xAOD::VertexContainer#%s" % BPHY18_diMeson_revertex.OutputVtxContainerName]
332 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY18_diMeson_revertex.OutputVtxContainerName]
334 AllVariables += [
"GSFTrackParticles"]
339 AllVariables += [
"TruthEvents",
"TruthParticles",
"TruthVertices",
"ElectronTruthParticles"]
341 AllVariables = list(
set(AllVariables))
343 BPHY18SlimmingHelper.AllVariables = AllVariables
344 BPHY18SlimmingHelper.ExtraVariables = ExtraVariables
346 BPHY18SlimmingHelper.StaticContent = StaticContent
348 from DerivationFrameworkEGamma.ElectronsCPDetailedContent
import ElectronsCPDetailedContent, GSFTracksCPDetailedContent
349 BPHY18SlimmingHelper.ExtraVariables += ElectronsCPDetailedContent
350 BPHY18SlimmingHelper.ExtraVariables += GSFTracksCPDetailedContent
352 BPHY18ItemList = BPHY18SlimmingHelper.GetItemList()
353 acc.merge(OutputStreamCfg(flags,
"DAOD_BPHY18", ItemList=BPHY18ItemList, AcceptAlgs=[
"BPHY18Kernel"]))
354 acc.merge(SetupMetaDataForStreamCfg(flags,
"DAOD_BPHY18", AcceptAlgs=[
"BPHY18Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
355 acc.printConfig(withDetails=
True, summariseProps=
True, onlyComponents = [], printDefaults=
True)