diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringMTConfig.py b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringMTConfig.py index bc9293a62327165fd3cde4da38f6f2149065d674..b7ee4e84d5e27ba6973c1df1fe290446f0a685b3 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringMTConfig.py +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringMTConfig.py @@ -594,7 +594,7 @@ class TrigEgammaMonAlgBuilder: self.basePath+'/'+trigger+'/Distributions/' + ("HLT" if online else "Offline") ) self.addHistogram(monGroup, TH1F("ethad", "ethad; ethad ; Count", 20, -1, 1)) - self.addHistogram(monGroup, TH1F("ethad1", "ethad1; ehad1 ; Count", 20, -1, 1)) + self.addHistogram(monGroup, TH1F("ethad1", "ethad1; ethad1 ; Count", 20, -1, 1)) self.addHistogram(monGroup, TH1F("Rhad", "Rhad; Rhad ; Count", 35, -0.3, 0.3)) self.addHistogram(monGroup, TH1F("Rhad1", "Rhad1; Rhad1 ; Count", 30, -0.3, 0.3)) self.addHistogram(monGroup, TH1F("Reta", "Reta; Reta ; Count", 15, 0.4, 1.2)) diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/egammaMonitorPrecisionConfig.py b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/egammaMonitorPrecisionConfig.py index 69f710bcbdc64f0ca854618ad637135686307dd9..968ed4978b30e3c6f75f2bba0227e806f8fb9ee2 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/egammaMonitorPrecisionConfig.py +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/egammaMonitorPrecisionConfig.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration # from AthenaCommon.Logging import logging @@ -14,40 +14,43 @@ def egammaMonitorPrecisionCfg(name): monTool_electron = GenericMonitoringTool("MonTool_"+name) monTool_electron.Histograms = [ #track variables monitoring - defineHistogram('deltaEta0',title='Precision#Delta#eta0', path='EXPERT',xbins=80, xmin=-0.1,xmax=0.1), - defineHistogram('deltaEta1',title='Precision#Delta#eta1', path='EXPERT',xbins=80, xmin=-0.1,xmax=0.1), - defineHistogram('deltaEta2',title='Precision#Delta#eta2', path='EXPERT',xbins=80, xmin=-0.1,xmax=0.1), - defineHistogram('deltaEta3',title='Precision#Delta#eta3', path='EXPERT',xbins=80, xmin=-0.1,xmax=0.1), - defineHistogram('deltaPhi0',title='Precision#Delta#eta0', path='EXPERT',xbins=80, xmin=-0.1,xmax=0.1), - defineHistogram('deltaPhi1',title='Precision#Delta#phi1', path='EXPERT',xbins=80, xmin=-0.1,xmax=0.1), - defineHistogram('deltaPhi2',title='Precision#Delta#phi2', path='EXPERT',xbins=80, xmin=-0.1,xmax=0.1), - defineHistogram('deltaPhi3',title='Precision#Delta#phi3', path='EXPERT',xbins=80, xmin=-0.1,xmax=0.1), - defineHistogram('deltaPhiRescaled0',title='Precision#Delta#phiRescaled0', path='EXPERT',xbins=80, xmin=-0.1,xmax=0.1), - defineHistogram('deltaPhiRescaled1',title='Precision#Delta#phiRescaled1', path='EXPERT',xbins=80, xmin=-0.1,xmax=0.1), - defineHistogram('deltaPhiRescaled2',title='Precision#Delta#phiRescaled2', path='EXPERT',xbins=80, xmin=-0.1,xmax=0.1), - defineHistogram('deltaPhiRescaled3',title='Precision#Delta#phiRescaled3', path='EXPERT',xbins=80, xmin=-0.1,xmax=0.1), - defineHistogram('deltaPhiFromLastMeasurement',title='Precision#Delta#phiLastMeasurement', path='EXPERT',xbins=80, xmin=-0.1,xmax=0.1), + defineHistogram('deltaEta0',title='Precision#Delta#eta0', path='EXPERT',xbins=40, xmin=-0.01,xmax=0.01), + defineHistogram('deltaEta1',title='Precision#Delta#eta1', path='EXPERT',xbins=40, xmin=-0.01,xmax=0.01), + defineHistogram('deltaEta2',title='Precision#Delta#eta2', path='EXPERT',xbins=40, xmin=-0.01,xmax=0.01), + defineHistogram('deltaEta3',title='Precision#Delta#eta3', path='EXPERT',xbins=40, xmin=-0.01,xmax=0.01), + defineHistogram('deltaPhi0',title='Precision#Delta#eta0', path='EXPERT',xbins=40, xmin=-0.01,xmax=0.01), + defineHistogram('deltaPhi1',title='Precision#Delta#phi1', path='EXPERT',xbins=40, xmin=-0.1,xmax=0.1), + defineHistogram('deltaPhi2',title='Precision#Delta#phi2', path='EXPERT',xbins=40, xmin=-0.1,xmax=0.1), + defineHistogram('deltaPhi3',title='Precision#Delta#phi3', path='EXPERT',xbins=40, xmin=-0.1,xmax=0.1), + defineHistogram('deltaPhiRescaled0',title='Precision#Delta#phiRescaled0', path='EXPERT',xbins=40, xmin=-0.1,xmax=0.1), + defineHistogram('deltaPhiRescaled1',title='Precision#Delta#phiRescaled1', path='EXPERT',xbins=40, xmin=-0.1,xmax=0.1), + defineHistogram('deltaPhiRescaled2',title='Precision#Delta#phiRescaled2', path='EXPERT',xbins=40, xmin=-0.1,xmax=0.1), + defineHistogram('deltaPhiRescaled3',title='Precision#Delta#phiRescaled3', path='EXPERT',xbins=40, xmin=-0.1,xmax=0.1), + defineHistogram('deltaPhiLast',title='Precision#Delta#phiLastMeasurement', path='EXPERT',xbins=40, xmin=-0.1,xmax=0.1), #Shower Shapes variables monitoring - defineHistogram('e237',type='TH1F', path='EXPERT',title="Precision Reconstruction uncor energy in 3x7 cells in em sampling 2; E [MeV]",xbins=50, xmin=-15000, xmax=150000 ), - defineHistogram('e277', type='TH1F', path='EXPERT',title="Precision Reconstruction uncor energy in 7x7 cells in em sampling 2;E [MeV]",xbins=50, xmin=-15000, xmax=150000 ), - defineHistogram('Rhad', type='TH1F', path='EXPERT',title="Rhad",xbins=50, xmin=-1, xmax=1 ), - defineHistogram('Rhad1', type='TH1F', path='EXPERT',title="Rhad",xbins=50, xmin=-1, xmax=1 ), - defineHistogram('ethad', type='TH1F', path='EXPERT',title="Transverse energy in the first sampling of the hadronic calorimeters behind the cluster calculated from ehad1 ; E [MeV]",xbins=50, xmin=-15000, xmax=150000 ), - defineHistogram('ethad1', type='TH1F', path='EXPERT',title="ET leakage into hadronic calorimeter with exclusion of energy in CaloSampling; E [MeV]",xbins=50, xmin=-15000, xmax=150000 ), - defineHistogram('weta1', type='TH1F', path='EXPERT',title="Precision Reconstruction corrected width in 3 strips in the 1st samp. ; Width",xbins=20, xmin=0, xmax=1 ), - defineHistogram('weta2', type='TH1F', path='EXPERT',title="Precision Reconstruction corrected width in 3 strips in the 2st samp. ; Width",xbins=20, xmin=0, xmax=0.05 ), + defineHistogram('Reta', type='TH1F', path='EXPERT',title="Reta",xbins=15, xmin=0.4, xmax=1.2), + defineHistogram('Rphi', type='TH1F', path='EXPERT',title="Rphi",xbins=15, xmin=0.4, xmax=1.2), + defineHistogram('Rhad', type='TH1F', path='EXPERT',title="Rhad",xbins=35, xmin=-0.3, xmax=0.3 ), + defineHistogram('Rhad1', type='TH1F', path='EXPERT',title="Rhad",xbins=30, xmin=-0.3, xmax=0.3 ), + defineHistogram('ethad', type='TH1F', path='EXPERT',title="Transverse energy in the first sampling of the hadronic calorimeters behind the cluster calculated from ehad1 ; E [MeV]",xbins=20, xmin=-1, xmax=1 ), + defineHistogram('ethad1', type='TH1F', path='EXPERT',title="ET leakage into hadronic calorimeter with exclusion of energy in CaloSampling; E [MeV]",xbins=20, xmin=-1, xmax=1 ), + defineHistogram('weta1', type='TH1F', path='EXPERT',title="Precision Reconstruction corrected width in 3 strips in the 1st samp. ; Width",xbins=12, xmin=0.4, xmax=1 ), + defineHistogram('weta2', type='TH1F', path='EXPERT',title="Precision Reconstruction corrected width in 3 strips in the 2st samp. ; Width",xbins=20, xmin=0, xmax=0.02 ), defineHistogram('wtots1', type='TH1F', path='EXPERT',title="Precision Reconstruction total width in em sampling 1 in 20 strips; Width",xbins=20, xmin=0, xmax=20 ), - defineHistogram('f1', type='TH1F', path='EXPERT',title="Fraction of energy found in 1st em sampling;Fraction",xbins=50, xmin=-0.1, xmax=1.1 ), - defineHistogram('f3', type='TH1F', path='EXPERT',title="Fraction of energy reconstructed in 3rd sampling ;Fraction",xbins=50, xmin=-0.1, xmax=1.1 ), - defineHistogram('eratio', type='TH1F', path='EXPERT',title="Eratio ;Count",xbins=50, xmin=0, xmax=2 ), - defineHistogram('fracs1', type='TH1F', path='EXPERT', title="Reconstruction energy outside core (E(+-7)-E(+-3))/E(+-7); E [MeV]",xbins=50, xmin=-5000, xmax=10000 ), + defineHistogram('f1', type='TH1F', path='EXPERT',title="Fraction of energy found in 1st em sampling;Fraction",xbins=11, xmin=0, xmax=1 ), + defineHistogram('f3', type='TH1F', path='EXPERT',title="Fraction of energy reconstructed in 3rd sampling ;Fraction",xbins=21, xmin=-0.05, xmax=0.1 ), + defineHistogram('eratio', type='TH1F', path='EXPERT',title="Eratio ;Count",xbins=20, xmin=0, xmax=2 ), #Isolation variables monitoring - defineHistogram('ptcone20', type='TH1F', path='EXPERT',title="count;ptcone20",xbins=50, xmin=0, xmax=10 ), - defineHistogram('ptcone30', type='TH1F', path='EXPERT',title="count;ptcone30",xbins=50, xmin=0, xmax=10 ), - defineHistogram('ptcone40', type='TH1F', path='EXPERT', title="count;ptcone40",xbins=50, xmin=0, xmax=10 ), - defineHistogram('topoetcone20', type='TH1F', path='EXPERT',title="count;topoetcone20[GeV]",xbins=50, xmin=-10, xmax=50 )] + defineHistogram('ptcone20', type='TH1F', path='EXPERT',title="count;ptcone20",xbins=50, xmin=0, xmax=5 ), + defineHistogram('ptcone30', type='TH1F', path='EXPERT',title="count;ptcone30",xbins=50, xmin=0, xmax=5 ), + defineHistogram('ptcone40', type='TH1F', path='EXPERT', title="count;ptcone40",xbins=50, xmin=0, xmax=5 ), + defineHistogram('ptvarcone20', type='TH1F', path='EXPERT',title="count;ptvarcone20",xbins=50, xmin=0, xmax=5 ), + defineHistogram('ptvarcone30', type='TH1F', path='EXPERT',title="count;ptvarcone30",xbins=50, xmin=0, xmax=5 ), + defineHistogram('ptvarcone40', type='TH1F', path='EXPERT', title="count;ptvarcone40",xbins=50, xmin=0, xmax=5 ), + defineHistogram('topoetcone20', type='TH1F', path='EXPERT',title="count;topoetcone20[GeV]",xbins=100, xmin=-10, xmax=50 ), + defineHistogram('topoetcone40_shift', type='TH1F', path='EXPERT',title="count;topoetcone40[GeV]",xbins=100, xmin=-10, xmax=50 )] return monTool_electron else: @@ -56,25 +59,30 @@ def egammaMonitorPrecisionCfg(name): monTool_photon.Histograms = [ #Shower Shapes variables monitoring - defineHistogram('e237',type='TH1F', path='EXPERT',title="Precision Reconstruction uncor energy in 3x7 cells in em sampling 2; E [MeV]",xbins=50, xmin=-15000, xmax=150000 ), - defineHistogram('e277', type='TH1F', path='EXPERT',title="Precision Reconstruction uncor energy in 7x7 cells in em sampling 2;E [MeV]",xbins=50, xmin=-15000, xmax=150000 ), - defineHistogram('Rhad', type='TH1F', path='EXPERT',title="Rhad",xbins=50, xmin=-1, xmax=1 ), - defineHistogram('Rhad1', type='TH1F', path='EXPERT',title="Rhad",xbins=50, xmin=-1, xmax=1 ), - defineHistogram('ethad', type='TH1F', path='EXPERT',title="Transverse energy in the first sampling of the hadronic calorimeters behind the cluster calculated from ehad1 ; E [MeV]",xbins=50, xmin=-15000, xmax=150000 ), - defineHistogram('ethad1', type='TH1F', path='EXPERT',title="ET leakage into hadronic calorimeter with exclusion of energy in CaloSampling; E [MeV]",xbins=50, xmin=-15000, xmax=150000 ), - defineHistogram('weta1', type='TH1F', path='EXPERT',title="Precision Reconstruction corrected width in 3 strips in the 1st samp. ; Width",xbins=20, xmin=0, xmax=1 ), - defineHistogram('weta2', type='TH1F', path='EXPERT',title="Precision Reconstruction corrected width in 3 strips in the 2st samp. ; Width",xbins=20, xmin=0, xmax=0.05 ), + defineHistogram('Reta', type='TH1F', path='EXPERT',title="Reta",xbins=15, xmin=0.4, xmax=1.2), + defineHistogram('Rphi', type='TH1F', path='EXPERT',title="Rphi",xbins=15, xmin=0.4, xmax=1.2), + defineHistogram('Rhad', type='TH1F', path='EXPERT',title="Rhad",xbins=35, xmin=-0.3, xmax=0.3 ), + defineHistogram('Rhad1', type='TH1F', path='EXPERT',title="Rhad",xbins=30, xmin=-0.3, xmax=0.3 ), + defineHistogram('ethad', type='TH1F', path='EXPERT',title="Transverse energy in the first sampling of the hadronic calorimeters behind the cluster calculated from ehad1 ; E [MeV]",xbins=20, xmin=-1, xmax=1 ), + defineHistogram('ethad1', type='TH1F', path='EXPERT',title="ET leakage into hadronic calorimeter with exclusion of energy in CaloSampling; E [MeV]",xbins=20, xmin=-1, xmax=1 ), + defineHistogram('weta1', type='TH1F', path='EXPERT',title="Precision Reconstruction corrected width in 3 strips in the 1st samp. ; Width",xbins=12, xmin=0.4, xmax=1 ), + defineHistogram('weta2', type='TH1F', path='EXPERT',title="Precision Reconstruction corrected width in 3 strips in the 2st samp. ; Width",xbins=20, xmin=0, xmax=0.02 ), defineHistogram('wtots1', type='TH1F', path='EXPERT',title="Precision Reconstruction total width in em sampling 1 in 20 strips; Width",xbins=20, xmin=0, xmax=20 ), - defineHistogram('f1', type='TH1F', path='EXPERT',title="Fraction of energy found in 1st em sampling;Fraction",xbins=50, xmin=-0.1, xmax=1.1 ), - defineHistogram('f3', type='TH1F', path='EXPERT',title="Fraction of energy reconstructed in 3rd sampling ;Fraction",xbins=50, xmin=-0.1, xmax=1.1 ), - defineHistogram('eratio', type='TH1F', path='EXPERT',title="Eratio ;Count",xbins=50, xmin=0, xmax=2 ), - defineHistogram('fracs1', type='TH1F', path='EXPERT', title="Reconstruction energy outside core (E(+-7)-E(+-3))/E(+-7); E [MeV]",xbins=50, xmin=-5000, xmax=10000 ), + defineHistogram('f1', type='TH1F', path='EXPERT',title="Fraction of energy found in 1st em sampling;Fraction",xbins=11, xmin=0, xmax=1 ), + defineHistogram('f3', type='TH1F', path='EXPERT',title="Fraction of energy reconstructed in 3rd sampling ;Fraction",xbins=21, xmin=-0.05, xmax=0.1 ), + defineHistogram('eratio', type='TH1F', path='EXPERT',title="Eratio ;Count",xbins=20, xmin=0, xmax=2 ), + #Isolation variables monitoring - defineHistogram('ptcone20', type='TH1F', path='EXPERT',title="count;ptcone20",xbins=50, xmin=0, xmax=10 ), - defineHistogram('ptcone30', type='TH1F', path='EXPERT',title="count;ptcone30",xbins=50, xmin=0, xmax=10 ), - defineHistogram('ptcone40', type='TH1F', path='EXPERT', title="count;ptcone40",xbins=50, xmin=0, xmax=10 ), - defineHistogram('topoetcone20', type='TH1F', path='EXPERT',title="count;topoetcone20[GeV]",xbins=50, xmin=-10, xmax=50 )] + defineHistogram('ptcone20', type='TH1F', path='EXPERT',title="count;ptcone20",xbins=50, xmin=0, xmax=5 ), + defineHistogram('ptcone30', type='TH1F', path='EXPERT',title="count;ptcone30",xbins=50, xmin=0, xmax=5 ), + defineHistogram('ptcone40', type='TH1F', path='EXPERT', title="count;ptcone40",xbins=50, xmin=0, xmax=5 ), + defineHistogram('ptvarcone20', type='TH1F', path='EXPERT',title="count;ptvarcone20",xbins=50, xmin=0, xmax=5 ), + defineHistogram('ptvarcone30', type='TH1F', path='EXPERT',title="count;ptvarcone30",xbins=50, xmin=0, xmax=5 ), + defineHistogram('ptvarcone40', type='TH1F', path='EXPERT', title="count;ptvarcone40",xbins=50, xmin=0, xmax=5 ), + defineHistogram('topoetcone20', type='TH1F', path='EXPERT',title="count;topoetcone20[GeV]",xbins=100, xmin=-10, xmax=50 ), + defineHistogram('topoetcone40_shift', type='TH1F', path='EXPERT',title="count;topoetcone40[GeV]",xbins=100, xmin=-10, xmax=50 )] + return monTool_photon diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/components/TrigEgammaMonitoring_entries.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/components/TrigEgammaMonitoring_entries.cxx index 9da4ec18fb505412b82aaf134ebe9a024e857abe..e6cb500b7a369c77e62cfa253fa30de7c3e84c38 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/components/TrigEgammaMonitoring_entries.cxx +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/components/TrigEgammaMonitoring_entries.cxx @@ -6,6 +6,7 @@ #include "../egammaMonitorElectronAlgorithm.h" #include "../egammaMonitorPhotonAlgorithm.h" #include "../egammaMonitorSuperClusterAlgorithm.h" +#include "../egammaMonitorBaseAlgorithm.h" DECLARE_COMPONENT(TrigEgammaMonitorBaseAlgorithm) DECLARE_COMPONENT(TrigEgammaMonitorAnalysisAlgorithm) @@ -15,4 +16,6 @@ DECLARE_COMPONENT(TrigEgammaMonitorTagAndProbeAlgorithm) DECLARE_COMPONENT(egammaMonitorElectronAlgorithm) DECLARE_COMPONENT(egammaMonitorPhotonAlgorithm) DECLARE_COMPONENT(egammaMonitorSuperClusterAlgorithm) +DECLARE_COMPONENT(egammaMonitorBaseAlgorithm) + diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorBaseAlgorithm.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorBaseAlgorithm.cxx new file mode 100644 index 0000000000000000000000000000000000000000..223e258d138e2a809ea0c9d9ee44a905cdedd830 --- /dev/null +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorBaseAlgorithm.cxx @@ -0,0 +1,117 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +#include "egammaMonitorBaseAlgorithm.h" + + + +egammaMonitorBaseAlgorithm::egammaMonitorBaseAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ): + AthReentrantAlgorithm(name,pSvcLocator) +{} + +egammaMonitorBaseAlgorithm::~egammaMonitorBaseAlgorithm() {} + + +StatusCode egammaMonitorBaseAlgorithm::initialize() +{ + + + return StatusCode::SUCCESS; +} + + +/*! Macros for plotting */ +#define GETTER(_name_) float egammaMonitorBaseAlgorithm::getShowerShape_##_name_(const xAOD::Egamma* eg) const \ +{ float val{-99}; \ + eg->showerShapeValue(val,xAOD::EgammaParameters::_name_); \ + return val; } + GETTER(e011) + GETTER(e132) + GETTER(e237) + GETTER(e277) + GETTER(ethad) + GETTER(ethad1) + GETTER(weta1) + GETTER(weta2) + GETTER(f1) + GETTER(e2tsts1) + GETTER(emins1) + GETTER(emaxs1) + GETTER(wtots1) + GETTER(fracs1) + GETTER(Reta) + GETTER(Rphi) + GETTER(f3) + GETTER(f3core) + GETTER(Eratio) + GETTER(Rhad) + GETTER(Rhad1) + GETTER(DeltaE) +#undef GETTER + + +// GETTER for Isolation monitoring +#define GETTER(_name_) float egammaMonitorBaseAlgorithm::getIsolation_##_name_(const xAOD::Egamma* eg) const\ +{ float val{-99}; \ + eg->isolationValue(val,xAOD::Iso::_name_); \ + return val; } + GETTER(ptcone20) + GETTER(ptcone30) + GETTER(ptcone40) + GETTER(ptvarcone20) + GETTER(ptvarcone30) + GETTER(ptvarcone40) +#undef GETTER + + +#define GETTER(_name_) float egammaMonitorBaseAlgorithm::getIsolation_##_name_(const xAOD::Egamma* eg) const\ +{ float val{-99}; \ + eg->isolationValue(val,xAOD::Iso::_name_); \ + return val; } + GETTER(etcone20) + GETTER(etcone30) + GETTER(etcone40) + GETTER(topoetcone20) + GETTER(topoetcone30) + GETTER(topoetcone40) +#undef GETTER + + +// GETTERs for Track monitoring +#define GETTER(_name_) float egammaMonitorBaseAlgorithm::getTrack_##_name_(const xAOD::Electron* eg) const\ +{ if(eg && eg->trackParticle()) \ + return eg->trackParticle()->_name_(); \ + else return -99.;} + GETTER(pt) + GETTER(phi) + GETTER(eta) + GETTER(d0) + GETTER(z0) +#undef GETTER + + +// GETTERs for Calo-Track monitoring +#define GETTER(_name_) float egammaMonitorBaseAlgorithm::getCaloTrackMatch_##_name_(const xAOD::Electron* eg) const\ +{ float val={-99.}; \ + if(eg){ \ + eg->trackCaloMatchValue(val,xAOD::EgammaParameters::_name_);} \ + return val; } + GETTER(deltaEta0) + GETTER(deltaPhi0) + GETTER(deltaPhiRescaled0) + GETTER(deltaEta1) + GETTER(deltaPhi1) + GETTER(deltaPhiRescaled1) + GETTER(deltaEta2) + GETTER(deltaPhi2) + GETTER(deltaPhiRescaled2) + GETTER(deltaEta3) + GETTER(deltaPhi3) + GETTER(deltaPhiRescaled3) + GETTER(deltaPhiFromLastMeasurement) +#undef GETTER + + + + diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorBaseAlgorithm.h b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorBaseAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..3f004fe6984e422120aa1279f842b305d61defbc --- /dev/null +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorBaseAlgorithm.h @@ -0,0 +1,119 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef egammaMonitorBaseAlgorithm_h +#define egammaMonitorBaseAlgorithm_h + +#include "AthenaMonitoring/AthMonitorAlgorithm.h" +#include "AthenaMonitoringKernel/GenericMonitoringTool.h" +#include "xAODEventInfo/EventInfo.h" +#include "xAODTruth/TruthParticleContainer.h" +#include "xAODEgamma/Egamma.h" +#include "xAODEgamma/EgammaxAODHelpers.h" +#include "xAODEgamma/ElectronContainer.h" +#include "xAODEgamma/PhotonContainer.h" +#include "StoreGate/ReadHandleKey.h" +#include "StoreGate/ReadCondHandleKey.h" +#include "AthenaBaseComps/AthAlgorithm.h" +#include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "egammaRecEvent/egammaRec.h" +#include "egammaRecEvent/egammaRecContainer.h" + + +class egammaMonitorBaseAlgorithm : public AthReentrantAlgorithm { + public: + + egammaMonitorBaseAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ); + + virtual ~egammaMonitorBaseAlgorithm(); + + virtual StatusCode initialize() override; + virtual StatusCode execute(const EventContext& /*ctx*/) const override {return StatusCode::SUCCESS;}; + + + + protected: + + /*! C Macros for plotting */ + #define GETTER(_name_) float getShowerShape_##_name_(const xAOD::Egamma* eg) const; + GETTER(e011) + GETTER(e132) + GETTER(e237) + GETTER(e277) + GETTER(ethad) + GETTER(ethad1) + GETTER(weta1) + GETTER(weta2) + GETTER(f1) + GETTER(e2tsts1) + GETTER(emins1) + GETTER(emaxs1) + GETTER(wtots1) + GETTER(fracs1) + GETTER(Reta) + GETTER(Rphi) + GETTER(f3) + GETTER(f3core) + GETTER(Eratio) + GETTER(Rhad) + GETTER(Rhad1) + GETTER(DeltaE) +#undef GETTER + + + // GETTER for Isolation monitoring +#define GETTER(_name_) float getIsolation_##_name_(const xAOD::Egamma* eg) const; + GETTER(ptcone20) + GETTER(ptcone30) + GETTER(ptcone40) + GETTER(ptvarcone20) + GETTER(ptvarcone30) + GETTER(ptvarcone40) +#undef GETTER +#define GETTER(_name_) float getIsolation_##_name_(const xAOD::Egamma* eg) const; + GETTER(etcone20) + GETTER(etcone30) + GETTER(etcone40) + GETTER(topoetcone20) + GETTER(topoetcone30) + GETTER(topoetcone40) +#undef GETTER + // GETTERs for CaloCluster monitoring +#define GETTER(_name_) float getCluster_##_name_(const xAOD::Egamma* eg) const; + GETTER(et) + GETTER(phi) + GETTER(eta) +#undef GETTER + + // GETTERs for Track monitoring +#define GETTER(_name_) float getTrack_##_name_(const xAOD::Electron* eg) const; + GETTER(pt) + GETTER(phi) + GETTER(eta) + GETTER(d0) + GETTER(z0) +#undef GETTER + + + // GETTERs for Calo-Track monitoring +#define GETTER(_name_) float getCaloTrackMatch_##_name_(const xAOD::Electron* eg) const; + GETTER(deltaEta0) + GETTER(deltaPhi0) + GETTER(deltaPhiRescaled0) + GETTER(deltaEta1) + GETTER(deltaPhi1) + GETTER(deltaPhiRescaled1) + GETTER(deltaEta2) + GETTER(deltaPhi2) + GETTER(deltaPhiRescaled2) + GETTER(deltaEta3) + GETTER(deltaPhi3) + GETTER(deltaPhiRescaled3) + GETTER(deltaPhiFromLastMeasurement) +#undef GETTER + + +}; +#endif + diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorElectronAlgorithm.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorElectronAlgorithm.cxx index b1a44216547c8279c10ab660b3e083c417101ee8..a243dc19ecbb0cd335ac17bbf630f7fa91ae94ec 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorElectronAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorElectronAlgorithm.cxx @@ -1,19 +1,12 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + #include "egammaMonitorElectronAlgorithm.h" -#include "xAODEgamma/EgammaContainer.h" -#include "xAODEgamma/Electron.h" -#include "xAODEgamma/ElectronAuxContainer.h" -#include "xAODEgamma/ElectronContainer.h" -#include "xAODCaloEvent/CaloClusterContainer.h" -#include "xAODTracking/TrackParticleContainer.h" -#include "xAODTracking/VertexContainer.h" -#include "StoreGate/ReadHandle.h" -#include "StoreGate/WriteHandle.h" -#include "xAODPrimitives/IsolationType.h" -#include "StoreGate/ReadCondHandleKey.h" egammaMonitorElectronAlgorithm::egammaMonitorElectronAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ): - AthAlgorithm( name, pSvcLocator ) + egammaMonitorBaseAlgorithm( name, pSvcLocator ) {} @@ -21,13 +14,14 @@ StatusCode egammaMonitorElectronAlgorithm::initialize() { ATH_CHECK(m_electronsKey.initialize()); - m_ptcone20Key = m_electronsKey.key() + ".ptcone20"; - ATH_CHECK(m_ptcone20Key.initialize()); + ATH_CHECK(egammaMonitorBaseAlgorithm::initialize()); if (!m_monTool.empty()) CHECK(m_monTool.retrieve()); + return StatusCode::SUCCESS; } -StatusCode egammaMonitorElectronAlgorithm::execute_r(const EventContext& ctx) const + +StatusCode egammaMonitorElectronAlgorithm::execute(const EventContext& ctx) const { filltopoElectronTrackCaloMatch(ctx); @@ -40,139 +34,140 @@ void egammaMonitorElectronAlgorithm::filltopoElectronTrackCaloMatch( const Event SG::ReadHandle<xAOD::ElectronContainer> electrons(m_electronsKey, ctx); - //std::vector<Delta> deltas_var0; - auto deltaEta0 = Monitored::Scalar<float>("deltaEta0",0.0); - auto deltaEta1 = Monitored::Scalar<float>("deltaEta1",0.0); - auto deltaEta2 = Monitored::Scalar<float>("deltaEta2",0.0); - auto deltaEta3 = Monitored::Scalar<float>("deltaEta3",0.0); - auto deltaPhi0 = Monitored::Scalar<float>("deltaPhi0",0.0); - auto deltaPhi1 = Monitored::Scalar<float>("deltaPhi1",0.0); - auto deltaPhi2 = Monitored::Scalar<float>("deltaPhi2",0.0); - auto deltaPhi3 = Monitored::Scalar<float>("deltaPhi3",0.0); - auto deltaPhiRescaled0 = Monitored::Scalar<float>("deltaPhiRescaled0",0.0); - auto deltaPhiRescaled1 = Monitored::Scalar<float>("deltaPhiRescaled1",0.0); - auto deltaPhiRescaled2 = Monitored::Scalar<float>("deltaPhiRescaled2",0.0); - auto deltaPhiRescaled3 = Monitored::Scalar<float>("deltaPhiRescaled3",0.0); - auto deltaPhiFromLastMeasurement = Monitored::Scalar<float>("deltaPhiFromLastMeasurement",0.0); - + std::vector<float> deltaEta0_vec, deltaEta1_vec, deltaEta2_vec, deltaEta3_vec, deltaPhi0_vec, deltaPhi1_vec, deltaPhi2_vec, deltaPhi3_vec, deltaPhiRescaled0_vec, deltaPhiRescaled1_vec, deltaPhiRescaled2_vec, deltaPhiRescaled3_vec, deltaPhiLast_vec; + + auto deltaEta0_col = Monitored::Collection("deltaEta0",deltaEta0_vec); + auto deltaEta1_col = Monitored::Collection("deltaEta1",deltaEta1_vec); + auto deltaEta2_col = Monitored::Collection("deltaEta2",deltaEta2_vec); + auto deltaEta3_col = Monitored::Collection("deltaEta3",deltaEta3_vec); + auto deltaPhi0_col = Monitored::Collection("deltaPhi0",deltaPhi0_vec); + auto deltaPhi1_col = Monitored::Collection("deltaPhi1",deltaPhi1_vec); + auto deltaPhi2_col = Monitored::Collection("deltaPhi2",deltaPhi2_vec); + auto deltaPhi3_col = Monitored::Collection("deltaPhi3",deltaPhi3_vec); + auto deltaPhiRescaled0_col = Monitored::Collection("deltaPhiRescaled0",deltaPhiRescaled0_vec); + auto deltaPhiRescaled1_col = Monitored::Collection("deltaPhiRescaled1",deltaPhiRescaled1_vec); + auto deltaPhiRescaled2_col = Monitored::Collection("deltaPhiRescaled2",deltaPhiRescaled2_vec); + auto deltaPhiRescaled3_col = Monitored::Collection("deltaPhiRescaled3",deltaPhiRescaled3_vec); + auto deltaPhiLast_col = Monitored::Collection("deltaPhiLast",deltaPhiLast_vec ); for (const auto electron : *electrons){ - electron->trackCaloMatchValue(deltaEta0,xAOD::EgammaParameters::deltaEta0); - electron->trackCaloMatchValue(deltaEta1,xAOD::EgammaParameters::deltaEta1); - electron->trackCaloMatchValue(deltaEta2,xAOD::EgammaParameters::deltaEta2); - electron->trackCaloMatchValue(deltaEta3,xAOD::EgammaParameters::deltaEta3); - electron->trackCaloMatchValue(deltaPhi0,xAOD::EgammaParameters::deltaPhi0); - electron->trackCaloMatchValue(deltaPhi1,xAOD::EgammaParameters::deltaPhi1); - electron->trackCaloMatchValue(deltaPhi2,xAOD::EgammaParameters::deltaPhi2); - electron->trackCaloMatchValue(deltaPhi3,xAOD::EgammaParameters::deltaPhi3); - electron->trackCaloMatchValue(deltaPhiRescaled0,xAOD::EgammaParameters::deltaPhiRescaled0); - electron->trackCaloMatchValue(deltaPhiRescaled1,xAOD::EgammaParameters::deltaPhiRescaled1); - electron->trackCaloMatchValue(deltaPhiRescaled2,xAOD::EgammaParameters::deltaPhiRescaled2); - electron->trackCaloMatchValue(deltaPhiRescaled3,xAOD::EgammaParameters::deltaPhiRescaled3); - electron->trackCaloMatchValue(deltaPhiFromLastMeasurement,xAOD::EgammaParameters::deltaPhiFromLastMeasurement); + + deltaEta0_vec.push_back(getCaloTrackMatch_deltaEta0(electron)); + deltaEta1_vec.push_back(getCaloTrackMatch_deltaEta1(electron)); + deltaEta2_vec.push_back(getCaloTrackMatch_deltaEta2(electron)); + deltaEta3_vec.push_back(getCaloTrackMatch_deltaEta3(electron)); + deltaPhi0_vec.push_back(getCaloTrackMatch_deltaPhi0(electron)); + deltaPhi1_vec.push_back(getCaloTrackMatch_deltaPhi1(electron)); + deltaPhi2_vec.push_back(getCaloTrackMatch_deltaPhi2(electron)); + deltaPhi3_vec.push_back(getCaloTrackMatch_deltaPhi3(electron)); + deltaPhiRescaled0_vec.push_back(getCaloTrackMatch_deltaPhiRescaled0(electron)); + deltaPhiRescaled1_vec.push_back(getCaloTrackMatch_deltaPhiRescaled1(electron)); + deltaPhiRescaled2_vec.push_back(getCaloTrackMatch_deltaPhiRescaled2(electron)); + deltaPhiRescaled3_vec.push_back(getCaloTrackMatch_deltaPhiRescaled3(electron)); + deltaPhiLast_vec.push_back(getCaloTrackMatch_deltaPhiFromLastMeasurement(electron)); } - auto mon = Monitored::Group(m_monTool, deltaEta0,deltaEta1,deltaEta2,deltaEta3,deltaPhi0,deltaPhi1,deltaPhi2, - deltaPhi3,deltaPhiRescaled0,deltaPhiRescaled1,deltaPhiRescaled2,deltaPhiRescaled3,deltaPhiFromLastMeasurement ); + auto mon = Monitored::Group(m_monTool, deltaEta0_col,deltaEta1_col,deltaEta2_col,deltaEta3_col, + deltaPhi0_col,deltaPhi1_col,deltaPhi2_col,deltaPhi3_col,deltaPhiRescaled0_col, + deltaPhiRescaled1_col,deltaPhiRescaled2_col,deltaPhiRescaled3_col,deltaPhiLast_col); ATH_MSG_DEBUG("Electron - Track Online Monitoring in Reconstruction ..."); } -void egammaMonitorElectronAlgorithm::filltopoElectronShowerShapes( const EventContext& ctx) const{ - +void egammaMonitorElectronAlgorithm::filltopoElectronShowerShapes(const EventContext& ctx) const{ + SG::ReadHandle<xAOD::ElectronContainer> electrons(m_electronsKey, ctx); ATH_MSG_DEBUG("Fill SS Reco Electron distributions: "); - - std::vector<float> e237_vec, e277_vec, ethad_vec, ethad1_vec, Rhad_vec, Rhad1_vec, Reta_vec, Rphi_vec, weta1_vec, weta2_vec, wtots1_vec, - f1_vec, f3_vec,f3core_vec, fracs1_vec, eratio_vec, DeltaE_vec, et_vec, highet_vec , eta_vec, phi_vec; - float val{-99}; - - auto e237_col = Monitored::Collection("e237" , e237_vec ); - auto e277_col = Monitored::Collection("e277" , e277_vec ); + + std::vector<float> ethad_vec, ethad1_vec, Rhad_vec, Rhad1_vec, Reta_vec, Rphi_vec,e237_vec,e277_vec, weta1_vec, weta2_vec, wtots1_vec, + f1_vec, f3_vec, eratio_vec, et_vec, highet_vec , eta_vec, phi_vec, topoetcone20_vec, topoetcone40_shift_vec, + topoetcone20_rel_vec, topoetcone40_shift_rel_vec; + + auto ethad_col = Monitored::Collection("ethad" , ethad_vec ); auto ethad1_col = Monitored::Collection("ethad1" , ethad1_vec ); auto Rhad_col = Monitored::Collection("Rhad" , Rhad_vec ); auto Rhad1_col = Monitored::Collection("Rhad1" , Rhad1_vec ); auto Reta_col = Monitored::Collection("Reta" , Reta_vec ); auto Rphi_col = Monitored::Collection("Rphi" , Rphi_vec ); + auto e237_col = Monitored::Collection("e237" , e237_vec ); + auto e277_col = Monitored::Collection("e277" , e277_vec ); auto weta1_col = Monitored::Collection("weta1" , weta1_vec ); auto weta2_col = Monitored::Collection("weta2" , weta2_vec ); auto wtots1_col = Monitored::Collection("wtots1" , wtots1_vec ); auto f1_col = Monitored::Collection("f1" , f1_vec ); auto f3_col = Monitored::Collection("f3" , f3_vec ); - auto f3core_col = Monitored::Collection("f3core" , f3core_vec ); - auto fracs1_col = Monitored::Collection("fracs1" , fracs1_vec ); auto eratio_col = Monitored::Collection("eratio" , eratio_vec ); - auto DeltaE_col = Monitored::Collection("deltaE" , DeltaE_vec ); - - for (const auto electron : *electrons) { + auto et_col = Monitored::Collection("et" , et_vec ); + auto highet_col = Monitored::Collection("highet" , highet_vec ); + auto eta_col = Monitored::Collection("eta" , eta_vec ); + auto phi_col = Monitored::Collection("phi" , phi_vec ); + auto topoetcone20_col = Monitored::Collection("topoetcone20", topoetcone20_vec); + auto topoetcone40_shift_col = Monitored::Collection("topoetcone40_shift", topoetcone40_shift_vec ); + - e237_vec.push_back(electron->showerShapeValue(val,xAOD::EgammaParameters::e237)); - e277_vec.push_back(electron->showerShapeValue(val,xAOD::EgammaParameters::e237)); - ethad_vec.push_back(electron->showerShapeValue(val,xAOD::EgammaParameters::ethad)); - ethad1_vec.push_back(electron->showerShapeValue(val,xAOD::EgammaParameters::ethad1)); - Rhad_vec.push_back(electron->showerShapeValue(val,xAOD::EgammaParameters::Rhad)); - Rhad1_vec.push_back(electron->showerShapeValue(val,xAOD::EgammaParameters::Rhad1)); - Reta_vec.push_back(electron->showerShapeValue(val,xAOD::EgammaParameters::Reta)); - Rphi_vec.push_back(electron->showerShapeValue(val,xAOD::EgammaParameters::Rphi)); - weta1_vec.push_back(electron->showerShapeValue(val,xAOD::EgammaParameters::weta1)); - weta2_vec.push_back(electron->showerShapeValue(val,xAOD::EgammaParameters::weta2)); - wtots1_vec.push_back(electron->showerShapeValue(val,xAOD::EgammaParameters::wtots1)); - f1_vec.push_back(electron->showerShapeValue(val,xAOD::EgammaParameters::f1)); - f3_vec.push_back(electron->showerShapeValue(val,xAOD::EgammaParameters::f3)); - f3core_vec.push_back(electron->showerShapeValue(val,xAOD::EgammaParameters::f3core)); - fracs1_vec.push_back(electron->showerShapeValue(val,xAOD::EgammaParameters::fracs1)); - eratio_vec.push_back(electron->showerShapeValue(val,xAOD::EgammaParameters::Eratio)); - DeltaE_vec.push_back(electron->showerShapeValue(val,xAOD::EgammaParameters::DeltaE)); + for ( const auto electron : *electrons ){ + + if(!electron) continue; + + Reta_vec.push_back( getShowerShape_Reta(electron)); + Rphi_vec.push_back( getShowerShape_Rphi(electron)); + e237_vec.push_back( getShowerShape_e237(electron)); + e277_vec.push_back( getShowerShape_e277(electron)); + ethad_vec.push_back( getShowerShape_ethad(electron)/Gaudi::Units::GeV); + ethad1_vec.push_back( getShowerShape_ethad1(electron)/Gaudi::Units::GeV); + Rhad_vec.push_back( getShowerShape_Rhad(electron)); + Rhad1_vec.push_back( getShowerShape_Rhad(electron)); + weta1_vec.push_back( getShowerShape_weta1(electron)); + weta2_vec.push_back( getShowerShape_weta2(electron)); + wtots1_vec.push_back( getShowerShape_wtots1(electron)); + f1_vec.push_back( getShowerShape_f1(electron)); + f3_vec.push_back( getShowerShape_f3(electron)); + eratio_vec.push_back( getShowerShape_Eratio(electron)); + et_vec.push_back( electron->pt()/Gaudi::Units::GeV); + highet_vec.push_back( electron->pt()/Gaudi::Units::GeV); + eta_vec.push_back( electron->eta()); + phi_vec.push_back( electron->phi()); + topoetcone20_vec.push_back( getIsolation_topoetcone20(electron)/Gaudi::Units::GeV); + topoetcone40_shift_vec.push_back( (getIsolation_topoetcone40(electron)-2450)/Gaudi::Units::GeV ); } - auto mon = Monitored::Group(m_monTool, e237_col, e277_col,ethad_col, ethad1_col, Rhad_col, Rhad1_col,Reta_col,Rphi_col,weta1_col,weta2_col,wtots1_col,f1_col,f3_col,f3core_col,fracs1_col,eratio_col,DeltaE_col); - ATH_MSG_DEBUG("Electron - ShowerShapes Online Monitoring in Reconstruction ..."); - - } + + auto mon = Monitored::Group(m_monTool,ethad_col, ethad1_col, Rhad_col, Rhad1_col, Reta_col, Rphi_col,e237_col,e277_col, weta1_col, weta2_col, wtots1_col, + f1_col, f3_col, eratio_col, et_col, highet_col , eta_col, phi_col, topoetcone20_col, topoetcone40_shift_col); + +} void egammaMonitorElectronAlgorithm::filltopoElectronIsolation( const EventContext& ctx) const{ SG::ReadHandle<xAOD::ElectronContainer> electrons(m_electronsKey, ctx); - std::vector<float> topoetcone20_vec, topoetcone40_shift_vec, topoetcone20_rel_vec, topoetcone40_shift_rel_vec, ptcone20_vec, ptcone30_vec, ptcone40_vec; - float val{-99}; + std::vector<float> ptcone20_vec, ptcone30_vec, ptcone40_vec, ptvarcone20_vec, ptvarcone30_vec, ptvarcone40_vec; - auto topoetcone20_col = Monitored::Collection("topoetcone20", topoetcone20_vec); auto ptcone20_col = Monitored::Collection("ptcone20", ptcone20_vec); auto ptcone30_col = Monitored::Collection("ptcone30", ptcone30_vec); auto ptcone40_col = Monitored::Collection("ptcone40", ptcone40_vec); + auto ptvarcone20_col = Monitored::Collection("ptvarcone20", ptvarcone20_vec); + auto ptvarcone30_col = Monitored::Collection("ptvarcone30", ptvarcone30_vec); + auto ptvarcone40_col = Monitored::Collection("ptvarcone40", ptvarcone40_vec); for (const xAOD::Electron* electron : *electrons){ - val = 0; - electron->isolationValue(val,xAOD::Iso::topoetcone20); - topoetcone20_vec.push_back( val/Gaudi::Units::GeV ); - - val = 0; - electron->isolationValue(val,xAOD::Iso::ptcone20); - ptcone20_vec.push_back( val/Gaudi::Units::GeV ); + ptcone20_vec.push_back( getIsolation_ptcone20(electron)/Gaudi::Units::GeV); + ptcone30_vec.push_back( getIsolation_ptcone30(electron)/Gaudi::Units::GeV); + ptcone40_vec.push_back( getIsolation_ptcone40(electron)/Gaudi::Units::GeV); + ptvarcone20_vec.push_back( getIsolation_ptvarcone20(electron)/Gaudi::Units::GeV); + ptvarcone30_vec.push_back( getIsolation_ptvarcone30(electron)/Gaudi::Units::GeV); + ptvarcone40_vec.push_back( getIsolation_ptvarcone40(electron)/Gaudi::Units::GeV); - val = 0; - electron->isolationValue(val,xAOD::Iso::ptcone30); - ptcone30_vec.push_back( val/Gaudi::Units::GeV ); - - val = 0; - electron->isolationValue(val,xAOD::Iso::ptcone40); - ptcone40_vec.push_back( val/Gaudi::Units::GeV ); } - - auto mon = Monitored::Group(m_monTool,ptcone20_col, ptcone30_col, ptcone40_col, topoetcone20_col); + + auto mon = Monitored::Group(m_monTool,ptcone20_col, ptcone30_col, ptcone40_col,ptvarcone20_col, ptvarcone30_col, ptvarcone40_col ); ATH_MSG_DEBUG("Electron - Isolation Online Monitoring in Reconstruction ..."); - - + } - - - - diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorElectronAlgorithm.h b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorElectronAlgorithm.h index 0cfd07ecd74f8886ec03ee37aff309b7ce2a1f45..703f430e5755ee0f5b34f8d19e2c706ae5c34542 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorElectronAlgorithm.h +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorElectronAlgorithm.h @@ -1,56 +1,31 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef egammaMonitorElectronAlgorithm_H #define egammaMonitorElectronAlgorithm_H +#include "egammaMonitorBaseAlgorithm.h" -#include "egammaMonitorElectronAlgorithm.h" -#include "AthenaMonitoringKernel/GenericMonitoringTool.h" -#include "xAODEventInfo/EventInfo.h" -#include "xAODTruth/TruthParticleContainer.h" -#include "xAODEgamma/Egamma.h" -#include "xAODEgamma/EgammaxAODHelpers.h" -#include "xAODEgamma/ElectronContainer.h" -#include "xAODEgamma/PhotonContainer.h" -#include "xAODTrigEgamma/TrigElectronContainer.h" -#include "xAODTracking/TrackParticleContainer.h" -#include "xAODTrigCalo/TrigEMClusterContainer.h" -#include "xAODMissingET/MissingETContainer.h" -#include "xAODTrigger/EmTauRoIContainer.h" -#include "StoreGate/ReadHandleKey.h" -#include "StoreGate/ReadCondHandleKey.h" -#include "StoreGate/ReadDecorHandleKey.h" -#include "AthenaBaseComps/AthAlgorithm.h" -#include "StoreGate/DataHandle.h" -#include "AthenaMonitoringKernel/Monitored.h" - - -class egammaMonitorElectronAlgorithm: public AthAlgorithm + +class egammaMonitorElectronAlgorithm: public egammaMonitorBaseAlgorithm { public: egammaMonitorElectronAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ); virtual StatusCode initialize() override; - virtual StatusCode execute() override final { - - return execute_r(Algorithm::getContext()); - } - - StatusCode execute_r(const EventContext& ctx) const; + virtual StatusCode execute( const EventContext& ctx) const override; protected: - + void filltopoElectronTrackCaloMatch(const EventContext& ctx) const; void filltopoElectronShowerShapes(const EventContext& ctx) const; void filltopoElectronIsolation(const EventContext& ctx) const; - - + private: + SG::ReadHandleKey<xAOD::ElectronContainer> m_electronsKey{ this, "ElectronKey", "Electrons", ""}; - SG::ReadDecorHandleKey<xAOD::ElectronContainer> m_ptcone20Key{ this, "ElectronPtcone20Key", "Electrons.ptcone20", ""}; ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool","","Monitoring tool"}; }; diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorPhotonAlgorithm.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorPhotonAlgorithm.cxx index 142e09a6a1ef38c1d14a3421db5edfe9ee7eb748..399a325e2aebadd709d43f943b4a13e7da4a6b11 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorPhotonAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorPhotonAlgorithm.cxx @@ -1,22 +1,12 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + #include "egammaMonitorPhotonAlgorithm.h" -#include "xAODEgamma/EgammaContainer.h" -#include "xAODEgamma/Electron.h" -#include "xAODEgamma/ElectronAuxContainer.h" -#include "xAODEgamma/ElectronContainer.h" -#include "xAODEgamma/Photon.h" -#include "xAODEgamma/PhotonAuxContainer.h" -#include "xAODEgamma/PhotonContainer.h" -#include "xAODCaloEvent/CaloClusterContainer.h" -#include "xAODTracking/TrackParticleContainer.h" -#include "xAODTracking/VertexContainer.h" -#include "StoreGate/ReadHandle.h" -#include "StoreGate/WriteHandle.h" -#include "xAODPrimitives/IsolationType.h" -#include "StoreGate/ReadCondHandleKey.h" egammaMonitorPhotonAlgorithm::egammaMonitorPhotonAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ): - AthAlgorithm( name, pSvcLocator ) + egammaMonitorBaseAlgorithm( name, pSvcLocator ) {} @@ -24,11 +14,13 @@ StatusCode egammaMonitorPhotonAlgorithm::initialize() { ATH_CHECK(m_photonsKey.initialize()); + ATH_CHECK(egammaMonitorBaseAlgorithm::initialize()); if (!m_monTool.empty()) CHECK(m_monTool.retrieve()); + return StatusCode::SUCCESS; } -StatusCode egammaMonitorPhotonAlgorithm::execute_r(const EventContext& ctx) const +StatusCode egammaMonitorPhotonAlgorithm::execute(const EventContext& ctx) const { filltopoPhotonShowerShapes(ctx); @@ -42,81 +34,96 @@ void egammaMonitorPhotonAlgorithm::filltopoPhotonShowerShapes( const EventContex SG::ReadHandle<xAOD::PhotonContainer> photons(m_photonsKey, ctx); ATH_MSG_DEBUG("Fill SS Reco Photon distributions: "); - std::vector<float> e237_vec, e277_vec, ethad_vec, ethad1_vec, Rhad_vec, Rhad1_vec, Reta_vec, Rphi_vec, weta1_vec, weta2_vec, wtots1_vec, - f1_vec, f3_vec,f3core_vec, fracs1_vec, eratio_vec, DeltaE_vec, et_vec, highet_vec , eta_vec, phi_vec; - float val{-99}; + std::vector<float> ethad_vec, ethad1_vec, Rhad_vec, Rhad1_vec, Reta_vec, Rphi_vec,e237_vec,e277_vec, weta1_vec, weta2_vec, wtots1_vec, + f1_vec, f3_vec, eratio_vec, et_vec, highet_vec , eta_vec, phi_vec, topoetcone20_vec, topoetcone40_shift_vec, + topoetcone20_rel_vec, topoetcone40_shift_rel_vec; - auto e237_col = Monitored::Collection("e237" , e237_vec ); - auto e277_col = Monitored::Collection("e277" , e277_vec ); auto ethad_col = Monitored::Collection("ethad" , ethad_vec ); auto ethad1_col = Monitored::Collection("ethad1" , ethad1_vec ); auto Rhad_col = Monitored::Collection("Rhad" , Rhad_vec ); auto Rhad1_col = Monitored::Collection("Rhad1" , Rhad1_vec ); auto Reta_col = Monitored::Collection("Reta" , Reta_vec ); auto Rphi_col = Monitored::Collection("Rphi" , Rphi_vec ); + auto e237_col = Monitored::Collection("e237" , e237_vec ); + auto e277_col = Monitored::Collection("e277" , e277_vec ); auto weta1_col = Monitored::Collection("weta1" , weta1_vec ); auto weta2_col = Monitored::Collection("weta2" , weta2_vec ); auto wtots1_col = Monitored::Collection("wtots1" , wtots1_vec ); auto f1_col = Monitored::Collection("f1" , f1_vec ); auto f3_col = Monitored::Collection("f3" , f3_vec ); - auto f3core_col = Monitored::Collection("f3core" , f3core_vec ); - auto fracs1_col = Monitored::Collection("fracs1" , fracs1_vec ); auto eratio_col = Monitored::Collection("eratio" , eratio_vec ); - auto DeltaE_col = Monitored::Collection("deltaE" , DeltaE_vec ); - - for (const auto photon : *photons) { + auto et_col = Monitored::Collection("et" , et_vec ); + auto highet_col = Monitored::Collection("highet" , highet_vec ); + auto eta_col = Monitored::Collection("eta" , eta_vec ); + auto phi_col = Monitored::Collection("phi" , phi_vec ); + auto topoetcone20_col = Monitored::Collection("topoetcone20", topoetcone20_vec); + auto topoetcone40_shift_col = Monitored::Collection("topoetcone40_shift", topoetcone40_shift_vec ); + - e237_vec.push_back(photon->showerShapeValue(val,xAOD::EgammaParameters::e237)); - e277_vec.push_back(photon->showerShapeValue(val,xAOD::EgammaParameters::e237)); - ethad_vec.push_back(photon->showerShapeValue(val,xAOD::EgammaParameters::ethad)); - ethad1_vec.push_back(photon->showerShapeValue(val,xAOD::EgammaParameters::ethad1)); - Rhad_vec.push_back(photon->showerShapeValue(val,xAOD::EgammaParameters::Rhad)); - Rhad1_vec.push_back(photon->showerShapeValue(val,xAOD::EgammaParameters::Rhad1)); - Reta_vec.push_back(photon->showerShapeValue(val,xAOD::EgammaParameters::Reta)); - Rphi_vec.push_back(photon->showerShapeValue(val,xAOD::EgammaParameters::Rphi)); - weta1_vec.push_back(photon->showerShapeValue(val,xAOD::EgammaParameters::weta1)); - weta2_vec.push_back(photon->showerShapeValue(val,xAOD::EgammaParameters::weta2)); - wtots1_vec.push_back(photon->showerShapeValue(val,xAOD::EgammaParameters::wtots1)); - f1_vec.push_back(photon->showerShapeValue(val,xAOD::EgammaParameters::f1)); - f3_vec.push_back(photon->showerShapeValue(val,xAOD::EgammaParameters::f3)); - f3core_vec.push_back(photon->showerShapeValue(val,xAOD::EgammaParameters::f3core)); - fracs1_vec.push_back(photon->showerShapeValue(val,xAOD::EgammaParameters::fracs1)); - eratio_vec.push_back(photon->showerShapeValue(val,xAOD::EgammaParameters::Eratio)); - DeltaE_vec.push_back(photon->showerShapeValue(val,xAOD::EgammaParameters::DeltaE)); + for ( const auto photon : *photons ){ + + if(!photon) continue; + + Reta_vec.push_back( getShowerShape_Reta(photon)); + Rphi_vec.push_back( getShowerShape_Rphi(photon)); + e237_vec.push_back( getShowerShape_e237(photon)); + e277_vec.push_back( getShowerShape_e277(photon)); + ethad_vec.push_back( getShowerShape_ethad(photon)/Gaudi::Units::GeV); + ethad1_vec.push_back( getShowerShape_ethad1(photon)/Gaudi::Units::GeV); + Rhad_vec.push_back( getShowerShape_Rhad(photon)); + Rhad1_vec.push_back( getShowerShape_Rhad(photon)); + weta1_vec.push_back( getShowerShape_weta1(photon)); + weta2_vec.push_back( getShowerShape_weta2(photon)); + wtots1_vec.push_back( getShowerShape_wtots1(photon)); + f1_vec.push_back( getShowerShape_f1(photon)); + f3_vec.push_back( getShowerShape_f3(photon)); + eratio_vec.push_back( getShowerShape_Eratio(photon)); + et_vec.push_back( photon->pt()/Gaudi::Units::GeV); + highet_vec.push_back( photon->pt()/Gaudi::Units::GeV); + eta_vec.push_back( photon->eta()); + phi_vec.push_back( photon->phi()); + topoetcone20_vec.push_back( getIsolation_topoetcone20(photon)/Gaudi::Units::GeV); + topoetcone40_shift_vec.push_back( (getIsolation_topoetcone40(photon)-2450)/Gaudi::Units::GeV ); } - auto mon = Monitored::Group(m_monTool, e237_col, e277_col,ethad_col, ethad1_col, Rhad_col, Rhad1_col,Reta_col,Rphi_col,weta1_col,weta2_col,wtots1_col,f1_col,f3_col,f3core_col,fracs1_col,eratio_col,DeltaE_col); - ATH_MSG_DEBUG("Photon - ShowerShapes Online Monitoring in Reconstruction ..."); + + auto mon = Monitored::Group(m_monTool,ethad_col, ethad1_col, Rhad_col, Rhad1_col, Reta_col, Rphi_col,e237_col,e277_col, weta1_col, weta2_col, wtots1_col, + f1_col, f3_col, eratio_col, et_col, highet_col , eta_col, phi_col, topoetcone20_col, topoetcone40_shift_col); - } +} + + void egammaMonitorPhotonAlgorithm::filltopoPhotonIsolation( const EventContext& ctx) const{ SG::ReadHandle<xAOD::PhotonContainer> photons(m_photonsKey, ctx); - std::vector<float> topoetcone20_vec, topoetcone40_shift_vec, topoetcone20_rel_vec, topoetcone40_shift_rel_vec, ptcone20_vec, ptcone30_vec, ptcone40_vec; - float val{-99}; + std::vector<float> ptcone20_vec, ptcone30_vec, ptcone40_vec, ptvarcone20_vec, ptvarcone30_vec, ptvarcone40_vec; - auto topoetcone20_col = Monitored::Collection("topoetcone20", topoetcone20_vec); auto ptcone20_col = Monitored::Collection("ptcone20", ptcone20_vec); auto ptcone30_col = Monitored::Collection("ptcone30", ptcone30_vec); auto ptcone40_col = Monitored::Collection("ptcone40", ptcone40_vec); + auto ptvarcone20_col = Monitored::Collection("ptvarcone20", ptvarcone20_vec); + auto ptvarcone30_col = Monitored::Collection("ptvarcone30", ptvarcone30_vec); + auto ptvarcone40_col = Monitored::Collection("ptvarcone40", ptvarcone40_vec); - - for (const auto photon : *photons) { - topoetcone20_vec.push_back( photon->isolationValue(val,xAOD::Iso::topoetcone20)/Gaudi::Units::GeV); - ptcone20_vec.push_back(photon->isolationValue(val,xAOD::Iso::ptcone20)); - ptcone30_vec.push_back(photon->isolationValue(val,xAOD::Iso::ptcone30)); - ptcone40_vec.push_back(photon->isolationValue(val,xAOD::Iso::ptcone40)); + + for (const xAOD::Photon* photon : *photons){ + ptcone20_vec.push_back( getIsolation_ptcone20(photon)/Gaudi::Units::GeV); + ptcone30_vec.push_back( getIsolation_ptcone30(photon)/Gaudi::Units::GeV); + ptcone40_vec.push_back( getIsolation_ptcone40(photon)/Gaudi::Units::GeV); + ptvarcone20_vec.push_back( getIsolation_ptvarcone20(photon)/Gaudi::Units::GeV); + ptvarcone30_vec.push_back( getIsolation_ptvarcone30(photon)/Gaudi::Units::GeV); + ptvarcone40_vec.push_back( getIsolation_ptvarcone40(photon)/Gaudi::Units::GeV); } - - auto mon = Monitored::Group(m_monTool,ptcone20_col, ptcone30_col, ptcone40_col, topoetcone20_col); + + auto mon = Monitored::Group(m_monTool,ptcone20_col, ptcone30_col, ptcone40_col,ptvarcone20_col, ptvarcone30_col, ptvarcone40_col ); ATH_MSG_DEBUG("Photon - Isolation Online Monitoring in Reconstruction ..."); - } +} diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorPhotonAlgorithm.h b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorPhotonAlgorithm.h index e53ccd7fecb0a981261def78c3c5b14ae9bd4220..c93beb7e287125c60e16b483dcf0787b3ef19eda 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorPhotonAlgorithm.h +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorPhotonAlgorithm.h @@ -1,56 +1,31 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef egammaMonitorPhotonAlgorithm_H #define egammaMonitorPhotonAlgorithm_H +#include "egammaMonitorBaseAlgorithm.h" -#include "egammaMonitorPhotonAlgorithm.h" -#include "AthenaMonitoringKernel/GenericMonitoringTool.h" -#include "xAODEventInfo/EventInfo.h" -#include "xAODTruth/TruthParticleContainer.h" -#include "xAODEgamma/Egamma.h" -#include "xAODEgamma/EgammaxAODHelpers.h" -#include "xAODEgamma/ElectronContainer.h" -#include "xAODEgamma/PhotonContainer.h" -#include "xAODTrigEgamma/TrigElectronContainer.h" -#include "xAODTracking/TrackParticleContainer.h" -#include "xAODTrigCalo/TrigEMClusterContainer.h" -#include "xAODMissingET/MissingETContainer.h" -#include "xAODTrigger/EmTauRoIContainer.h" -#include "StoreGate/ReadHandleKey.h" -#include "StoreGate/ReadCondHandleKey.h" -#include "AthenaBaseComps/AthAlgorithm.h" -#include "StoreGate/DataHandle.h" -#include "AthenaMonitoringKernel/Monitored.h" - - -class egammaMonitorPhotonAlgorithm: public AthAlgorithm + +class egammaMonitorPhotonAlgorithm: public egammaMonitorBaseAlgorithm { public: egammaMonitorPhotonAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ); virtual StatusCode initialize() override; - virtual StatusCode execute() override final { - - return execute_r(Algorithm::getContext()); - } - - StatusCode execute_r(const EventContext& ctx) const; + virtual StatusCode execute( const EventContext& ctx) const override; protected: void filltopoPhotonShowerShapes(const EventContext& ctx) const; void filltopoPhotonIsolation(const EventContext& ctx) const; - + private: SG::ReadHandleKey<xAOD::PhotonContainer> m_photonsKey{ this, "PhotonKey", "Photons", ""}; ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool","","Monitoring tool"}; }; - - #endif diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorSuperClusterAlgorithm.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorSuperClusterAlgorithm.cxx index 522f2862c60350aad432636b4efb20cd67230b3c..317c7658a62b20471e365c4c088011c37531483b 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorSuperClusterAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorSuperClusterAlgorithm.cxx @@ -3,32 +3,9 @@ */ #include "egammaMonitorSuperClusterAlgorithm.h" -#include "xAODEgamma/EgammaContainer.h" -#include "xAODEgamma/Electron.h" -#include "xAODEgamma/Egamma.h" -#include "xAODEgamma/ElectronAuxContainer.h" -#include "xAODEgamma/ElectronContainer.h" -#include "xAODCaloEvent/CaloCluster.h" -#include "xAODCaloEvent/CaloClusterContainer.h" -#include "xAODTracking/TrackParticleContainer.h" -#include "xAODTracking/VertexContainer.h" - -#include "StoreGate/ReadHandle.h" -#include "StoreGate/WriteHandle.h" -#include "xAODPrimitives/IsolationType.h" -#include "GaudiKernel/EventContext.h" -#include "StoreGate/ReadCondHandleKey.h" - -#include "egammaRecEvent/egammaRec.h" -#include "egammaRecEvent/egammaRecContainer.h" - -#include "AthenaMonitoringKernel/Monitored.h" -#include "AthenaMonitoringKernel/GenericMonitoringTool.h" -#include "GaudiKernel/SystemOfUnits.h" -#include "GaudiKernel/PhysicalConstants.h" egammaMonitorSuperClusterAlgorithm::egammaMonitorSuperClusterAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ): - AthReentrantAlgorithm( name, pSvcLocator ) + egammaMonitorBaseAlgorithm( name, pSvcLocator ) {} @@ -37,13 +14,14 @@ StatusCode egammaMonitorSuperClusterAlgorithm::initialize() ATH_CHECK(m_inputEgammaRecContainerKey.initialize()); if (!m_monTool.empty()) CHECK(m_monTool.retrieve()); + ATH_CHECK(egammaMonitorBaseAlgorithm::initialize()); return StatusCode::SUCCESS; } StatusCode egammaMonitorSuperClusterAlgorithm::execute(const EventContext& ctx) const { - fillSuperClusterQuantities(ctx); + fillSuperClusterQuantities(ctx); return StatusCode::SUCCESS; } diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorSuperClusterAlgorithm.h b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorSuperClusterAlgorithm.h index 56bd54278df554fb86a9b05b4d016a3b5de6b3d0..9684c407cacd9e22a82a644a4a86730cc9f194da 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorSuperClusterAlgorithm.h +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/egammaMonitorSuperClusterAlgorithm.h @@ -5,29 +5,11 @@ #ifndef egammaMonitorSuperClusterAlgorithm_H #define egammaMonitorSuperClusterAlgorithm_H -#include "AthenaBaseComps/AthReentrantAlgorithm.h" -#include "AthenaBaseComps/AthAlgorithm.h" -#include "egammaMonitorSuperClusterAlgorithm.h" -#include "xAODEventInfo/EventInfo.h" -#include "xAODTruth/TruthParticleContainer.h" -#include "xAODEgamma/Egamma.h" -#include "xAODEgamma/EgammaContainer.h" -#include "xAODEgamma/EgammaxAODHelpers.h" -#include "xAODEgamma/ElectronContainer.h" -#include "xAODEgamma/PhotonContainer.h" -#include "GaudiKernel/EventContext.h" -#include "egammaRecEvent/egammaRec.h" -#include "egammaRecEvent/egammaRecContainer.h" - -#include "StoreGate/ReadHandleKey.h" -#include "StoreGate/ReadCondHandleKey.h" -#include "StoreGate/DataHandle.h" -#include "AthenaMonitoringKernel/Monitored.h" -#include "AthenaMonitoringKernel/GenericMonitoringTool.h" +#include "egammaMonitorBaseAlgorithm.h" class egammaRec; -class egammaMonitorSuperClusterAlgorithm: public AthReentrantAlgorithm +class egammaMonitorSuperClusterAlgorithm: public egammaMonitorBaseAlgorithm { public: