6 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory
import CompFactory
8 from AthenaConfiguration.Enums
import MetadataCategory
12 """Configure the skimming tool"""
15 from DerivationFrameworkJetEtMiss
import TriggerLists
16 metTriggers = TriggerLists.MET_Trig(flags)
17 elTriggers = TriggerLists.single_el_Trig(flags)
18 muTriggers = TriggerLists.single_mu_Trig(flags)
20 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"]
22 addRun3ElectronTriggers = [
"HLT_e17_lhvloose_L1EM15VHI",
"HLT_e20_lhvloose_L1EM15VH",
"HLT_e250_etcut_L1EM22VHI",
23 "HLT_e26_lhtight_ivarloose_L1EM22VHI",
"HLT_e26_lhtight_ivarloose_L1eEM26M",
24 "HLT_e60_lhmedium_L1EM22VHI",
"HLT_e60_lhmedium_L1eEM26M",
25 "HLT_e140_lhloose_L1EM22VHI",
"HLT_e140_lhloose_L1eEM26M",
26 "HLT_e300_etcut_L1EM22VHI",
"HLT_e300_etcut_L1eEM26M",
27 "HLT_e140_lhloose_noringer_L1EM22VHI",
"HLT_e140_lhloose_noringer_L1eEM26M"]
29 addRund3MuonTriggers = [
"HLT_mu24_ivarmedium_L1MU14FCH",
"HLT_mu50_L1MU14FCH",
"HLT_mu60_0eta105_msonly_L1MU14FCH",
"HLT_mu60_L1MU14FCH",
"HLT_mu80_msonly_3layersEC_L1MU14FCH"]
31 metTriggers = metTriggers+addRun3METTriggers
32 elTriggers = elTriggers+addRun3ElectronTriggers
33 muTriggers = muTriggers+addRund3MuonTriggers
36 if not flags.Input.isMC:
38 from CoolConvUtilities.MagFieldUtils
import getFieldForRun
39 magfield=
getFieldForRun(flags.Input.RunNumbers[0],lumiblock=flags.Input.LumiBlockNumbers[0])
40 addTtbarEvents = magfield.solenoidCurrent() > 0
44 tracks =
'InDetTrackParticles.TrkIsoPt1000_ptcone20 < 0.12*InDetTrackParticles.pt && InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 5.0*mm'
46 trackRequirements =
'(InDetTrackParticles.pt > 6.*GeV && '+tracks+
' )'
47 trackRequirementsMu =
'(InDetTrackParticles.pt > 40.*GeV && '+tracks+
' )'
48 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)'
49 trackRequirementsNoIso =
'(InDetTrackParticles.pt > 10.*GeV && abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 5.0*mm )'
51 muonsRequirements =
'(Muons.pt >= 20.*GeV) && (abs(Muons.eta) < 2.6) && (Muons.DFCommonMuonPassPreselection)'
52 electronsRequirements =
'(Electrons.pt > 20.*GeV) && (abs(Electrons.eta) < 2.6) && ((Electrons.Loose) || (Electrons.DFCommonElectronsLHLoose))'
55 expression_W =
'( count('+trackRequirements+
') >=1 )'
56 expression_Mu =
'( count('+trackRequirementsMu+
') >=1 )'
57 expression_ttbarEl =
'( count('+electronsRequirements+
') >=1 ) && ( count('+jetRequirementsTtbar+
') >=1 ) && ( count('+trackRequirementsNoIso+
') >=2 ) && ( count('+trackRequirements+
') >=1 )'
58 expression_ttbarElNoTag =
'( count('+electronsRequirements+
') >=1 ) && ( count('+trackRequirements+
') >=1 )'
59 expression_ttbarMu =
'( count('+muonsRequirements+
') >=1 ) && ( count('+jetRequirementsTtbar+
') >=1 ) && ( count('+trackRequirementsNoIso+
') >=2 ) && ( count('+trackRequirements+
') >=1 )'
60 expression_ttbarMuNoTag =
'( count('+muonsRequirements+
') >=1 ) && ( count('+trackRequirements+
') >=1 )'
62 skimmingTool_W = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"skimmingTool_W", expression = expression_W)
63 acc.addPublicTool(skimmingTool_W)
64 skimmingTool_Mu = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"skimmingTool_mu", expression = expression_Mu)
65 acc.addPublicTool(skimmingTool_Mu)
68 JETM12TriggerSkimmingTool_W = CompFactory.DerivationFramework.TriggerSkimmingTool(name =
"JETM12TriggerSkimmingTool_W", TriggerListOR = metTriggers)
69 acc.addPublicTool(JETM12TriggerSkimmingTool_W)
70 JETM12TriggerSkimmingTool_ele = CompFactory.DerivationFramework.TriggerSkimmingTool(name =
"JETM12TriggerSkimmingTool_ele", TriggerListOR = elTriggers)
71 acc.addPublicTool(JETM12TriggerSkimmingTool_ele)
72 JETM12TriggerSkimmingTool_mu = CompFactory.DerivationFramework.TriggerSkimmingTool(name =
"JETM12TriggerSkimmingTool_mu", TriggerListOR = muTriggers)
73 acc.addPublicTool(JETM12TriggerSkimmingTool_mu)
75 JETM12SkimmingTool_W = CompFactory.DerivationFramework.FilterCombinationAND(name=
"JETM12SkimmingTool_W", FilterList=[skimmingTool_W, JETM12TriggerSkimmingTool_W])
76 acc.addPublicTool(JETM12SkimmingTool_W)
77 JETM12SkimmingTool_Mu = CompFactory.DerivationFramework.FilterCombinationAND(name=
"JETM12SkimmingTool_Mu", FilterList=[skimmingTool_Mu, JETM12TriggerSkimmingTool_mu])
78 acc.addPublicTool(JETM12SkimmingTool_Mu)
80 finalSkimmingTools = [JETM12SkimmingTool_W,JETM12SkimmingTool_Mu]
83 skimmingTool_ttbarEl = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"skimmingTool_ttbarEl", expression = expression_ttbarEl)
84 acc.addPublicTool(skimmingTool_ttbarEl)
85 skimmingTool_ttbarElNoTag = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"skimmingTool_ttbarElNoTag", expression = expression_ttbarElNoTag)
86 acc.addPublicTool(skimmingTool_ttbarElNoTag)
87 skimmingTool_ttbarMu = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"skimmingTool_ttbarMu", expression = expression_ttbarMu)
88 acc.addPublicTool(skimmingTool_ttbarMu)
89 skimmingTool_ttbarMuNoTag = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"skimmingTool_ttbarMuNoTag", expression = expression_ttbarMuNoTag)
90 acc.addPublicTool(skimmingTool_ttbarMuNoTag)
92 JETM12SkimmingTool_ttbarEl = CompFactory.DerivationFramework.FilterCombinationAND(name=
"JETM12SkimmingTool_ttbarEl",FilterList=[skimmingTool_ttbarEl,JETM12TriggerSkimmingTool_ele])
93 acc.addPublicTool(JETM12SkimmingTool_ttbarEl)
94 JETM12SkimmingTool_ttbarElNoTag = CompFactory.DerivationFramework.FilterCombinationAND(name=
"JETM12SkimmingTool_ttbarElNoTag",FilterList=[skimmingTool_ttbarElNoTag,JETM12TriggerSkimmingTool_ele])
95 acc.addPublicTool(JETM12SkimmingTool_ttbarElNoTag)
96 JETM12SkimmingTool_ttbarMu = CompFactory.DerivationFramework.FilterCombinationAND(name=
"JETM12SkimmingTool_ttbarMu",FilterList=[skimmingTool_ttbarMu,JETM12TriggerSkimmingTool_mu])
97 acc.addPublicTool(JETM12SkimmingTool_ttbarMu)
98 JETM12SkimmingTool_ttbarMuNoTag = CompFactory.DerivationFramework.FilterCombinationAND(name=
"JETM12SkimmingTool_ttbarMuNoTag",FilterList=[skimmingTool_ttbarMuNoTag,JETM12TriggerSkimmingTool_mu])
99 acc.addPublicTool(JETM12SkimmingTool_ttbarMuNoTag)
101 finalSkimmingTools = [JETM12SkimmingTool_W, JETM12SkimmingTool_Mu, JETM12SkimmingTool_ttbarEl, JETM12SkimmingTool_ttbarMu, JETM12SkimmingTool_ttbarElNoTag, JETM12SkimmingTool_ttbarMuNoTag]
103 JETM12SkimmingTool = CompFactory.DerivationFramework.FilterCombinationOR(name=
"JETM12SkimmingTool", FilterList=finalSkimmingTools)
104 acc.addPublicTool(JETM12SkimmingTool, primary =
True)
109 """Configure the augmentation tool for skimming"""
114 from InDetConfig.InDetTrackSelectionToolConfig
import InDetTrackSelectionTool_Loose_Cfg
116 name =
"TrackSelectionTool1000_JETM12",
120 from TrackVertexAssociationTool.TrackVertexAssociationToolConfig
import isoTTVAToolCfg
121 toolkwargs[
'TTVATool'] = acc.popToolsAndMerge(
isoTTVAToolCfg(flags))
123 toolkwargs[
"name"] =
"TrackIsolationToolPt1000"
124 TrackIsoTool = CompFactory.xAOD.TrackIsolationTool(**toolkwargs)
125 acc.addPublicTool(TrackIsoTool)
127 from xAODPrimitives.xAODIso
import xAODIso
as isoPar
128 Pt1000IsoTrackDecorator = CompFactory.DerivationFramework.trackIsolationDecorator(name =
"Pt1000IsoTrackDecorator",
129 TrackIsolationTool = TrackIsoTool,
130 TargetContainer =
"InDetTrackParticles",
131 ptcones = [isoPar.ptcone40,isoPar.ptcone30,isoPar.ptcone20],
132 Prefix =
'TrkIsoPt1000_')
134 acc.addPublicTool(Pt1000IsoTrackDecorator, primary=
True)
139 """Configure the augmentation tool"""
144 from InDetConfig.InDetTrackSelectionToolConfig
import InDetTrackSelectionTool_Loose_Cfg
146 name =
"TrackSelectionTool500_JETM12",
149 from TrackVertexAssociationTool.TrackVertexAssociationToolConfig
import isoTTVAToolCfg
150 toolkwargs[
'TTVATool'] = acc.popToolsAndMerge(
isoTTVAToolCfg(flags))
152 toolkwargs[
"name"] =
"TrackIsolationToolPt500"
153 TrackIsoTool = CompFactory.xAOD.TrackIsolationTool(**toolkwargs)
154 acc.addPublicTool(TrackIsoTool)
156 from xAODPrimitives.xAODIso
import xAODIso
as isoPar
157 Pt500IsoTrackDecorator = CompFactory.DerivationFramework.trackIsolationDecorator(name =
"Pt500IsoTrackDecorator",
158 TrackIsolationTool = TrackIsoTool,
159 TargetContainer =
"InDetTrackParticles",
160 ptcones = [isoPar.ptcone40,isoPar.ptcone30,isoPar.ptcone20],
161 Prefix =
'TrkIsoPt500_')
163 acc.addPublicTool(Pt500IsoTrackDecorator, primary=
True)
169 """Configure the derivation framework driving algorithm (kernel) for JETM12"""
173 from DerivationFrameworkPhys.PhysCommonConfig
import PhysCommonAugmentationsCfg
177 from AthenaCommon.CFElements
import seqAND
178 acc.addSequence(
seqAND(
"JETM12Sequence") )
179 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
182 skimmingKernel =
DerivationKernel(kwargs[
"PreselectionName"], SkimmingTools = [skimmingTool], AugmentationTools = [augmentationToolSkim])
183 acc.addEventAlgo( skimmingKernel, sequenceName=
"JETM12Sequence" )
186 from DerivationFrameworkInDet.InDetToolsConfig
import TrackParticleThinningCfg, MuonTrackParticleThinningCfg, EgammaTrackParticleThinningCfg, TauTrackParticleThinningCfg
189 JETM12_thinning_expression =
"( InDetTrackParticles.pt > 6*GeV && InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 5.0*mm )"
192 name =
"JETM12TrackParticleThinningTool",
193 StreamName = kwargs[
'StreamName'],
194 SelectionString = JETM12_thinning_expression,
195 InDetTrackParticlesKey =
"InDetTrackParticles"))
200 name =
"JETM12MuonTPThinningTool",
201 StreamName = kwargs[
'StreamName'],
203 InDetTrackParticlesKey =
"InDetTrackParticles"))
208 name =
"JETM12ElectronTPThinningTool",
209 StreamName = kwargs[
'StreamName'],
211 InDetTrackParticlesKey =
"InDetTrackParticles"))
216 name =
"JETM12PhotonTPThinningTool",
217 StreamName = kwargs[
'StreamName'],
219 InDetTrackParticlesKey =
"InDetTrackParticles",
220 GSFConversionVerticesKey =
"GSFConversionVertices"))
225 name =
"JETM12TauTPThinningTool",
226 StreamName = kwargs[
'StreamName'],
228 InDetTrackParticlesKey =
"InDetTrackParticles",
229 DoTauTracksThinning =
True,
230 TauTracksKey =
"TauTracks"))
232 thinningTools = [JETM12TrackParticleThinningTool,
233 JETM12MuonTPThinningTool,
234 JETM12ElectronTPThinningTool,
235 JETM12PhotonTPThinningTool,
236 JETM12TauTPThinningTool]
239 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig
import CaloClusterThinningCfg
240 selectionString =
"( InDetTrackParticles.pt > 6*GeV && InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 5.0*mm )"
242 name =
"JETM12CaloClusterThinning",
243 StreamName = kwargs[
'StreamName'],
244 SGKey =
"InDetTrackParticles",
245 TopoClCollectionSGKey =
"CaloCalTopoClusters",
246 SelectionString = selectionString,
248 acc.addPublicTool(JETM12CaloThinningTool)
249 thinningTools.append(JETM12CaloThinningTool)
252 truth_cond_status =
"( (TruthParticles.status == 1) && (TruthParticles.barcode < 200000) && (TruthParticles.pt > 8*GeV) )"
253 truth_cond_Lepton =
"((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16) && (TruthParticles.barcode < 200000))"
254 truth_expression =
'('+truth_cond_status+
' || '+truth_cond_Lepton +
')'
256 JETM12TruthThinningTool = CompFactory.DerivationFramework.GenericTruthThinning(name =
"JETM12TruthThinningTool",
257 StreamName = kwargs[
'StreamName'],
258 ParticleSelectionString = truth_expression,
259 PreserveDescendants =
False,
260 PreserveGeneratorDescendants =
True,
261 PreserveAncestors =
False)
263 acc.addPublicTool(JETM12TruthThinningTool)
264 thinningTools.append(JETM12TruthThinningTool)
271 ThinningTools = thinningTools,
272 AugmentationTools = [augmentationTool]),
273 sequenceName=
"JETM12Sequence")
285 from DerivationFrameworkPhys.TriggerListsHelper
import TriggerListsHelper
286 JETM12TriggerListsHelper = TriggerListsHelper(flags)
289 acc.merge(
JETM12KernelCfg(flags, name=
"JETM12Kernel", PreselectionName=
"JETM12PreselectionKernel", StreamName =
'StreamDAOD_JETM12', TriggerListsHelper = JETM12TriggerListsHelper))
294 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
295 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
296 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
298 JETM12SlimmingHelper =
SlimmingHelper(
"JETM12SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
300 JETM12SlimmingHelper.SmartCollections = [
"EventInfo",
301 "Electrons",
"Photons",
"Muons",
"TauJets",
302 "InDetTrackParticles",
"PrimaryVertices",
303 "MET_Baseline_AntiKt4EMPFlow",
304 "AntiKt4EMPFlowJets",
305 "BTagging_AntiKt4EMPFlow"]
307 JETM12SlimmingHelper.AllVariables = [
"MuonSegments",
"InDetTrackParticles",
308 "Kt4EMTopoOriginEventShape",
"Kt4EMPFlowEventShape",
"CaloCalTopoClusters"]
310 JETM12SlimmingHelper.ExtraVariables = [
"InDetTrackParticles.TrkIsoPt1000_ptcone40.TrkIsoPt1000_ptcone30.TrkIsoPt1000_ptcone20.TrkIsoPt500_ptcone40.TrkIsoPt500_ptcone30.TrkIsoPt500_ptcone20"]
313 from DerivationFrameworkMCTruth.MCTruthCommonConfig
import addTruth3ContentToSlimmerTool
316 JETM12SlimmingHelper.AppendToDictionary.update({
'TruthParticles':
'xAOD::TruthParticleContainer',
317 'TruthParticlesAux':
'xAOD::TruthParticleAuxContainer'})
319 JETM12SlimmingHelper.SmartCollections += [
"AntiKt4TruthJets"]
320 JETM12SlimmingHelper.AllVariables += [
"MuonTruthParticles",
"TruthParticles",
"TruthVertices"]
323 JETM12SlimmingHelper.IncludeTriggerNavigation =
False
324 JETM12SlimmingHelper.IncludeJetTriggerContent =
False
325 JETM12SlimmingHelper.IncludeMuonTriggerContent =
False
326 JETM12SlimmingHelper.IncludeEGammaTriggerContent =
False
327 JETM12SlimmingHelper.IncludeTauTriggerContent =
False
328 JETM12SlimmingHelper.IncludeEtMissTriggerContent =
False
329 JETM12SlimmingHelper.IncludeBJetTriggerContent =
False
330 JETM12SlimmingHelper.IncludeBPhysTriggerContent =
False
331 JETM12SlimmingHelper.IncludeMinBiasTriggerContent =
False
334 JETM12ItemList = JETM12SlimmingHelper.GetItemList()
335 acc.merge(
OutputStreamCfg(flags,
"DAOD_JETM12", ItemList=JETM12ItemList, AcceptAlgs=[
"JETM12Kernel"]))
336 acc.merge(
SetupMetaDataForStreamCfg(flags,
"DAOD_JETM12", AcceptAlgs=[
"JETM12Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))