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