ATLAS Offline Software
Loading...
Searching...
No Matches
python.EGammaCommonConfig Namespace Reference

Functions

 EGammaCommonCfg (flags)

Function Documentation

◆ EGammaCommonCfg()

EGammaCommonCfg ( flags)
Main config method for e-gamma decorations

Definition at line 16 of file EGammaCommonConfig.py.

16def EGammaCommonCfg(flags):
17 """Main config method for e-gamma decorations"""
18
19 acc = ComponentAccumulator()
20 acc.flagPerfmonDomain('EGamma')
21 includeFwdElectrons = "ForwardElectrons" in flags.Input.Collections
22
23 isMC = flags.Input.isMC
24 isFullSim = False
25 if isMC:
26 isFullSim = flags.Sim.ISF.Simulator.isFullSim()
27 isRun2orRun3 = flags.GeoModel.Run in (LHCPeriod.Run2, LHCPeriod.Run3)
28
29 print("EGammaCommon: isMC = ", isMC)
30 if isMC:
31 print("EGammaCommon: isFullSim = ", isFullSim)
32
33 # ====================================================================
34 # FWD ELECTRON LH SELECTORS
35 # ====================================================================
36 if includeFwdElectrons:
37
38 from IsolationAlgs.IsolationSteeringDerivConfig import FwdElectronIsolationSteeringDerivCfg
39 acc.merge(FwdElectronIsolationSteeringDerivCfg(flags))
40
41 # ====================================================================
42 # RECTANGULAR CLUSTER TOOLS
43 # ====================================================================
44
45 from egammaCaloTools.egammaCaloToolsConfig import CaloFillRectangularClusterCfg
46
47 EGAMCOM_caloFillRect55 = acc.popToolsAndMerge(
48 CaloFillRectangularClusterCfg(
49 flags,
50 name="EGAMCOMCaloFillRectangularCluster55",
51 cells_name="AllCalo",
52 eta_size=5,
53 phi_size=5,
54 fill_cluster=True,
55 )
56 )
57 acc.addPublicTool(EGAMCOM_caloFillRect55)
58
59 EGAMCOM_caloFillRect35 = acc.popToolsAndMerge(
60 CaloFillRectangularClusterCfg(
61 flags,
62 name="EGAMCOMCaloFillRectangularCluster35",
63 cells_name="AllCalo",
64 eta_size=3,
65 phi_size=5,
66 fill_cluster=True,
67 )
68 )
69 acc.addPublicTool(EGAMCOM_caloFillRect35)
70
71 EGAMCOM_caloFillRect37 = acc.popToolsAndMerge(
72 CaloFillRectangularClusterCfg(
73 flags,
74 name="EGAMCOMCaloFillRectangularCluster37",
75 cells_name="AllCalo",
76 eta_size=3,
77 phi_size=7,
78 fill_cluster=True,
79 )
80 )
81 acc.addPublicTool(EGAMCOM_caloFillRect37)
82
83 EGAMCOM_caloFillRect711 = acc.popToolsAndMerge(
84 CaloFillRectangularClusterCfg(
85 flags,
86 name="EGAMCOMCaloFillRectangularCluster711",
87 cells_name="AllCalo",
88 eta_size=7,
89 phi_size=11,
90 fill_cluster=True,
91 )
92 )
93 acc.addPublicTool(EGAMCOM_caloFillRect711)
94
95 # ==================================================
96 # Truth Related tools
97 if flags.Input.isMC:
98 # Compute the truth-particle-level energy density in the central eta region
99 from EventShapeTools.EventDensityConfig import configEventDensityTool
100 from JetRecConfig.JetRecConfig import (
101 getInputAlgs,
102 getConstitPJGAlg,
103 reOrderAlgs,
104 )
105 from JetRecConfig.StandardJetConstits import stdConstitDic as cst
106
107 # Schedule PseudoJetTruth
108 constit_algs = getInputAlgs(cst.Truth, flags=flags)
109 constit_algs, ca = reOrderAlgs([a for a in constit_algs if a is not None])
110 acc.merge(ca)
111 for a in constit_algs:
112 acc.addEventAlgo(a)
113 constitPJAlg = getConstitPJGAlg(cst.Truth, suffix=None)
114 acc.addEventAlgo(constitPJAlg)
115
116 tc = configEventDensityTool(
117 "EDTruthCentralTool",
118 cst.Truth,
119 0.5,
120 AbsRapidityMin=0.0,
121 AbsRapidityMax=1.5,
122 OutputContainer="TruthIsoCentralEventShape",
123 OutputLevel=3,
124 )
125 acc.addPublicTool(tc)
126
127 # Compute the truth-particle-level energy density in the forward eta region
128 tf = configEventDensityTool(
129 "EDTruthForwardTool",
130 cst.Truth,
131 0.5,
132 AbsRapidityMin=1.5,
133 AbsRapidityMax=3.0,
134 OutputContainer="TruthIsoForwardEventShape",
135 OutputLevel=3,
136 )
137 acc.addPublicTool(tf)
138
139 acc.addEventAlgo(
140 CompFactory.EventDensityAthAlg("EDTruthCentralAlg", EventDensityTool=tc)
141 )
142 acc.addEventAlgo(
143 CompFactory.EventDensityAthAlg("EDTruthForwardAlg", EventDensityTool=tf)
144 )
145
146 # Create Fudged egamma collections
147 if flags.Input.isMC:
148 from DerivationFrameworkEGamma.EGammaToolsConfig import (
149 ElectronFudgeAlgorithmCfg, PhotonFudgeAlgorithmCfg, PhotonNFFudgeAlgorithmCfg)
150 acc.merge(ElectronFudgeAlgorithmCfg(flags))
151 if isRun2orRun3:
152 acc.merge(PhotonNFFudgeAlgorithmCfg(flags))
153 if isFullSim:
154 acc.merge(PhotonFudgeAlgorithmCfg(flags))
155
156 EGAugmentationTools = []
157
158 # ====================================================================
159 # PHOTON ETA (=ETA2), ET (=E/COSH(ETA2))
160 # ====================================================================
161 from DerivationFrameworkEGamma.EGammaToolsConfig import PhotonsDirectionToolCfg
162
163 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
164 PhotonsDirectionToolCfg(
165 flags,
166 name="DFCommonPhotonsDirection",
167 EtaSGEntry="DFCommonPhotons_eta",
168 PhiSGEntry="DFCommonPhotons_phi",
169 EtSGEntry="DFCommonPhotons_et",
170 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
171 )))
172
173 # ====================================================================
174 # AUGMENTATION TOOLS
175 # ====================================================================
176
177 from DerivationFrameworkEGamma.EGammaToolsConfig import EGSelectionToolWrapperCfg
178 from DerivationFrameworkEGamma.EGammaToolsConfig import (
179 EGElectronLikelihoodToolWrapperCfg,
180 EGPhotonBDTToolWrapperCfg,
181 EGPhotonBDTToolDecoratorCfg
182 )
183
184 # ====================================================================
185 # ELECTRON LH SELECTORS
186 # see Reconstruction/egamma/egammaTools/python/EMPIDBuilderBase.py
187 # on how to configure the selectors
188 # ====================================================================
189 from ROOT import LikeEnum
190
191 from ElectronPhotonSelectorTools.AsgElectronLikelihoodToolsConfig import (
192 AsgElectronLikelihoodToolCfg,
193 )
194 from ElectronPhotonSelectorTools.ElectronLikelihoodToolMapping import electronLHmenu
195
196 lhMenu = electronLHmenu.offlineMC21
197 if flags.GeoModel.Run is LHCPeriod.Run2:
198 lhMenu = electronLHmenu.offlineMC20
199
200 # Note: LH selectors don't need fudging since the LH is tuned to data
201
202 # decorate electrons with the output of LH very loose
203 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
204 EGElectronLikelihoodToolWrapperCfg(
205 flags,
206 name="ElectronPassLHVeryLoose",
207 EGammaElectronLikelihoodTool=acc.popToolsAndMerge(
208 AsgElectronLikelihoodToolCfg(
209 flags,
210 name="ElectronLHSelectorVeryLoose",
211 quality=LikeEnum.VeryLoose,
212 menu=lhMenu,
213 primaryVertexContainer = "PrimaryVertices"
214 )),
215 CutType="",
216 StoreGateEntryName="DFCommonElectronsLHVeryLoose",
217 ContainerName="Electrons",
218 StoreTResult=False,
219 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
220 )))
221
222 # decorate electrons with the output of LH loose
223 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
224 EGElectronLikelihoodToolWrapperCfg(
225 flags,
226 name="ElectronPassLHLoose",
227 EGammaElectronLikelihoodTool=acc.popToolsAndMerge(
228 AsgElectronLikelihoodToolCfg(
229 flags,
230 name="ElectronLHSelectorLoose",
231 quality=LikeEnum.Loose,
232 menu=lhMenu,
233 primaryVertexContainer = "PrimaryVertices"
234 )),
235 CutType="",
236 StoreGateEntryName="DFCommonElectronsLHLoose",
237 ContainerName="Electrons",
238 StoreTResult=False,
239 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
240 )))
241
242 # decorate electrons with the output of LH loose+BL
243 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
244 EGElectronLikelihoodToolWrapperCfg(
245 flags,
246 name="ElectronPassLHLooseBL",
247 EGammaElectronLikelihoodTool=acc.popToolsAndMerge(
248 AsgElectronLikelihoodToolCfg(
249 flags,
250 name="ElectronLHSelectorLooseBL",
251 quality=LikeEnum.LooseBL,
252 menu=lhMenu,
253 primaryVertexContainer = "PrimaryVertices"
254 )),
255 CutType="",
256 StoreGateEntryName="DFCommonElectronsLHLooseBL",
257 ContainerName="Electrons",
258 StoreTResult=False,
259 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
260 )))
261
262 # decorate electrons with the output of LH medium
263 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
264 EGElectronLikelihoodToolWrapperCfg(
265 flags,
266 name="ElectronPassLHMedium",
267 EGammaElectronLikelihoodTool=acc.popToolsAndMerge(
268 AsgElectronLikelihoodToolCfg(
269 flags,
270 name="ElectronLHSelectorMedium",
271 quality=LikeEnum.Medium,
272 menu=lhMenu,
273 primaryVertexContainer = "PrimaryVertices"
274 )),
275 CutType="",
276 StoreGateEntryName="DFCommonElectronsLHMedium",
277 ContainerName="Electrons",
278 StoreTResult=False,
279 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
280 )))
281
282 # decorate electrons with the output of LH tight
283 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
284 EGElectronLikelihoodToolWrapperCfg(
285 flags,
286 name="ElectronPassLHTight",
287 EGammaElectronLikelihoodTool=acc.popToolsAndMerge(
288 AsgElectronLikelihoodToolCfg(
289 flags,
290 name="ElectronLHSelectorTight",
291 quality=LikeEnum.Tight,
292 menu=lhMenu,
293 primaryVertexContainer = "PrimaryVertices"
294 )),
295 CutType="",
296 StoreGateEntryName="DFCommonElectronsLHTight",
297 ContainerName="Electrons",
298 StoreTResult=False,
299 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
300 )))
301
302 # ====================================================================
303 # ELECTRON DNN SELECTORS
304 # ====================================================================
305 from ElectronPhotonSelectorTools.AsgElectronSelectorToolConfig import (
306 AsgElectronSelectorToolCfg,
307 )
308
309 # decorate electrons with the output of DNN Loose
310 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
311 EGElectronLikelihoodToolWrapperCfg(
312 flags,
313 name="ElectronPassDNNLoose",
314 EGammaElectronLikelihoodTool=acc.popToolsAndMerge(
315 AsgElectronSelectorToolCfg(
316 flags,
317 name="ElectronDNNSelectorLoose",
318 WorkingPoint="LooseDNNElectron",
319 )),
320 CutType="",
321 StoreGateEntryName="DFCommonElectronsDNNLoose",
322 ContainerName="Electrons",
323 FudgedContainerName="FudgedElectrons" if isMC else "",
324 StoreTResult=False,
325 StoreGateEntryMultipleNames=[
326 "DFCommonElectronsDNN_pel",
327 "DFCommonElectronsDNN_pcf",
328 "DFCommonElectronsDNN_ppc",
329 "DFCommonElectronsDNN_phf",
330 "DFCommonElectronsDNN_ple",
331 "DFCommonElectronsDNN_plh",
332 ],
333 StoreMultipleOutputs=True,
334 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
335 )))
336
337 # decorate electrons with the output of DNN Medium
338 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
339 EGElectronLikelihoodToolWrapperCfg(
340 flags,
341 name="ElectronPassDNNMedium",
342 EGammaElectronLikelihoodTool=acc.popToolsAndMerge(
343 AsgElectronSelectorToolCfg(
344 flags,
345 name="ElectronDNNSelectorMedium",
346 WorkingPoint="MediumDNNElectron",
347 )),
348 CutType="",
349 StoreGateEntryName="DFCommonElectronsDNNMedium",
350 ContainerName="Electrons",
351 FudgedContainerName="FudgedElectrons" if isMC else "",
352 StoreTResult=False,
353 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
354 )))
355
356 # decorate electrons with the output of DNN Tight
357 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
358 EGElectronLikelihoodToolWrapperCfg(
359 flags,
360 name="ElectronPassDNNTight",
361 EGammaElectronLikelihoodTool=acc.popToolsAndMerge(
362 AsgElectronSelectorToolCfg(
363 flags,
364 name="ElectronDNNSelectorTight",
365 WorkingPoint="TightDNNElectron",
366 )),
367 CutType="",
368 StoreGateEntryName="DFCommonElectronsDNNTight",
369 ContainerName="Electrons",
370 FudgedContainerName="FudgedElectrons" if isMC else "",
371 StoreTResult=False,
372 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
373 )))
374
375 # ====================================================================
376 # ELECTRON DNN SELECTORS WITHOUT CF REJECTION
377 # ====================================================================
378 # decorate electrons with the output of DNN VeryLoose97 without CF
379 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
380 EGElectronLikelihoodToolWrapperCfg(
381 flags,
382 name="ElectronPassDNNVeryLooseNoCF97",
383 EGammaElectronLikelihoodTool=acc.popToolsAndMerge(
384 AsgElectronSelectorToolCfg(
385 flags,
386 name="ElectronDNNSelectorVeryLooseNoCF97",
387 WorkingPoint="VeryLooseNoCF97DNNElectron",
388 )),
389 CutType="",
390 StoreGateEntryName="DFCommonElectronsDNNVeryLooseNoCF97",
391 ContainerName="Electrons",
392 FudgedContainerName="FudgedElectrons" if isMC else "",
393 StoreTResult=False,
394 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
395 )))
396
397 # decorate electrons with the output of DNN Loose without CF
398 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
399 EGElectronLikelihoodToolWrapperCfg(
400 flags,
401 name="ElectronPassDNNLooseNoCF",
402 EGammaElectronLikelihoodTool=acc.popToolsAndMerge(
403 AsgElectronSelectorToolCfg(
404 flags,
405 name="ElectronDNNSelectorLooseNoCF",
406 WorkingPoint="LooseNoCFDNNElectron",
407 )),
408 CutType="",
409 StoreGateEntryName="DFCommonElectronsDNNLooseNoCF",
410 ContainerName="Electrons",
411 FudgedContainerName="FudgedElectrons" if isMC else "",
412 StoreTResult=False,
413 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
414 )))
415
416 # decorate electrons with the output of DNN Medium without CF
417 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
418 EGElectronLikelihoodToolWrapperCfg(
419 flags,
420 name="ElectronPassDNNMediumNoCF",
421 EGammaElectronLikelihoodTool=acc.popToolsAndMerge(
422 AsgElectronSelectorToolCfg(
423 flags,
424 name="ElectronDNNSelectorMediumNoCF",
425 WorkingPoint="MediumNoCFDNNElectron",
426 )),
427 CutType="",
428 StoreGateEntryName="DFCommonElectronsDNNMediumNoCF",
429 ContainerName="Electrons",
430 FudgedContainerName="FudgedElectrons" if isMC else "",
431 StoreTResult=False,
432 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
433 )))
434
435 # decorate electrons with the output of DNN Tight without CF
436 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
437 EGElectronLikelihoodToolWrapperCfg(
438 flags,
439 name="ElectronPassDNNTightNoCF",
440 EGammaElectronLikelihoodTool=acc.popToolsAndMerge(
441 AsgElectronSelectorToolCfg(
442 flags,
443 name="ElectronDNNSelectorTightNoCF",
444 WorkingPoint="TightNoCFDNNElectron",
445 )),
446 CutType="",
447 StoreGateEntryName="DFCommonElectronsDNNTightNoCF",
448 ContainerName="Electrons",
449 FudgedContainerName="FudgedElectrons" if isMC else "",
450 StoreTResult=False,
451 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
452 )))
453
454 # ====================================================================
455 # PHOTON SELECTION (loose and tight cut-based)
456 # ====================================================================
457 from ROOT import egammaPID
458
459 from ElectronPhotonSelectorTools.AsgPhotonIsEMSelectorsConfig import (
460 AsgPhotonIsEMSelectorCfg,
461 )
462 from ElectronPhotonSelectorTools.PhotonIsEMSelectorMapping import photonPIDmenu
463 pidMenu = photonPIDmenu.offlineMC21
464 if flags.GeoModel.Run is LHCPeriod.Run2:
465 pidMenu = photonPIDmenu.offlineMC20
466
467 # decorate photons with the output of IsEM loose
468 # on MC, use fudged shower shapes to compute the ID (but the
469 # original shower shapes are not overridden)
470 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
471 EGSelectionToolWrapperCfg(
472 flags,
473 name="PhotonPassIsEMLoose",
474 EGammaSelectionTool=acc.popToolsAndMerge(
475 AsgPhotonIsEMSelectorCfg(
476 flags,
477 name="PhotonIsEMSelectorLoose",
478 quality=egammaPID.PhotonIDLoose,
479 menu=pidMenu
480 )),
481 CutType="",
482 StoreGateEntryName="DFCommonPhotonsIsEMLoose",
483 ContainerName="Photons",
484 FudgedContainerName="FudgedPhotons" if isFullSim else "",
485 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
486 )))
487
488 # decorate photons with the output of IsEM medium
489 # on MC, use fudged shower shapes to compute the ID (but the
490 # original shower shapes are not overridden)
491 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
492 EGSelectionToolWrapperCfg(
493 flags,
494 name="PhotonPassIsEMMedium",
495 EGammaSelectionTool=acc.popToolsAndMerge(
496 AsgPhotonIsEMSelectorCfg(
497 flags,
498 name="PhotonIsEMSelectorMedium",
499 quality=egammaPID.PhotonIDMedium,
500 menu=pidMenu
501 )),
502 CutType="",
503 StoreGateEntryName="DFCommonPhotonsIsEMMedium",
504 ContainerName="Photons",
505 FudgedContainerName="FudgedPhotons" if isFullSim else "",
506 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
507 )))
508
509 # decorate photons with the output of IsEM tight
510 # on full-sim MC, use fudged shower shapes to compute the ID
511 # (but the original shower shapes are not overridden)
512 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
513 EGSelectionToolWrapperCfg(
514 flags,
515 name="PhotonPassIsEMTight",
516 EGammaSelectionTool=acc.popToolsAndMerge(
517 AsgPhotonIsEMSelectorCfg(
518 flags,
519 name="PhotonIsEMSelectorTight",
520 quality=egammaPID.PhotonIDTight,
521 menu=pidMenu
522 )),
523 CutType="",
524 StoreGateEntryName="DFCommonPhotonsIsEMTight",
525 ContainerName="Photons",
526 FudgedContainerName="FudgedPhotons" if isFullSim else "",
527 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
528 )))
529
530 # decorate photons with the output of IsEM tight
531 # on MC, normalizing flows-based correction used to compute the ID
532 # (but the original shower shapes are not overridden)
533 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
534 EGSelectionToolWrapperCfg(
535 flags,
536 name="PhotonPassIsEMTightNF",
537 EGammaSelectionTool=acc.popToolsAndMerge(
538 AsgPhotonIsEMSelectorCfg(
539 flags,
540 name="PhotonIsEMSelectorTightNF",
541 quality=egammaPID.PhotonIDTight,
542 menu=pidMenu
543 )),
544 CutType="",
545 StoreGateEntryName="DFCommonPhotonsIsEMTightNF",
546 ContainerName="Photons",
547 FudgedContainerName= "NFFudgedPhotons" if (isMC and isRun2orRun3) else ""
548 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
549 )))
550
551 # ====================================================================
552 # PHOTON BDT SELECTION
553 # ====================================================================
554 photonIDBDTWP = "TightBDTPhoton_Run3"
555 if flags.GeoModel.Run is LHCPeriod.Run2:
556 photonIDBDTWP = "TightBDTPhoton_Run2"
557 from ElectronPhotonSelectorTools.AsgPhotonBDTSelectorConfig import (
558 PhotonBDTCalculatorCfg,
559 AsgPhotonBDTSelectorCfg,
560 )
561 # decorate photons with the output of BDT tight
562 # on full-sim MC, use fudged shower shapes to compute the ID
563 # (but the original shower shapes are not overridden)
564 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
565 EGPhotonBDTToolDecoratorCfg(
566 flags,
567 name="PhotonBDTDecorator",
568 PhotonObservableTool=acc.popToolsAndMerge(
569 PhotonBDTCalculatorCfg(
570 flags,
571 name="PhotonBDTCalculator",
572 useNFs=False,
573 )),
574 StoreGateEntryName="DFCommonPhotonsBDT",
575 ContainerName="Photons",
576 FudgedContainerName= "FudgedPhotons" if isFullSim else ""
577 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
578 )))
579
580 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
581 EGPhotonBDTToolWrapperCfg(
582 flags,
583 name="PhotonPassBDTTight",
584 PhotonBDTSelectionTool=acc.popToolsAndMerge(
585 AsgPhotonBDTSelectorCfg(
586 flags,
587 name="PhotonBDTSelectorTight",
588 ScoreDecoration="DFCommonPhotonsBDTScore",
589 WorkingPoint=photonIDBDTWP,
590 useNFs=False,
591 SuppressInputDependence=True
592 )),
593 CutType="",
594 StoreGateEntryName="DFCommonPhotonsBDT",
595 WorkingPointName="Tight",
596 ContainerName="Photons",
597 FudgedContainerName= "FudgedPhotons" if isFullSim else ""
598 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
599 )))
600
601 # decorate photons with the output of BDT tight
602 # on MC, normalizing flows-based correction used to compute the ID
603 # (but the original shower shapes are not overridden)
604 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
605 EGPhotonBDTToolDecoratorCfg(
606 flags,
607 name="PhotonBDTDecoratorNF",
608 PhotonObservableTool=acc.popToolsAndMerge(
609 PhotonBDTCalculatorCfg(
610 flags,
611 name="PhotonBDTCalculatorNF",
612 useNFs=True)),
613 StoreGateEntryName="DFCommonPhotonsNFBDT",
614 ContainerName="Photons",
615 FudgedContainerName= "NFFudgedPhotons" if (isMC and isRun2orRun3) else ""
616 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
617 )))
618
619 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
620 EGPhotonBDTToolWrapperCfg(
621 flags,
622 name="PhotonPassBDTTightNF",
623 PhotonBDTSelectionTool=acc.popToolsAndMerge(
624 AsgPhotonBDTSelectorCfg(
625 flags,
626 name="PhotonBDTSelectorTightNF",
627 ScoreDecoration="DFCommonPhotonsNFBDTScore",
628 WorkingPoint=photonIDBDTWP+"_NFs",
629 useNFs=True,
630 SuppressInputDependence=True
631 )),
632 CutType="",
633 StoreGateEntryName="DFCommonPhotonsNFBDT",
634 WorkingPointName="Tight",
635 ContainerName="Photons",
636 FudgedContainerName= "NFFudgedPhotons" if (isMC and isRun2orRun3) else ""
637 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
638 )))
639
640
641 # decorate photons with the photon cleaning flags
642 # on MC, fudge the shower shapes used to compute the flags
643 from DerivationFrameworkEGamma.EGammaToolsConfig import EGPhotonCleaningWrapperCfg
644 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
645 EGPhotonCleaningWrapperCfg(
646 flags,
647 name="PhotonPassCleaning",
648 StoreGateEntryName="DFCommonPhotonsCleaning",
649 ContainerName="Photons",
650 FudgedContainerName= "FudgedPhotons" if isFullSim else ""
651 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
652 )))
653
654 # decorate some electrons with an additional ambiguity flag
655 # against internal and early material conversion
656 from DerivationFrameworkEGamma.EGammaToolsConfig import EGElectronAmbiguityToolCfg
657
658 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
659 EGElectronAmbiguityToolCfg(
660 flags,
661 name="ElectronAdditionnalAmbiguity",
662 isMC=flags.Input.isMC,
663 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
664 )))
665
666 # ====================================================================
667 # ELECTRON CHARGE SELECTION
668 # ====================================================================
669 if flags.Derivation.Egamma.addECIDS:
670 # decorate electrons with the output of ECIDS
671 from ElectronPhotonSelectorTools.AsgElectronChargeIDSelectorToolConfig import (
672 AsgElectronChargeIDSelectorToolCfg,
673 )
674
675 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
676 EGElectronLikelihoodToolWrapperCfg(
677 flags,
678 name="ElectronPassECIDS",
679 EGammaElectronLikelihoodTool=acc.popToolsAndMerge(
680 AsgElectronChargeIDSelectorToolCfg(
681 flags, name="ElectronChargeIDSelectorLoose",
682 primaryVertexContainer = "PrimaryVertices",
683 TrainingFile = ("ElectronPhotonSelectorTools/ChargeID/ECIDS_20180731rel21Summer2018.root")
684 )),
685 CutType="",
686 StoreGateEntryName="DFCommonElectronsECIDS",
687 ContainerName="Electrons",
688 StoreTResult=True,
689 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
690 )))
691
692 # ====================================================================
693 # FWD ELECTRON LH SELECTORS
694 # ====================================================================
695 if includeFwdElectrons:
696 from ElectronPhotonSelectorTools.AsgForwardElectronLikelihoodToolConfig import (
697 AsgForwardElectronLikelihoodToolCfg,
698 )
699 # decorate forward electrons with the output of LH loose
700 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
701 EGElectronLikelihoodToolWrapperCfg(
702 flags,
703 name="ForwardElectronPassLHLoose",
704 EGammaElectronLikelihoodTool=acc.popToolsAndMerge(
705 AsgForwardElectronLikelihoodToolCfg(
706 flags,
707 name="ForwardElectronLHSelectorLoose",
708 WorkingPoint="LooseLHForwardElectron",
709 )),
710 CutType="",
711 StoreGateEntryName="DFCommonForwardElectronsLHLoose",
712 ContainerName="ForwardElectrons",
713 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
714 )))
715
716 # decorate forward electrons with the output of LH medium
717 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
718 EGElectronLikelihoodToolWrapperCfg(
719 flags,
720 name="ForwardElectronPassLHMedium",
721 EGammaElectronLikelihoodTool=acc.popToolsAndMerge(
722 AsgForwardElectronLikelihoodToolCfg(
723 flags,
724 name="ForwardElectronLHSelectorMedium",
725 WorkingPoint="MediumLHForwardElectron",
726 )),
727 CutType="",
728 StoreGateEntryName="DFCommonForwardElectronsLHMedium",
729 ContainerName="ForwardElectrons",
730 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
731 )))
732
733 # decorate forward electrons with the output of LH tight
734 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
735 EGElectronLikelihoodToolWrapperCfg(
736 flags,
737 name="ForwardElectronPassLHTight",
738 EGammaElectronLikelihoodTool=acc.popToolsAndMerge(
739 AsgForwardElectronLikelihoodToolCfg(
740 flags,
741 name="ForwardElectronLHSelectorTight",
742 WorkingPoint="TightLHForwardElectron",
743 )),
744 CutType="",
745 StoreGateEntryName="DFCommonForwardElectronsLHTight",
746 ContainerName="ForwardElectrons",
747 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
748 )))
749
750 from egammaAlgs.egammaAODFixesConfig import runAODFix
751 _, fixes = runAODFix(flags)
752 # the topoIso fix already provides the decorations that this tool creates
753 if not('egammatopoIsoFix' in fixes):
754 if flags.Derivation.Egamma.addMissingCellInfo:
755 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig import (
756 EgammaCoreCellRecoveryCfg,
757 )
758
759 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
760 EgammaCoreCellRecoveryCfg(flags) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
761 )))
762
763 if flags.Derivation.Egamma.addMissingCellInfo:
764 from DerivationFrameworkEGamma.EGammaToolsConfig import EGammaEnergyCalibrationWrapperCfg
765 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
766 EGammaEnergyCalibrationWrapperCfg(
767 flags,
768 name="TransformerEnergyCalibration",
769 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
770 )))
771
772 # ==================================================
773 # Truth Related tools
774 if flags.Input.isMC:
775 # Decorate Electron with bkg electron type/origin
776 from DerivationFrameworkEGamma.EGammaToolsConfig import (
777 BkgElectronClassificationCfg,
778 )
779
780 EGAugmentationTools.append(acc.addPublicTool(acc.popToolsAndMerge(
781 BkgElectronClassificationCfg(
782 flags,
783 name="BkgElectronClassificationTool"
784 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
785 )))
786
787 # Decorate egammaTruthParticles with truth-particle-level etcone20,30,40
788 from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import (
789 TruthIsolationToolCfg,
790 )
791
792 EGAugmentationTools.append(acc.getPrimaryAndMerge(
793 TruthIsolationToolCfg(
794 flags,
795 name="TruthEgetIsolationTool",
796 isoParticlesKey="egammaTruthParticles",
797 allParticlesKey="TruthParticles",
798 particleIDsToCalculate=[-11, 11, 22],
799 IsolationConeSizes=[0.2, 0.3, 0.4],
800 excludeIDsFromCone=[-16, -14, -13, -12, 12, 13, 14, 16],
801 IsolationVarNamePrefix="etcone",
802 ChargedParticlesOnly=False,
803 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
804 ))
805
806 # Decorate egammaTruthParticles with truth-particle-level ptcone20,30,40
807 EGAugmentationTools.append(acc.getPrimaryAndMerge(
808 TruthIsolationToolCfg(
809 flags,
810 name="TruthEgptIsolationTool",
811 isoParticlesKey="egammaTruthParticles",
812 allParticlesKey="TruthParticles",
813 particleIDsToCalculate=[-11, 11, 22],
814 IsolationConeSizes=[0.2, 0.3, 0.4],
815 IsolationVarNamePrefix="ptcone",
816 ChargedParticlesOnly=True,
817 ) # TODO Migrate to AthReentrantAlgorithm (ATLASG-3211)
818 ))
819
820 # =======================================
821 # CREATE THE DERIVATION KERNEL ALGORITHM
822 # =======================================
823
824 acc.addEventAlgo(
825 CompFactory.DerivationFramework.CommonAugmentation(
826 "EGammaCommonKernel", AugmentationTools=EGAugmentationTools
827 )
828 )
829
830 # =======================================
831 # ADD TOOLS : custom electron, photon and muon track isolation
832 # =======================================
833 from IsolationAlgs.DerivationTrackIsoConfig import DerivationTrackIsoCfg
834
835 if includeFwdElectrons:
836 acc.merge(DerivationTrackIsoCfg(flags, object_types=("Electrons", "Muons", "ForwardElectrons")))
837 else:
838 acc.merge(DerivationTrackIsoCfg(flags, object_types=("Electrons", "Muons")))
839
840 hasFlowObject = (
841 "JetETMissChargedParticleFlowObjects" in flags.Input.Collections
842 and "JetETMissNeutralParticleFlowObjects" in flags.Input.Collections
843 )
844 if hasFlowObject:
845 from IsolationAlgs.IsolationSteeringDerivConfig import IsolationSteeringDerivCfg
846
847 acc.merge(IsolationSteeringDerivCfg(flags))
848
849 return acc
void print(char *figname, TCanvas *c1)