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)
35 if flags.Trigger.EDMVersion >= 0:
36 BPHY18TriggerSkim = CompFactory.DerivationFramework.TriggerSkimmingTool(
37 name =
"BPHY18TriggerSkim",
39 "HLT_e5_lhvloose_e3_lhvloose_bBeeM6000_L1BKeePrimary",
40 "HLT_2e5_bBeeM6000_L1BKeePrimary",
41 "HLT_e5_lhvloose_bBeeM6000_L1BKeePrimary",
42 "HLT_e5_lhvloose_e3_lhvloose_bBeeM6000_L1BKeePrescaled",
43 "HLT_2e5_bBeeM6000_L1BKeePrescaled",
44 "HLT_e5_lhvloose_bBeeM6000_L1BKeePrescaled"
47 skimmingTools += [BPHY18TriggerSkim]
49 ElectronLHSelectorLHvloose_nod0 = CompFactory.AsgElectronLikelihoodTool(
"ElectronLHSelectorLHvloosenod0",
50 primaryVertexContainer =
"PrimaryVertices",
51 ConfigFile=
"ElectronPhotonSelectorTools/offline/mc20_20230321/ElectronLikelihoodVeryLooseOfflineConfig2017_Smooth_NoD0_NoPix.conf")
54 from DerivationFrameworkEGamma.EGammaToolsConfig
import EGElectronLikelihoodToolWrapperCfg
55 ElectronPassLHvloosenod0 = acc.addPublicTool(acc.popToolsAndMerge(EGElectronLikelihoodToolWrapperCfg(flags, name =
"ElectronPassLHvloosenod0",
56 EGammaElectronLikelihoodTool = ElectronLHSelectorLHvloose_nod0,
57 EGammaFudgeMCTool =
"",
59 StoreGateEntryName =
"DFCommonElectronsLHVeryLoosenod0",
60 ContainerName =
"Electrons",
63 BPHY18DiElectronFinder = CompFactory.Analysis.JpsiFinder_ee(
64 name =
"BPHY18DiElectronFinder",
67 TrackAndTrack =
False,
68 assumeDiElectrons =
True,
69 elThresholdPt = 4000.0,
70 invMassUpper = 7000.0,
73 oppChargesOnly =
False,
74 allChargeCombinations =
True,
75 useElectronTrackMeasurement =
True,
76 electronCollectionKey =
"Electrons",
77 TrackParticleCollection =
"GSFTrackParticles",
79 V0VertexFitterTool =
None,
81 TrkVertexFitterTool = vkalvrt,
82 TrackSelectorTool = trackselect,
83 VertexPointEstimator = vpest,
84 ElectronSelection =
"d0_or_nod0",
85 PartPropSvc = PartPropSvcName
87 extraTools = [BPHY18DiElectronFinder]
88 BPHY18DiElectronSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
89 name =
"BPHY18DiElectronSelectAndWrite",
90 VertexSearchTool = BPHY18DiElectronFinder,
91 OutputVtxContainerName =
"BPHY18DiElectronCandidates",
92 PVContainerName =
"PrimaryVertices",
94 PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
95 RefPVContainerName =
"SHOULDNOTBEUSED",
99 BPHY18_Select_DiElectrons = CompFactory.DerivationFramework.Select_onia2mumu(
100 name =
"BPHY18_Select_DiElectrons",
101 HypothesisName =
"Jpsi",
102 InputVtxContainerName =
"BPHY18DiElectronCandidates",
104 VtxMassHypo = 3096.916,
111 BPHY18BeeKst = CompFactory.Analysis.JpsiPlus2Tracks(
112 name =
"BPHY18BeeKstFinder",
113 kaonkaonHypothesis =
False,
114 pionpionHypothesis =
False,
115 kaonpionHypothesis =
True,
116 oppChargesOnly =
False,
117 SameChargesOnly =
False,
118 trkThresholdPt = 500.0,
120 BThresholdPt = 1000.,
123 JpsiContainerKey =
"BPHY18DiElectronCandidates",
124 TrackParticleCollection =
"InDetTrackParticles",
125 ExcludeCrossJpsiTracks =
False,
126 TrkVertexFitterTool = vkalvrt,
127 TrackSelectorTool = trackselect,
128 UseMassConstraint =
False,
129 DiTrackMassUpper = 1110.,
130 DiTrackMassLower = 690.,
133 TrkQuadrupletMassLower = 1000.0,
134 TrkQuadrupletMassUpper = 10000.0,
135 FinalDiTrackPt = 500.,
136 UseGSFTrackIndices = [0,1]
138 BPHY18BeeKstSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
139 name =
"BPHY18BeeKstSelectAndWrite",
140 VertexSearchTool = BPHY18BeeKst,
141 OutputVtxContainerName =
"BeeKstCandidates",
142 PVContainerName =
"PrimaryVertices",
143 RefPVContainerName =
"BPHY18RefittedPrimaryVertices",
146 PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
151 BPHY18_Select_BeeKst = CompFactory.DerivationFramework.Select_onia2mumu(
152 name =
"BPHY18_Select_BeeKst",
153 HypothesisName =
"Bd",
154 InputVtxContainerName =
"BeeKstCandidates",
156 TrkMasses = [0.511, 0.511, 493.677, 139.570],
157 VtxMassHypo = 5279.6,
163 BPHY18_Select_BeeKstbar = CompFactory.DerivationFramework.Select_onia2mumu(
164 name =
"BPHY18_Select_Bd2JpsiKstbar",
165 HypothesisName =
"Bdbar",
166 InputVtxContainerName =
"BeeKstCandidates",
168 TrkMasses = [0.511, 0.511, 139.570, 493.677],
169 VtxMassHypo = 5279.6,
176 BPHY18_diMeson_revertex = CompFactory.DerivationFramework.ReVertex(
177 name =
"BPHY18_diMeson_revertex",
178 InputVtxContainerName =
"BeeKstCandidates",
180 PVRefitter = acc.popToolsAndMerge(PrimaryVertexRefittingToolCfg(flags)),
181 TrackIndices = [ 2, 3 ],
182 TrkVertexFitterTool = vkalvrt,
183 OutputVtxContainerName =
"BPHY18DiMeson"
186 BPHY18_Select_Kpi = CompFactory.DerivationFramework.Select_onia2mumu(
187 name =
"BPHY18_Select_Kpi",
188 HypothesisName =
"Kpi",
189 InputVtxContainerName =
"BPHY18DiMeson",
191 TrkMasses = [ 493.677, 139.570 ],
192 VtxMassHypo = 891.66,
198 BPHY18_Select_piK = CompFactory.DerivationFramework.Select_onia2mumu(
199 name =
"BPHY18_Select_piK",
200 HypothesisName =
"piK",
201 InputVtxContainerName =
"BPHY18DiMeson",
203 TrkMasses = [ 139.570, 493.677 ],
204 VtxMassHypo = 891.66,
210 from DerivationFrameworkTools.DerivationFrameworkToolsConfig
import (
211 xAODStringSkimmingToolCfg)
212 BPHY18_SelectBeeKstEvent = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
213 flags, name =
"BPHY18_SelectBeeKstEvent",
214 expression =
"(count(BeeKstCandidates.passed_Bd > 0) + count(BeeKstCandidates.passed_Bdbar > 0)) > 0"))
215 skimmingTools += [BPHY18_SelectBeeKstEvent]
217 BPHY18SkimmingAND = CompFactory.DerivationFramework.FilterCombinationAND(
218 "BPHY18SkimmingAND", FilterList = skimmingTools)
220 BPHY18_thinningTool_Tracks = CompFactory.DerivationFramework.Thin_vtxTrk(
221 name =
"BPHY18_thinningTool_Tracks",
222 TrackParticleContainerName =
"InDetTrackParticles",
223 StreamName = streamName,
224 VertexContainerNames = [
"BeeKstCandidates"],
225 PassFlags = [
"passed_Bd",
"passed_Bdbar"] )
227 BPHY18_thinningTool_GSFTracks = CompFactory.DerivationFramework.Thin_vtxTrk(
228 name =
"BPHY18_thinningTool_GSFTracks",
229 TrackParticleContainerName =
"GSFTrackParticles",
230 StreamName = streamName,
231 VertexContainerNames = [
"BeeKstCandidates"],
232 PassFlags = [
"passed_Bd",
"passed_Bdbar"] )
234 BPHY18_thinningTool_PV = CompFactory.DerivationFramework.BPhysPVThinningTool(
235 name =
"BPHY18_thinningTool_PV",
236 StreamName = streamName,
237 CandidateCollections = [
"BeeKstCandidates"],
241 BPHY18MuonTPThinningTool = CompFactory.DerivationFramework.MuonTrackParticleThinning(
242 name =
"BPHY18MuonTPThinningTool",
243 StreamName = streamName,
245 InDetTrackParticlesKey =
"InDetTrackParticles")
247 BPHY18EgammaTPThinningTool = CompFactory.DerivationFramework.EgammaTrackParticleThinning(
248 name =
"BPHY18EgammaTPThinningTool",
249 StreamName = streamName,
251 InDetTrackParticlesKey =
"InDetTrackParticles")
253 BPHY18TruthThinTool = CompFactory.DerivationFramework.GenericTruthThinning(name =
"BPHY18TruthThinTool",
254 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",
255 PreserveDescendants =
True,
256 StreamName = streamName,
257 PreserveAncestors =
True)
259 BPHY18TruthThinNoChainTool = CompFactory.DerivationFramework.GenericTruthThinning(name =
"BPHY18TruthThinNoChainTool",
260 ParticleSelectionString =
"abs(TruthParticles.pdgId) == 5 || abs(TruthParticles.pdgId) == 12 || abs(TruthParticles.pdgId) == 14",
261 PreserveDescendants =
False,
262 StreamName = streamName,
263 PreserveAncestors =
False)
265 thinningCollection = [ BPHY18_thinningTool_Tracks, BPHY18_thinningTool_GSFTracks,
266 BPHY18_thinningTool_PV,
267 BPHY18EgammaTPThinningTool, BPHY18MuonTPThinningTool
271 augTools = [ElectronPassLHvloosenod0,
272 BPHY18DiElectronSelectAndWrite, BPHY18_Select_DiElectrons,
273 BPHY18BeeKstSelectAndWrite, BPHY18_Select_BeeKst, BPHY18_Select_BeeKstbar,
274 BPHY18_diMeson_revertex, BPHY18_Select_Kpi, BPHY18_Select_piK]
275 skimTools = [BPHY18SkimmingAND]
278 thinningCollection += [BPHY18TruthThinTool,BPHY18TruthThinNoChainTool]
280 for t
in (augTools + skimTools + skimmingTools + thinningCollection +
284 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel(
"BPHY18Kernel",
285 AugmentationTools = augTools,
287 SkimmingTools = skimTools,
288 ThinningTools = thinningCollection))
290 from IsolationAlgs.DerivationTrackIsoConfig
import DerivationTrackIsoCfg
291 acc.merge(DerivationTrackIsoCfg(flags, object_types=(
"Electrons",
"Muons")))
298 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
299 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
300 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
301 BPHY18SlimmingHelper =
SlimmingHelper(
"BPHY18SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
302 from DerivationFrameworkBPhys.commonBPHYMethodsCfg
import getDefaultAllVariables
303 AllVariables = getDefaultAllVariables()
306 BPHY18SlimmingHelper.SmartCollections = [
"Electrons",
"Muons",
"InDetTrackParticles" ]
309 BPHY18SlimmingHelper.IncludeMuonTriggerContent =
False
310 BPHY18SlimmingHelper.IncludeBPhysTriggerContent =
False
311 BPHY18SlimmingHelper.IncludeEGammaTriggerContent =
True
313 AllVariables += [
"PrimaryVertices"]
314 StaticContent += [
"xAOD::VertexContainer#BPHY18RefittedPrimaryVertices"]
315 StaticContent += [
"xAOD::VertexAuxContainer#BPHY18RefittedPrimaryVerticesAux."]
317 ExtraVariables += [
"Muons.etaLayer1Hits.etaLayer2Hits.etaLayer3Hits.etaLayer4Hits.phiLayer1Hits.phiLayer2Hits.phiLayer3Hits.phiLayer4Hits",
318 "Muons.numberOfTriggerEtaLayers.numberOfPhiLayers",
319 "InDetTrackParticles.numberOfTRTHits.numberOfTRTHighThresholdHits.vx.vy.vz.pixeldEdx",
320 "PrimaryVertices.chiSquared.covariance",
321 "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",
322 "egammaClusters.calE.calEta.calPhi.e_sampl.eta_sampl.etaCalo.phiCalo.ETACALOFRAME.PHICALOFRAME",
323 "HLT_xAOD__ElectronContainer_egamma_ElectronsAuxDyn.charge"]
326 StaticContent += [
"xAOD::VertexContainer#%s" % BPHY18DiElectronSelectAndWrite.OutputVtxContainerName]
327 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY18DiElectronSelectAndWrite.OutputVtxContainerName]
329 StaticContent += [
"xAOD::VertexContainer#%s" % BPHY18BeeKstSelectAndWrite.OutputVtxContainerName]
330 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY18BeeKstSelectAndWrite.OutputVtxContainerName]
332 StaticContent += [
"xAOD::VertexContainer#%s" % BPHY18_diMeson_revertex.OutputVtxContainerName]
333 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY18_diMeson_revertex.OutputVtxContainerName]
335 AllVariables += [
"GSFTrackParticles"]
340 AllVariables += [
"TruthEvents",
"TruthParticles",
"TruthVertices",
"ElectronTruthParticles"]
342 AllVariables = list(
set(AllVariables))
344 BPHY18SlimmingHelper.AllVariables = AllVariables
345 BPHY18SlimmingHelper.ExtraVariables = ExtraVariables
347 BPHY18SlimmingHelper.StaticContent = StaticContent
349 from DerivationFrameworkEGamma.ElectronsCPDetailedContent
import ElectronsCPDetailedContent, GSFTracksCPDetailedContent
350 BPHY18SlimmingHelper.ExtraVariables += ElectronsCPDetailedContent
351 BPHY18SlimmingHelper.ExtraVariables += GSFTracksCPDetailedContent
353 BPHY18ItemList = BPHY18SlimmingHelper.GetItemList()
354 acc.merge(OutputStreamCfg(flags,
"DAOD_BPHY18", ItemList=BPHY18ItemList, AcceptAlgs=[
"BPHY18Kernel"]))
355 acc.merge(SetupMetaDataForStreamCfg(flags,
"DAOD_BPHY18", AcceptAlgs=[
"BPHY18Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
356 acc.printConfig(withDetails=
True, summariseProps=
True, onlyComponents = [], printDefaults=
True)