71 """Configure the derivation framework driving algorithm (kernel)
76 from JetRecConfig.StandardSmallRJets
import AntiKt4PV0Track
77 from JetRecConfig.JetRecConfig
import JetRecCfg
79 jetList = [AntiKt4PV0Track]
84 from DerivationFrameworkPhys.PhysCommonConfig
import PhysCommonAugmentationsCfg
88 flags, TriggerListsHelper=kwargs[
"TriggerListsHelper"]
93 augmentationTools = []
98 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig
import (
99 CaloDecoratorKernelCfg)
105 streamName = kwargs[
"StreamName"]
108 if flags.Derivation.Egamma.doTrackThinning:
109 from DerivationFrameworkInDet.InDetToolsConfig
import (
110 TrackParticleThinningCfg,
111 MuonTrackParticleThinningCfg,
112 TauTrackParticleThinningCfg,
115 TrackThinningKeepElectronTracks =
True
116 TrackThinningKeepPhotonTracks =
True
117 TrackThinningKeepAllElectronTracks =
False
118 TrackThinningKeepJetTracks =
False
119 TrackThinningKeepMuonTracks =
False
120 TrackThinningKeepTauTracks =
False
121 TrackThinningKeepPVTracks =
False
124 if TrackThinningKeepElectronTracks:
125 EGAM7ElectronTPThinningTool = (
126 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
127 name=
"EGAM7ElectronTPThinningTool",
128 StreamName=streamName,
130 GSFTrackParticlesKey=
"GSFTrackParticles",
131 InDetTrackParticlesKey=
"InDetTrackParticles",
132 SelectionString=
"Electrons.pt > 0*GeV",
137 acc.addPublicTool(EGAM7ElectronTPThinningTool)
138 thinningTools.append(EGAM7ElectronTPThinningTool)
142 if TrackThinningKeepAllElectronTracks:
143 EGAM7ElectronTPThinningTool2 = (
144 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
145 name=
"EGAM7ElectronTPThinningTool2",
146 StreamName=streamName,
148 GSFTrackParticlesKey=
"GSFTrackParticles",
149 InDetTrackParticlesKey=
"InDetTrackParticles",
150 SelectionString=
"Electrons.pt > 4*GeV",
155 acc.addPublicTool(EGAM7ElectronTPThinningTool2)
156 thinningTools.append(EGAM7ElectronTPThinningTool2)
159 if TrackThinningKeepPhotonTracks:
160 EGAM7PhotonTPThinningTool = (
161 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
162 name=
"EGAM7PhotonTPThinningTool",
163 StreamName=streamName,
165 GSFTrackParticlesKey=
"GSFTrackParticles",
166 InDetTrackParticlesKey=
"InDetTrackParticles",
167 GSFConversionVerticesKey=
"GSFConversionVertices",
168 SelectionString=
"Photons.pt > 0*GeV",
173 acc.addPublicTool(EGAM7PhotonTPThinningTool)
174 thinningTools.append(EGAM7PhotonTPThinningTool)
177 if TrackThinningKeepJetTracks:
178 EGAM7JetTPThinningTool = (
179 CompFactory.DerivationFramework.JetTrackParticleThinning(
180 name=
"EGAM7JetTPThinningTool",
181 StreamName=streamName,
182 JetKey=
"AntiKt4EMPFlowJets",
183 InDetTrackParticlesKey=
"InDetTrackParticles",
186 acc.addPublicTool(EGAM7JetTPThinningTool)
187 thinningTools.append(EGAM7JetTPThinningTool)
190 if TrackThinningKeepMuonTracks:
191 EGAM7MuonTPThinningTool = acc.getPrimaryAndMerge(
194 name=
"EGAM7MuonTPThinningTool",
195 StreamName=streamName,
197 InDetTrackParticlesKey=
"InDetTrackParticles",
200 thinningTools.append(EGAM7MuonTPThinningTool)
203 if TrackThinningKeepTauTracks:
204 EGAM7TauTPThinningTool = acc.getPrimaryAndMerge(
207 name=
"EGAM7TauTPThinningTool",
208 StreamName=streamName,
211 InDetTrackParticlesKey=
"InDetTrackParticles",
212 DoTauTracksThinning=
True,
213 TauTracksKey=
"TauTracks",
216 thinningTools.append(EGAM7TauTPThinningTool)
219 thinning_expression =
" && ".
join(
221 "(InDetTrackParticles.DFCommonTightPrimary)",
222 "(abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta)<3*mm)",
223 "(InDetTrackParticles.pt>10*GeV)",
226 if TrackThinningKeepPVTracks:
227 EGAM7TPThinningTool = acc.getPrimaryAndMerge(
230 name=
"EGAM7TPThinningTool",
231 StreamName=streamName,
232 SelectionString=thinning_expression,
233 InDetTrackParticlesKey=
"InDetTrackParticles",
236 thinningTools.append(EGAM7TPThinningTool)
241 truth_cond_WZH =
" && ".
join(
242 [
"(abs(TruthParticles.pdgId) >= 23)",
"(abs(TruthParticles.pdgId) <= 25)"]
245 truth_cond_lep =
" && ".
join(
246 [
"(abs(TruthParticles.pdgId) >= 11)",
"(abs(TruthParticles.pdgId) <= 16)"]
249 truth_cond_top =
"(abs(TruthParticles.pdgId) == 6)"
251 truth_cond_gam =
" && ".
join(
252 [
"(abs(TruthParticles.pdgId) == 22)",
"(TruthParticles.pt > 1*GeV)"]
255 truth_cond_finalState =
" && ".
join(
256 [
"(TruthParticles.status == 1)",
"(TruthParticles.barcode<200000)"]
272 + truth_cond_finalState
275 print(
"EGAM7 truth thinning expression: ", truth_expression)
277 EGAM7TruthThinningTool = CompFactory.DerivationFramework.GenericTruthThinning(
278 name=
"EGAM7TruthThinningTool",
279 StreamName=streamName,
280 ParticleSelectionString=truth_expression,
281 PreserveDescendants=
False,
282 PreserveGeneratorDescendants=
True,
283 PreserveAncestors=
True,
285 acc.addPublicTool(EGAM7TruthThinningTool)
286 thinningTools.append(EGAM7TruthThinningTool)
290 from DerivationFrameworkCalo.CaloCellDFGetterConfig
import thinCaloCellsForDFCfg
295 inputClusterKeys=[
"egammaClusters"],
296 streamName=
"StreamDAOD_EGAM7",
297 inputCellKey=
"AllCalo",
298 outputCellKey=
"DFEGAMCellContainer",
307 CompFactory.DerivationFramework.DerivationKernel(
309 SkimmingTools=[skimmingTool],
310 AugmentationTools=augmentationTools,
311 ThinningTools=thinningTools,