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 electronTriggers = TriggerLists.single_el_Trig(flags)
17 muonTriggers = TriggerLists.single_mu_Trig(flags)
19 addRun3ElectronTriggers = [
"HLT_e17_lhvloose_L1EM15VHI",
"HLT_e20_lhvloose_L1EM15VH",
"HLT_e250_etcut_L1EM22VHI",
20 "HLT_e26_lhtight_ivarloose_L1EM22VHI",
"HLT_e26_lhtight_ivarloose_L1eEM26M",
21 "HLT_e60_lhmedium_L1EM22VHI",
"HLT_e60_lhmedium_L1eEM26M",
22 "HLT_e140_lhloose_L1EM22VHI",
"HLT_e140_lhloose_L1eEM26M",
23 "HLT_e300_etcut_L1EM22VHI",
"HLT_e300_etcut_L1eEM26M",
24 "HLT_e140_lhloose_noringer_L1EM22VHI",
"HLT_e140_lhloose_noringer_L1eEM26M"]
26 addRund3MuonTriggers = [
"HLT_mu24_ivarmedium_L1MU14FCH",
"HLT_mu50_L1MU14FCH",
"HLT_mu60_0eta105_msonly_L1MU14FCH",
"HLT_mu60_L1MU14FCH",
"HLT_mu80_msonly_3layersEC_L1MU14FCH"]
28 electronTriggers = electronTriggers+addRun3ElectronTriggers
29 muonTriggers = muonTriggers+addRund3MuonTriggers
31 elofflinesel =
'(count((Electrons.pt > 20*GeV) && (Electrons.DFCommonElectronsLHMedium)) >= 2)'
32 muofflinesel =
'(count((Muons.pt > 20*GeV) && (Muons.DFCommonMuonPassPreselection)) >= 2)'
36 JETM3OfflineSkimmingTool_ele = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"JETM3OfflineSkimmingTool_ele",
37 expression = elofflinesel,
39 JETM3OfflineSkimmingTool_mu = CompFactory.DerivationFramework.xAODStringSkimmingTool( name =
"JETM3OfflineSkimmingTool_mu",
40 expression = muofflinesel,
43 acc.addPublicTool(JETM3OfflineSkimmingTool_ele)
44 acc.addPublicTool(JETM3OfflineSkimmingTool_mu)
46 if not flags.Input.isMC:
48 JETM3TriggerSkimmingTool_ele = CompFactory.DerivationFramework.TriggerSkimmingTool(name =
"JETM3TriggerSkimmingTool_ele", TriggerListOR = electronTriggers)
49 acc.addPublicTool(JETM3TriggerSkimmingTool_ele)
50 JETM3TriggerSkimmingTool_mu = CompFactory.DerivationFramework.TriggerSkimmingTool(name =
"JETM3TriggerSkimmingTool_mu", TriggerListOR = muonTriggers)
51 acc.addPublicTool(JETM3TriggerSkimmingTool_mu)
53 JETM3SkimmingTool_ele = CompFactory.DerivationFramework.FilterCombinationAND(name=
"JETM3SkimmingTool_ele", FilterList=[JETM3OfflineSkimmingTool_ele, JETM3TriggerSkimmingTool_ele] )
54 JETM3SkimmingTool_mu = CompFactory.DerivationFramework.FilterCombinationAND(name=
"JETM3SkimmingTool_mu", FilterList=[JETM3OfflineSkimmingTool_mu, JETM3TriggerSkimmingTool_mu] )
55 acc.addPublicTool(JETM3SkimmingTool_ele)
56 acc.addPublicTool(JETM3SkimmingTool_mu)
59 JETM3SkimmingTool = CompFactory.DerivationFramework.FilterCombinationOR(name=
"JETM3SkimmingTool", FilterList=[JETM3SkimmingTool_ele, JETM3SkimmingTool_mu])
60 acc.addPublicTool(JETM3SkimmingTool, primary =
True)
63 JETM3SkimmingTool = CompFactory.DerivationFramework.FilterCombinationOR(name=
"JETM3SkimmingTool", FilterList=[JETM3OfflineSkimmingTool_ele, JETM3OfflineSkimmingTool_mu])
64 acc.addPublicTool(JETM3SkimmingTool, primary =
True)
71 """Configure the derivation framework driving algorithm (kernel) for JETM3"""
78 from DerivationFrameworkPhys.PhysCommonConfig
import PhysCommonAugmentationsCfg
82 from DerivationFrameworkInDet.InDetToolsConfig
import TrackParticleThinningCfg, MuonTrackParticleThinningCfg, EgammaTrackParticleThinningCfg, TauTrackParticleThinningCfg
85 JETM3_thinning_expression =
"( abs(InDetTrackParticles.d0) < 5*mm ) && ( abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 5*mm )"
88 name =
"JETM3TrackParticleThinningTool",
89 StreamName = kwargs[
'StreamName'],
90 SelectionString = JETM3_thinning_expression,
91 InDetTrackParticlesKey =
"InDetTrackParticles"))
96 name =
"JETM3MuonTPThinningTool",
97 StreamName = kwargs[
'StreamName'],
99 InDetTrackParticlesKey =
"InDetTrackParticles"))
104 name =
"JETM3ElectronTPThinningTool",
105 StreamName = kwargs[
'StreamName'],
107 InDetTrackParticlesKey =
"InDetTrackParticles"))
112 name =
"JETM3PhotonTPThinningTool",
113 StreamName = kwargs[
'StreamName'],
115 InDetTrackParticlesKey =
"InDetTrackParticles",
116 GSFConversionVerticesKey =
"GSFConversionVertices"))
121 name =
"JETM3TauTPThinningTool",
122 StreamName = kwargs[
'StreamName'],
124 InDetTrackParticlesKey =
"InDetTrackParticles",
125 DoTauTracksThinning =
True,
126 TauTracksKey =
"TauTracks"))
129 thinningTools = [JETM3TrackParticleThinningTool,
130 JETM3MuonTPThinningTool,
131 JETM3ElectronTPThinningTool,
132 JETM3PhotonTPThinningTool,
133 JETM3TauTPThinningTool]
136 truth_cond_WZH =
"((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))"
137 truth_cond_Lepton =
"((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16) && (TruthParticles.barcode < 200000))"
138 truth_cond_Quark =
"((abs(TruthParticles.pdgId) <= 5 && (TruthParticles.pt > 10000.)) || (abs(TruthParticles.pdgId) == 6))"
139 truth_cond_Gluon =
"((abs(TruthParticles.pdgId) == 21) && (TruthParticles.pt > 10000.))"
140 truth_cond_Photon =
"((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 10000.) && (TruthParticles.barcode < 200000))"
142 truth_expression =
'('+truth_cond_WZH+
' || '+truth_cond_Lepton +
' || '+truth_cond_Quark+
'||'+truth_cond_Gluon+
' || '+truth_cond_Photon+
')'
144 preserveAllDescendants =
False
146 JETM3TruthThinningTool = CompFactory.DerivationFramework.GenericTruthThinning ( name =
"JETM3TruthThinningTool",
147 StreamName = kwargs[
'StreamName'],
148 ParticleSelectionString = truth_expression,
149 PreserveDescendants = preserveAllDescendants,
150 PreserveGeneratorDescendants =
not preserveAllDescendants,
151 PreserveAncestors =
True)
153 acc.addPublicTool(JETM3TruthThinningTool)
154 thinningTools.append(JETM3TruthThinningTool)
157 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
159 ThinningTools = thinningTools,
160 SkimmingTools = [skimmingTool]))
173 from JetRecConfig.JetRecConfig
import JetRecCfg, getModifier
174 from JetRecConfig.StandardJetMods
import stdJetModifiers
175 from JetRecConfig.StandardSmallRJets
import AntiKt4EMPFlow, AntiKt4EMPFlowLowPt, AntiKt4EMTopoLowPt, AntiKt4UFOCSSKLowPt
180 bJVTTool =
getModifier(AntiKt4EMPFlow, stdJetModifiers[
'bJVT'], stdJetModifiers[
'bJVT'].modspec, flags=flags)
181 acc.addEventAlgo(CompFactory.JetDecorationAlg(name=
'bJVTAlg',
182 JetContainer=
'AntiKt4EMPFlowJets',
183 Decorators=[bJVTTool]))
188 AntiKt4UFOCSSKLowPt_JETM3 = AntiKt4UFOCSSKLowPt.clone(
189 modifiers = AntiKt4UFOCSSKLowPt.modifiers+(
"NNJVT",)
191 jetList = [AntiKt4EMPFlowLowPt, AntiKt4EMTopoLowPt, AntiKt4UFOCSSKLowPt_JETM3]
199 from DerivationFrameworkJetEtMiss.PFlowCommonConfig
import PFlowCommonCfg
208 if flags.Trigger.EDMVersion == 2:
209 triggerNames = [
"JetContainer_a4tcemsubjesFS",
"JetContainer_a4tcemsubjesISFS",
"JetContainer_a10tclcwsubjesFS",
"JetContainer_GSCJet"]
211 for trigger
in triggerNames:
212 wrapperName = trigger+
'AuxWrapper'
213 auxContainerName =
'HLT_xAOD__'+trigger+
'Aux'
215 acc.addEventAlgo(CompFactory.xAODMaker.AuxStoreWrapper( wrapperName, SGKeys = [ auxContainerName+
"." ] ))
229 from DerivationFrameworkPhys.TriggerListsHelper
import TriggerListsHelper
230 JETM3TriggerListsHelper = TriggerListsHelper(flags)
233 acc.merge(
JETM3KernelCfg(flags, name=
"JETM3Kernel", StreamName =
'StreamDAOD_JETM3', TriggerListsHelper = JETM3TriggerListsHelper))
238 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
239 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
240 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
242 JETM3SlimmingHelper =
SlimmingHelper(
"JETM3SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
244 JETM3SlimmingHelper.SmartCollections = [
"EventInfo",
"InDetTrackParticles",
"PrimaryVertices",
245 "Electrons",
"Photons",
"Muons",
"TauJets",
246 "MET_Baseline_AntiKt4EMTopo",
"MET_Baseline_AntiKt4EMPFlow",
247 "AntiKt4EMPFlowJets",
"AntiKt4EMTopoJets",
248 "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets",
249 "BTagging_AntiKt4EMPFlow"]
251 JETM3SlimmingHelper.AllVariables = [
"CHSGChargedParticleFlowObjects",
"CHSGNeutralParticleFlowObjects",
252 "MuonSegments",
"LVL1JetRoIs",
253 "Kt4EMTopoOriginEventShape",
"Kt4EMPFlowEventShape",
"Kt4EMPFlowPUSBEventShape",
"Kt4EMPFlowNeutEventShape"]
255 JETM3SlimmingHelper.ExtraVariables = [
"AntiKt4EMPFlowJets.passOnlyBJVT.DFCommonJets_bJvt.isJvtHS.isJvtPU",
256 "Muons.energyLossType.EnergyLoss.ParamEnergyLoss.MeasEnergyLoss.EnergyLossSigma.MeasEnergyLossSigma.ParamEnergyLossSigmaPlus.ParamEnergyLossSigmaMinus"]
259 from DerivationFrameworkJetEtMiss.CommonJETMXContent
import ClusterVariables, FlowElementVariables
260 JETM3SlimmingHelper.ExtraVariables += [
".".
join([
"CaloCalTopoClusters"] + ClusterVariables)]
261 JETM3SlimmingHelper.ExtraVariables += [
".".
join([
"GlobalChargedParticleFlowObjects"] + FlowElementVariables)]
262 JETM3SlimmingHelper.ExtraVariables += [
".".
join([
"GlobalNeutralParticleFlowObjects"] + FlowElementVariables)]
267 from DerivationFrameworkMCTruth.MCTruthCommonConfig
import addTruth3ContentToSlimmerTool
270 JETM3SlimmingHelper.AppendToDictionary.update({
'TruthParticles':
'xAOD::TruthParticleContainer',
271 'TruthParticlesAux':
'xAOD::TruthParticleAuxContainer'})
273 JETM3SlimmingHelper.AllVariables += [
"AntiKt4TruthJets",
"InTimeAntiKt4TruthJets",
"OutOfTimeAntiKt4TruthJets",
274 "TruthParticles",
"TruthEvents",
"TruthVertices",
275 "MuonTruthParticles",
"egammaTruthParticles",]
276 JETM3SlimmingHelper.SmartCollections += [
"AntiKt4TruthWZJets",
"AntiKt4TruthJets",
"AntiKt10TruthJets",
277 "AntiKt10TruthTrimmedPtFrac5SmallR20Jets",
278 "AntiKt10TruthSoftDropBeta100Zcut10Jets"]
281 JETM3SlimmingHelper.IncludeTriggerNavigation =
False
282 JETM3SlimmingHelper.IncludeJetTriggerContent =
True
283 JETM3SlimmingHelper.IncludeMuonTriggerContent =
True
284 JETM3SlimmingHelper.IncludeEGammaTriggerContent =
True
285 JETM3SlimmingHelper.IncludeTauTriggerContent =
False
286 JETM3SlimmingHelper.IncludeEtMissTriggerContent =
False
287 JETM3SlimmingHelper.IncludeBJetTriggerContent =
False
288 JETM3SlimmingHelper.IncludeBPhysTriggerContent =
False
289 JETM3SlimmingHelper.IncludeMinBiasTriggerContent =
False
293 if flags.Trigger.EDMVersion == 2:
294 from DerivationFrameworkPhys.TriggerMatchingCommonConfig
import AddRun2TriggerMatchingToSlimmingHelper
296 OutputContainerPrefix =
"TrigMatch_",
297 TriggerList = JETM3TriggerListsHelper.Run2TriggerNamesTau)
299 OutputContainerPrefix =
"TrigMatch_",
300 TriggerList = JETM3TriggerListsHelper.Run2TriggerNamesNoTau)
302 if flags.Trigger.EDMVersion == 3
or (flags.Trigger.EDMVersion == 2
and flags.Trigger.doEDMVersionConversion):
303 from TrigNavSlimmingMT.TrigNavSlimmingMTConfig
import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
306 jetOutputList = [
"AntiKt4EMPFlowLowPtJets",
"AntiKt4EMTopoLowPtJets",
"AntiKt4UFOCSSKLowPtJets"]
307 from DerivationFrameworkJetEtMiss.JetCommonConfig
import addJetsToSlimmingTool
311 JETM3ItemList = JETM3SlimmingHelper.GetItemList()
312 acc.merge(
OutputStreamCfg(flags,
"DAOD_JETM3", ItemList=JETM3ItemList, AcceptAlgs=[
"JETM3Kernel"]))
313 acc.merge(
SetupMetaDataForStreamCfg(flags,
"DAOD_JETM3", AcceptAlgs=[
"JETM3Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))