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  # Very-Loose 97%
186  ElectronDNNSelectorVeryLooseNoCF97 = acc.popToolsAndMerge(
188  ConfigFlags,
189  name="ElectronDNNSelectorVeryLooseNoCF97",
190  WorkingPoint="VeryLooseDNNnoCF97Electron",
191  )
192  )
193  acc.addPublicTool(ElectronDNNSelectorVeryLooseNoCF97)
194 
195  # Loose
196  ElectronDNNSelectorLooseNoCF = acc.popToolsAndMerge(
198  ConfigFlags,
199  name="ElectronDNNSelectorLooseNoCF",
200  WorkingPoint="LooseDNNnoCFElectron",
201  )
202  )
203  acc.addPublicTool(ElectronDNNSelectorLooseNoCF)
204 
205  # Medium
206  ElectronDNNSelectorMediumNoCF = acc.popToolsAndMerge(
208  ConfigFlags,
209  name="ElectronDNNSelectorMediumNoCF",
210  WorkingPoint="MediumDNNnoCFElectron",
211  )
212  )
213  acc.addPublicTool(ElectronDNNSelectorMediumNoCF)
214 
215  # Tight
216  ElectronDNNSelectorTightNoCF = acc.popToolsAndMerge(
218  ConfigFlags,
219  name="ElectronDNNSelectorTightNoCF",
220  WorkingPoint="TightDNNnoCFElectron",
221  )
222  )
223  acc.addPublicTool(ElectronDNNSelectorTightNoCF)
224 
225  # ====================================================================
226  # ELECTRON CHARGE SELECTION
227  # ====================================================================
228  if ConfigFlags.Derivation.Egamma.addECIDS:
229  from ElectronPhotonSelectorTools.AsgElectronChargeIDSelectorToolConfig import (
230  AsgElectronChargeIDSelectorToolCfg,
231  )
232 
233  ElectronChargeIDSelector = acc.popToolsAndMerge(
235  ConfigFlags, name="ElectronChargeIDSelectorLoose"
236  )
237  )
238  ElectronChargeIDSelector.primaryVertexContainer = "PrimaryVertices"
239  ElectronChargeIDSelector.TrainingFile = (
240  "ElectronPhotonSelectorTools/ChargeID/ECIDS_20180731rel21Summer2018.root"
241  )
242  acc.addPublicTool(ElectronChargeIDSelector)
243 
244  # ====================================================================
245  # FWD ELECTRON LH SELECTORS
246  # ====================================================================
247  if includeFwdElectrons:
248  from ElectronPhotonSelectorTools.AsgForwardElectronLikelihoodToolConfig import (
249  AsgForwardElectronLikelihoodToolCfg,
250  )
251 
252  ForwardElectronLHSelectorLoose = acc.popToolsAndMerge(
254  ConfigFlags,
255  name="ForwardElectronLHSelectorLoose",
256  WorkingPoint="LooseLHForwardElectron",
257  )
258  )
259  acc.addPublicTool(ForwardElectronLHSelectorLoose)
260 
261  ForwardElectronLHSelectorMedium = acc.popToolsAndMerge(
263  ConfigFlags,
264  name="ForwardElectronLHSelectorMedium",
265  WorkingPoint="MediumLHForwardElectron",
266  )
267  )
268  acc.addPublicTool(ForwardElectronLHSelectorMedium)
269 
270  ForwardElectronLHSelectorTight = acc.popToolsAndMerge(
272  ConfigFlags,
273  name="ForwardElectronLHSelectorTight",
274  WorkingPoint="TightLHForwardElectron",
275  )
276  )
277  acc.addPublicTool(ForwardElectronLHSelectorTight)
278 
279  # ====================================================================
280  # PHOTON SELECTION (loose and tight cut-based)
281  # ====================================================================
282  from ROOT import egammaPID
283 
284  from ElectronPhotonSelectorTools.AsgPhotonIsEMSelectorsConfig import (
285  AsgPhotonIsEMSelectorCfg,
286  )
287  from ElectronPhotonSelectorTools.PhotonIsEMSelectorMapping import photonPIDmenu
288 
289  # Loose
290  PhotonIsEMSelectorLoose = acc.popToolsAndMerge(
292  ConfigFlags, name="PhotonIsEMSelectorLoose", quality=egammaPID.PhotonIDLoose
293  )
294  )
295  acc.addPublicTool(PhotonIsEMSelectorLoose)
296 
297  # Medium
298  PhotonIsEMSelectorMedium = acc.popToolsAndMerge(
300  ConfigFlags, name="PhotonIsEMSelectorMedium", quality=egammaPID.PhotonIDMedium
301  )
302  )
303  acc.addPublicTool(PhotonIsEMSelectorMedium)
304 
305  # Tight (default == pt-dependent)
306  PhotonIsEMSelectorTight = acc.popToolsAndMerge(
308  ConfigFlags, name="PhotonIsEMSelectorTight", quality=egammaPID.PhotonIDTight
309  )
310  )
311  acc.addPublicTool(PhotonIsEMSelectorTight)
312 
313  # Tight (pt-inclusive)
314  # To be removed when pt-dependent menu above is supported with scale factors
315  PhotonIsEMSelectorTightPtIncl = acc.popToolsAndMerge(
317  ConfigFlags,
318  name="PhotonIsEMSelectorTightPtIncl",
319  quality=egammaPID.PhotonIDTight,
320  menu=photonPIDmenu.menuPtInclJan2018,
321  )
322  )
323  acc.addPublicTool(PhotonIsEMSelectorTightPtIncl)
324 
325  # ====================================================================
326  # RECTANGULAR CLUSTER TOOLS
327  # ====================================================================
328 
329  from egammaCaloTools.egammaCaloToolsConfig import CaloFillRectangularClusterCfg
330 
331  EGAMCOM_caloFillRect55 = acc.popToolsAndMerge(
333  ConfigFlags,
334  name="EGAMCOMCaloFillRectangularCluster55",
335  cells_name="AllCalo",
336  eta_size=5,
337  phi_size=5,
338  fill_cluster=True,
339  )
340  )
341  acc.addPublicTool(EGAMCOM_caloFillRect55)
342 
343  EGAMCOM_caloFillRect35 = acc.popToolsAndMerge(
345  ConfigFlags,
346  name="EGAMCOMCaloFillRectangularCluster35",
347  cells_name="AllCalo",
348  eta_size=3,
349  phi_size=5,
350  fill_cluster=True,
351  )
352  )
353  acc.addPublicTool(EGAMCOM_caloFillRect35)
354 
355  EGAMCOM_caloFillRect37 = acc.popToolsAndMerge(
357  ConfigFlags,
358  name="EGAMCOMCaloFillRectangularCluster37",
359  cells_name="AllCalo",
360  eta_size=3,
361  phi_size=7,
362  fill_cluster=True,
363  )
364  )
365  acc.addPublicTool(EGAMCOM_caloFillRect37)
366 
367  EGAMCOM_caloFillRect711 = acc.popToolsAndMerge(
369  ConfigFlags,
370  name="EGAMCOMCaloFillRectangularCluster711",
371  cells_name="AllCalo",
372  eta_size=7,
373  phi_size=11,
374  fill_cluster=True,
375  )
376  )
377  acc.addPublicTool(EGAMCOM_caloFillRect711)
378 
379  # ====================================================================
380  # AUGMENTATION TOOLS
381  # ====================================================================
382  from DerivationFrameworkEGamma.EGammaToolsConfig import EGSelectionToolWrapperCfg
383  from DerivationFrameworkEGamma.EGammaToolsConfig import (
384  EGElectronLikelihoodToolWrapperCfg,
385  )
386 
387  # decorate electrons with the output of LH very loose
388  ElectronPassLHVeryLoose = acc.getPrimaryAndMerge(
390  ConfigFlags,
391  name="ElectronPassLHVeryLoose",
392  EGammaElectronLikelihoodTool=ElectronLHSelectorVeryLoose,
393  EGammaFudgeMCTool=None,
394  CutType="",
395  StoreGateEntryName="DFCommonElectronsLHVeryLoose",
396  ContainerName="Electrons",
397  StoreTResult=False,
398  )
399  )
400 
401  # decorate electrons with the output of LH loose
402  ElectronPassLHLoose = acc.getPrimaryAndMerge(
404  ConfigFlags,
405  name="ElectronPassLHLoose",
406  EGammaElectronLikelihoodTool=ElectronLHSelectorLoose,
407  EGammaFudgeMCTool=None,
408  CutType="",
409  StoreGateEntryName="DFCommonElectronsLHLoose",
410  ContainerName="Electrons",
411  StoreTResult=False,
412  )
413  )
414 
415  # decorate electrons with the output of LH loose+BL
416  ElectronPassLHLooseBL = acc.getPrimaryAndMerge(
418  ConfigFlags,
419  name="ElectronPassLHLooseBL",
420  EGammaElectronLikelihoodTool=ElectronLHSelectorLooseBL,
421  EGammaFudgeMCTool=None,
422  CutType="",
423  StoreGateEntryName="DFCommonElectronsLHLooseBL",
424  ContainerName="Electrons",
425  StoreTResult=False,
426  )
427  )
428 
429  # decorate electrons with the output of LH medium
430  ElectronPassLHMedium = acc.getPrimaryAndMerge(
432  ConfigFlags,
433  name="ElectronPassLHMedium",
434  EGammaElectronLikelihoodTool=ElectronLHSelectorMedium,
435  EGammaFudgeMCTool=None,
436  CutType="",
437  StoreGateEntryName="DFCommonElectronsLHMedium",
438  ContainerName="Electrons",
439  StoreTResult=False,
440  )
441  )
442 
443  # decorate electrons with the output of LH tight
444  ElectronPassLHTight = acc.getPrimaryAndMerge(
446  ConfigFlags,
447  name="ElectronPassLHTight",
448  EGammaElectronLikelihoodTool=ElectronLHSelectorTight,
449  EGammaFudgeMCTool=None,
450  CutType="",
451  StoreGateEntryName="DFCommonElectronsLHTight",
452  ContainerName="Electrons",
453  StoreTResult=False,
454  )
455  )
456 
457  # decorate electrons with the output of DNN Loose
458  ElectronPassDNNLoose = acc.getPrimaryAndMerge(
460  ConfigFlags,
461  name="ElectronPassDNNLoose",
462  EGammaElectronLikelihoodTool=ElectronDNNSelectorLoose,
463  EGammaFudgeMCTool=(ElectronVariableCorrectionTool if isFullSim else None),
464  CutType="",
465  StoreGateEntryName="DFCommonElectronsDNNLoose",
466  ContainerName="Electrons",
467  StoreTResult=False,
468  StoreGateEntryMultipleNames=[
469  "DFCommonElectronsDNN_pel",
470  "DFCommonElectronsDNN_pcf",
471  "DFCommonElectronsDNN_ppc",
472  "DFCommonElectronsDNN_phf",
473  "DFCommonElectronsDNN_ple",
474  "DFCommonElectronsDNN_plh",
475  ],
476  StoreMultipleOutputs=True,
477  )
478  )
479 
480  # decorate electrons with the output of DNN Medium
481  ElectronPassDNNMedium = acc.getPrimaryAndMerge(
483  ConfigFlags,
484  name="ElectronPassDNNMedium",
485  EGammaElectronLikelihoodTool=ElectronDNNSelectorMedium,
486  EGammaFudgeMCTool=(ElectronVariableCorrectionTool if isFullSim else None),
487  CutType="",
488  StoreGateEntryName="DFCommonElectronsDNNMedium",
489  ContainerName="Electrons",
490  StoreTResult=False,
491  )
492  )
493 
494  # decorate electrons with the output of DNN Tight
495  ElectronPassDNNTight = acc.getPrimaryAndMerge(
497  ConfigFlags,
498  name="ElectronPassDNNTight",
499  EGammaElectronLikelihoodTool=ElectronDNNSelectorTight,
500  EGammaFudgeMCTool=(ElectronVariableCorrectionTool if isFullSim else None),
501  CutType="",
502  StoreGateEntryName="DFCommonElectronsDNNTight",
503  ContainerName="Electrons",
504  StoreTResult=False,
505  )
506  )
507 
508  # decorate electrons with the output of DNN VeryLoose97 without CF
509  ElectronPassDNNVeryLooseNoCF97 = acc.getPrimaryAndMerge(
511  ConfigFlags,
512  name="ElectronPassDNNVeryLooseNoCF97",
513  EGammaElectronLikelihoodTool=ElectronDNNSelectorVeryLooseNoCF97,
514  EGammaFudgeMCTool=(ElectronVariableCorrectionTool if isFullSim else None),
515  CutType="",
516  StoreGateEntryName="DFCommonElectronsDNNVeryLooseNoCF97",
517  ContainerName="Electrons",
518  StoreTResult=False,
519  )
520  )
521  # decorate electrons with the output of DNN Loose without CF
522  ElectronPassDNNLooseNoCF = acc.getPrimaryAndMerge(
524  ConfigFlags,
525  name="ElectronPassDNNLooseNoCF",
526  EGammaElectronLikelihoodTool=ElectronDNNSelectorLooseNoCF,
527  EGammaFudgeMCTool=(ElectronVariableCorrectionTool if isFullSim else None),
528  CutType="",
529  StoreGateEntryName="DFCommonElectronsDNNLooseNoCF",
530  ContainerName="Electrons",
531  StoreTResult=False,
532  )
533  )
534 
535  # decorate electrons with the output of DNN Medium without CF
536  ElectronPassDNNMediumNoCF = acc.getPrimaryAndMerge(
538  ConfigFlags,
539  name="ElectronPassDNNMediumNoCF",
540  EGammaElectronLikelihoodTool=ElectronDNNSelectorMediumNoCF,
541  EGammaFudgeMCTool=(ElectronVariableCorrectionTool if isFullSim else None),
542  CutType="",
543  StoreGateEntryName="DFCommonElectronsDNNMediumNoCF",
544  ContainerName="Electrons",
545  StoreTResult=False,
546  )
547  )
548 
549  # decorate electrons with the output of DNN Tight without CF
550  ElectronPassDNNTightNoCF = acc.getPrimaryAndMerge(
552  ConfigFlags,
553  name="ElectronPassDNNTightNoCF",
554  EGammaElectronLikelihoodTool=ElectronDNNSelectorTightNoCF,
555  EGammaFudgeMCTool=(ElectronVariableCorrectionTool if isFullSim else None),
556  CutType="",
557  StoreGateEntryName="DFCommonElectronsDNNTightNoCF",
558  ContainerName="Electrons",
559  StoreTResult=False,
560  )
561  )
562 
563  # decorate electrons with the output of ECIDS
564  if ConfigFlags.Derivation.Egamma.addECIDS:
565  ElectronPassECIDS = acc.getPrimaryAndMerge(
567  ConfigFlags,
568  name="ElectronPassECIDS",
569  EGammaElectronLikelihoodTool=ElectronChargeIDSelector,
570  EGammaFudgeMCTool=None,
571  CutType="",
572  StoreGateEntryName="DFCommonElectronsECIDS",
573  ContainerName="Electrons",
574  StoreTResult=True,
575  )
576  )
577 
578  if includeFwdElectrons:
579  # decorate forward electrons with the output of LH loose
580  ForwardElectronPassLHLoose = acc.getPrimaryAndMerge(
582  ConfigFlags,
583  name="ForwardElectronPassLHLoose",
584  EGammaElectronLikelihoodTool=ForwardElectronLHSelectorLoose,
585  EGammaFudgeMCTool=None,
586  CutType="",
587  StoreGateEntryName="DFCommonForwardElectronsLHLoose",
588  ContainerName="ForwardElectrons",
589  )
590  )
591 
592  # decorate forward electrons with the output of LH medium
593  ForwardElectronPassLHMedium = acc.getPrimaryAndMerge(
595  ConfigFlags,
596  name="ForwardElectronPassLHMedium",
597  EGammaElectronLikelihoodTool=ForwardElectronLHSelectorMedium,
598  EGammaFudgeMCTool=None,
599  CutType="",
600  StoreGateEntryName="DFCommonForwardElectronsLHMedium",
601  ContainerName="ForwardElectrons",
602  )
603  )
604 
605  # decorate forward electrons with the output of LH tight
606  ForwardElectronPassLHTight = acc.getPrimaryAndMerge(
608  ConfigFlags,
609  name="ForwardElectronPassLHTight",
610  EGammaElectronLikelihoodTool=ForwardElectronLHSelectorTight,
611  EGammaFudgeMCTool=None,
612  CutType="",
613  StoreGateEntryName="DFCommonForwardElectronsLHTight",
614  ContainerName="ForwardElectrons",
615  )
616  )
617 
618  # decorate photons with the output of IsEM loose
619  # on MC, fudge the shower shapes before computing the ID (but the
620  # original shower shapes are not overridden)
621  PhotonPassIsEMLoose = acc.getPrimaryAndMerge(
623  ConfigFlags,
624  name="PhotonPassIsEMLoose",
625  EGammaSelectionTool=PhotonIsEMSelectorLoose,
626  EGammaFudgeMCTool=(PhotonVariableCorrectionTool if isFullSim else None),
627  CutType="",
628  StoreGateEntryName="DFCommonPhotonsIsEMLoose",
629  ContainerName="Photons",
630  )
631  )
632 
633  # decorate photons with the output of IsEM medium
634  # on MC, fudge the shower shapes before computing the ID (but the
635  # original shower shapes are not overridden)
636  PhotonPassIsEMMedium = acc.getPrimaryAndMerge(
638  ConfigFlags,
639  name="PhotonPassIsEMMedium",
640  EGammaSelectionTool=PhotonIsEMSelectorMedium,
641  EGammaFudgeMCTool=(PhotonVariableCorrectionTool if isFullSim else None),
642  CutType="",
643  StoreGateEntryName="DFCommonPhotonsIsEMMedium",
644  ContainerName="Photons",
645  )
646  )
647 
648  # decorate photons with the output of IsEM tight
649  # on full-sim MC, fudge the shower shapes before computing the ID
650  # (but the original shower shapes are not overridden)
651  PhotonPassIsEMTight = acc.getPrimaryAndMerge(
653  ConfigFlags,
654  name="PhotonPassIsEMTight",
655  EGammaSelectionTool=PhotonIsEMSelectorTight,
656  EGammaFudgeMCTool=(PhotonVariableCorrectionTool if isFullSim else None),
657  CutType="",
658  StoreGateEntryName="DFCommonPhotonsIsEMTight",
659  ContainerName="Photons",
660  )
661  )
662 
663  # decorate photons with the output of IsEM tight pt-inclusive menu
664  # Can be removed once pt-dependent cuts are fully supported.
665  # On full-sim MC, fudge the shower shapes before computing the ID
666  # (but the original shower shapes are not overridden)
667  PhotonPassIsEMTightPtIncl = acc.getPrimaryAndMerge(
669  ConfigFlags,
670  name="PhotonPassIsEMTightPtIncl",
671  EGammaSelectionTool=PhotonIsEMSelectorTightPtIncl,
672  EGammaFudgeMCTool=(PhotonVariableCorrectionTool if isFullSim else None),
673  CutType="",
674  StoreGateEntryName="DFCommonPhotonsIsEMTightPtIncl",
675  ContainerName="Photons",
676  )
677  )
678 
679  # decorate photons with the photon cleaning flags
680  # on MC, fudge the shower shapes before computing the flags
681  from DerivationFrameworkEGamma.EGammaToolsConfig import EGPhotonCleaningWrapperCfg
682 
683  PhotonPassCleaning = acc.getPrimaryAndMerge(
685  ConfigFlags,
686  name="PhotonPassCleaning",
687  EGammaFudgeMCTool=(PhotonVariableCorrectionTool if isFullSim else None),
688  StoreGateEntryName="DFCommonPhotonsCleaning",
689  ContainerName="Photons",
690  )
691  )
692 
693  # decorate central electrons and photons with a flag to tell if the
694  # candidates are affected by the crack bug in mc16a and data 2015+2016
695  from DerivationFrameworkEGamma.EGammaToolsConfig import EGCrackVetoCleaningToolCfg
696 
697  PhotonPassCrackVeto = acc.getPrimaryAndMerge(
699  ConfigFlags,
700  name="PhotonPassCrackVeto",
701  StoreGateEntryName="DFCommonCrackVetoCleaning",
702  ContainerName="Photons",
703  )
704  )
705  ElectronPassCrackVeto = acc.getPrimaryAndMerge(
707  ConfigFlags,
708  name="ElectronPassCrackVeto",
709  StoreGateEntryName="DFCommonCrackVetoCleaning",
710  ContainerName="Electrons",
711  )
712  )
713 
714  # decorate some electrons with an additional ambiguity flag
715  # against internal and early material conversion
716  from DerivationFrameworkEGamma.EGammaToolsConfig import EGElectronAmbiguityToolCfg
717 
718  ElectronAmbiguity = acc.getPrimaryAndMerge(
720  ConfigFlags,
721  name="ElectronAdditionnalAmbiguity",
722  isMC=ConfigFlags.Input.isMC,
723  )
724  )
725 
726  # list of all the decorators so far
727  EGAugmentationTools = [
728  DFCommonPhotonsDirection,
729  ElectronPassLHVeryLoose,
730  ElectronPassLHLoose,
731  ElectronPassLHLooseBL,
732  ElectronPassLHMedium,
733  ElectronPassLHTight,
734  ElectronPassDNNLoose,
735  ElectronPassDNNMedium,
736  ElectronPassDNNTight,
737  ElectronPassDNNVeryLooseNoCF97,
738  ElectronPassDNNLooseNoCF,
739  ElectronPassDNNMediumNoCF,
740  ElectronPassDNNTightNoCF,
741  PhotonPassIsEMLoose,
742  PhotonPassIsEMMedium,
743  PhotonPassIsEMTight,
744  PhotonPassIsEMTightPtIncl,
745  PhotonPassCleaning,
746  PhotonPassCrackVeto,
747  ElectronPassCrackVeto,
748  ElectronAmbiguity,
749  ]
750 
751  if ConfigFlags.Derivation.Egamma.addECIDS:
752  EGAugmentationTools.extend([ElectronPassECIDS])
753 
754  if includeFwdElectrons:
755  EGAugmentationTools.extend(
756  [
757  ForwardElectronPassLHLoose,
758  ForwardElectronPassLHMedium,
759  ForwardElectronPassLHTight,
760  ]
761  )
762 
763  if ConfigFlags.Derivation.Egamma.addMissingCellInfo:
764  from DerivationFrameworkCalo.DerivationFrameworkCaloConfig import (
765  EgammaCoreCellRecoveryCfg,
766  )
767 
768  CoreCellRecoveryTool = acc.popToolsAndMerge(
769  EgammaCoreCellRecoveryCfg(ConfigFlags)
770  )
771  acc.addPublicTool(CoreCellRecoveryTool)
772  EGAugmentationTools.append(CoreCellRecoveryTool)
773 
774  # ==================================================
775  # Truth Related tools
776  if ConfigFlags.Input.isMC:
777  # Decorate Electron with bkg electron type/origin
778  from MCTruthClassifier.MCTruthClassifierConfig import MCTruthClassifierCfg
779 
780  BkgElectronMCTruthClassifier = acc.popToolsAndMerge(
782  ConfigFlags,
783  name="BkgElectronMCTruthClassifier",
784  ParticleCaloExtensionTool="",
785  )
786  )
787  acc.addPublicTool(BkgElectronMCTruthClassifier)
788 
789  from DerivationFrameworkEGamma.EGammaToolsConfig import (
790  BkgElectronClassificationCfg,
791  )
792 
793  BkgElectronClassificationTool = acc.getPrimaryAndMerge(
795  ConfigFlags,
796  name="BkgElectronClassificationTool",
797  MCTruthClassifierTool=BkgElectronMCTruthClassifier,
798  )
799  )
800  EGAugmentationTools.append(BkgElectronClassificationTool)
801 
802  # Decorate egammaTruthParticles with truth-particle-level etcone20,30,40
803  from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import (
804  TruthIsolationToolCfg,
805  )
806 
807  TruthEgetIsolationTool = acc.getPrimaryAndMerge(
809  ConfigFlags,
810  name="TruthEgetIsolationTool",
811  isoParticlesKey="egammaTruthParticles",
812  allParticlesKey="TruthParticles",
813  particleIDsToCalculate=[-11, 11, 22],
814  IsolationConeSizes=[0.2, 0.3, 0.4],
815  excludeIDsFromCone=[-16, -14, -13, -12, 12, 13, 14, 16],
816  IsolationVarNamePrefix="etcone",
817  ChargedParticlesOnly=False,
818  )
819  )
820  EGAugmentationTools.append(TruthEgetIsolationTool)
821 
822  # Decorate egammaTruthParticles with truth-particle-level ptcone20,30,40
823  TruthEgptIsolationTool = acc.getPrimaryAndMerge(
825  ConfigFlags,
826  name="TruthEgptIsolationTool",
827  isoParticlesKey="egammaTruthParticles",
828  allParticlesKey="TruthParticles",
829  particleIDsToCalculate=[-11, 11, 22],
830  IsolationConeSizes=[0.2, 0.3, 0.4],
831  IsolationVarNamePrefix="ptcone",
832  ChargedParticlesOnly=True,
833  )
834  )
835  EGAugmentationTools.append(TruthEgptIsolationTool)
836 
837  # Compute the truth-particle-level energy density in the central eta region
838  from EventShapeTools.EventDensityConfig import configEventDensityTool
839  from JetRecConfig.JetRecConfig import (
840  getInputAlgs,
841  getConstitPJGAlg,
842  reOrderAlgs,
843  )
844  from JetRecConfig.StandardJetConstits import stdConstitDic as cst
845 
846  # Schedule PseudoJetTruth
847  constit_algs = getInputAlgs(cst.Truth, flags=ConfigFlags)
848  constit_algs, ca = reOrderAlgs([a for a in constit_algs if a is not None])
849  acc.merge(ca)
850  for a in constit_algs:
851  acc.addEventAlgo(a)
852  constitPJAlg = getConstitPJGAlg(cst.Truth, suffix=None)
853  acc.addEventAlgo(constitPJAlg)
854 
856  "EDTruthCentralTool",
857  cst.Truth,
858  0.5,
859  AbsRapidityMin=0.0,
860  AbsRapidityMax=1.5,
861  OutputContainer="TruthIsoCentralEventShape",
862  OutputLevel=3,
863  )
864  acc.addPublicTool(tc)
865 
866  # Compute the truth-particle-level energy density in the forward eta region
868  "EDTruthForwardTool",
869  cst.Truth,
870  0.5,
871  AbsRapidityMin=1.5,
872  AbsRapidityMax=3.0,
873  OutputContainer="TruthIsoForwardEventShape",
874  OutputLevel=3,
875  )
876  acc.addPublicTool(tf)
877 
878  acc.addEventAlgo(
879  CompFactory.EventDensityAthAlg("EDTruthCentralAlg", EventDensityTool=tc)
880  )
881  acc.addEventAlgo(
882  CompFactory.EventDensityAthAlg("EDTruthForwardAlg", EventDensityTool=tf)
883  )
884 
885  # =======================================
886  # CREATE THE DERIVATION KERNEL ALGORITHM
887  # =======================================
888 
889  acc.addEventAlgo(
890  CompFactory.DerivationFramework.CommonAugmentation(
891  "EGammaCommonKernel", AugmentationTools=EGAugmentationTools
892  )
893  )
894 
895  # =======================================
896  # ADD TOOLS : custom electron, photon and muon track isolation
897  # =======================================
898  from IsolationAlgs.DerivationTrackIsoConfig import DerivationTrackIsoCfg
899 
900  acc.merge(DerivationTrackIsoCfg(ConfigFlags, object_types=("Electrons", "Muons")))
901 
902  hasFlowObject = (
903  "JetETMissChargedParticleFlowObjects" in ConfigFlags.Input.Collections
904  and "JetETMissNeutralParticleFlowObjects" in ConfigFlags.Input.Collections
905  )
906  if hasFlowObject:
907  from IsolationAlgs.IsolationSteeringDerivConfig import IsolationSteeringDerivCfg
908 
909  acc.merge(IsolationSteeringDerivCfg(ConfigFlags))
910 
911  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:279
python.JetRecConfig.reOrderAlgs
def reOrderAlgs(algs)
Definition: JetRecConfig.py:796
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:166
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:27
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
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
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:350
python.AsgElectronSelectorToolConfig.AsgElectronSelectorToolCfg
def AsgElectronSelectorToolCfg(ConfigFlags, name, **kwargs)
Definition: AsgElectronSelectorToolConfig.py:7
python.EGammaToolsConfig.PhotonsDirectionToolCfg
def PhotonsDirectionToolCfg(flags, name, **kwargs)
Definition: EGammaToolsConfig.py:13
DerivationTrackIsoConfig.DerivationTrackIsoCfg
def DerivationTrackIsoCfg(flags, **jwarg)
Definition: DerivationTrackIsoConfig.py:11
DerivationFrameworkCaloConfig.CaloFillRectangularClusterCfg
def CaloFillRectangularClusterCfg(flags, **kwargs)
Definition: DerivationFrameworkCaloConfig.py:35
python.EGammaToolsConfig.EGCrackVetoCleaningToolCfg
def EGCrackVetoCleaningToolCfg(flags, name, **kwargs)
Definition: EGammaToolsConfig.py:51