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 triggerlist = TriggerLists.single_photon_Trig(flags)
17 addRun3PhotonTriggers = [
"HLT_g140_loose_L1EM22VHI",
"HLT_g300_etcut_L1EM22VHI"]
18 triggerlist = triggerlist+addRun3PhotonTriggers
20 triggers =
'||'.
join(triggerlist)
22 JETM4SkimmingTool = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"JETM4SkimmingTool",
23 expression = triggers)
24 acc.addPublicTool(JETM4SkimmingTool, primary =
True)
31 """Configure the derivation framework driving algorithm (kernel) for JETM4"""
35 if not flags.Input.isMC:
39 from DerivationFrameworkPhys.PhysCommonConfig
import PhysCommonAugmentationsCfg
43 from DerivationFrameworkInDet.InDetToolsConfig
import TrackParticleThinningCfg, MuonTrackParticleThinningCfg, EgammaTrackParticleThinningCfg, TauTrackParticleThinningCfg
46 JETM4_thinning_expression =
"( abs(InDetTrackParticles.d0) < 5*mm ) && ( abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 5*mm )"
49 name =
"JETM4TrackParticleThinningTool",
50 StreamName = kwargs[
'StreamName'],
51 SelectionString = JETM4_thinning_expression,
52 InDetTrackParticlesKey =
"InDetTrackParticles"))
57 name =
"JETM4MuonTPThinningTool",
58 StreamName = kwargs[
'StreamName'],
60 InDetTrackParticlesKey =
"InDetTrackParticles"))
65 name =
"JETM4ElectronTPThinningTool",
66 StreamName = kwargs[
'StreamName'],
68 InDetTrackParticlesKey =
"InDetTrackParticles"))
73 name =
"JETM4PhotonTPThinningTool",
74 StreamName = kwargs[
'StreamName'],
76 InDetTrackParticlesKey =
"InDetTrackParticles",
77 GSFConversionVerticesKey =
"GSFConversionVertices"))
82 name =
"JETM4TauTPThinningTool",
83 StreamName = kwargs[
'StreamName'],
85 InDetTrackParticlesKey =
"InDetTrackParticles",
86 DoTauTracksThinning =
True,
87 TauTracksKey =
"TauTracks"))
90 thinningTools = [JETM4TrackParticleThinningTool,
91 JETM4MuonTPThinningTool,
92 JETM4ElectronTPThinningTool,
93 JETM4PhotonTPThinningTool,
94 JETM4TauTPThinningTool]
97 truth_cond_WZH =
"((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))"
98 truth_cond_Lepton =
"((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16) && (TruthParticles.barcode < 200000))"
99 truth_cond_Quark =
"((abs(TruthParticles.pdgId) <= 5 && (TruthParticles.pt > 10000.)) || (abs(TruthParticles.pdgId) == 6))"
100 truth_cond_Gluon =
"((abs(TruthParticles.pdgId) == 21) && (TruthParticles.pt > 10000.))"
101 truth_cond_Photon =
"((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 10000.) && (TruthParticles.barcode < 200000))"
103 truth_expression =
'('+truth_cond_WZH+
' || '+truth_cond_Lepton +
' || '+truth_cond_Quark+
'||'+truth_cond_Gluon+
' || '+truth_cond_Photon+
')'
105 preserveAllDescendants =
False
107 JETM4TruthThinningTool = CompFactory.DerivationFramework.GenericTruthThinning ( name =
"JETM4TruthThinningTool",
108 StreamName = kwargs[
'StreamName'],
109 ParticleSelectionString = truth_expression,
110 PreserveDescendants = preserveAllDescendants,
111 PreserveGeneratorDescendants =
not preserveAllDescendants,
112 PreserveAncestors =
True)
114 acc.addPublicTool(JETM4TruthThinningTool)
115 thinningTools.append(JETM4TruthThinningTool)
118 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
120 ThinningTools = thinningTools,
121 SkimmingTools = [skimmingTool]
if not flags.Input.isMC
else []))
134 from DerivationFrameworkJetEtMiss.PFlowCommonConfig
import PFlowCommonCfg
137 from JetRecConfig.JetRecConfig
import JetRecCfg
138 from JetRecConfig.StandardSmallRJets
import AntiKt4UFOCSSKLowPt
139 AntiKt4UFOCSSKLowPt_JETM4 = AntiKt4UFOCSSKLowPt.clone(
140 modifiers = AntiKt4UFOCSSKLowPt.modifiers+(
"NNJVT",)
142 jetList = [AntiKt4UFOCSSKLowPt_JETM4]
157 from DerivationFrameworkPhys.TriggerListsHelper
import TriggerListsHelper
158 JETM4TriggerListsHelper = TriggerListsHelper(flags)
161 acc.merge(
JETM4KernelCfg(flags, name=
"JETM4Kernel", StreamName =
'StreamDAOD_JETM4', TriggerListsHelper = JETM4TriggerListsHelper))
166 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
167 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
168 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
170 JETM4SlimmingHelper =
SlimmingHelper(
"JETM4SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
172 JETM4SlimmingHelper.SmartCollections = [
"EventInfo",
"InDetTrackParticles",
"PrimaryVertices",
173 "Electrons",
"Photons",
"Muons",
"TauJets",
174 "MET_Baseline_AntiKt4EMTopo",
"MET_Baseline_AntiKt4EMPFlow",
175 "AntiKt4EMPFlowJets",
"AntiKt4EMTopoJets",
"AntiKt4UFOCSSKLowPtJets",
176 "AntiKt10UFOCSSKJets",
177 "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets",
178 "AntiKtVR30Rmax4Rmin02PV0TrackJets",
179 "BTagging_AntiKt4EMPFlow",
180 "BTagging_AntiKtVR30Rmax4Rmin02Track"]
182 JETM4SlimmingHelper.AllVariables = [
"CHSGChargedParticleFlowObjects",
"CHSGNeutralParticleFlowObjects",
184 "Kt4EMTopoOriginEventShape",
"Kt4EMPFlowEventShape",
"Kt4EMPFlowPUSBEventShape",
"Kt4EMPFlowNeutEventShape"]
186 JETM4SlimmingHelper.ExtraVariables = [
"TauJets.truthJetLink.truthParticleLink.IsTruthMatched"]
189 from DerivationFrameworkJetEtMiss.CommonJETMXContent
import ClusterVariables, FlowElementVariables
190 JETM4SlimmingHelper.ExtraVariables += [
".".
join([
"CaloCalTopoClusters"] + ClusterVariables)]
191 JETM4SlimmingHelper.ExtraVariables += [
".".
join([
"GlobalChargedParticleFlowObjects"] + FlowElementVariables)]
192 JETM4SlimmingHelper.ExtraVariables += [
".".
join([
"GlobalNeutralParticleFlowObjects"] + FlowElementVariables)]
197 from DerivationFrameworkMCTruth.MCTruthCommonConfig
import addTruth3ContentToSlimmerTool
200 JETM4SlimmingHelper.AppendToDictionary.update({
'TruthParticles':
'xAOD::TruthParticleContainer',
201 'TruthParticlesAux':
'xAOD::TruthParticleAuxContainer'})
203 JETM4SlimmingHelper.AllVariables += [
"TruthParticles",
"TruthEvents",
"TruthVertices",
204 "MuonTruthParticles",
"egammaTruthParticles",]
205 JETM4SlimmingHelper.SmartCollections += [
"AntiKt4TruthJets",
"AntiKt10TruthJets",
206 "AntiKt10TruthSoftDropBeta100Zcut10Jets"]
209 JETM4SlimmingHelper.IncludeTriggerNavigation =
False
210 JETM4SlimmingHelper.IncludeJetTriggerContent =
False
211 JETM4SlimmingHelper.IncludeMuonTriggerContent =
False
212 JETM4SlimmingHelper.IncludeEGammaTriggerContent =
True
213 JETM4SlimmingHelper.IncludeTauTriggerContent =
False
214 JETM4SlimmingHelper.IncludeEtMissTriggerContent =
False
215 JETM4SlimmingHelper.IncludeBJetTriggerContent =
False
216 JETM4SlimmingHelper.IncludeBPhysTriggerContent =
False
217 JETM4SlimmingHelper.IncludeMinBiasTriggerContent =
False
221 if flags.Trigger.EDMVersion == 2:
222 from DerivationFrameworkPhys.TriggerMatchingCommonConfig
import AddRun2TriggerMatchingToSlimmingHelper
224 OutputContainerPrefix =
"TrigMatch_",
225 TriggerList = JETM4TriggerListsHelper.Run2TriggerNamesTau)
227 OutputContainerPrefix =
"TrigMatch_",
228 TriggerList = JETM4TriggerListsHelper.Run2TriggerNamesNoTau)
230 if flags.Trigger.EDMVersion == 3
or (flags.Trigger.EDMVersion == 2
and flags.Trigger.doEDMVersionConversion):
231 from TrigNavSlimmingMT.TrigNavSlimmingMTConfig
import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
235 JETM4ItemList = JETM4SlimmingHelper.GetItemList()
236 acc.merge(
OutputStreamCfg(flags,
"DAOD_JETM4", ItemList=JETM4ItemList, AcceptAlgs=[
"JETM4Kernel"]))
237 acc.merge(
SetupMetaDataForStreamCfg(flags,
"DAOD_JETM4", AcceptAlgs=[
"JETM4Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))