From 6bc72e96609371098f0f542b2f6793059df4044f Mon Sep 17 00:00:00 2001
From: Bertrand LAFORGE <laforge@lpnhe.in2p3.fr>
Date: Sat, 29 Feb 2020 14:14:22 +0100
Subject: [PATCH 1/3] egamma monitoring with dual mode Run2/Run3 configuration

---
 .../MonitorElectronAlgorithm.h                |  36 ++
 .../MonitorPhotonAlgorithm.h                  |  37 ++
 .../python/SetupEgammaMonitoring.py           | 381 ++++++++++++++++++
 .../share/egammaMonitoringConfig.py           | 290 +++++++++++++
 .../src/MonitorElectronAlgorithm.cxx          |  82 ++++
 .../src/MonitorPhotonAlgorithm.cxx            |  83 ++++
 .../components/egammaPerformance_entries.cxx  |  17 +-
 7 files changed, 923 insertions(+), 3 deletions(-)
 create mode 100755 Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorElectronAlgorithm.h
 create mode 100755 Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorPhotonAlgorithm.h
 create mode 100755 Reconstruction/egamma/egammaPerformance/python/SetupEgammaMonitoring.py
 create mode 100755 Reconstruction/egamma/egammaPerformance/share/egammaMonitoringConfig.py
 create mode 100755 Reconstruction/egamma/egammaPerformance/src/MonitorElectronAlgorithm.cxx
 create mode 100755 Reconstruction/egamma/egammaPerformance/src/MonitorPhotonAlgorithm.cxx

diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorElectronAlgorithm.h b/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorElectronAlgorithm.h
new file mode 100755
index 000000000000..bc924e67b48b
--- /dev/null
+++ b/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorElectronAlgorithm.h
@@ -0,0 +1,36 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef MonitorElectronAlgorithm_H
+#define MonitorElectronAlgorithm_H
+
+#include "AthenaMonitoring/AthMonitorAlgorithm.h"
+#include "AthenaMonitoringKernel/Monitored.h"
+
+#include "xAODEgamma/Electron.h"
+#include "xAODEgamma/ElectronContainer.h"
+#include "xAODEgamma/ElectronxAODHelpers.h"
+
+#include <string>
+
+class MonitorElectronAlgorithm : public AthMonitorAlgorithm {
+
+public:
+
+    MonitorElectronAlgorithm( const std::string& name, ISvcLocator* pSvcLocator );
+    virtual ~MonitorElectronAlgorithm();
+    virtual StatusCode initialize() override;
+    virtual StatusCode fillHistograms( const EventContext& ctx ) const override;
+
+private:
+
+    SG::ReadHandleKey<xAOD::ElectronContainer> m_ParticleContainerKey {this, "ParticleContainerName", "Electrons", "Name of electrons container" };
+
+    Gaudi::Property<std::string> m_ParticlePrefix {this,"ParticlePrefix","electron","Name of the particle prefix to be used to define hists"};
+    Gaudi::Property<std::string> m_RecoName {this,"RecoName","LHTight","Name of particle flavor in egamma reco"};
+    Gaudi::Property<std::string> m_WithTrigger {this,"WithTrigger","","Name extension when electrons are chosen from triggered events"};
+    Gaudi::Property<bool> m_CheckTrigger {this,"CheckTrigger",false,"Variable to check if trigger filter is to be used"};
+
+};
+#endif
diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorPhotonAlgorithm.h b/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorPhotonAlgorithm.h
new file mode 100755
index 000000000000..36824f77e495
--- /dev/null
+++ b/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorPhotonAlgorithm.h
@@ -0,0 +1,37 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef MonitorPhotonAlgorithm_H
+#define MonitorPhotonAlgorithm_H
+
+#include "AthenaMonitoring/AthMonitorAlgorithm.h"
+#include "AthenaMonitoringKernel/Monitored.h"
+
+#include "xAODEgamma/Photon.h"
+#include "xAODEgamma/PhotonContainer.h"
+#include "xAODEgamma/PhotonxAODHelpers.h"
+
+#include <string>
+
+class MonitorPhotonAlgorithm : public AthMonitorAlgorithm {
+
+public:
+
+    MonitorPhotonAlgorithm( const std::string& name, ISvcLocator* pSvcLocator );
+    virtual ~MonitorPhotonAlgorithm();
+    virtual StatusCode initialize() override;
+    virtual StatusCode fillHistograms( const EventContext& ctx ) const override;
+
+private:
+
+    SG::ReadHandleKey<xAOD::PhotonContainer> m_ParticleContainerKey {this, "ParticleContainerName", "Photons", "Name of photons container" };
+
+    Gaudi::Property<std::string> m_ParticlePrefix {this,"ParticlePrefix","photon","Name of the particle prefix to be used to define hists"};
+    Gaudi::Property<std::string> m_RecoName {this,"RecoName","LHTight","Name of particle flavor in egamma reco"};
+    Gaudi::Property<std::string> m_WithTrigger {this,"WithTrigger","","Name extension when photons are chosen from triggered events"};
+    Gaudi::Property<bool> m_CheckTrigger {this,"CheckTrigger",false,"Variable to check if trigger filter is to be used"};
+
+
+};
+#endif
diff --git a/Reconstruction/egamma/egammaPerformance/python/SetupEgammaMonitoring.py b/Reconstruction/egamma/egammaPerformance/python/SetupEgammaMonitoring.py
new file mode 100755
index 000000000000..b07a9fb9184b
--- /dev/null
+++ b/Reconstruction/egamma/egammaPerformance/python/SetupEgammaMonitoring.py
@@ -0,0 +1,381 @@
+#
+#  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+#
+
+'''@file SetupEgammaMonitoring.py
+@author B. Laforge
+@date 2019-09-24
+@brief Example python configuration for the Run III AthenaMonitoring package
+'''
+
+
+def BookHistogramPerRegion(groupe,name,particletype,title,path,xbins,xmin,xmax,nregions=3):
+    '''
+    Function to configure the egamma histograms per region (BARREL, CRACK, ENDCAP, FORWARD)
+    The list is different for electrons, forward electrons and photons
+    '''
+
+    nregionsloc = nregions
+
+    if nregionsloc > 4 :
+        nregionsloc = 4
+
+    Regions = ['BARREL', 'CRACK', 'ENDCAP', 'FORWARD']
+    for n in range(nregionsloc):
+        hname = name + particletype + Regions[n]
+        htitle = title + particletype + Regions[n]
+        groupe.defineHistogram(hname,title=htitle, path=path, xbins=xbins,xmin=xmin,xmax=xmax)
+
+
+def BookHistograms(groupe,reconame,particletype,withTrigger=""):
+    '''
+    Function to configure the egamma histograms
+    The list is different for electrons, forward electrons and photons  
+    usage example : BookHistograms(GroupElectronLHTight,"LHTight","Electron","WithTrigger")
+    '''
+
+    if particletype in ["Electron","Photon"] :
+
+        if particletype in ["Electron"] :
+            prefix = "electron"
+        if particletype in ["Photon"] :
+            prefix = "photon"
+
+        groupe.defineHistogram('lumiPerBCID',title='Luminosity,WithCommaInTitle;L/BCID;Events',path='Shifter',xbins=40,xmin=0.0,xmax=80.0)
+        groupe.defineHistogram('lb', title='Luminosity Block;lb;Events', path='Shifter',xbins=1000,xmin=-0.5,xmax=999.5)
+        groupe.defineHistogram('run',title='Run Number;run;Events', path='Shifter',xbins=1000000,xmin=-0.5,xmax=999999.5)
+        
+        groupe.defineHistogram('pt',title='Electron Transerve momentum Distribution ; Events ; Electron Transerve momentum [GeV]', path='Shifter',xbins=40,xmin=0.0,xmax=80.0)
+
+        # SHIFTER PANEL      
+                                                                                                                                          
+        hname = prefix + "N" + reconame + withTrigger
+        htitle = "Number of " + prefix + "s (" + reconame + ")"
+        groupe.defineHistogram(hname,title=htitle, path='Shifter',xbins=20,xmin=0.0,xmax=20.0)
+
+        hname= prefix + "Et" + reconame
+        htitle= particletype + " transverse energy [MeV]" + " (" + reconame + ")"
+        groupe.defineHistogram(hname,title=htitle, path='Shifter',xbins=100,xmin=-1000.0,xmax=25000.0)
+        
+        #hname= prefix + "EtaPhiPtgt4GeV" + reconame 
+        #htitle= particletype + " #eta,#phi map (candidates with Pt>4GeV)" + " (" + reconame + ")"
+        #groupe.defineHistogram(hname,title=htitle,path='Shifter',type='TH2F',xbins=64,xmin=-3.2,xmax=3.2,ybins=64,ymin=-3.2,ymax=3.2)
+
+        hname= prefix + "Eta" + reconame
+        htitle= particletype + " #eta" + " (" + reconame + ")"
+        groupe.defineHistogram(hname,title=htitle, path='Shifter',xbins=64,xmin=-3.2,xmax=3.2)
+        
+        hname= prefix + "Phi" + reconame
+        htitle= particletype + " #phi" + " (" + reconame + ")"
+        groupe.defineHistogram(hname,title=htitle, path='Shifter',xbins=64,xmin=-3.2,xmax=3.2)
+        
+        hname= prefix+"TopoEtCone40" + reconame
+        htitle= particletype + " Topocluster Isolation Energy" + " (" + reconame + ")"
+        groupe.defineHistogram(hname,title=htitle, path='Shifter',xbins=64,xmin=-10000.,xmax=40000.)
+
+    return True
+
+def MonitorElectronConfig(inputFlags):
+    '''Function to configures some algorithms in the monitoring system.'''
+
+    ### STEP 1 ###
+    # If you need to set up special tools, etc., you will need your own ComponentAccumulator;
+    # uncomment the following 2 lines and use the last three lines of this function instead of the ones
+    # just before
+    # from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
+    # result = ComponentAccumulator()
+
+    # The following class will make a sequence, configure algorithms, and link
+    # them to GenericMonitoringTools
+    from AthenaMonitoring import AthMonitorCfgHelper
+    helper = AthMonitorCfgHelper(inputFlags,'ElectronAthMonitorCfg')
+
+
+    ### STEP 2 ###
+    # Adding an algorithm to the helper. Here, we will use the example
+    # algorithm in the AthenaMonitoring package. Just pass the type to the
+    # helper. Then, the helper will instantiate an instance and set up the
+    # base class configuration following the inputFlags. The returned object
+    # is the algorithm.
+    from egammaPerformance.egammaPerformanceConf import MonitorElectronAlgorithm
+
+    elLHTightMonAlg = helper.addAlgorithm(MonitorElectronAlgorithm,'elLHTightMonAlg')
+    elLHTightTrigMonAlg = helper.addAlgorithm(MonitorElectronAlgorithm,'elLHTightTrigMonAlg')
+
+    elLHLooseMonAlg = helper.addAlgorithm(MonitorElectronAlgorithm,'elLHLooseMonAlg')
+    elLHLooseTrigMonAlg = helper.addAlgorithm(MonitorElectronAlgorithm,'elLHLooseTrigMonAlg')
+
+    elCBTightMonAlg = helper.addAlgorithm(MonitorElectronAlgorithm,'elCBTightMonAlg')
+    elCBTightTrigMonAlg = helper.addAlgorithm(MonitorElectronAlgorithm,'elCBTightTrigMonAlg')
+
+    elCBLooseMonAlg = helper.addAlgorithm(MonitorElectronAlgorithm,'elCBLooseMonAlg')
+    elCBLooseTrigMonAlg = helper.addAlgorithm(MonitorElectronAlgorithm,'elCBLooseTrigMonAlg')
+
+    ### STEP 3 ###
+    # Edit properties of algorithms
+
+    elLHTightMonAlg.ParticleContainerName = "Electrons"
+    elLHTightMonAlg.RecoName = "LHTight"
+    elLHTightMonAlg.ParticlePrefix = "electron"
+    elLHTightMonAlg.WithTrigger = "" 
+    elLHTightMonAlg.CheckTrigger = False 
+    # to enable a trigger filter, for example:
+    # elLHTightMonAlg.TriggerChain = 'HLT_mu26_ivarmedium'
+    elLHTightTrigMonAlg.ParticleContainerName = "Electrons"
+    elLHTightTrigMonAlg.RecoName = "LHTight"
+    elLHTightTrigMonAlg.ParticlePrefix = "electron"
+    elLHTightTrigMonAlg.WithTrigger = "WithTrigger" 
+    elLHTightTrigMonAlg.CheckTrigger = True 
+    # to enable a trigger filter, for example:
+    # elLHTightTrigMonAlg.TriggerChain = 'HLT_mu26_ivarmedium'
+
+    elLHLooseMonAlg.ParticleContainerName = "Electrons"
+    elLHLooseMonAlg.RecoName = "LHLoose"
+    elLHLooseMonAlg.ParticlePrefix = "electron"
+    elLHLooseMonAlg.CheckTrigger = False 
+    # to enable a trigger filter, for example:
+    # elLHLooseMonAlg.TriggerChain = 'HLT_mu26_ivarmedium'
+
+    elLHLooseTrigMonAlg.ParticleContainerName = "Electrons"
+    elLHLooseTrigMonAlg.RecoName = "LHLoose"
+    elLHLooseTrigMonAlg.ParticlePrefix = "electron"
+    elLHLooseTrigMonAlg.CheckTrigger = True 
+    # to enable a trigger filter, for example:
+    # elLHLooseTrigMonAlg.TriggerChain = 'HLT_mu26_ivarmedium'
+
+    elCBTightMonAlg.ParticleContainerName = "Electrons"
+    elCBTightMonAlg.RecoName = "CBTight"
+    elCBTightMonAlg.ParticlePrefix = "electron"
+    elCBTightMonAlg.CheckTrigger = False 
+    # to enable a trigger filter, for example:
+    # elCBTightMonAlg.TriggerChain = 'HLT_mu26_ivarmedium'
+
+    elCBTightTrigMonAlg.ParticleContainerName = "Electrons"
+    elCBTightTrigMonAlg.RecoName = "CBTight"
+    elCBTightTrigMonAlg.ParticlePrefix = "electron"
+    elCBTightTrigMonAlg.CheckTrigger = True 
+    # to enable a trigger filter, for example:
+    # elCBTightTrigMonAlg.TriggerChain = 'HLT_mu26_ivarmedium'
+
+    elCBLooseMonAlg.ParticleContainerName = "Electrons"
+    elCBLooseMonAlg.RecoName = "CBLoose"
+    elCBLooseMonAlg.ParticlePrefix = "electron"
+    elCBLooseMonAlg.CheckTrigger = False 
+    # to enable a trigger filter, for example:
+    # elCBLooseMonAlg.TriggerChain = 'HLT_mu26_ivarmedium'
+
+    elCBLooseTrigMonAlg.ParticleContainerName = "Electrons"
+    elCBLooseTrigMonAlg.RecoName = "CBLoose"
+    elCBLooseTrigMonAlg.ParticlePrefix = "electron"
+    elCBLooseTrigMonAlg.CheckTrigger = True 
+    # to enable a trigger filter, for example:
+    # elCBLooseTrigMonAlg.TriggerChain = 'HLT_mu26_ivarmedium'
+
+
+    ### STEP 4 ###
+    # Add some tools. N.B. Do not use your own trigger decion tool. Use the
+    # standard one that is included with AthMonitorAlgorithm.
+
+    # First, add a tool that's set up by a different configuration function.
+    # In this case, CaloNoiseToolCfg returns its own component accumulator,
+    # which must be merged with the one from this function.
+    # from CaloTools.CaloNoiseToolConfig import CaloNoiseToolCfg
+    # caloNoiseAcc, caloNoiseTool = CaloNoiseToolCfg(inputFlags)
+    # result.merge(caloNoiseAcc)
+    # electronMonAlg.CaloNoiseTool = caloNoiseTool
+
+    # # Then, add a tool that doesn't have its own configuration function. In
+    # # this example, no accumulator is returned, so no merge is necessary.
+    # from MyDomainPackage.MyDomainPackageConf import MyDomainTool
+    # exampleMonAlg.MyDomainTool = MyDomainTool()
+
+    # Add a generic monitoring tool (a "group" in old language). The returned
+    # object here is the standard GenericMonitoringTool.
+
+    GroupElectronLHTight = helper.addGroup(elLHTightMonAlg, 'MonitorElectron', 'LHTightElectrons/')
+    GroupElectronLHTightTriggered = helper.addGroup(elLHTightTrigMonAlg, 'MonitorElectron', 'LHTightElectronsWithTrigger/')
+    GroupElectronLHLoose = helper.addGroup(elLHLooseMonAlg, 'MonitorElectron', 'LHLooseElectrons/')
+    GroupElectronLHLooseTriggered = helper.addGroup(elLHLooseTrigMonAlg, 'MonitorElectron', 'LHLooseElectronsWithTrigger/')
+    GroupElectronCBTight = helper.addGroup(elCBTightMonAlg, 'MonitorElectron', 'CBTightElectrons/')
+    GroupElectronCBTightTriggered = helper.addGroup(elCBTightTrigMonAlg, 'MonitorElectron', 'CBTightTriggeredElectrons/')
+    GroupElectronCBLoose = helper.addGroup(elCBLooseMonAlg, 'MonitorElectron', 'CBLooseElectrons/')
+    GroupElectronCBLooseTriggered = helper.addGroup(elCBLooseTrigMonAlg, 'MonitorElectron', 'CBLooseTriggeredElectrons/')
+
+    ### STEP 5 ###
+    # Configure histograms
+
+    # LHTight Electrons
+    BookHistograms(GroupElectronLHTight,"LHTight","Electron")
+    BookHistograms(GroupElectronLHTightTriggered,"LHTightTrig","Electron","WithTrigger")
+    # LHLoose Electrons
+    BookHistograms(GroupElectronLHLoose,"LHLoose","Electron")
+    BookHistograms(GroupElectronLHLooseTriggered,"LHLooseTrig","Electron","withTrigger")
+    # Cut Based Tight Electrons
+    BookHistograms(GroupElectronCBTight,"CBTight","Electron")
+    BookHistograms(GroupElectronCBTightTriggered,"CBTightTrig","Electron","withTrigger")
+    # Cut Based Loose Electrons
+    BookHistograms(GroupElectronCBLoose,"CBLoose","Electron")
+    BookHistograms(GroupElectronCBLooseTriggered,"CBLooseTrig","Electron","withTrigger")
+
+    ### STEP 6 ###
+    # Finalize. The return value should be a tuple of the ComponentAccumulator
+    # and the sequence containing the created algorithms. If we haven't called
+    # any configuration other than the AthMonitorCfgHelper here, then we can
+    # just return directly (and not create "result" above)
+    return helper.result()
+
+    # # Otherwise, merge with result object and return
+    # acc = helper.result()
+    # result.merge(acc)
+    # return result
+
+
+def MonitorPhotonConfig(inputFlags):
+    '''Function to configures some algorithms in the monitoring system.'''
+
+    ### STEP 1 ###
+    # If you need to set up special tools, etc., you will need your own ComponentAccumulator;
+    # uncomment the following 2 lines and use the last three lines of this function instead of the ones
+    # just before
+    # from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
+    # result = ComponentAccumulator()
+
+    # The following class will make a sequence, configure algorithms, and link
+    # them to GenericMonitoringTools
+    from AthenaMonitoring import AthMonitorCfgHelper
+    helper = AthMonitorCfgHelper(inputFlags,'PhotonnAthMonitorCfg')
+
+
+    ### STEP 2 ###
+    # Adding an algorithm to the helper. Here, we will use the example
+    # algorithm in the AthenaMonitoring package. Just pass the type to the
+    # helper. Then, the helper will instantiate an instance and set up the
+    # base class configuration following the inputFlags. The returned object
+    # is the algorithm.
+    from egammaPerformance.egammaPerformanceConf import MonitorPhotonAlgorithm
+
+    phCBTightMonAlg = helper.addAlgorithm(MonitorPhotonAlgorithm,'phCBTightMonAlg')
+    phCBTightTrigMonAlg = helper.addAlgorithm(MonitorPhotonAlgorithm,'phCBTightTrigMonAlg')
+
+    phCBLooseMonAlg = helper.addAlgorithm(MonitorPhotonAlgorithm,'phCBLooseMonAlg')
+    phCBLooseTrigMonAlg = helper.addAlgorithm(MonitorPhotonAlgorithm,'phCBLooseTrigMonAlg')
+
+    ### STEP 3 ###
+    # Edit properties of algorithms
+
+    phCBTightMonAlg.ParticleContainerName = "Photons"
+    phCBTightMonAlg.RecoName = "CBTight"
+    phCBTightMonAlg.ParticlePrefix = "photon"
+    phCBTightMonAlg.CheckTrigger = False 
+    # to enable a trigger filter, for example:
+    # phCBTightMonAlg.TriggerChain = 'HLT_mu26_ivarmedium'
+
+    phCBTightTrigMonAlg.ParticleContainerName = "Photons"
+    phCBTightTrigMonAlg.RecoName = "CBTight"
+    phCBTightTrigMonAlg.ParticlePrefix = "photon"
+    phCBTightTrigMonAlg.CheckTrigger = True 
+    phCBTightTrigMonAlg.WithTrigger = "WithTrigger" 
+    # to enable a trigger filter, for example:
+    # phCBTightTrigMonAlg.TriggerChain = 'HLT_mu26_ivarmedium'
+
+    phCBLooseMonAlg.ParticleContainerName = "Photons"
+    phCBLooseMonAlg.RecoName = "CBLoose"
+    phCBLooseMonAlg.ParticlePrefix = "photon"
+    phCBLooseMonAlg.CheckTrigger = False 
+    # to enable a trigger filter, for example:
+    # phCBLooseMonAlg.TriggerChain = 'HLT_mu26_ivarmedium'
+
+    phCBLooseTrigMonAlg.ParticleContainerName = "Photons"
+    phCBLooseTrigMonAlg.RecoName = "CBLoose"
+    phCBLooseTrigMonAlg.ParticlePrefix = "photon"
+    phCBLooseTrigMonAlg.CheckTrigger = True 
+    phCBLooseTrigMonAlg.WithTrigger = "WithTrigger" 
+    # to enable a trigger filter, for example:
+    # phCBLooseTrigMonAlg.TriggerChain = 'HLT_mu26_ivarmedium'
+
+
+    ### STEP 4 ###
+    # Add some tools. N.B. Do not use your own trigger decion tool. Use the
+    # standard one that is included with AthMonitorAlgorithm.
+
+    # First, add a tool that's set up by a different configuration function.
+    # In this case, CaloNoiseToolCfg returns its own component accumulator,
+    # which must be merged with the one from this function.
+    # from CaloTools.CaloNoiseToolConfig import CaloNoiseToolCfg
+    # caloNoiseAcc, caloNoiseTool = CaloNoiseToolCfg(inputFlags)
+    # result.merge(caloNoiseAcc)
+    # photonMonAlg.CaloNoiseTool = caloNoiseTool
+
+    # # Then, add a tool that doesn't have its own configuration function. In
+    # # this example, no accumulator is returned, so no merge is necessary.
+    # from MyDomainPackage.MyDomainPackageConf import MyDomainTool
+    # exampleMonAlg.MyDomainTool = MyDomainTool()
+
+    # Add a generic monitoring tool (a "group" in old language). The returned
+    # object here is the standard GenericMonitoringTool.
+
+    GroupPhotonCBTight = helper.addGroup(phCBTightMonAlg, 'MonitorPhoton', 'CBTightPhotons/')
+    GroupPhotonCBTightTriggered = helper.addGroup(phCBTightTrigMonAlg, 'MonitorPhoton', 'CBTightTriggeredPhotons/')
+    GroupPhotonCBLoose = helper.addGroup(phCBLooseMonAlg, 'MonitorPhoton', 'CBLoosePhotons/')
+    GroupPhotonCBLooseTriggered = helper.addGroup(phCBLooseTrigMonAlg, 'MonitorPhoton', 'CBLooseTriggeredPhotons/')
+
+    ### STEP 5 ###
+    # Configure histograms
+
+    # Cut Based Tight Photons
+    BookHistograms(GroupPhotonCBTight,"CBTight","Photon")
+    BookHistograms(GroupPhotonCBTightTriggered,"CBTightTrig","Photon")
+    # Cut Based Loose Photons
+    BookHistograms(GroupPhotonCBLoose,"CBLoose","Photon")
+    BookHistograms(GroupPhotonCBLooseTriggered,"CBLooseTrig","Photon")
+
+    ### STEP 6 ###
+    # Finalize. The return value should be a tuple of the ComponentAccumulator
+    # and the sequence containing the created algorithms. If we haven't called
+    # any configuration other than the AthMonitorCfgHelper here, then we can
+    # just return directly (and not create "result" above)
+    return helper.result()
+
+    # # Otherwise, merge with result object and return
+    # acc = helper.result()
+    # result.merge(acc)
+    # return result
+
+
+if __name__=='__main__':
+    # Setup the Run III behavior
+    from AthenaCommon.Configurable import Configurable
+    Configurable.configurableRun3Behavior = 1
+
+    # Setup logs
+    from AthenaCommon.Logging import log
+    from AthenaCommon.Constants import INFO
+    log.setLevel(INFO)
+
+    # Set the Athena configuration flags
+    from AthenaConfiguration.AllConfigFlags import ConfigFlags
+    nightly = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/'
+    file = 'data16_13TeV.00311321.physics_Main.recon.AOD.r9264/AOD.11038520._000001.pool.root.1'
+    ConfigFlags.Input.Files = [nightly+file]
+    ConfigFlags.Input.isMC = False
+    ConfigFlags.Output.HISTFileName = 'MonitorEgammaOutput.root'
+
+    ConfigFlags.lock()
+
+    # Initialize configuration object, add accumulator, merge, and run.
+    from AthenaConfiguration.MainServicesConfig import MainServicesSerialCfg
+    from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
+    cfg = MainServicesSerialCfg()
+    cfg.merge(PoolReadCfg(ConfigFlags))
+
+    MonitorElectronAcc = MonitorElectronConfig(ConfigFlags)
+    cfg.merge(MonitorElectronAcc)
+
+    MonitorPhotonAcc = MonitorPhotonConfig(ConfigFlags)
+    cfg.merge(MonitorPhotonAcc)
+
+    # If you want to turn on more detailed messages ...
+    # exampleMonitorAcc.getEventAlgo('ExampleMonAlg').OutputLevel = 2 # DEBUG
+    cfg.printConfig(withDetails=False) # set True for exhaustive info
+
+    cfg.run(20) #use cfg.run(20) to only run on first 20 events
diff --git a/Reconstruction/egamma/egammaPerformance/share/egammaMonitoringConfig.py b/Reconstruction/egamma/egammaPerformance/share/egammaMonitoringConfig.py
new file mode 100755
index 000000000000..2c938941e425
--- /dev/null
+++ b/Reconstruction/egamma/egammaPerformance/share/egammaMonitoringConfig.py
@@ -0,0 +1,290 @@
+#
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# B. Laforge, laforge@lpnhe.in2p3.fr, Jan. 2020
+#
+    
+from AthenaCommon.AlgSequence import AlgSequence
+topSequence = AlgSequence()
+
+from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
+from AthenaMonitoring.DQMonFlags import DQMonFlags
+
+if  DQMonFlags.monManEnvironment() in ('tier0','tier0ESD','online', 'AOD'):
+
+# dual use of Run2 and Run3 monitoring
+
+    from AthenaCommon.Configurable import Configurable
+
+    if Configurable.configurableRun3Behavior == 1 : # Configure Run3 monitoring
+ 
+        try:
+            from egammaPerformance.egammaPerformanceConf import MonitorElectronConfig
+            from egammaPerformance.egammaPerformanceConf import MonitorPhotonConfig
+            # Set the Athena configuration flags
+            from AthenaConfiguration.AllConfigFlags import ConfigFlags
+            ConfigFlags.lock()
+            # Initialize configuration object, add accumulator, merge, and run.
+            from AthenaConfiguration.MainServicesConfig import MainServicesSerialCfg
+            from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
+            cfg = MainServicesSerialCfg()
+            cfg.merge(PoolReadCfg(ConfigFlags))
+
+            MonitorElectronAcc = MonitorElectronConfig(ConfigFlags)
+            cfg.merge(MonitorElectronAcc)
+
+            MonitorPhotonAcc = MonitorPhotonConfig(ConfigFlags)
+            cfg.merge(MonitorPhotonAcc)
+
+        except Exception:
+            from AthenaCommon.Resilience import treatException
+            treatException("egammaMonitoring_jobOptions.py: exception when setting up Egamma monitoring for Run III")
+            
+    else : # Configure Run2 monitoring
+
+        import TrigEgammaMonitoring.TrigEgammaMonitCategory as egammaConf
+        try:
+
+            # Set the Athena configuration flags
+            from AthenaCommon.AthenaCommonFlags import jobproperties
+            from AthenaCommon.Constants import INFO
+
+
+            monManEgamma = AthenaMonManager(name="EgammaMonManager",
+                                            FileKey             = DQMonFlags.monManFileKey(),
+                                            Environment         = DQMonFlags.monManEnvironment(),
+                                            ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup(),
+                                            DataType            = DQMonFlags.monManDataType())
+            topSequence += monManEgamma
+        
+            from AthenaMonitoring.BadLBFilterTool import GetLArBadLBFilterTool
+            from AthenaMonitoring.FilledBunchFilterTool import GetFilledBunchFilterTool
+
+            ### Setup which objects will be monitored
+            
+            ## Commenting in/out Mon tools for now
+            egammaMonitorUpsilon1S  = False
+            egammaMonitorUpsilon2S  = False
+            # egammaMonitorJPsi  = False
+            # egammaMonitorZee  = False
+            # egammaMonitorFwdEg  = False
+            # egammaMonitorPhotons  = False
+            # egammaMonitorElectrons  = False
+
+            if not ('egammaMonitorPhotons' in dir()):
+                egammaMonitorPhotons  = True
+            if not ('egammaMonitorElectrons' in dir()):
+                egammaMonitorElectrons  = True
+            if not ('egammaMonitorFwdEg' in dir()):
+                egammaMonitorFwdEg  = True
+            if not ('egammaMonitorZee' in dir()):
+                egammaMonitorZee  = True
+            if not ('egammaMonitorJPsi' in dir()):
+                egammaMonitorJPsi  = True
+            if not ('egammaMonitorUpsilon1S' in dir()):
+                egammaMonitorUpsilon1S  = True
+            if not ('egammaMonitorUpsilon2S' in dir()):
+                egammaMonitorUpsilon2S  = True
+
+            photonTrigItems = []
+            electronTrigItems = []
+            mySingleElectronTrigger = []
+            myDiElectronTrigger = [] 
+            ZeeTrigItems = []
+            JPsiTrigItems = []
+            UpsilonTrigItems = []
+            FrwdETrigItems = []
+            MyTrigDecisionTool = ""
+
+            # do trigger by default for at least one electron and photon monitor
+
+            BypassphotonTrigItems = []
+            BypassmySingleElectronTrigItems = []
+            # Force the trigger with a trigger found in the test file for test purpose
+            # BypassphotonTrigItems = ['L1_EM20VH']
+            # BypassmySingleElectronTrigItems = ['L1_EM20VH']
+
+            BypassphotonTrigItems += egammaConf.primary_double_pho
+            BypassmySingleElectronTrigItems += egammaConf.primary_single_ele
+            print("egamma electron trigger = %s" % BypassmySingleElectronTrigItems)
+
+            BypassMyTrigDecisionTool = monTrigDecTool if DQMonFlags.useTrigger() else None
+
+            ## Commenting in/out Trigger for now
+            MyDoTrigger = False
+            #MyDoTrigger = DQMonFlags.useTrigger()
+
+            if (MyDoTrigger):
+                photonTrigItems += egammaConf.primary_double_pho
+                mySingleElectronTrigger += egammaConf.primary_single_ele
+                myDiElectronTrigger += egammaConf.primary_double_ele
+                JPsiTrigItems += egammaConf.monitoring_Jpsiee
+                FrwdETrigItems += egammaConf.primary_single_ele
+                ZeeTrigItems += egammaConf.monitoring_Zee 
+                MyTrigDecisionTool = monTrigDecTool
+            
+            egammaMonOutputLevel = INFO
+            #egammaMonOutputLevel = VERBOSE
+            #egammaMonOutputLevel = DEBUG
+        
+            if(egammaMonitorPhotons):
+                from egammaPerformance.egammaPerformanceConf import photonMonTool
+                phMonTool = photonMonTool(name= "phMonTool",
+                                      EgTrigDecisionTool = MyTrigDecisionTool,
+                                      EgUseTrigger = MyDoTrigger,
+                                      EgTrigger = photonTrigItems,
+                                      EgGroupExtension = "",
+                                      PhotonContainer = "Photons",
+                                      OutputLevel = egammaMonOutputLevel)            
+                if jobproperties.Beam.beamType()=='collisions':
+                    phMonTool.FilterTools += [ GetLArBadLBFilterTool() ]
+                    phMonTool.FilterTools += [ GetFilledBunchFilterTool() ]
+                monManEgamma.AthenaMonTools += [ phMonTool ]    
+                print(phMonTool)
+
+                if DQMonFlags.useTrigger():
+                    phMonToolWithTrigger = photonMonTool(name= "phMonToolWithTrigger",
+                                                     EgTrigDecisionTool = BypassMyTrigDecisionTool,
+                                                     EgUseTrigger = True,
+                                                     EgTrigger = BypassphotonTrigItems,
+                                                     EgGroupExtension = "WithTrigger",
+                                                     PhotonContainer = "Photons",
+                                                     OutputLevel = egammaMonOutputLevel)
+                    if jobproperties.Beam.beamType()=='collisions':
+                        phMonToolWithTrigger.FilterTools += [ GetLArBadLBFilterTool() ]
+                        phMonToolWithTrigger.FilterTools += [ GetFilledBunchFilterTool() ]
+                    monManEgamma.AthenaMonTools += [ phMonToolWithTrigger ]    
+                    print(phMonToolWithTrigger)
+                
+
+            if(egammaMonitorElectrons):
+                from egammaPerformance.egammaPerformanceConf import electronMonTool
+                elMonTool = electronMonTool(name= "elMonTool",
+                                        EgTrigDecisionTool = MyTrigDecisionTool,
+                                        EgUseTrigger = MyDoTrigger,
+                                        EgTrigger = mySingleElectronTrigger,
+                                        EgGroupExtension = "",
+                                        ElectronContainer = "Electrons",
+                                        OutputLevel = egammaMonOutputLevel)
+                if jobproperties.Beam.beamType()=='collisions':
+                    elMonTool.FilterTools += [ GetLArBadLBFilterTool() ]
+                    elMonTool.FilterTools += [ GetFilledBunchFilterTool() ]
+                monManEgamma.AthenaMonTools += [ elMonTool ]
+                print(elMonTool)
+
+                if DQMonFlags.useTrigger():
+                    elMonToolWithTrigger = electronMonTool(name= "elMonToolWithTrigger",
+                                                           EgTrigDecisionTool = BypassMyTrigDecisionTool,
+                                                           EgUseTrigger = True,
+                                                           EgTrigger = BypassmySingleElectronTrigItems,
+                                                           EgGroupExtension = "WithTrigger",
+                                                           ElectronContainer = "Electrons",
+                                                           OutputLevel = egammaMonOutputLevel)
+                    if jobproperties.Beam.beamType()=='collisions':
+                        elMonToolWithTrigger.FilterTools += [ GetLArBadLBFilterTool() ]
+                        elMonToolWithTrigger.FilterTools += [GetFilledBunchFilterTool()]
+                    monManEgamma.AthenaMonTools += [ elMonToolWithTrigger ]
+                    print(elMonToolWithTrigger)
+
+            if(egammaMonitorFwdEg):
+                from egammaPerformance.egammaPerformanceConf import forwardElectronMonTool
+                fwdMonTool = forwardElectronMonTool(name= "fwdMonTool",
+                                                EgTrigDecisionTool = MyTrigDecisionTool,
+                                                EgUseTrigger = MyDoTrigger,
+                                                EgTrigger = FrwdETrigItems,
+                                                ForwardElectronContainer ="ForwardElectrons",
+                                                OutputLevel = egammaMonOutputLevel)
+                if jobproperties.Beam.beamType()=='collisions':
+                    fwdMonTool.FilterTools += [ GetLArBadLBFilterTool() ]
+                    fwdMonTool.FilterTools += [ GetFilledBunchFilterTool() ]
+                monManEgamma.AthenaMonTools += [ fwdMonTool ]    
+                print(fwdMonTool)
+
+            if(egammaMonitorZee):
+                from egammaPerformance.egammaPerformanceConf import ZeeTaPMonTool
+                ZeeMonTool = ZeeTaPMonTool(name= "ZeeMonTool",
+                                           EgTrigDecisionTool = MyTrigDecisionTool,
+                                           EgUseTrigger = MyDoTrigger,
+                                           EgTrigger = ZeeTrigItems,
+                                           EgGroupExtension="Z",
+                                           ElectronContainer  ="Electrons",
+                                           massPeak = 91188,
+                                           electronEtCut = 20000,
+                                           massLowerCut = 60000,
+                                           massUpperCut = 120000,
+                                           #PhiBinning = 64,
+                                           OutputLevel = egammaMonOutputLevel,
+                                           TrigDecisionTool = MyTrigDecisionTool,
+                                           UseTrigger = MyDoTrigger)
+                if jobproperties.Beam.beamType()=='collisions':
+                    ZeeMonTool.FilterTools += [ GetLArBadLBFilterTool() ]
+                    ZeeMonTool.FilterTools += [ GetFilledBunchFilterTool() ]
+                monManEgamma.AthenaMonTools += [ ZeeMonTool ]
+                print(ZeeMonTool)
+
+            if(egammaMonitorJPsi):
+                from egammaPerformance.egammaPerformanceConf import ZeeTaPMonTool
+                JPsiMonTool = ZeeTaPMonTool(name= "JPsiMonTool",
+                                        EgTrigDecisionTool = MyTrigDecisionTool,
+                                        EgUseTrigger = MyDoTrigger,
+                                        EgTrigger = JPsiTrigItems,
+                                        EgGroupExtension="JPsi",
+                                        ElectronContainer="Electrons",
+                                        massPeak = 3097,
+                                        electronEtCut = 3000,
+                                        massLowerCut = 2000,
+                                        massUpperCut = 5000,
+                                        #PhiBinning = 40,
+                                        OutputLevel = egammaMonOutputLevel,
+                                        TrigDecisionTool = MyTrigDecisionTool,
+                                        UseTrigger = MyDoTrigger)
+                if jobproperties.Beam.beamType()=='collisions':
+                    JPsiMonTool.FilterTools += [ GetLArBadLBFilterTool() ]                
+                    JPsiMonTool.FilterTools += [ GetFilledBunchFilterTool() ]       
+                monManEgamma.AthenaMonTools += [ JPsiMonTool ]
+                print(JPsiMonTool)
+
+            if(egammaMonitorUpsilon1S):
+                from egammaPerformance.egammaPerformanceConf import physicsMonTool
+                Upsilon1SMonTool = physicsMonTool(name= "Upsilon1SMonTool",
+                                              ElectronContainer="Electrons",
+                                              Trigger_Items = UpsilonTrigItems,
+                                              ProcessName = "Upsilon1See",
+                                              Selection_Items = ["all"],
+                                              massShift = 9460,
+                                              massElectronClusterEtCut = 1000 ,
+                                              massLowerCut = 5000,
+                                              massUpperCut = 15000,
+                                              #PhiBinning = 64,
+                                              OutputLevel = egammaMonOutputLevel,
+                                              TrigDecisionTool = MyTrigDecisionTool,
+                                              UseTrigger = MyDoTrigger)
+                if jobproperties.Beam.beamType()=='collisions':
+                    Upsilon1SMonTool.FilterTools += [ GetLArBadLBFilterTool() ]                
+                    Upsilon1SMonTool.FilterTools += [ GetFilledBunchFilterTool() ]       
+                monManEgamma.AthenaMonTools += [ Upsilon1SMonTool ]
+                print(Upsilon1SMonTool)
+
+            if(egammaMonitorUpsilon2S):
+                from egammaPerformance.egammaPerformanceConf import physicsMonTool
+                Upsilon2SMonTool = physicsMonTool(name= "Upsilon2SMonTool",
+                                              ElectronContainer="Electrons",
+                                              Trigger_Items = UpsilonTrigItems,
+                                              ProcessName = "Upsilon2See",
+                                              Selection_Items = ["all"],
+                                              massShift = 10023,
+                                              massElectronClusterEtCut = 1000 ,
+                                              massLowerCut = 5000,
+                                              massUpperCut = 15000,
+                                              #PhiBinning = 64,
+                                              OutputLevel = egammaMonOutputLevel,
+                                              TrigDecisionTool = MyTrigDecisionTool,
+                                              UseTrigger = MyDoTrigger)
+                if jobproperties.Beam.beamType()=='collisions':
+                    Upsilon2SMonTool.FilterTools += [ GetLArBadLBFilterTool() ]                
+                    Upsilon2SMonTool.FilterTools += [ GetFilledBunchFilterTool() ]       
+                monManEgamma.AthenaMonTools += [ Upsilon2SMonTool ]
+                print(Upsilon2SMonTool)
+
+        except Exception:
+            from AthenaCommon.Resilience import treatException
+            treatException("egammaMonitoring_jobOptions.py: exception when setting up Egamma monitoring for Run II")
diff --git a/Reconstruction/egamma/egammaPerformance/src/MonitorElectronAlgorithm.cxx b/Reconstruction/egamma/egammaPerformance/src/MonitorElectronAlgorithm.cxx
new file mode 100755
index 000000000000..6dc61903c43e
--- /dev/null
+++ b/Reconstruction/egamma/egammaPerformance/src/MonitorElectronAlgorithm.cxx
@@ -0,0 +1,82 @@
+/*x
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "egammaPerformance/MonitorElectronAlgorithm.h"
+
+MonitorElectronAlgorithm::MonitorElectronAlgorithm( const std::string& name, ISvcLocator* pSvcLocator )
+:AthMonitorAlgorithm(name,pSvcLocator)
+{
+}
+
+MonitorElectronAlgorithm::~MonitorElectronAlgorithm() {}
+
+
+StatusCode MonitorElectronAlgorithm::initialize() {
+    using namespace Monitored;
+
+    ATH_CHECK( m_ParticleContainerKey.initialize() );
+    return AthMonitorAlgorithm::initialize();
+}
+
+
+StatusCode MonitorElectronAlgorithm::fillHistograms( const EventContext& ctx ) const {
+    using namespace Monitored;
+
+    // Only monitor good LAr Events :
+
+    xAOD::EventInfo::EventFlagErrorState error_state = GetEventInfo(ctx)->errorState(xAOD::EventInfo::LAr);
+    if (error_state==xAOD::EventInfo::Error) {
+      ATH_MSG_DEBUG("LAr event data integrity error");
+      return StatusCode::SUCCESS;
+    }
+
+    // get the Electron container
+
+    SG::ReadHandle<xAOD::ElectronContainer> electrons(m_ParticleContainerKey, ctx);
+    if (! electrons.isValid() ) {
+      ATH_MSG_ERROR("evtStore() does not contain electron Collection with name "<< m_ParticleContainerKey);
+      return StatusCode::FAILURE;
+    }
+
+    // Event variables to be monitored
+
+    auto lumiPerBCID = Monitored::Scalar<float>("lumiPerBCID",0.0);
+    auto lb = Monitored::Scalar<int>("lb",0);
+    auto run = Monitored::Scalar<int>("run",0);
+
+    // Particle variables to be monitored
+
+    std::string name = m_ParticlePrefix+"N"+m_RecoName+m_WithTrigger;
+    auto np = Monitored::Scalar<int>(name,0.0);
+ 
+    auto pt = Monitored::Scalar<float>("pt",0.0); 
+
+    // Set the values of the monitored variables for the event
+    lumiPerBCID = lbAverageInteractionsPerCrossing(ctx);
+    lb = GetEventInfo(ctx)->lumiBlock();
+    run = GetEventInfo(ctx)->runNumber();
+
+    // Fill. First argument is the tool name, all others are the variables to be histogramed
+    fill("MonitorElectron",lumiPerBCID,lb,run);
+ 
+
+    np = 0;
+    for (const auto& e_iter : *electrons) {
+
+      // Check that the electron meets our requirements
+      bool isGood;
+      e_iter->passSelection(isGood,m_RecoName);
+      if(isGood) {np++;}
+      else continue;
+                           
+      // do stuff with electrons
+      pt = e_iter->pt(); // in GeV
+      fill("MonitorElectron",pt);
+
+    }
+
+    fill("MonitorElectron",np);
+
+    return StatusCode::SUCCESS;
+}
diff --git a/Reconstruction/egamma/egammaPerformance/src/MonitorPhotonAlgorithm.cxx b/Reconstruction/egamma/egammaPerformance/src/MonitorPhotonAlgorithm.cxx
new file mode 100755
index 000000000000..80ec15c2f044
--- /dev/null
+++ b/Reconstruction/egamma/egammaPerformance/src/MonitorPhotonAlgorithm.cxx
@@ -0,0 +1,83 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "egammaPerformance/MonitorPhotonAlgorithm.h"
+
+MonitorPhotonAlgorithm::MonitorPhotonAlgorithm( const std::string& name, ISvcLocator* pSvcLocator )
+:AthMonitorAlgorithm(name,pSvcLocator)
+{
+}
+
+
+MonitorPhotonAlgorithm::~MonitorPhotonAlgorithm() {}
+
+
+StatusCode MonitorPhotonAlgorithm::initialize() {
+    using namespace Monitored;
+
+    ATH_CHECK( m_ParticleContainerKey.initialize() );
+    return AthMonitorAlgorithm::initialize();
+}
+
+
+StatusCode MonitorPhotonAlgorithm::fillHistograms( const EventContext& ctx ) const {
+    using namespace Monitored;
+
+    // Only monitor good LAr Events :
+
+    xAOD::EventInfo::EventFlagErrorState error_state = GetEventInfo(ctx)->errorState(xAOD::EventInfo::LAr);
+    if (error_state==xAOD::EventInfo::Error) {
+      ATH_MSG_DEBUG("LAr event data integrity error");
+      return StatusCode::SUCCESS;
+    }
+
+    // get the Photon container
+
+    SG::ReadHandle<xAOD::PhotonContainer> electrons(m_ParticleContainerKey, ctx);
+    if (! electrons.isValid() ) {
+      ATH_MSG_ERROR("evtStore() does not contain electron Collection with name "<< m_ParticleContainerKey);
+      return StatusCode::FAILURE;
+    }
+
+    // Event variables to be monitored
+
+    auto lumiPerBCID = Monitored::Scalar<float>("lumiPerBCID",0.0);
+    auto lb = Monitored::Scalar<int>("lb",0);
+    auto run = Monitored::Scalar<int>("run",0);
+
+    // Particle variables to be monitored
+
+    std::string name = m_ParticlePrefix+"N"+m_RecoName+m_WithTrigger;
+    auto np = Monitored::Scalar<int>(name,0.0);
+ 
+    auto pt = Monitored::Scalar<float>("pt",0.0); 
+
+    // Set the values of the monitored variables for the event
+    lumiPerBCID = lbAverageInteractionsPerCrossing(ctx);
+    lb = GetEventInfo(ctx)->lumiBlock();
+    run = GetEventInfo(ctx)->runNumber();
+
+    // Fill. First argument is the tool name, all others are the variables to be histogramed
+    fill("MonitorPhoton",lumiPerBCID,lb,run);
+ 
+
+    np = 0;
+    for (const auto& e_iter : *electrons) {
+
+      // Check that the electron meets our requirements
+      bool isGood;
+      e_iter->passSelection(isGood,m_RecoName);
+      if(isGood) {np++;}
+      else continue;
+                           
+      // do stuff with electrons
+      pt = e_iter->pt(); // in GeV
+      fill("MonitorPhoton",pt);
+
+    }
+
+    fill("MonitorPhoton",np);
+
+    return StatusCode::SUCCESS;
+}
diff --git a/Reconstruction/egamma/egammaPerformance/src/components/egammaPerformance_entries.cxx b/Reconstruction/egamma/egammaPerformance/src/components/egammaPerformance_entries.cxx
index 0b42e1e51369..a5477f55e86f 100644
--- a/Reconstruction/egamma/egammaPerformance/src/components/egammaPerformance_entries.cxx
+++ b/Reconstruction/egamma/egammaPerformance/src/components/egammaPerformance_entries.cxx
@@ -1,10 +1,21 @@
+// New Run 3 algorithms
+#include "egammaPerformance/MonitorElectronAlgorithm.h"
+#include "egammaPerformance/MonitorPhotonAlgorithm.h"
+// Run 2 algorithms
 #include "egammaPerformance/photonMonTool.h"
 #include "egammaPerformance/electronMonTool.h"
 #include "egammaPerformance/forwardElectronMonTool.h"
 #include "egammaPerformance/ZeeTaPMonTool.h"
 
-DECLARE_COMPONENT( photonMonTool )
+// Run 2 Algorithms
+
+DECLARE_COMPONENT( photonMonTool ) 
 DECLARE_COMPONENT( electronMonTool )
-DECLARE_COMPONENT( forwardElectronMonTool )
-DECLARE_COMPONENT( ZeeTaPMonTool )
+DECLARE_COMPONENT( forwardElectronMonTool )  
+DECLARE_COMPONENT( ZeeTaPMonTool )  
+
+// RUN 3 algorithms
+
+DECLARE_COMPONENT( MonitorElectronAlgorithm ) 
+DECLARE_COMPONENT( MonitorPhotonAlgorithm ) 
 
-- 
GitLab


From c3583774779095a49aacc101d4572aba83f56524 Mon Sep 17 00:00:00 2001
From: Bertrand LAFORGE <laforge@lpnhe.in2p3.fr>
Date: Sun, 1 Mar 2020 15:39:13 +0100
Subject: [PATCH 2/3] update of copyright in new files for Run3 setup

---
 .../egammaPerformance/MonitorElectronAlgorithm.h             | 2 +-
 .../egammaPerformance/MonitorPhotonAlgorithm.h               | 4 ++--
 .../egamma/egammaPerformance/python/SetupEgammaMonitoring.py | 4 +---
 .../egamma/egammaPerformance/share/egammaMonitoringConfig.py | 3 +--
 .../egammaPerformance/src/MonitorElectronAlgorithm.cxx       | 4 ++--
 .../egamma/egammaPerformance/src/MonitorPhotonAlgorithm.cxx  | 2 +-
 .../src/components/egammaPerformance_entries.cxx             | 5 +++++
 7 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorElectronAlgorithm.h b/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorElectronAlgorithm.h
index bc924e67b48b..52f1ea3784a2 100755
--- a/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorElectronAlgorithm.h
+++ b/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorElectronAlgorithm.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef MonitorElectronAlgorithm_H
diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorPhotonAlgorithm.h b/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorPhotonAlgorithm.h
index 36824f77e495..e6a385c2b056 100755
--- a/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorPhotonAlgorithm.h
+++ b/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorPhotonAlgorithm.h
@@ -1,8 +1,8 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#ifndef MonitorPhotonAlgorithm_H
+#Ifndef MonitorPhotonAlgorithm_H
 #define MonitorPhotonAlgorithm_H
 
 #include "AthenaMonitoring/AthMonitorAlgorithm.h"
diff --git a/Reconstruction/egamma/egammaPerformance/python/SetupEgammaMonitoring.py b/Reconstruction/egamma/egammaPerformance/python/SetupEgammaMonitoring.py
index b07a9fb9184b..80b7a8ef8957 100755
--- a/Reconstruction/egamma/egammaPerformance/python/SetupEgammaMonitoring.py
+++ b/Reconstruction/egamma/egammaPerformance/python/SetupEgammaMonitoring.py
@@ -1,14 +1,12 @@
 #
-#  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+#  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 #
 
 '''@file SetupEgammaMonitoring.py
 @author B. Laforge
-@date 2019-09-24
 @brief Example python configuration for the Run III AthenaMonitoring package
 '''
 
-
 def BookHistogramPerRegion(groupe,name,particletype,title,path,xbins,xmin,xmax,nregions=3):
     '''
     Function to configure the egamma histograms per region (BARREL, CRACK, ENDCAP, FORWARD)
diff --git a/Reconstruction/egamma/egammaPerformance/share/egammaMonitoringConfig.py b/Reconstruction/egamma/egammaPerformance/share/egammaMonitoringConfig.py
index 2c938941e425..48495a6bb403 100755
--- a/Reconstruction/egamma/egammaPerformance/share/egammaMonitoringConfig.py
+++ b/Reconstruction/egamma/egammaPerformance/share/egammaMonitoringConfig.py
@@ -1,6 +1,5 @@
 #
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-# B. Laforge, laforge@lpnhe.in2p3.fr, Jan. 2020
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 #
     
 from AthenaCommon.AlgSequence import AlgSequence
diff --git a/Reconstruction/egamma/egammaPerformance/src/MonitorElectronAlgorithm.cxx b/Reconstruction/egamma/egammaPerformance/src/MonitorElectronAlgorithm.cxx
index 6dc61903c43e..8ff35d3239ae 100755
--- a/Reconstruction/egamma/egammaPerformance/src/MonitorElectronAlgorithm.cxx
+++ b/Reconstruction/egamma/egammaPerformance/src/MonitorElectronAlgorithm.cxx
@@ -1,5 +1,5 @@
-/*x
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "egammaPerformance/MonitorElectronAlgorithm.h"
diff --git a/Reconstruction/egamma/egammaPerformance/src/MonitorPhotonAlgorithm.cxx b/Reconstruction/egamma/egammaPerformance/src/MonitorPhotonAlgorithm.cxx
index 80ec15c2f044..5f1e226f68a3 100755
--- a/Reconstruction/egamma/egammaPerformance/src/MonitorPhotonAlgorithm.cxx
+++ b/Reconstruction/egamma/egammaPerformance/src/MonitorPhotonAlgorithm.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "egammaPerformance/MonitorPhotonAlgorithm.h"
diff --git a/Reconstruction/egamma/egammaPerformance/src/components/egammaPerformance_entries.cxx b/Reconstruction/egamma/egammaPerformance/src/components/egammaPerformance_entries.cxx
index a5477f55e86f..2f2d147e1462 100644
--- a/Reconstruction/egamma/egammaPerformance/src/components/egammaPerformance_entries.cxx
+++ b/Reconstruction/egamma/egammaPerformance/src/components/egammaPerformance_entries.cxx
@@ -1,3 +1,8 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+
 // New Run 3 algorithms
 #include "egammaPerformance/MonitorElectronAlgorithm.h"
 #include "egammaPerformance/MonitorPhotonAlgorithm.h"
-- 
GitLab


From 76e6b2484dfd63fe38c174c5116400727049a4f9 Mon Sep 17 00:00:00 2001
From: Bertrand LAFORGE <laforge@lpnhe.in2p3.fr>
Date: Sun, 1 Mar 2020 19:36:30 +0100
Subject: [PATCH 3/3] update a small typo in one header file

---
 .../egammaPerformance/MonitorPhotonAlgorithm.h                  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorPhotonAlgorithm.h b/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorPhotonAlgorithm.h
index e6a385c2b056..68a370592cd0 100755
--- a/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorPhotonAlgorithm.h
+++ b/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorPhotonAlgorithm.h
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#Ifndef MonitorPhotonAlgorithm_H
+#ifndef MonitorPhotonAlgorithm_H
 #define MonitorPhotonAlgorithm_H
 
 #include "AthenaMonitoring/AthMonitorAlgorithm.h"
-- 
GitLab