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
20 isSimulation = flags.Input.isMC
21 V0Tools = acc.popToolsAndMerge(
BPHY_V0ToolCfg(flags, BPHYDerivationName))
23 acc.addPublicTool(vkalvrt)
24 acc.addPublicTool(V0Tools)
26 acc.addPublicTool(trackselect)
28 acc.addPublicTool(vpest)
34 ElectronLHSelectorLHvloose_nod0 = CompFactory.AsgElectronLikelihoodTool(
"ElectronLHSelectorLHvloosenod0",
35 primaryVertexContainer =
"PrimaryVertices",
36 ConfigFile=
"ElectronPhotonSelectorTools/offline/mc20_20230321/ElectronLikelihoodVeryLooseOfflineConfig2017_Smooth_NoD0_NoPix.conf")
40 ElectronPassLHvloosenod0 = CompFactory.DerivationFramework.EGElectronLikelihoodToolWrapper(name =
"ElectronPassLHvloosenod0",
41 EGammaElectronLikelihoodTool = ElectronLHSelectorLHvloose_nod0,
42 EGammaFudgeMCTool =
"",
44 StoreGateEntryName =
"DFCommonElectronsLHVeryLoosenod0",
45 ContainerName =
"Electrons",
48 BPHY18DiElectronFinder = CompFactory.Analysis.JpsiFinder_ee(
49 name =
"BPHY18DiElectronFinder",
52 TrackAndTrack =
False,
53 assumeDiElectrons =
True,
54 elThresholdPt = 4000.0,
55 invMassUpper = 7000.0,
58 oppChargesOnly =
False,
59 allChargeCombinations =
True,
60 useElectronTrackMeasurement =
True,
61 electronCollectionKey =
"Electrons",
62 TrackParticleCollection =
"GSFTrackParticles",
64 V0VertexFitterTool =
None,
66 TrkVertexFitterTool = vkalvrt,
67 TrackSelectorTool = trackselect,
68 VertexPointEstimator = vpest,
69 ElectronSelection =
"d0_or_nod0"
71 extraTools = [BPHY18DiElectronFinder]
72 BPHY18DiElectronSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
73 name =
"BPHY18DiElectronSelectAndWrite",
74 VertexSearchTool = BPHY18DiElectronFinder,
75 OutputVtxContainerName =
"BPHY18DiElectronCandidates",
76 PVContainerName =
"PrimaryVertices",
79 RefPVContainerName =
"SHOULDNOTBEUSED",
83 BPHY18_Select_DiElectrons = CompFactory.DerivationFramework.Select_onia2mumu(
84 name =
"BPHY18_Select_DiElectrons",
85 HypothesisName =
"Jpsi",
86 InputVtxContainerName =
"BPHY18DiElectronCandidates",
88 VtxMassHypo = 3096.916,
95 BPHY18BeeKst = CompFactory.Analysis.JpsiPlus2Tracks(
96 name =
"BPHY18BeeKstFinder",
97 kaonkaonHypothesis =
False,
98 pionpionHypothesis =
False,
99 kaonpionHypothesis =
True,
100 oppChargesOnly =
False,
101 SameChargesOnly =
False,
102 trkThresholdPt = 500.0,
104 BThresholdPt = 1000.,
107 JpsiContainerKey =
"BPHY18DiElectronCandidates",
108 TrackParticleCollection =
"InDetTrackParticles",
109 ExcludeCrossJpsiTracks =
False,
110 TrkVertexFitterTool = vkalvrt,
111 TrackSelectorTool = trackselect,
112 UseMassConstraint =
False,
113 DiTrackMassUpper = 1110.,
114 DiTrackMassLower = 690.,
117 TrkQuadrupletMassLower = 1000.0,
118 TrkQuadrupletMassUpper = 10000.0,
119 FinalDiTrackPt = 500.,
120 UseGSFTrackIndices = [0,1]
122 BPHY18BeeKstSelectAndWrite = CompFactory.DerivationFramework.Reco_Vertex(
123 name =
"BPHY18BeeKstSelectAndWrite",
124 VertexSearchTool = BPHY18BeeKst,
125 OutputVtxContainerName =
"BeeKstCandidates",
126 PVContainerName =
"PrimaryVertices",
127 RefPVContainerName =
"BPHY18RefittedPrimaryVertices",
135 BPHY18_Select_BeeKst = CompFactory.DerivationFramework.Select_onia2mumu(
136 name =
"BPHY18_Select_BeeKst",
137 HypothesisName =
"Bd",
138 InputVtxContainerName =
"BeeKstCandidates",
140 TrkMasses = [0.511, 0.511, 493.677, 139.570],
141 VtxMassHypo = 5279.6,
147 BPHY18_Select_BeeKstbar = CompFactory.DerivationFramework.Select_onia2mumu(
148 name =
"BPHY18_Select_Bd2JpsiKstbar",
149 HypothesisName =
"Bdbar",
150 InputVtxContainerName =
"BeeKstCandidates",
152 TrkMasses = [0.511, 0.511, 139.570, 493.677],
153 VtxMassHypo = 5279.6,
160 BPHY18_diMeson_revertex = CompFactory.DerivationFramework.ReVertex(
161 name =
"BPHY18_diMeson_revertex",
162 InputVtxContainerName =
"BeeKstCandidates",
165 TrackIndices = [ 2, 3 ],
166 TrkVertexFitterTool = vkalvrt,
167 OutputVtxContainerName =
"BPHY18DiMeson"
170 BPHY18_Select_Kpi = CompFactory.DerivationFramework.Select_onia2mumu(
171 name =
"BPHY18_Select_Kpi",
172 HypothesisName =
"Kpi",
173 InputVtxContainerName =
"BPHY18DiMeson",
175 TrkMasses = [ 493.677, 139.570 ],
176 VtxMassHypo = 891.66,
182 BPHY18_Select_piK = CompFactory.DerivationFramework.Select_onia2mumu(
183 name =
"BPHY18_Select_piK",
184 HypothesisName =
"piK",
185 InputVtxContainerName =
"BPHY18DiMeson",
187 TrkMasses = [ 139.570, 493.677 ],
188 VtxMassHypo = 891.66,
194 BPHY18_SelectBeeKstEvent = CompFactory.DerivationFramework.xAODStringSkimmingTool(
195 name =
"BPHY18_SelectBeeKstEvent",
196 expression =
"(count(BeeKstCandidates.passed_Bd > 0) + count(BeeKstCandidates.passed_Bdbar > 0)) > 0")
198 BPHY18SkimmingAND = CompFactory.DerivationFramework.FilterCombinationAND(
201 FilterList = [BPHY18_SelectBeeKstEvent])
202 extraTools += [BPHY18_SelectBeeKstEvent, BPHY18SkimmingAND]
203 BPHY18_thinningTool_Tracks = CompFactory.DerivationFramework.Thin_vtxTrk(
204 name =
"BPHY18_thinningTool_Tracks",
205 TrackParticleContainerName =
"InDetTrackParticles",
206 StreamName = streamName,
207 VertexContainerNames = [
"BeeKstCandidates"],
208 PassFlags = [
"passed_Bd",
"passed_Bdbar"] )
210 BPHY18_thinningTool_GSFTracks = CompFactory.DerivationFramework.Thin_vtxTrk(
211 name =
"BPHY18_thinningTool_GSFTracks",
212 TrackParticleContainerName =
"GSFTrackParticles",
213 StreamName = streamName,
214 VertexContainerNames = [
"BeeKstCandidates"],
215 PassFlags = [
"passed_Bd",
"passed_Bdbar"] )
217 BPHY18_thinningTool_PV = CompFactory.DerivationFramework.BPhysPVThinningTool(
218 name =
"BPHY18_thinningTool_PV",
219 StreamName = streamName,
220 CandidateCollections = [
"BeeKstCandidates"],
224 BPHY18MuonTPThinningTool = CompFactory.DerivationFramework.MuonTrackParticleThinning(
225 name =
"BPHY18MuonTPThinningTool",
226 StreamName = streamName,
228 InDetTrackParticlesKey =
"InDetTrackParticles")
230 BPHY18EgammaTPThinningTool = CompFactory.DerivationFramework.EgammaTrackParticleThinning(
231 name =
"BPHY18EgammaTPThinningTool",
232 StreamName = streamName,
234 InDetTrackParticlesKey =
"InDetTrackParticles")
236 BPHY18TruthThinTool = CompFactory.DerivationFramework.GenericTruthThinning(name =
"BPHY18TruthThinTool",
237 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",
238 PreserveDescendants =
True,
239 StreamName = streamName,
240 PreserveAncestors =
True)
242 BPHY18TruthThinNoChainTool = CompFactory.DerivationFramework.GenericTruthThinning(name =
"BPHY18TruthThinNoChainTool",
243 ParticleSelectionString =
"abs(TruthParticles.pdgId) == 5 || abs(TruthParticles.pdgId) == 12 || abs(TruthParticles.pdgId) == 14",
244 PreserveDescendants =
False,
245 StreamName = streamName,
246 PreserveAncestors =
False)
248 thinningCollection = [ BPHY18_thinningTool_Tracks, BPHY18_thinningTool_GSFTracks,
249 BPHY18_thinningTool_PV,
250 BPHY18EgammaTPThinningTool, BPHY18MuonTPThinningTool
254 augTools = [ElectronPassLHvloosenod0,
255 BPHY18DiElectronSelectAndWrite, BPHY18_Select_DiElectrons,
256 BPHY18BeeKstSelectAndWrite, BPHY18_Select_BeeKst, BPHY18_Select_BeeKstbar,
257 BPHY18_diMeson_revertex, BPHY18_Select_Kpi, BPHY18_Select_piK]
258 skimTools = [BPHY18SkimmingAND]
261 thinningCollection += [BPHY18TruthThinTool,BPHY18TruthThinNoChainTool]
263 for t
in augTools + skimTools + thinningCollection + extraTools: acc.addPublicTool(t)
264 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel(
"BPHY18Kernel",
265 AugmentationTools = augTools,
267 SkimmingTools = skimTools,
268 ThinningTools = thinningCollection))
270 from IsolationAlgs.DerivationTrackIsoConfig
import DerivationTrackIsoCfg
278 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
279 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
280 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
281 BPHY18SlimmingHelper =
SlimmingHelper(
"BPHY18SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
282 from DerivationFrameworkBPhys.commonBPHYMethodsCfg
import getDefaultAllVariables
286 BPHY18SlimmingHelper.SmartCollections = [
"Electrons",
"Muons",
"InDetTrackParticles" ]
289 BPHY18SlimmingHelper.IncludeMuonTriggerContent =
False
290 BPHY18SlimmingHelper.IncludeBPhysTriggerContent =
False
291 BPHY18SlimmingHelper.IncludeEGammaTriggerContent =
True
293 AllVariables += [
"PrimaryVertices"]
294 StaticContent += [
"xAOD::VertexContainer#BPHY18RefittedPrimaryVertices"]
295 StaticContent += [
"xAOD::VertexAuxContainer#BPHY18RefittedPrimaryVerticesAux."]
297 ExtraVariables += [
"Muons.etaLayer1Hits.etaLayer2Hits.etaLayer3Hits.etaLayer4Hits.phiLayer1Hits.phiLayer2Hits.phiLayer3Hits.phiLayer4Hits",
298 "Muons.numberOfTriggerEtaLayers.numberOfPhiLayers",
299 "InDetTrackParticles.numberOfTRTHits.numberOfTRTHighThresholdHits.vx.vy.vz.pixeldEdx",
300 "PrimaryVertices.chiSquared.covariance",
301 "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",
302 "egammaClusters.calE.calEta.calPhi.e_sampl.eta_sampl.etaCalo.phiCalo.ETACALOFRAME.PHICALOFRAME",
303 "HLT_xAOD__ElectronContainer_egamma_ElectronsAuxDyn.charge"]
306 StaticContent += [
"xAOD::VertexContainer#%s" % BPHY18DiElectronSelectAndWrite.OutputVtxContainerName]
307 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY18DiElectronSelectAndWrite.OutputVtxContainerName]
309 StaticContent += [
"xAOD::VertexContainer#%s" % BPHY18BeeKstSelectAndWrite.OutputVtxContainerName]
310 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY18BeeKstSelectAndWrite.OutputVtxContainerName]
312 StaticContent += [
"xAOD::VertexContainer#%s" % BPHY18_diMeson_revertex.OutputVtxContainerName]
313 StaticContent += [
"xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % BPHY18_diMeson_revertex.OutputVtxContainerName]
315 AllVariables += [
"GSFTrackParticles"]
320 AllVariables += [
"TruthEvents",
"TruthParticles",
"TruthVertices",
"ElectronTruthParticles"]
322 AllVariables =
list(
set(AllVariables))
324 BPHY18SlimmingHelper.AllVariables = AllVariables
325 BPHY18SlimmingHelper.ExtraVariables = ExtraVariables
327 BPHY18SlimmingHelper.StaticContent = StaticContent
329 from DerivationFrameworkEGamma.ElectronsCPDetailedContent
import ElectronsCPDetailedContent, GSFTracksCPDetailedContent
330 BPHY18SlimmingHelper.ExtraVariables += ElectronsCPDetailedContent
331 BPHY18SlimmingHelper.ExtraVariables += GSFTracksCPDetailedContent
333 BPHY18ItemList = BPHY18SlimmingHelper.GetItemList()
334 acc.merge(
OutputStreamCfg(flags,
"DAOD_BPHY18", ItemList=BPHY18ItemList, AcceptAlgs=[
"BPHY18Kernel"]))
335 acc.merge(
SetupMetaDataForStreamCfg(flags,
"DAOD_BPHY18", AcceptAlgs=[
"BPHY18Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
336 acc.printConfig(withDetails=
True, summariseProps=
True, onlyComponents = [], printDefaults=
True, printComponentsOnly=
False)