6 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory
import CompFactory
8 from AthenaConfiguration.Enums
import MetadataCategory
11 BPHYDerivationName =
"BPHY18"
12 streamName =
"StreamDAOD_BPHY18"
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
21 PartPropSvcName = acc.getPrimaryAndMerge(
PartPropSvcCfg(flags)).name
23 isSimulation = flags.Input.isMC
24 V0Tools = acc.popToolsAndMerge(
BPHY_V0ToolCfg(flags, BPHYDerivationName))
26 acc.addPublicTool(vkalvrt)
27 acc.addPublicTool(V0Tools)
29 acc.addPublicTool(trackselect)
31 acc.addPublicTool(vpest)
33 BPHY18TriggerSkim = CompFactory.DerivationFramework.TriggerSkimmingTool(
34 name =
"BPHY18TriggerSkim",
36 "HLT_e5_lhvloose_e3_lhvloose_bBeeM6000_L1BKeePrimary",
37 "HLT_2e5_bBeeM6000_L1BKeePrimary",
38 "HLT_e5_lhvloose_bBeeM6000_L1BKeePrimary",
39 "HLT_e5_lhvloose_e3_lhvloose_bBeeM6000_L1BKeePrescaled",
40 "HLT_2e5_bBeeM6000_L1BKeePrescaled",
41 "HLT_e5_lhvloose_bBeeM6000_L1BKeePrescaled"
45 ElectronLHSelectorLHvloose_nod0 = CompFactory.AsgElectronLikelihoodTool(
"ElectronLHSelectorLHvloosenod0",
46 primaryVertexContainer =
"PrimaryVertices",
47 ConfigFile=
"ElectronPhotonSelectorTools/offline/mc20_20230321/ElectronLikelihoodVeryLooseOfflineConfig2017_Smooth_NoD0_NoPix.conf")
51 ElectronPassLHvloosenod0 = CompFactory.DerivationFramework.EGElectronLikelihoodToolWrapper(name =
"ElectronPassLHvloosenod0",
52 EGammaElectronLikelihoodTool = ElectronLHSelectorLHvloose_nod0,
53 EGammaFudgeMCTool =
"",
55 StoreGateEntryName =
"DFCommonElectronsLHVeryLoosenod0",
56 ContainerName =
"Electrons",
59 BPHY18DiElectronFinder = CompFactory.Analysis.JpsiFinder_ee(
60 name =
"BPHY18DiElectronFinder",
63 TrackAndTrack =
False,
64 assumeDiElectrons =
True,
65 elThresholdPt = 4000.0,
66 invMassUpper = 7000.0,
69 oppChargesOnly =
False,
70 allChargeCombinations =
True,
71 useElectronTrackMeasurement =
True,
72 electronCollectionKey =
"Electrons",
73 TrackParticleCollection =
"GSFTrackParticles",
75 V0VertexFitterTool =
None,
77 TrkVertexFitterTool = vkalvrt,
78 TrackSelectorTool = trackselect,
79 VertexPointEstimator = vpest,
80 ElectronSelection =
"d0_or_nod0",
81 PartPropSvc = PartPropSvcName
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",
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",
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 BPHY18_SelectBeeKstEvent = CompFactory.DerivationFramework.xAODStringSkimmingTool(
207 name =
"BPHY18_SelectBeeKstEvent",
208 expression =
"(count(BeeKstCandidates.passed_Bd > 0) + count(BeeKstCandidates.passed_Bdbar > 0)) > 0")
210 BPHY18SkimmingAND = CompFactory.DerivationFramework.FilterCombinationAND(
212 FilterList = [BPHY18_SelectBeeKstEvent, BPHY18TriggerSkim])
213 extraTools += [BPHY18_SelectBeeKstEvent, BPHY18TriggerSkim, BPHY18SkimmingAND]
214 BPHY18_thinningTool_Tracks = CompFactory.DerivationFramework.Thin_vtxTrk(
215 name =
"BPHY18_thinningTool_Tracks",
216 TrackParticleContainerName =
"InDetTrackParticles",
217 StreamName = streamName,
218 VertexContainerNames = [
"BeeKstCandidates"],
219 PassFlags = [
"passed_Bd",
"passed_Bdbar"] )
221 BPHY18_thinningTool_GSFTracks = CompFactory.DerivationFramework.Thin_vtxTrk(
222 name =
"BPHY18_thinningTool_GSFTracks",
223 TrackParticleContainerName =
"GSFTrackParticles",
224 StreamName = streamName,
225 VertexContainerNames = [
"BeeKstCandidates"],
226 PassFlags = [
"passed_Bd",
"passed_Bdbar"] )
228 BPHY18_thinningTool_PV = CompFactory.DerivationFramework.BPhysPVThinningTool(
229 name =
"BPHY18_thinningTool_PV",
230 StreamName = streamName,
231 CandidateCollections = [
"BeeKstCandidates"],
235 BPHY18MuonTPThinningTool = CompFactory.DerivationFramework.MuonTrackParticleThinning(
236 name =
"BPHY18MuonTPThinningTool",
237 StreamName = streamName,
239 InDetTrackParticlesKey =
"InDetTrackParticles")
241 BPHY18EgammaTPThinningTool = CompFactory.DerivationFramework.EgammaTrackParticleThinning(
242 name =
"BPHY18EgammaTPThinningTool",
243 StreamName = streamName,
245 InDetTrackParticlesKey =
"InDetTrackParticles")
247 BPHY18TruthThinTool = CompFactory.DerivationFramework.GenericTruthThinning(name =
"BPHY18TruthThinTool",
248 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",
249 PreserveDescendants =
True,
250 StreamName = streamName,
251 PreserveAncestors =
True)
253 BPHY18TruthThinNoChainTool = CompFactory.DerivationFramework.GenericTruthThinning(name =
"BPHY18TruthThinNoChainTool",
254 ParticleSelectionString =
"abs(TruthParticles.pdgId) == 5 || abs(TruthParticles.pdgId) == 12 || abs(TruthParticles.pdgId) == 14",
255 PreserveDescendants =
False,
256 StreamName = streamName,
257 PreserveAncestors =
False)
259 thinningCollection = [ BPHY18_thinningTool_Tracks, BPHY18_thinningTool_GSFTracks,
260 BPHY18_thinningTool_PV,
261 BPHY18EgammaTPThinningTool, BPHY18MuonTPThinningTool
265 augTools = [ElectronPassLHvloosenod0,
266 BPHY18DiElectronSelectAndWrite, BPHY18_Select_DiElectrons,
267 BPHY18BeeKstSelectAndWrite, BPHY18_Select_BeeKst, BPHY18_Select_BeeKstbar,
268 BPHY18_diMeson_revertex, BPHY18_Select_Kpi, BPHY18_Select_piK]
269 skimTools = [BPHY18SkimmingAND]
272 thinningCollection += [BPHY18TruthThinTool,BPHY18TruthThinNoChainTool]
274 for t
in augTools + skimTools + thinningCollection + extraTools: acc.addPublicTool(t)
275 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel(
"BPHY18Kernel",
276 AugmentationTools = augTools,
278 SkimmingTools = skimTools,
279 ThinningTools = thinningCollection))
281 from IsolationAlgs.DerivationTrackIsoConfig
import DerivationTrackIsoCfg
289 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
290 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
291 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
292 BPHY18SlimmingHelper =
SlimmingHelper(
"BPHY18SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
293 from DerivationFrameworkBPhys.commonBPHYMethodsCfg
import getDefaultAllVariables
297 BPHY18SlimmingHelper.SmartCollections = [
"Electrons",
"Muons",
"InDetTrackParticles" ]
300 BPHY18SlimmingHelper.IncludeMuonTriggerContent =
False
301 BPHY18SlimmingHelper.IncludeBPhysTriggerContent =
False
302 BPHY18SlimmingHelper.IncludeEGammaTriggerContent =
True
304 AllVariables += [
"PrimaryVertices"]
305 StaticContent += [
"xAOD::VertexContainer#BPHY18RefittedPrimaryVertices"]
306 StaticContent += [
"xAOD::VertexAuxContainer#BPHY18RefittedPrimaryVerticesAux."]
308 ExtraVariables += [
"Muons.etaLayer1Hits.etaLayer2Hits.etaLayer3Hits.etaLayer4Hits.phiLayer1Hits.phiLayer2Hits.phiLayer3Hits.phiLayer4Hits",
309 "Muons.numberOfTriggerEtaLayers.numberOfPhiLayers",
310 "InDetTrackParticles.numberOfTRTHits.numberOfTRTHighThresholdHits.vx.vy.vz.pixeldEdx",
311 "PrimaryVertices.chiSquared.covariance",
312 "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",
313 "egammaClusters.calE.calEta.calPhi.e_sampl.eta_sampl.etaCalo.phiCalo.ETACALOFRAME.PHICALOFRAME",
314 "HLT_xAOD__ElectronContainer_egamma_ElectronsAuxDyn.charge"]
317 StaticContent += [
"xAOD::VertexContainer#%s" % BPHY18DiElectronSelectAndWrite.OutputVtxContainerName]
318 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY18DiElectronSelectAndWrite.OutputVtxContainerName]
320 StaticContent += [
"xAOD::VertexContainer#%s" % BPHY18BeeKstSelectAndWrite.OutputVtxContainerName]
321 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY18BeeKstSelectAndWrite.OutputVtxContainerName]
323 StaticContent += [
"xAOD::VertexContainer#%s" % BPHY18_diMeson_revertex.OutputVtxContainerName]
324 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY18_diMeson_revertex.OutputVtxContainerName]
326 AllVariables += [
"GSFTrackParticles"]
331 AllVariables += [
"TruthEvents",
"TruthParticles",
"TruthVertices",
"ElectronTruthParticles"]
333 AllVariables =
list(
set(AllVariables))
335 BPHY18SlimmingHelper.AllVariables = AllVariables
336 BPHY18SlimmingHelper.ExtraVariables = ExtraVariables
338 BPHY18SlimmingHelper.StaticContent = StaticContent
340 from DerivationFrameworkEGamma.ElectronsCPDetailedContent
import ElectronsCPDetailedContent, GSFTracksCPDetailedContent
341 BPHY18SlimmingHelper.ExtraVariables += ElectronsCPDetailedContent
342 BPHY18SlimmingHelper.ExtraVariables += GSFTracksCPDetailedContent
344 BPHY18ItemList = BPHY18SlimmingHelper.GetItemList()
345 acc.merge(
OutputStreamCfg(flags,
"DAOD_BPHY18", ItemList=BPHY18ItemList, AcceptAlgs=[
"BPHY18Kernel"]))
346 acc.merge(
SetupMetaDataForStreamCfg(flags,
"DAOD_BPHY18", AcceptAlgs=[
"BPHY18Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
347 acc.printConfig(withDetails=
True, summariseProps=
True, onlyComponents = [], printDefaults=
True, printComponentsOnly=
False)