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)
18 JETM4SkimmingTool = CompFactory.DerivationFramework.TriggerSkimmingTool(name =
"JETM4SkimmingTool", TriggerListOR = triggerlist)
19 acc.addPublicTool(JETM4SkimmingTool, primary=
True)
26 """Configure the derivation framework driving algorithm (kernel) for JETM4"""
30 if not flags.Input.isMC:
34 from DerivationFrameworkPhys.PhysCommonConfig
import PhysCommonAugmentationsCfg
38 from DerivationFrameworkInDet.InDetToolsConfig
import TrackParticleThinningCfg, MuonTrackParticleThinningCfg, EgammaTrackParticleThinningCfg, TauTrackParticleThinningCfg
41 JETM4_thinning_expression =
"( abs(InDetTrackParticles.d0) < 5*mm ) && ( abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 5*mm )"
44 name =
"JETM4TrackParticleThinningTool",
45 StreamName = kwargs[
'StreamName'],
46 SelectionString = JETM4_thinning_expression,
47 InDetTrackParticlesKey =
"InDetTrackParticles"))
52 name =
"JETM4MuonTPThinningTool",
53 StreamName = kwargs[
'StreamName'],
55 InDetTrackParticlesKey =
"InDetTrackParticles"))
60 name =
"JETM4ElectronTPThinningTool",
61 StreamName = kwargs[
'StreamName'],
63 InDetTrackParticlesKey =
"InDetTrackParticles"))
68 name =
"JETM4PhotonTPThinningTool",
69 StreamName = kwargs[
'StreamName'],
71 InDetTrackParticlesKey =
"InDetTrackParticles",
72 GSFConversionVerticesKey =
"GSFConversionVertices"))
77 name =
"JETM4TauTPThinningTool",
78 StreamName = kwargs[
'StreamName'],
80 InDetTrackParticlesKey =
"InDetTrackParticles",
81 DoTauTracksThinning =
True,
82 TauTracksKey =
"TauTracks"))
85 thinningTools = [JETM4TrackParticleThinningTool,
86 JETM4MuonTPThinningTool,
87 JETM4ElectronTPThinningTool,
88 JETM4PhotonTPThinningTool,
89 JETM4TauTPThinningTool]
92 truth_cond_WZH =
"((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))"
93 truth_cond_Lepton =
"((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16) && !(TruthParticles.isSimulationParticle))"
94 truth_cond_Quark =
"((abs(TruthParticles.pdgId) <= 5 && (TruthParticles.pt > 10000.)) || (abs(TruthParticles.pdgId) == 6))"
95 truth_cond_Gluon =
"((abs(TruthParticles.pdgId) == 21) && (TruthParticles.pt > 10000.))"
96 truth_cond_Photon =
"((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 10000.) && !(TruthParticles.isSimulationParticle))"
98 truth_expression =
'('+truth_cond_WZH+
' || '+truth_cond_Lepton +
' || '+truth_cond_Quark+
'||'+truth_cond_Gluon+
' || '+truth_cond_Photon+
')'
100 preserveAllDescendants =
False
102 JETM4TruthThinningTool = CompFactory.DerivationFramework.GenericTruthThinning ( name =
"JETM4TruthThinningTool",
103 StreamName = kwargs[
'StreamName'],
104 ParticleSelectionString = truth_expression,
105 PreserveDescendants = preserveAllDescendants,
106 PreserveGeneratorDescendants =
not preserveAllDescendants,
107 PreserveAncestors =
True)
109 acc.addPublicTool(JETM4TruthThinningTool)
110 thinningTools.append(JETM4TruthThinningTool)
113 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
115 ThinningTools = thinningTools,
116 SkimmingTools = [skimmingTool]
if not flags.Input.isMC
else []))
129 from DerivationFrameworkJetEtMiss.PFlowCommonConfig
import PFlowCommonCfg
132 from JetRecConfig.JetRecConfig
import JetRecCfg
133 from JetRecConfig.StandardSmallRJets
import AntiKt4UFOCSSKLowPt
134 AntiKt4UFOCSSKLowPt_JETM4 = AntiKt4UFOCSSKLowPt.clone(
135 modifiers = AntiKt4UFOCSSKLowPt.modifiers+(
"NNJVT",)
137 jetList = [AntiKt4UFOCSSKLowPt_JETM4]
152 from DerivationFrameworkPhys.TriggerListsHelper
import TriggerListsHelper
153 JETM4TriggerListsHelper = TriggerListsHelper(flags)
156 acc.merge(
JETM4KernelCfg(flags, name=
"JETM4Kernel", StreamName =
'StreamDAOD_JETM4', TriggerListsHelper = JETM4TriggerListsHelper))
161 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
162 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
163 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
165 JETM4SlimmingHelper =
SlimmingHelper(
"JETM4SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
167 JETM4SlimmingHelper.SmartCollections = [
"EventInfo",
"InDetTrackParticles",
"PrimaryVertices",
168 "Electrons",
"Photons",
"Muons",
"TauJets",
169 "MET_Baseline_AntiKt4EMTopo",
"MET_Baseline_AntiKt4EMPFlow",
170 "AntiKt4EMPFlowJets",
"AntiKt4EMTopoJets",
"AntiKt4UFOCSSKLowPtJets",
171 "AntiKt10UFOCSSKJets",
172 "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets",
173 "AntiKtVR30Rmax4Rmin02PV0TrackJets",
174 "BTagging_AntiKt4EMPFlow",
175 "BTagging_AntiKtVR30Rmax4Rmin02Track"]
177 JETM4SlimmingHelper.AllVariables = [
"CHSGChargedParticleFlowObjects",
"CHSGNeutralParticleFlowObjects",
179 "Kt4EMTopoOriginEventShape",
"Kt4EMPFlowEventShape",
"Kt4EMPFlowPUSBEventShape",
"Kt4EMPFlowNeutEventShape"]
181 JETM4SlimmingHelper.ExtraVariables = [
"TauJets.truthJetLink.truthParticleLink.IsTruthMatched"]
184 from DerivationFrameworkJetEtMiss.CommonJETMXContent
import ClusterVariables, FlowElementVariables
185 JETM4SlimmingHelper.ExtraVariables += [
".".
join([
"CaloCalTopoClusters"] + ClusterVariables)]
186 JETM4SlimmingHelper.ExtraVariables += [
".".
join([
"GlobalChargedParticleFlowObjects"] + FlowElementVariables)]
187 JETM4SlimmingHelper.ExtraVariables += [
".".
join([
"GlobalNeutralParticleFlowObjects"] + FlowElementVariables)]
191 modelName =
"bJR10v00"
192 for score
in [
"mass",
"pt"]:
193 extraListReg.append(f
"{modelName}_{score}")
194 JETM4SlimmingHelper.ExtraVariables += [
"AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets." +
".".
join(extraListReg)]
199 from DerivationFrameworkMCTruth.MCTruthCommonConfig
import addTruth3ContentToSlimmerTool
202 JETM4SlimmingHelper.AppendToDictionary.update({
'TruthParticles':
'xAOD::TruthParticleContainer',
203 'TruthParticlesAux':
'xAOD::TruthParticleAuxContainer'})
205 JETM4SlimmingHelper.AllVariables += [
"TruthParticles",
"TruthEvents",
"TruthVertices",
206 "MuonTruthParticles",
"egammaTruthParticles",]
207 JETM4SlimmingHelper.SmartCollections += [
"AntiKt4TruthJets",
"AntiKt10TruthJets",
208 "AntiKt10TruthSoftDropBeta100Zcut10Jets"]
211 JETM4SlimmingHelper.IncludeTriggerNavigation =
False
212 JETM4SlimmingHelper.IncludeJetTriggerContent =
False
213 JETM4SlimmingHelper.IncludeMuonTriggerContent =
False
214 JETM4SlimmingHelper.IncludeEGammaTriggerContent =
True
215 JETM4SlimmingHelper.IncludeTauTriggerContent =
False
216 JETM4SlimmingHelper.IncludeEtMissTriggerContent =
False
217 JETM4SlimmingHelper.IncludeBJetTriggerContent =
False
218 JETM4SlimmingHelper.IncludeBPhysTriggerContent =
False
219 JETM4SlimmingHelper.IncludeMinBiasTriggerContent =
False
223 if flags.Trigger.EDMVersion == 2:
224 from DerivationFrameworkPhys.TriggerMatchingCommonConfig
import AddRun2TriggerMatchingToSlimmingHelper
226 OutputContainerPrefix =
"TrigMatch_",
227 TriggerList = JETM4TriggerListsHelper.Run2TriggerNamesTau)
229 OutputContainerPrefix =
"TrigMatch_",
230 TriggerList = JETM4TriggerListsHelper.Run2TriggerNamesNoTau)
232 if flags.Trigger.EDMVersion == 3
or (flags.Trigger.EDMVersion == 2
and flags.Trigger.doEDMVersionConversion):
233 from TrigNavSlimmingMT.TrigNavSlimmingMTConfig
import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
237 JETM4ItemList = JETM4SlimmingHelper.GetItemList()
238 acc.merge(
OutputStreamCfg(flags,
"DAOD_JETM4", ItemList=JETM4ItemList, AcceptAlgs=[
"JETM4Kernel"]))
239 acc.merge(
SetupMetaDataForStreamCfg(flags,
"DAOD_JETM4", AcceptAlgs=[
"JETM4Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))