7 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
8 from AthenaConfiguration.ComponentFactory
import CompFactory
9 from AthenaConfiguration.Enums
import MetadataCategory
13 """Configure the skimming tool"""
16 from DerivationFrameworkJetEtMiss
import TriggerLists
17 metTriggers = TriggerLists.MET_Trig(flags)
18 elTriggers = TriggerLists.single_el_Trig(flags)
19 muTriggers = TriggerLists.single_mu_Trig(flags)
21 addRun3METTriggers = [
"HLT_xe55_cell_xe70_tcpufit_xe90_pfsum_vssk_L1XE50",
"HLT_xe55_cell_xe70_tcpufit_xe95_pfsum_cssk_L1XE50",
"HLT_xe60_cell_xe95_pfsum_cssk_L1XE50",
"HLT_xe65_cell_xe100_mhtpufit_pf_L1XE50",
"HLT_xe65_cell_xe105_mhtpufit_em_L1XE50",
"HLT_xe75_cell_xe65_tcpufit_xe90_trkmht_L1XE50",
"HLT_xe65_cell_xe90_pfopufit_L1XE50",
"HLT_xe80_cell_xe115_tcpufit_L1XE50"]
23 addRun3ElectronTriggers = [
"HLT_e17_lhvloose_L1EM15VHI",
"HLT_e20_lhvloose_L1EM15VH",
"HLT_e250_etcut_L1EM22VHI",
24 "HLT_e26_lhtight_ivarloose_L1EM22VHI",
"HLT_e26_lhtight_ivarloose_L1eEM26M",
25 "HLT_e60_lhmedium_L1EM22VHI",
"HLT_e60_lhmedium_L1eEM26M",
26 "HLT_e140_lhloose_L1EM22VHI",
"HLT_e140_lhloose_L1eEM26M",
27 "HLT_e300_etcut_L1EM22VHI",
"HLT_e300_etcut_L1eEM26M",
28 "HLT_e140_lhloose_noringer_L1EM22VHI",
"HLT_e140_lhloose_noringer_L1eEM26M"]
30 addRund3MuonTriggers = [
"HLT_mu24_ivarmedium_L1MU14FCH",
"HLT_mu50_L1MU14FCH",
"HLT_mu60_0eta105_msonly_L1MU14FCH",
"HLT_mu60_L1MU14FCH",
"HLT_mu80_msonly_3layersEC_L1MU14FCH"]
32 metTriggers = metTriggers+addRun3METTriggers
33 elTriggers = elTriggers+addRun3ElectronTriggers
34 muTriggers = muTriggers+addRund3MuonTriggers
37 if not flags.Input.isMC:
39 from CoolConvUtilities.MagFieldUtils
import getFieldForRun
40 magfield=
getFieldForRun(flags.Input.RunNumbers[0],lumiblock=flags.Input.LumiBlockNumbers[0])
41 addTtbarEvents = magfield.solenoidCurrent() > 0
45 tracks =
'InDetTrackParticles.TrkIsoPt1000_ptcone20 < 0.12*InDetTrackParticles.pt && InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 5.0*mm'
47 trackRequirements =
'(InDetTrackParticles.pt > 6.*GeV && '+tracks+
' )'
48 trackRequirementsMu =
'(InDetTrackParticles.pt > 40.*GeV && '+tracks+
' )'
49 jetRequirementsTtbar =
'(AntiKt4EMPFlowJets.pt > 18*GeV && log(BTagging_AntiKt4EMPFlow.DL1dv01_pb/(0.018*BTagging_AntiKt4EMPFlow.DL1dv01_pc+(1.0-0.018)*BTagging_AntiKt4EMPFlow.DL1dv01_pu)) > 0.948)'
50 trackRequirementsNoIso =
'(InDetTrackParticles.pt > 10.*GeV && abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 5.0*mm )'
52 muonsRequirements =
'(Muons.pt >= 20.*GeV) && (abs(Muons.eta) < 2.6) && (Muons.DFCommonMuonPassPreselection)'
53 electronsRequirements =
'(Electrons.pt > 20.*GeV) && (abs(Electrons.eta) < 2.6) && ((Electrons.Loose) || (Electrons.DFCommonElectronsLHLoose))'
56 expression_W =
'( count('+trackRequirements+
') >=1 )'
57 expression_Mu =
'( count('+trackRequirementsMu+
') >=1 )'
58 expression_ttbarEl =
'( count('+electronsRequirements+
') >=1 ) && ( count('+jetRequirementsTtbar+
') >=1 ) && ( count('+trackRequirementsNoIso+
') >=2 ) && ( count('+trackRequirements+
') >=1 )'
59 expression_ttbarElNoTag =
'( count('+electronsRequirements+
') >=1 ) && ( count('+trackRequirements+
') >=1 )'
60 expression_ttbarMu =
'( count('+muonsRequirements+
') >=1 ) && ( count('+jetRequirementsTtbar+
') >=1 ) && ( count('+trackRequirementsNoIso+
') >=2 ) && ( count('+trackRequirements+
') >=1 )'
61 expression_ttbarMuNoTag =
'( count('+muonsRequirements+
') >=1 ) && ( count('+trackRequirements+
') >=1 )'
63 skimmingTool_W = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"skimmingTool_W", expression = expression_W)
64 acc.addPublicTool(skimmingTool_W)
65 skimmingTool_Mu = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"skimmingTool_mu", expression = expression_Mu)
66 acc.addPublicTool(skimmingTool_Mu)
69 JETM12TriggerSkimmingTool_W = CompFactory.DerivationFramework.TriggerSkimmingTool(name =
"JETM12TriggerSkimmingTool_W", TriggerListOR = metTriggers)
70 acc.addPublicTool(JETM12TriggerSkimmingTool_W)
71 JETM12TriggerSkimmingTool_ele = CompFactory.DerivationFramework.TriggerSkimmingTool(name =
"JETM12TriggerSkimmingTool_ele", TriggerListOR = elTriggers)
72 acc.addPublicTool(JETM12TriggerSkimmingTool_ele)
73 JETM12TriggerSkimmingTool_mu = CompFactory.DerivationFramework.TriggerSkimmingTool(name =
"JETM12TriggerSkimmingTool_mu", TriggerListOR = muTriggers)
74 acc.addPublicTool(JETM12TriggerSkimmingTool_mu)
76 JETM12SkimmingTool_W = CompFactory.DerivationFramework.FilterCombinationAND(name=
"JETM12SkimmingTool_W", FilterList=[skimmingTool_W, JETM12TriggerSkimmingTool_W])
77 acc.addPublicTool(JETM12SkimmingTool_W)
78 JETM12SkimmingTool_Mu = CompFactory.DerivationFramework.FilterCombinationAND(name=
"JETM12SkimmingTool_Mu", FilterList=[skimmingTool_Mu, JETM12TriggerSkimmingTool_mu])
79 acc.addPublicTool(JETM12SkimmingTool_Mu)
81 finalSkimmingTools = [JETM12SkimmingTool_W,JETM12SkimmingTool_Mu]
84 skimmingTool_ttbarEl = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"skimmingTool_ttbarEl", expression = expression_ttbarEl)
85 acc.addPublicTool(skimmingTool_ttbarEl)
86 skimmingTool_ttbarElNoTag = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"skimmingTool_ttbarElNoTag", expression = expression_ttbarElNoTag)
87 acc.addPublicTool(skimmingTool_ttbarElNoTag)
88 skimmingTool_ttbarMu = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"skimmingTool_ttbarMu", expression = expression_ttbarMu)
89 acc.addPublicTool(skimmingTool_ttbarMu)
90 skimmingTool_ttbarMuNoTag = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"skimmingTool_ttbarMuNoTag", expression = expression_ttbarMuNoTag)
91 acc.addPublicTool(skimmingTool_ttbarMuNoTag)
93 JETM12SkimmingTool_ttbarEl = CompFactory.DerivationFramework.FilterCombinationAND(name=
"JETM12SkimmingTool_ttbarEl",FilterList=[skimmingTool_ttbarEl,JETM12TriggerSkimmingTool_ele])
94 acc.addPublicTool(JETM12SkimmingTool_ttbarEl)
95 JETM12SkimmingTool_ttbarElNoTag = CompFactory.DerivationFramework.FilterCombinationAND(name=
"JETM12SkimmingTool_ttbarElNoTag",FilterList=[skimmingTool_ttbarElNoTag,JETM12TriggerSkimmingTool_ele])
96 acc.addPublicTool(JETM12SkimmingTool_ttbarElNoTag)
97 JETM12SkimmingTool_ttbarMu = CompFactory.DerivationFramework.FilterCombinationAND(name=
"JETM12SkimmingTool_ttbarMu",FilterList=[skimmingTool_ttbarMu,JETM12TriggerSkimmingTool_mu])
98 acc.addPublicTool(JETM12SkimmingTool_ttbarMu)
99 JETM12SkimmingTool_ttbarMuNoTag = CompFactory.DerivationFramework.FilterCombinationAND(name=
"JETM12SkimmingTool_ttbarMuNoTag",FilterList=[skimmingTool_ttbarMuNoTag,JETM12TriggerSkimmingTool_mu])
100 acc.addPublicTool(JETM12SkimmingTool_ttbarMuNoTag)
102 finalSkimmingTools = [JETM12SkimmingTool_W, JETM12SkimmingTool_Mu, JETM12SkimmingTool_ttbarEl, JETM12SkimmingTool_ttbarMu, JETM12SkimmingTool_ttbarElNoTag, JETM12SkimmingTool_ttbarMuNoTag]
104 JETM12SkimmingTool = CompFactory.DerivationFramework.FilterCombinationOR(name=
"JETM12SkimmingTool", FilterList=finalSkimmingTools)
105 acc.addPublicTool(JETM12SkimmingTool, primary =
True)
110 """Configure the augmentation tool for skimming"""
115 from InDetConfig.InDetTrackSelectionToolConfig
import InDetTrackSelectionTool_Loose_Cfg
117 name =
"TrackSelectionTool1000_JETM12",
121 from TrackVertexAssociationTool.TrackVertexAssociationToolConfig
import isoTTVAToolCfg
122 toolkwargs[
'TTVATool'] = acc.popToolsAndMerge(
isoTTVAToolCfg(flags))
124 toolkwargs[
"name"] =
"TrackIsolationToolPt1000"
125 TrackIsoTool = CompFactory.xAOD.TrackIsolationTool(**toolkwargs)
126 acc.addPublicTool(TrackIsoTool)
128 from xAODPrimitives.xAODIso
import xAODIso
as isoPar
129 Pt1000IsoTrackDecorator = CompFactory.DerivationFramework.trackIsolationDecorator(name =
"Pt1000IsoTrackDecorator",
130 TrackIsolationTool = TrackIsoTool,
131 TargetContainer =
"InDetTrackParticles",
132 ptcones = [isoPar.ptcone40,isoPar.ptcone30,isoPar.ptcone20],
133 Prefix =
'TrkIsoPt1000_')
135 acc.addPublicTool(Pt1000IsoTrackDecorator, primary=
True)
140 """Configure the augmentation tool"""
145 from InDetConfig.InDetTrackSelectionToolConfig
import InDetTrackSelectionTool_Loose_Cfg
147 name =
"TrackSelectionTool500_JETM12",
150 from TrackVertexAssociationTool.TrackVertexAssociationToolConfig
import isoTTVAToolCfg
151 toolkwargs[
'TTVATool'] = acc.popToolsAndMerge(
isoTTVAToolCfg(flags))
153 toolkwargs[
"name"] =
"TrackIsolationToolPt500"
154 TrackIsoTool = CompFactory.xAOD.TrackIsolationTool(**toolkwargs)
155 acc.addPublicTool(TrackIsoTool)
157 from xAODPrimitives.xAODIso
import xAODIso
as isoPar
158 Pt500IsoTrackDecorator = CompFactory.DerivationFramework.trackIsolationDecorator(name =
"Pt500IsoTrackDecorator",
159 TrackIsolationTool = TrackIsoTool,
160 TargetContainer =
"InDetTrackParticles",
161 ptcones = [isoPar.ptcone40,isoPar.ptcone30,isoPar.ptcone20],
162 Prefix =
'TrkIsoPt500_')
164 acc.addPublicTool(Pt500IsoTrackDecorator, primary=
True)
170 """Configure the derivation framework driving algorithm (kernel) for JETM12"""
174 from DerivationFrameworkPhys.PhysCommonConfig
import PhysCommonAugmentationsCfg
178 from AthenaCommon.CFElements
import seqAND
179 acc.addSequence(
seqAND(
"JETM12Sequence") )
180 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
183 skimmingKernel =
DerivationKernel(kwargs[
"PreselectionName"], SkimmingTools = [skimmingTool], AugmentationTools = [augmentationToolSkim])
184 acc.addEventAlgo( skimmingKernel, sequenceName=
"JETM12Sequence" )
187 from DerivationFrameworkInDet.InDetToolsConfig
import TrackParticleThinningCfg, MuonTrackParticleThinningCfg, EgammaTrackParticleThinningCfg, TauTrackParticleThinningCfg
190 JETM12_thinning_expression =
"( InDetTrackParticles.pt > 6*GeV && InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 5.0*mm )"
193 name =
"JETM12TrackParticleThinningTool",
194 StreamName = kwargs[
'StreamName'],
195 SelectionString = JETM12_thinning_expression,
196 InDetTrackParticlesKey =
"InDetTrackParticles"))
201 name =
"JETM12MuonTPThinningTool",
202 StreamName = kwargs[
'StreamName'],
204 InDetTrackParticlesKey =
"InDetTrackParticles"))
209 name =
"JETM12ElectronTPThinningTool",
210 StreamName = kwargs[
'StreamName'],
212 InDetTrackParticlesKey =
"InDetTrackParticles"))
217 name =
"JETM12PhotonTPThinningTool",
218 StreamName = kwargs[
'StreamName'],
220 InDetTrackParticlesKey =
"InDetTrackParticles",
221 GSFConversionVerticesKey =
"GSFConversionVertices"))
226 name =
"JETM12TauTPThinningTool",
227 StreamName = kwargs[
'StreamName'],
229 InDetTrackParticlesKey =
"InDetTrackParticles",
230 DoTauTracksThinning =
True,
231 TauTracksKey =
"TauTracks"))
233 thinningTools = [JETM12TrackParticleThinningTool,
234 JETM12MuonTPThinningTool,
235 JETM12ElectronTPThinningTool,
236 JETM12PhotonTPThinningTool,
237 JETM12TauTPThinningTool]
240 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig
import CaloClusterThinningCfg
241 selectionString =
"( InDetTrackParticles.pt > 6*GeV && InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 5.0*mm )"
243 name =
"JETM12CaloClusterThinning",
244 StreamName = kwargs[
'StreamName'],
245 SGKey =
"InDetTrackParticles",
246 TopoClCollectionSGKey =
"CaloCalTopoClusters",
247 SelectionString = selectionString,
249 acc.addPublicTool(JETM12CaloThinningTool)
250 thinningTools.append(JETM12CaloThinningTool)
253 truth_cond_status =
"( (TruthParticles.status == 1) && (TruthParticles.barcode < 200000) && (TruthParticles.pt > 8*GeV) )"
254 truth_cond_Lepton =
"((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16) && (TruthParticles.barcode < 200000))"
255 truth_expression =
'('+truth_cond_status+
' || '+truth_cond_Lepton +
')'
257 JETM12TruthThinningTool = CompFactory.DerivationFramework.GenericTruthThinning(name =
"JETM12TruthThinningTool",
258 StreamName = kwargs[
'StreamName'],
259 ParticleSelectionString = truth_expression,
260 PreserveDescendants =
False,
261 PreserveGeneratorDescendants =
True,
262 PreserveAncestors =
False)
264 acc.addPublicTool(JETM12TruthThinningTool)
265 thinningTools.append(JETM12TruthThinningTool)
272 ThinningTools = thinningTools,
273 AugmentationTools = [augmentationTool]),
274 sequenceName=
"JETM12Sequence")
286 from DerivationFrameworkPhys.TriggerListsHelper
import TriggerListsHelper
287 JETM12TriggerListsHelper = TriggerListsHelper(flags)
290 acc.merge(
JETM12KernelCfg(flags, name=
"JETM12Kernel", PreselectionName=
"JETM12PreselectionKernel", StreamName =
'StreamDAOD_JETM12', TriggerListsHelper = JETM12TriggerListsHelper))
295 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
296 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
297 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
299 JETM12SlimmingHelper =
SlimmingHelper(
"JETM12SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
301 JETM12SlimmingHelper.SmartCollections = [
"EventInfo",
302 "Electrons",
"Photons",
"Muons",
"TauJets",
303 "InDetTrackParticles",
"PrimaryVertices",
304 "MET_Baseline_AntiKt4EMPFlow",
305 "AntiKt4EMPFlowJets",
306 "BTagging_AntiKt4EMPFlow"]
308 JETM12SlimmingHelper.AllVariables = [
"MuonSegments",
"InDetTrackParticles",
309 "Kt4EMTopoOriginEventShape",
"Kt4EMPFlowEventShape",
"CaloCalTopoClusters"]
311 JETM12SlimmingHelper.ExtraVariables = [
"InDetTrackParticles.TrkIsoPt1000_ptcone40.TrkIsoPt1000_ptcone30.TrkIsoPt1000_ptcone20.TrkIsoPt500_ptcone40.TrkIsoPt500_ptcone30.TrkIsoPt500_ptcone20"]
314 from DerivationFrameworkMCTruth.MCTruthCommonConfig
import addTruth3ContentToSlimmerTool
317 JETM12SlimmingHelper.AppendToDictionary.update({
'TruthParticles':
'xAOD::TruthParticleContainer',
318 'TruthParticlesAux':
'xAOD::TruthParticleAuxContainer'})
320 JETM12SlimmingHelper.SmartCollections += [
"AntiKt4TruthJets"]
321 JETM12SlimmingHelper.AllVariables += [
"MuonTruthParticles",
"TruthParticles",
"TruthVertices"]
324 JETM12SlimmingHelper.IncludeTriggerNavigation =
False
325 JETM12SlimmingHelper.IncludeJetTriggerContent =
False
326 JETM12SlimmingHelper.IncludeMuonTriggerContent =
False
327 JETM12SlimmingHelper.IncludeEGammaTriggerContent =
False
328 JETM12SlimmingHelper.IncludeTauTriggerContent =
False
329 JETM12SlimmingHelper.IncludeEtMissTriggerContent =
False
330 JETM12SlimmingHelper.IncludeBJetTriggerContent =
False
331 JETM12SlimmingHelper.IncludeBPhysTriggerContent =
False
332 JETM12SlimmingHelper.IncludeMinBiasTriggerContent =
False
335 JETM12ItemList = JETM12SlimmingHelper.GetItemList()
336 acc.merge(
OutputStreamCfg(flags,
"DAOD_JETM12", ItemList=JETM12ItemList, AcceptAlgs=[
"JETM12Kernel"]))
337 acc.merge(
SetupMetaDataForStreamCfg(flags,
"DAOD_JETM12", AcceptAlgs=[
"JETM12Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))