ATLAS Offline Software
Functions
python.EGammaCommonConfig Namespace Reference

Functions

def EGammaCommonCfg (ConfigFlags)
 

Function Documentation

◆ EGammaCommonCfg()

def python.EGammaCommonConfig.EGammaCommonCfg (   ConfigFlags)
Main config method for e-gamma decorations

Definition at line 15 of file EGammaCommonConfig.py.

15 def EGammaCommonCfg(ConfigFlags):
16  """Main config method for e-gamma decorations"""
17 
18  acc = ComponentAccumulator()
19 
20  includeFwdElectrons = "ForwardElectrons" in ConfigFlags.Input.Collections
21 
22  # ====================================================================
23  # PHOTON ETA (=ETA2), ET (=E/COSH(ETA2))
24  # ====================================================================
25  from DerivationFrameworkEGamma.EGammaToolsConfig import PhotonsDirectionToolCfg
26 
27  DFCommonPhotonsDirection = acc.getPrimaryAndMerge(
29  ConfigFlags,
30  name="DFCommonPhotonsDirection",
31  EtaSGEntry="DFCommonPhotons_eta",
32  PhiSGEntry="DFCommonPhotons_phi",
33  EtSGEntry="DFCommonPhotons_et",
34  )
35  )
36 
37  # ====================================================================
38  # SHOWER SHAPE CORRECTIONS IN MC
39  # TUNE26: e/gamma FUDGE FACTORS RUN2 FULL DATA, derived with
40  # rel 22 (e) or 21.2 (gamma)
41  # ====================================================================
42  isMC = ConfigFlags.Input.isMC
43  isFullSim = False
44  if isMC:
45  isFullSim = ConfigFlags.Sim.ISF.Simulator.isFullSim()
46 
47  print("EGammaCommon: isMC = ", isMC)
48  if isMC:
49  print("EGammaCommon: isFullSim = ", isFullSim)
50 
51  if isFullSim:
52  from EGammaVariableCorrection.EGammaVariableCorrectionConfig import (
53  ElectronVariableCorrectionToolCfg,
54  PhotonVariableCorrectionToolCfg,
55  )
56 
57  ElectronVariableCorrectionTool = acc.popToolsAndMerge(
59  )
60  acc.addPublicTool(ElectronVariableCorrectionTool)
61 
62  PhotonVariableCorrectionTool = acc.popToolsAndMerge(
64  )
65  acc.addPublicTool(PhotonVariableCorrectionTool)
66 
67  # ====================================================================
68  # ELECTRON LH SELECTORS
69  # see Reconstruction/egamma/egammaTools/python/EMPIDBuilderBase.py
70  # on how to configure the selectors
71  # ====================================================================
72  from ROOT import LikeEnum
73 
74  from ElectronPhotonSelectorTools.AsgElectronLikelihoodToolsConfig import (
75  AsgElectronLikelihoodToolCfg,
76  )
77  from ElectronPhotonSelectorTools.ElectronLikelihoodToolMapping import electronLHmenu
78 
79  lhMenu = electronLHmenu.offlineMC21
80  from AthenaConfiguration.Enums import LHCPeriod
81 
82  if ConfigFlags.GeoModel.Run is LHCPeriod.Run2:
83  lhMenu = electronLHmenu.offlineMC20
84 
85  # Very Loose
86  ElectronLHSelectorVeryLoose = acc.popToolsAndMerge(
88  ConfigFlags,
89  name="ElectronLHSelectorVeryLoose",
90  quality=LikeEnum.VeryLoose,
91  menu=lhMenu,
92  )
93  )
94  ElectronLHSelectorVeryLoose.primaryVertexContainer = "PrimaryVertices"
95  acc.addPublicTool(ElectronLHSelectorVeryLoose)
96 
97  # Loose
98  ElectronLHSelectorLoose = acc.popToolsAndMerge(
100  ConfigFlags,
101  name="ElectronLHSelectorLoose",
102  quality=LikeEnum.Loose,
103  menu=lhMenu,
104  )
105  )
106  ElectronLHSelectorLoose.primaryVertexContainer = "PrimaryVertices"
107  acc.addPublicTool(ElectronLHSelectorLoose)
108 
109  # LooseBL
110  ElectronLHSelectorLooseBL = acc.popToolsAndMerge(
112  ConfigFlags,
113  name="ElectronLHSelectorLooseBL",
114  quality=LikeEnum.LooseBL,
115  menu=lhMenu,
116  )
117  )
118  ElectronLHSelectorLooseBL.primaryVertexContainer = "PrimaryVertices"
119  acc.addPublicTool(ElectronLHSelectorLooseBL)
120 
121  # Medium
122  ElectronLHSelectorMedium = acc.popToolsAndMerge(
124  ConfigFlags,
125  name="ElectronLHSelectorMedium",
126  quality=LikeEnum.Medium,
127  menu=lhMenu,
128  )
129  )
130  ElectronLHSelectorMedium.primaryVertexContainer = "PrimaryVertices"
131  acc.addPublicTool(ElectronLHSelectorMedium)
132 
133  # Tight
134  ElectronLHSelectorTight = acc.popToolsAndMerge(
136  ConfigFlags,
137  name="ElectronLHSelectorTight",
138  quality=LikeEnum.Tight,
139  menu=lhMenu,
140  )
141  )
142  ElectronLHSelectorTight.primaryVertexContainer = "PrimaryVertices"
143  acc.addPublicTool(ElectronLHSelectorTight)
144 
145  # ====================================================================
146  # ELECTRON DNN SELECTORS
147  # ====================================================================
148  from ElectronPhotonSelectorTools.AsgElectronSelectorToolConfig import (
149  AsgElectronSelectorToolCfg,
150  )
151 
152  # Loose
153  ElectronDNNSelectorLoose = acc.popToolsAndMerge(
155  ConfigFlags,
156  name="ElectronDNNSelectorLoose",
157  WorkingPoint="LooseDNNElectron",
158  )
159  )
160  acc.addPublicTool(ElectronDNNSelectorLoose)
161 
162  # Medium
163  ElectronDNNSelectorMedium = acc.popToolsAndMerge(
165  ConfigFlags,
166  name="ElectronDNNSelectorMedium",
167  WorkingPoint="MediumDNNElectron",
168  )
169  )
170  acc.addPublicTool(ElectronDNNSelectorMedium)
171 
172  # Tight
173  ElectronDNNSelectorTight = acc.popToolsAndMerge(
175  ConfigFlags,
176  name="ElectronDNNSelectorTight",
177  WorkingPoint="TightDNNElectron",
178  )
179  )
180  acc.addPublicTool(ElectronDNNSelectorTight)
181 
182  # ====================================================================
183  # ELECTRON DNN SELECTORS WITHOUT CF REJECTION
184  # ====================================================================
185  # Loose
186  ElectronDNNSelectorLooseNoCF = acc.popToolsAndMerge(
188  ConfigFlags,
189  name="ElectronDNNSelectorLooseNoCF",
190  WorkingPoint="LooseDNNnoCFElectron",
191  )
192  )
193  acc.addPublicTool(ElectronDNNSelectorLooseNoCF)
194 
195  # Medium
196  ElectronDNNSelectorMediumNoCF = acc.popToolsAndMerge(
198  ConfigFlags,
199  name="ElectronDNNSelectorMediumNoCF",
200  WorkingPoint="MediumDNNnoCFElectron",
201  )
202  )
203  acc.addPublicTool(ElectronDNNSelectorMediumNoCF)
204 
205  # Tight
206  ElectronDNNSelectorTightNoCF = acc.popToolsAndMerge(
208  ConfigFlags,
209  name="ElectronDNNSelectorTightNoCF",
210  WorkingPoint="TightDNNnoCFElectron",
211  )
212  )
213  acc.addPublicTool(ElectronDNNSelectorTightNoCF)
214 
215  # ====================================================================
216  # ELECTRON CHARGE SELECTION
217  # ====================================================================
218  if ConfigFlags.Derivation.Egamma.addECIDS:
219  from ElectronPhotonSelectorTools.AsgElectronChargeIDSelectorToolConfig import (
220  AsgElectronChargeIDSelectorToolCfg,
221  )
222 
223  ElectronChargeIDSelector = acc.popToolsAndMerge(
225  ConfigFlags, name="ElectronChargeIDSelectorLoose"
226  )
227  )
228  ElectronChargeIDSelector.primaryVertexContainer = "PrimaryVertices"
229  ElectronChargeIDSelector.TrainingFile = (
230  "ElectronPhotonSelectorTools/ChargeID/ECIDS_20180731rel21Summer2018.root"
231  )
232  acc.addPublicTool(ElectronChargeIDSelector)
233 
234  # ====================================================================
235  # FWD ELECTRON LH SELECTORS
236  # ====================================================================
237  if includeFwdElectrons:
238  from ElectronPhotonSelectorTools.AsgForwardElectronLikelihoodToolConfig import (
239  AsgForwardElectronLikelihoodToolCfg,
240  )
241 
242  ForwardElectronLHSelectorLoose = acc.popToolsAndMerge(
244  ConfigFlags,
245  name="ForwardElectronLHSelectorLoose",
246  WorkingPoint="LooseLHForwardElectron",
247  )
248  )
249  acc.addPublicTool(ForwardElectronLHSelectorLoose)
250 
251  ForwardElectronLHSelectorMedium = acc.popToolsAndMerge(
253  ConfigFlags,
254  name="ForwardElectronLHSelectorMedium",
255  WorkingPoint="MediumLHForwardElectron",
256  )
257  )
258  acc.addPublicTool(ForwardElectronLHSelectorMedium)
259 
260  ForwardElectronLHSelectorTight = acc.popToolsAndMerge(
262  ConfigFlags,
263  name="ForwardElectronLHSelectorTight",
264  WorkingPoint="TightLHForwardElectron",
265  )
266  )
267  acc.addPublicTool(ForwardElectronLHSelectorTight)
268 
269  # ====================================================================
270  # PHOTON SELECTION (loose and tight cut-based)
271  # ====================================================================
272  from ROOT import egammaPID
273 
274  from ElectronPhotonSelectorTools.AsgPhotonIsEMSelectorsConfig import (
275  AsgPhotonIsEMSelectorCfg,
276  )
277  from ElectronPhotonSelectorTools.PhotonIsEMSelectorMapping import photonPIDmenu
278 
279  # Loose
280  PhotonIsEMSelectorLoose = acc.popToolsAndMerge(
282  ConfigFlags, name="PhotonIsEMSelectorLoose", quality=egammaPID.PhotonIDLoose
283  )
284  )
285  acc.addPublicTool(PhotonIsEMSelectorLoose)
286 
287  # Medium
288  PhotonIsEMSelectorMedium = acc.popToolsAndMerge(
290  ConfigFlags, name="PhotonIsEMSelectorMedium", quality=egammaPID.PhotonIDMedium
291  )
292  )
293  acc.addPublicTool(PhotonIsEMSelectorMedium)
294 
295  # Tight (default == pt-dependent)
296  PhotonIsEMSelectorTight = acc.popToolsAndMerge(
298  ConfigFlags, name="PhotonIsEMSelectorTight", quality=egammaPID.PhotonIDTight
299  )
300  )
301  acc.addPublicTool(PhotonIsEMSelectorTight)
302 
303  # Tight (pt-inclusive)
304  # To be removed when pt-dependent menu above is supported with scale factors
305  PhotonIsEMSelectorTightPtIncl = acc.popToolsAndMerge(
307  ConfigFlags,
308  name="PhotonIsEMSelectorTightPtIncl",
309  quality=egammaPID.PhotonIDTight,
310  menu=photonPIDmenu.menuPtInclJan2018,
311  )
312  )
313  acc.addPublicTool(PhotonIsEMSelectorTightPtIncl)
314 
315  # ====================================================================
316  # RECTANGULAR CLUSTER TOOLS
317  # ====================================================================
318 
319  from egammaCaloTools.egammaCaloToolsConfig import CaloFillRectangularClusterCfg
320 
321  EGAMCOM_caloFillRect55 = acc.popToolsAndMerge(
323  ConfigFlags,
324  name="EGAMCOMCaloFillRectangularCluster55",
325  cells_name="AllCalo",
326  eta_size=5,
327  phi_size=5,
328  fill_cluster=True,
329  )
330  )
331  acc.addPublicTool(EGAMCOM_caloFillRect55)
332 
333  EGAMCOM_caloFillRect35 = acc.popToolsAndMerge(
335  ConfigFlags,
336  name="EGAMCOMCaloFillRectangularCluster35",
337  cells_name="AllCalo",
338  eta_size=3,
339  phi_size=5,
340  fill_cluster=True,
341  )
342  )
343  acc.addPublicTool(EGAMCOM_caloFillRect35)
344 
345  EGAMCOM_caloFillRect37 = acc.popToolsAndMerge(
347  ConfigFlags,
348  name="EGAMCOMCaloFillRectangularCluster37",
349  cells_name="AllCalo",
350  eta_size=3,
351  phi_size=7,
352  fill_cluster=True,
353  )
354  )
355  acc.addPublicTool(EGAMCOM_caloFillRect37)
356 
357  EGAMCOM_caloFillRect711 = acc.popToolsAndMerge(
359  ConfigFlags,
360  name="EGAMCOMCaloFillRectangularCluster711",
361  cells_name="AllCalo",
362  eta_size=7,
363  phi_size=11,
364  fill_cluster=True,
365  )
366  )
367  acc.addPublicTool(EGAMCOM_caloFillRect711)
368 
369  # ====================================================================
370  # AUGMENTATION TOOLS
371  # ====================================================================
372  from DerivationFrameworkEGamma.EGammaToolsConfig import EGSelectionToolWrapperCfg
373  from DerivationFrameworkEGamma.EGammaToolsConfig import (
374  EGElectronLikelihoodToolWrapperCfg,
375  )
376 
377  # decorate electrons with the output of LH very loose
378  ElectronPassLHVeryLoose = acc.getPrimaryAndMerge(
380  ConfigFlags,
381  name="ElectronPassLHVeryLoose",
382  EGammaElectronLikelihoodTool=ElectronLHSelectorVeryLoose,
383  EGammaFudgeMCTool=None,
384  CutType="",
385  StoreGateEntryName="DFCommonElectronsLHVeryLoose",
386  ContainerName="Electrons",
387  StoreTResult=False,
388  )
389  )
390 
391  # decorate electrons with the output of LH loose
392  ElectronPassLHLoose = acc.getPrimaryAndMerge(
394  ConfigFlags,
395  name="ElectronPassLHLoose",
396  EGammaElectronLikelihoodTool=ElectronLHSelectorLoose,
397  EGammaFudgeMCTool=None,
398  CutType="",
399  StoreGateEntryName="DFCommonElectronsLHLoose",
400  ContainerName="Electrons",
401  StoreTResult=False,
402  )
403  )
404 
405  # decorate electrons with the output of LH loose+BL
406  ElectronPassLHLooseBL = acc.getPrimaryAndMerge(
408  ConfigFlags,
409  name="ElectronPassLHLooseBL",
410  EGammaElectronLikelihoodTool=ElectronLHSelectorLooseBL,
411  EGammaFudgeMCTool=None,
412  CutType="",
413  StoreGateEntryName="DFCommonElectronsLHLooseBL",
414  ContainerName="Electrons",
415  StoreTResult=False,
416  )
417  )
418 
419  # decorate electrons with the output of LH medium
420  ElectronPassLHMedium = acc.getPrimaryAndMerge(
422  ConfigFlags,
423  name="ElectronPassLHMedium",
424  EGammaElectronLikelihoodTool=ElectronLHSelectorMedium,
425  EGammaFudgeMCTool=None,
426  CutType="",
427  StoreGateEntryName="DFCommonElectronsLHMedium",
428  ContainerName="Electrons",
429  StoreTResult=False,
430  )
431  )
432 
433  # decorate electrons with the output of LH tight
434  ElectronPassLHTight = acc.getPrimaryAndMerge(
436  ConfigFlags,
437  name="ElectronPassLHTight",
438  EGammaElectronLikelihoodTool=ElectronLHSelectorTight,
439  EGammaFudgeMCTool=None,
440  CutType="",
441  StoreGateEntryName="DFCommonElectronsLHTight",
442  ContainerName="Electrons",
443  StoreTResult=False,
444  )
445  )
446 
447  # decorate electrons with the output of DNN Loose
448  ElectronPassDNNLoose = acc.getPrimaryAndMerge(
450  ConfigFlags,
451  name="ElectronPassDNNLoose",
452  EGammaElectronLikelihoodTool=ElectronDNNSelectorLoose,
453  EGammaFudgeMCTool=(ElectronVariableCorrectionTool if isFullSim else None),
454  CutType="",
455  StoreGateEntryName="DFCommonElectronsDNNLoose",
456  ContainerName="Electrons",
457  StoreTResult=False,
458  StoreGateEntryMultipleNames=[
459  "DFCommonElectronsDNN_pel",
460  "DFCommonElectronsDNN_pcf",
461  "DFCommonElectronsDNN_ppc",
462  "DFCommonElectronsDNN_phf",
463  "DFCommonElectronsDNN_ple",
464  "DFCommonElectronsDNN_plh",
465  ],
466  StoreMultipleOutputs=True,
467  )
468  )
469 
470  # decorate electrons with the output of DNN Medium
471  ElectronPassDNNMedium = acc.getPrimaryAndMerge(
473  ConfigFlags,
474  name="ElectronPassDNNMedium",
475  EGammaElectronLikelihoodTool=ElectronDNNSelectorMedium,
476  EGammaFudgeMCTool=(ElectronVariableCorrectionTool if isFullSim else None),
477  CutType="",
478  StoreGateEntryName="DFCommonElectronsDNNMedium",
479  ContainerName="Electrons",
480  StoreTResult=False,
481  )
482  )
483 
484  # decorate electrons with the output of DNN Tight
485  ElectronPassDNNTight = acc.getPrimaryAndMerge(
487  ConfigFlags,
488  name="ElectronPassDNNTight",
489  EGammaElectronLikelihoodTool=ElectronDNNSelectorTight,
490  EGammaFudgeMCTool=(ElectronVariableCorrectionTool if isFullSim else None),
491  CutType="",
492  StoreGateEntryName="DFCommonElectronsDNNTight",
493  ContainerName="Electrons",
494  StoreTResult=False,
495  )
496  )
497 
498  # decorate electrons with the output of DNN Loose without CF
499  ElectronPassDNNLooseNoCF = acc.getPrimaryAndMerge(
501  ConfigFlags,
502  name="ElectronPassDNNLooseNoCF",
503  EGammaElectronLikelihoodTool=ElectronDNNSelectorLooseNoCF,
504  EGammaFudgeMCTool=(ElectronVariableCorrectionTool if isFullSim else None),
505  CutType="",
506  StoreGateEntryName="DFCommonElectronsDNNLooseNoCF",
507  ContainerName="Electrons",
508  StoreTResult=False,
509  )
510  )
511 
512  # decorate electrons with the output of DNN Medium without CF
513  ElectronPassDNNMediumNoCF = acc.getPrimaryAndMerge(
515  ConfigFlags,
516  name="ElectronPassDNNMediumNoCF",
517  EGammaElectronLikelihoodTool=ElectronDNNSelectorMediumNoCF,
518  EGammaFudgeMCTool=(ElectronVariableCorrectionTool if isFullSim else None),
519  CutType="",
520  StoreGateEntryName="DFCommonElectronsDNNMediumNoCF",
521  ContainerName="Electrons",
522  StoreTResult=False,
523  )
524  )
525 
526  # decorate electrons with the output of DNN Tight without CF
527  ElectronPassDNNTightNoCF = acc.getPrimaryAndMerge(
529  ConfigFlags,
530  name="ElectronPassDNNTightNoCF",
531  EGammaElectronLikelihoodTool=ElectronDNNSelectorTightNoCF,
532  EGammaFudgeMCTool=(ElectronVariableCorrectionTool if isFullSim else None),
533  CutType="",
534  StoreGateEntryName="DFCommonElectronsDNNTightNoCF",
535  ContainerName="Electrons",
536  StoreTResult=False,
537  )
538  )
539 
540  # decorate electrons with the output of ECIDS
541  if ConfigFlags.Derivation.Egamma.addECIDS:
542  ElectronPassECIDS = acc.getPrimaryAndMerge(
544  ConfigFlags,
545  name="ElectronPassECIDS",
546  EGammaElectronLikelihoodTool=ElectronChargeIDSelector,
547  EGammaFudgeMCTool=None,
548  CutType="",
549  StoreGateEntryName="DFCommonElectronsECIDS",
550  ContainerName="Electrons",
551  StoreTResult=True,
552  )
553  )
554 
555  if includeFwdElectrons:
556  # decorate forward electrons with the output of LH loose
557  ForwardElectronPassLHLoose = acc.getPrimaryAndMerge(
559  ConfigFlags,
560  name="ForwardElectronPassLHLoose",
561  EGammaElectronLikelihoodTool=ForwardElectronLHSelectorLoose,
562  EGammaFudgeMCTool=None,
563  CutType="",
564  StoreGateEntryName="DFCommonForwardElectronsLHLoose",
565  ContainerName="ForwardElectrons",
566  )
567  )
568 
569  # decorate forward electrons with the output of LH medium
570  ForwardElectronPassLHMedium = acc.getPrimaryAndMerge(
572  ConfigFlags,
573  name="ForwardElectronPassLHMedium",
574  EGammaElectronLikelihoodTool=ForwardElectronLHSelectorMedium,
575  EGammaFudgeMCTool=None,
576  CutType="",
577  StoreGateEntryName="DFCommonForwardElectronsLHMedium",
578  ContainerName="ForwardElectrons",
579  )
580  )
581 
582  # decorate forward electrons with the output of LH tight
583  ForwardElectronPassLHTight = acc.getPrimaryAndMerge(
585  ConfigFlags,
586  name="ForwardElectronPassLHTight",
587  EGammaElectronLikelihoodTool=ForwardElectronLHSelectorTight,
588  EGammaFudgeMCTool=None,
589  CutType="",
590  StoreGateEntryName="DFCommonForwardElectronsLHTight",
591  ContainerName="ForwardElectrons",
592  )
593  )
594 
595  # decorate photons with the output of IsEM loose
596  # on MC, fudge the shower shapes before computing the ID (but the
597  # original shower shapes are not overridden)
598  PhotonPassIsEMLoose = acc.getPrimaryAndMerge(
600  ConfigFlags,
601  name="PhotonPassIsEMLoose",
602  EGammaSelectionTool=PhotonIsEMSelectorLoose,
603  EGammaFudgeMCTool=(PhotonVariableCorrectionTool if isFullSim else None),
604  CutType="",
605  StoreGateEntryName="DFCommonPhotonsIsEMLoose",
606  ContainerName="Photons",
607  )
608  )
609 
610  # decorate photons with the output of IsEM medium
611  # on MC, fudge the shower shapes before computing the ID (but the
612  # original shower shapes are not overridden)
613  PhotonPassIsEMMedium = acc.getPrimaryAndMerge(
615  ConfigFlags,
616  name="PhotonPassIsEMMedium",
617  EGammaSelectionTool=PhotonIsEMSelectorMedium,
618  EGammaFudgeMCTool=(PhotonVariableCorrectionTool if isFullSim else None),
619  CutType="",
620  StoreGateEntryName="DFCommonPhotonsIsEMMedium",
621  ContainerName="Photons",
622  )
623  )
624 
625  # decorate photons with the output of IsEM tight
626  # on full-sim MC, fudge the shower shapes before computing the ID
627  # (but the original shower shapes are not overridden)
628  PhotonPassIsEMTight = acc.getPrimaryAndMerge(
630  ConfigFlags,
631  name="PhotonPassIsEMTight",
632  EGammaSelectionTool=PhotonIsEMSelectorTight,
633  EGammaFudgeMCTool=(PhotonVariableCorrectionTool if isFullSim else None),
634  CutType="",
635  StoreGateEntryName="DFCommonPhotonsIsEMTight",
636  ContainerName="Photons",
637  )
638  )
639 
640  # decorate photons with the output of IsEM tight pt-inclusive menu
641  # Can be removed once pt-dependent cuts are fully supported.
642  # On full-sim MC, fudge the shower shapes before computing the ID
643  # (but the original shower shapes are not overridden)
644  PhotonPassIsEMTightPtIncl = acc.getPrimaryAndMerge(
646  ConfigFlags,
647  name="PhotonPassIsEMTightPtIncl",
648  EGammaSelectionTool=PhotonIsEMSelectorTightPtIncl,
649  EGammaFudgeMCTool=(PhotonVariableCorrectionTool if isFullSim else None),
650  CutType="",
651  StoreGateEntryName="DFCommonPhotonsIsEMTightPtIncl",
652  ContainerName="Photons",
653  )
654  )
655 
656  # decorate photons with the photon cleaning flags
657  # on MC, fudge the shower shapes before computing the flags
658  from DerivationFrameworkEGamma.EGammaToolsConfig import EGPhotonCleaningWrapperCfg
659 
660  PhotonPassCleaning = acc.getPrimaryAndMerge(
662  ConfigFlags,
663  name="PhotonPassCleaning",
664  EGammaFudgeMCTool=(PhotonVariableCorrectionTool if isFullSim else None),
665  StoreGateEntryName="DFCommonPhotonsCleaning",
666  ContainerName="Photons",
667  )
668  )
669 
670  # decorate central electrons and photons with a flag to tell if the
671  # candidates are affected by the crack bug in mc16a and data 2015+2016
672  from DerivationFrameworkEGamma.EGammaToolsConfig import EGCrackVetoCleaningToolCfg
673 
674  PhotonPassCrackVeto = acc.getPrimaryAndMerge(
676  ConfigFlags,
677  name="PhotonPassCrackVeto",
678  StoreGateEntryName="DFCommonCrackVetoCleaning",
679  ContainerName="Photons",
680  )
681  )
682  ElectronPassCrackVeto = acc.getPrimaryAndMerge(
684  ConfigFlags,
685  name="ElectronPassCrackVeto",
686  StoreGateEntryName="DFCommonCrackVetoCleaning",
687  ContainerName="Electrons",
688  )
689  )
690 
691  # decorate some electrons with an additional ambiguity flag
692  # against internal and early material conversion
693  from DerivationFrameworkEGamma.EGammaToolsConfig import EGElectronAmbiguityToolCfg
694 
695  ElectronAmbiguity = acc.getPrimaryAndMerge(
697  ConfigFlags,
698  name="ElectronAdditionnalAmbiguity",
699  isMC=ConfigFlags.Input.isMC,
700  )
701  )
702 
703  # list of all the decorators so far
704  EGAugmentationTools = [
705  DFCommonPhotonsDirection,
706  ElectronPassLHVeryLoose,
707  ElectronPassLHLoose,
708  ElectronPassLHLooseBL,
709  ElectronPassLHMedium,
710  ElectronPassLHTight,
711  ElectronPassDNNLoose,
712  ElectronPassDNNMedium,
713  ElectronPassDNNTight,
714  ElectronPassDNNLooseNoCF,
715  ElectronPassDNNMediumNoCF,
716  ElectronPassDNNTightNoCF,
717  PhotonPassIsEMLoose,
718  PhotonPassIsEMMedium,
719  PhotonPassIsEMTight,
720  PhotonPassIsEMTightPtIncl,
721  PhotonPassCleaning,
722  PhotonPassCrackVeto,
723  ElectronPassCrackVeto,
724  ElectronAmbiguity,
725  ]
726 
727  if ConfigFlags.Derivation.Egamma.addECIDS:
728  EGAugmentationTools.extend([ElectronPassECIDS])
729 
730  if includeFwdElectrons:
731  EGAugmentationTools.extend(
732  [
733  ForwardElectronPassLHLoose,
734  ForwardElectronPassLHMedium,
735  ForwardElectronPassLHTight,
736  ]
737  )
738 
739  if ConfigFlags.Derivation.Egamma.addMissingCellInfo:
740  from DerivationFrameworkCalo.DerivationFrameworkCaloConfig import (
741  EgammaCoreCellRecoveryCfg,
742  )
743 
744  CoreCellRecoveryTool = acc.popToolsAndMerge(
745  EgammaCoreCellRecoveryCfg(ConfigFlags)
746  )
747  acc.addPublicTool(CoreCellRecoveryTool)
748  EGAugmentationTools.append(CoreCellRecoveryTool)
749 
750  # ==================================================
751  # Truth Related tools
752  if ConfigFlags.Input.isMC:
753  # Decorate Electron with bkg electron type/origin
754  from MCTruthClassifier.MCTruthClassifierConfig import MCTruthClassifierCfg
755 
756  BkgElectronMCTruthClassifier = acc.popToolsAndMerge(
758  ConfigFlags,
759  name="BkgElectronMCTruthClassifier",
760  ParticleCaloExtensionTool="",
761  )
762  )
763  acc.addPublicTool(BkgElectronMCTruthClassifier)
764 
765  from DerivationFrameworkEGamma.EGammaToolsConfig import (
766  BkgElectronClassificationCfg,
767  )
768 
769  BkgElectronClassificationTool = acc.getPrimaryAndMerge(
771  ConfigFlags,
772  name="BkgElectronClassificationTool",
773  MCTruthClassifierTool=BkgElectronMCTruthClassifier,
774  )
775  )
776  EGAugmentationTools.append(BkgElectronClassificationTool)
777 
778  # Decorate egammaTruthParticles with truth-particle-level etcone20,30,40
779  from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import (
780  TruthIsolationToolCfg,
781  )
782 
783  TruthEgetIsolationTool = acc.getPrimaryAndMerge(
785  ConfigFlags,
786  name="TruthEgetIsolationTool",
787  isoParticlesKey="egammaTruthParticles",
788  allParticlesKey="TruthParticles",
789  particleIDsToCalculate=[-11, 11, 22],
790  IsolationConeSizes=[0.2, 0.3, 0.4],
791  excludeIDsFromCone=[-16, -14, -13, -12, 12, 13, 14, 16],
792  IsolationVarNamePrefix="etcone",
793  ChargedParticlesOnly=False,
794  )
795  )
796  EGAugmentationTools.append(TruthEgetIsolationTool)
797 
798  # Decorate egammaTruthParticles with truth-particle-level ptcone20,30,40
799  TruthEgptIsolationTool = acc.getPrimaryAndMerge(
801  ConfigFlags,
802  name="TruthEgptIsolationTool",
803  isoParticlesKey="egammaTruthParticles",
804  allParticlesKey="TruthParticles",
805  particleIDsToCalculate=[-11, 11, 22],
806  IsolationConeSizes=[0.2, 0.3, 0.4],
807  IsolationVarNamePrefix="ptcone",
808  ChargedParticlesOnly=True,
809  )
810  )
811  EGAugmentationTools.append(TruthEgptIsolationTool)
812 
813  # Compute the truth-particle-level energy density in the central eta region
814  from EventShapeTools.EventDensityConfig import configEventDensityTool
815  from JetRecConfig.JetRecConfig import (
816  getInputAlgs,
817  getConstitPJGAlg,
818  reOrderAlgs,
819  )
820  from JetRecConfig.StandardJetConstits import stdConstitDic as cst
821 
822  # Schedule PseudoJetTruth
823  constit_algs = getInputAlgs(cst.Truth, flags=ConfigFlags)
824  constit_algs, ca = reOrderAlgs([a for a in constit_algs if a is not None])
825  acc.merge(ca)
826  for a in constit_algs:
827  acc.addEventAlgo(a)
828  constitPJAlg = getConstitPJGAlg(cst.Truth, suffix=None)
829  acc.addEventAlgo(constitPJAlg)
830 
832  "EDTruthCentralTool",
833  cst.Truth,
834  0.5,
835  AbsRapidityMin=0.0,
836  AbsRapidityMax=1.5,
837  OutputContainer="TruthIsoCentralEventShape",
838  OutputLevel=3,
839  )
840  acc.addPublicTool(tc)
841 
842  # Compute the truth-particle-level energy density in the forward eta region
844  "EDTruthForwardTool",
845  cst.Truth,
846  0.5,
847  AbsRapidityMin=1.5,
848  AbsRapidityMax=3.0,
849  OutputContainer="TruthIsoForwardEventShape",
850  OutputLevel=3,
851  )
852  acc.addPublicTool(tf)
853 
854  acc.addEventAlgo(
855  CompFactory.EventDensityAthAlg("EDTruthCentralAlg", EventDensityTool=tc)
856  )
857  acc.addEventAlgo(
858  CompFactory.EventDensityAthAlg("EDTruthForwardAlg", EventDensityTool=tf)
859  )
860 
861  # =======================================
862  # CREATE THE DERIVATION KERNEL ALGORITHM
863  # =======================================
864 
865  acc.addEventAlgo(
866  CompFactory.DerivationFramework.CommonAugmentation(
867  "EGammaCommonKernel", AugmentationTools=EGAugmentationTools
868  )
869  )
870 
871  # =======================================
872  # ADD TOOLS : custom electron, photon and muon track isolation
873  # =======================================
874  from IsolationAlgs.DerivationTrackIsoConfig import DerivationTrackIsoCfg
875 
876  acc.merge(DerivationTrackIsoCfg(ConfigFlags, object_types=("Electrons", "Muons")))
877 
878  hasFlowObject = (
879  "JetETMissChargedParticleFlowObjects" in ConfigFlags.Input.Collections
880  and "JetETMissNeutralParticleFlowObjects" in ConfigFlags.Input.Collections
881  )
882  if hasFlowObject:
883  from IsolationAlgs.IsolationSteeringDerivConfig import IsolationSteeringDerivCfg
884 
885  acc.merge(IsolationSteeringDerivCfg(ConfigFlags))
886 
887  return acc
MCTruthClassifierConfig.MCTruthClassifierCfg
def MCTruthClassifierCfg(flags, **kwargs)
Definition: MCTruthClassifier/python/MCTruthClassifierConfig.py:8
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.JetRecConfig.getInputAlgs
def getInputAlgs(jetOrConstitdef, flags, context="default", monTool=None)
Definition: JetRecConfig.py:280
python.JetRecConfig.reOrderAlgs
def reOrderAlgs(algs)
Definition: JetRecConfig.py:797
IsolationSteeringDerivConfig.IsolationSteeringDerivCfg
def IsolationSteeringDerivCfg(flags, name='IsolationSteeringDeriv', inType='EMPFlow')
Definition: IsolationSteeringDerivConfig.py:11
python.EGammaToolsConfig.EGSelectionToolWrapperCfg
def EGSelectionToolWrapperCfg(flags, name, **kwargs)
Definition: EGammaToolsConfig.py:22
python.AsgElectronLikelihoodToolsConfig.AsgElectronLikelihoodToolCfg
def AsgElectronLikelihoodToolCfg(flag, name, quality, menu=electronLHmenu.offlineMC21)
Definition: AsgElectronLikelihoodToolsConfig.py:13
EventDensityConfig.configEventDensityTool
def configEventDensityTool(name, jetOrConstitdef, radius=0.4, **options)
Definition: EventDensityConfig.py:36
python.TruthDerivationToolsConfig.TruthIsolationToolCfg
def TruthIsolationToolCfg(flags, name, **kwargs)
Definition: TruthDerivationToolsConfig.py:167
python.AsgForwardElectronLikelihoodToolConfig.AsgForwardElectronLikelihoodToolCfg
def AsgForwardElectronLikelihoodToolCfg(ConfigFlags, name, **kwargs)
Definition: AsgForwardElectronLikelihoodToolConfig.py:6
python.EGammaCommonConfig.EGammaCommonCfg
def EGammaCommonCfg(ConfigFlags)
Definition: EGammaCommonConfig.py:15
python.EGammaToolsConfig.EGElectronAmbiguityToolCfg
def EGElectronAmbiguityToolCfg(flags, name, **kwargs)
Definition: EGammaToolsConfig.py:60
DerivationFrameworkCaloConfig.EgammaCoreCellRecoveryCfg
def EgammaCoreCellRecoveryCfg(flags, **kwargs)
Definition: DerivationFrameworkCaloConfig.py:28
python.EGammaVariableCorrectionConfig.ElectronVariableCorrectionToolCfg
def ElectronVariableCorrectionToolCfg(flags, name="ElectronVariableCorrectionTool", **kwargs)
Definition: EGammaVariableCorrectionConfig.py:5
python.AsgElectronChargeIDSelectorToolConfig.AsgElectronChargeIDSelectorToolCfg
def AsgElectronChargeIDSelectorToolCfg(ConfigFlags, name, **kwargs)
Definition: AsgElectronChargeIDSelectorToolConfig.py:6
python.EGammaVariableCorrectionConfig.PhotonVariableCorrectionToolCfg
def PhotonVariableCorrectionToolCfg(flags, name="PhotonVariableCorrectionTool", **kwargs)
Definition: EGammaVariableCorrectionConfig.py:15
python.EGammaToolsConfig.EGPhotonCleaningWrapperCfg
def EGPhotonCleaningWrapperCfg(flags, name, **kwargs)
Definition: EGammaToolsConfig.py:42
python.AsgPhotonIsEMSelectorsConfig.AsgPhotonIsEMSelectorCfg
def AsgPhotonIsEMSelectorCfg(flags, name, quality, menu=photonPIDmenu.menuCurrentCuts, trigger=False)
Definition: AsgPhotonIsEMSelectorsConfig.py:15
python.EGammaToolsConfig.EGElectronLikelihoodToolWrapperCfg
def EGElectronLikelihoodToolWrapperCfg(flags, name, **kwargs)
Definition: EGammaToolsConfig.py:31
python.EGammaToolsConfig.BkgElectronClassificationCfg
def BkgElectronClassificationCfg(flags, name, **kwargs)
Definition: EGammaToolsConfig.py:69
python.JetRecConfig.getConstitPJGAlg
def getConstitPJGAlg(constitdef, suffix=None, flags=None, parent_jetdef=None)
Definition: JetRecConfig.py:351
python.AsgElectronSelectorToolConfig.AsgElectronSelectorToolCfg
def AsgElectronSelectorToolCfg(ConfigFlags, name, **kwargs)
Definition: AsgElectronSelectorToolConfig.py:7
python.EGammaToolsConfig.PhotonsDirectionToolCfg
def PhotonsDirectionToolCfg(flags, name, **kwargs)
Definition: EGammaToolsConfig.py:13
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28
DerivationTrackIsoConfig.DerivationTrackIsoCfg
def DerivationTrackIsoCfg(flags, **jwarg)
Definition: DerivationTrackIsoConfig.py:11
DerivationFrameworkCaloConfig.CaloFillRectangularClusterCfg
def CaloFillRectangularClusterCfg(flags, **kwargs)
Definition: DerivationFrameworkCaloConfig.py:36
python.EGammaToolsConfig.EGCrackVetoCleaningToolCfg
def EGCrackVetoCleaningToolCfg(flags, name, **kwargs)
Definition: EGammaToolsConfig.py:51