42 """Configure the derivation framework driving algorithm (kernel)
47 from JetRecConfig.StandardSmallRJets
import (
52 from JetRecConfig.JetRecConfig
import JetRecCfg
54 jetList = [AntiKt4EMTopo, AntiKt4PV0Track, AntiKt4Truth]
57 JetKey =
"AntiKt4EMTopoJets"
64 from DerivationFrameworkInDet.InDetCommonConfig
import InDetCommonCfg
65 from DerivationFrameworkMuons.MuonsCommonConfig
import MuonsCommonCfg
66 from DerivationFrameworkEGamma.EGammaCommonConfig
import EGammaCommonCfg
68 TrackingFlags = flags.Tracking
73 DoVertexFinding=TrackingFlags.doVertexFinding,
74 AddPseudoTracks=TrackingFlags.doPseudoTracking,
76 DoR3LargeD0=TrackingFlags.doLargeD0,
77 StoreSeparateLargeD0Container=TrackingFlags.storeSeparateLargeD0Container,
91 from JetJvtEfficiency.JetJvtEfficiencyToolConfig
import getJvtEffToolCfg
93 algName =
"DFJet_EventCleaning_passJvtAlg"
95 passJvtTool.PassJVTKey =
"AntiKt4EMTopoJets.DFCommonJets_passJvt"
97 CompFactory.JetDecorationAlg(
98 algName, JetContainer=
"AntiKt4EMTopoJets", Decorators=[passJvtTool]
104 from AssociationUtils.AssociationUtilsConfig
import OverlapRemovalToolCfg
106 outputLabel =
"DFCommonJets_passOR"
110 orTool = acc.popToolsAndMerge(
112 flags, outputLabel=outputLabel, bJetLabel=bJetLabel, doTaus=
False
115 algOR = CompFactory.OverlapRemovalGenUseAlg(
116 "OverlapRemovalGenUseAlg",
117 OverlapLabel=outputLabel,
118 OverlapRemovalTool=orTool,
123 acc.addEventAlgo(algOR)
126 from JetSelectorTools.JetSelectorToolsConfig
import (
127 EventCleaningToolCfg,
131 workingPoints = [
"Loose"]
132 prefix =
"DFCommonJets_"
134 for wp
in workingPoints:
135 cleaningLevel = wp +
"Bad"
138 cleaningLevel = wp.replace(
"LLP",
"BadLLP")
140 jetCleaningTool = acc.popToolsAndMerge(
143 "JetCleaningTool_" + cleaningLevel,
149 acc.addPublicTool(jetCleaningTool)
151 ecTool = acc.popToolsAndMerge(
154 ecTool.JetCleanPrefix = prefix
155 ecTool.JetContainer =
"AntiKt4EMTopoJets"
156 ecTool.JetCleaningTool = jetCleaningTool
157 acc.addPublicTool(ecTool)
161 eventCleanAlg = CompFactory.EventCleaningTestAlg(
162 "EventCleaningTestAlg_" + wp,
163 EventCleaningTool=ecTool,
164 JetCollectionName=
"AntiKt4EMTopoJets",
165 EventCleanPrefix=prefix,
166 CleaningLevel=cleaningLevel,
167 doEvent=(
"Loose" in wp),
169 acc.addEventAlgo(eventCleanAlg)
172 augmentationTools = []
177 if addCaloDecorations:
178 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig
import (
179 CaloDecoratorKernelCfg)
184 streamName = kwargs[
"StreamName"]
187 if flags.Derivation.Egamma.doTrackThinning:
188 from DerivationFrameworkInDet.InDetToolsConfig
import (
189 TrackParticleThinningCfg,
190 MuonTrackParticleThinningCfg,
191 TauTrackParticleThinningCfg,
194 TrackThinningKeepElectronTracks =
True
195 TrackThinningKeepPhotonTracks =
True
196 TrackThinningKeepAllElectronTracks =
False
197 TrackThinningKeepJetTracks =
False
198 TrackThinningKeepMuonTracks =
False
199 TrackThinningKeepTauTracks =
False
200 TrackThinningKeepPVTracks =
False
203 if TrackThinningKeepElectronTracks:
204 EGAM12ElectronTPThinningTool = (
205 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
206 name=
"EGAM12ElectronTPThinningTool",
207 StreamName=streamName,
209 GSFTrackParticlesKey=
"GSFTrackParticles",
210 InDetTrackParticlesKey=
"InDetTrackParticles",
211 SelectionString=
"Electrons.pt > 0*GeV",
216 acc.addPublicTool(EGAM12ElectronTPThinningTool)
217 thinningTools.append(EGAM12ElectronTPThinningTool)
221 if TrackThinningKeepAllElectronTracks:
222 EGAM12ElectronTPThinningTool2 = (
223 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
224 name=
"EGAM12ElectronTPThinningTool2",
225 StreamName=streamName,
227 GSFTrackParticlesKey=
"GSFTrackParticles",
228 InDetTrackParticlesKey=
"InDetTrackParticles",
229 SelectionString=
"Electrons.pt > 4*GeV",
234 acc.addPublicTool(EGAM12ElectronTPThinningTool2)
235 thinningTools.append(EGAM12ElectronTPThinningTool2)
238 if TrackThinningKeepPhotonTracks:
239 EGAM12PhotonTPThinningTool = (
240 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
241 name=
"EGAM12PhotonTPThinningTool",
242 StreamName=streamName,
244 GSFTrackParticlesKey=
"GSFTrackParticles",
245 InDetTrackParticlesKey=
"InDetTrackParticles",
246 GSFConversionVerticesKey=
"GSFConversionVertices",
247 SelectionString=
"Photons.pt > 0*GeV",
252 acc.addPublicTool(EGAM12PhotonTPThinningTool)
253 thinningTools.append(EGAM12PhotonTPThinningTool)
256 if TrackThinningKeepJetTracks:
257 EGAM12JetTPThinningTool = (
258 CompFactory.DerivationFramework.JetTrackParticleThinning(
259 name=
"EGAM12JetTPThinningTool",
260 StreamName=streamName,
262 InDetTrackParticlesKey=
"InDetTrackParticles",
265 acc.addPublicTool(EGAM12JetTPThinningTool)
266 thinningTools.append(EGAM12JetTPThinningTool)
269 if TrackThinningKeepMuonTracks:
270 EGAM12MuonTPThinningTool = acc.getPrimaryAndMerge(
273 name=
"EGAM12MuonTPThinningTool",
274 StreamName=streamName,
276 InDetTrackParticlesKey=
"InDetTrackParticles",
279 thinningTools.append(EGAM12MuonTPThinningTool)
282 if TrackThinningKeepTauTracks:
283 EGAM12TauTPThinningTool = acc.getPrimaryAndMerge(
286 name=
"EGAM12TauTPThinningTool",
287 StreamName=streamName,
290 InDetTrackParticlesKey=
"InDetTrackParticles",
291 DoTauTracksThinning=
True,
292 TauTracksKey=
"TauTracks",
295 thinningTools.append(EGAM12TauTPThinningTool)
298 thinning_expression =
" && ".
join(
300 "(InDetTrackParticles.DFCommonTightPrimary)",
301 "(abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta)<3*mm)",
302 "(InDetTrackParticles.pt>10*GeV)",
305 if TrackThinningKeepPVTracks:
306 EGAM12TPThinningTool = acc.getPrimaryAndMerge(
309 name=
"EGAM12TPThinningTool",
310 StreamName=streamName,
311 SelectionString=thinning_expression,
312 InDetTrackParticlesKey=
"InDetTrackParticles",
315 thinningTools.append(EGAM12TPThinningTool)
320 truth_cond_WZH =
" && ".
join(
321 [
"(abs(TruthParticles.pdgId) >= 23)",
"(abs(TruthParticles.pdgId) <= 25)"]
324 truth_cond_lep =
" && ".
join(
325 [
"(abs(TruthParticles.pdgId) >= 11)",
"(abs(TruthParticles.pdgId) <= 16)"]
328 truth_cond_top =
"(abs(TruthParticles.pdgId) == 6)"
330 truth_cond_gam =
" && ".
join(
331 [
"(abs(TruthParticles.pdgId) == 22)",
"(TruthParticles.pt > 1*GeV)"]
334 truth_cond_finalState =
" && ".
join(
335 [
"(TruthParticles.status == 1)",
"(TruthParticles.barcode<200000)"]
351 + truth_cond_finalState
354 print(
"EGAM12 truth thinning expression: ", truth_expression)
356 EGAM12TruthThinningTool = CompFactory.DerivationFramework.GenericTruthThinning(
357 name=
"EGAM12TruthThinningTool",
358 StreamName=streamName,
359 ParticleSelectionString=truth_expression,
360 PreserveDescendants=
False,
361 PreserveGeneratorDescendants=
True,
362 PreserveAncestors=
True,
364 acc.addPublicTool(EGAM12TruthThinningTool)
365 thinningTools.append(EGAM12TruthThinningTool)
372 CompFactory.DerivationFramework.DerivationKernel(
374 SkimmingTools=[skimmingTool],
375 AugmentationTools=augmentationTools,
376 ThinningTools=thinningTools,