From fbdabe8352c7fc5a6d0d70535cf95418f4e3a554 Mon Sep 17 00:00:00 2001 From: mverissi <mverissi@cern.ch> Date: Fri, 10 Jul 2020 23:26:40 +0200 Subject: [PATCH] Change the names for L2Calo and L2Electron in EgammaHypo and TriggerMenuMT --- .../TrigEgammaHypo/CMakeLists.txt | 8 +- ...oTool.py => TrigEgammaFastCaloHypoTool.py} | 24 +- ...y => TrigEgammaFastElectronFexMTConfig.py} | 54 +-- ...l.py => TrigEgammaFastElectronHypoTool.py} | 34 +- ...poTool.h => ITrigEgammaFastCaloHypoTool.h} | 22 +- ...MT.cxx => TrigEgammaFastCaloHypoAlgMT.cxx} | 10 +- ...oAlgMT.h => TrigEgammaFastCaloHypoAlgMT.h} | 16 +- .../src/TrigEgammaFastCaloHypoToolInc.cxx | 403 ++++++++++++++++++ ...lInc.h => TrigEgammaFastCaloHypoToolInc.h} | 22 +- ...cxx => TrigEgammaFastCaloHypoToolMult.cxx} | 10 +- ...ult.h => TrigEgammaFastCaloHypoToolMult.h} | 20 +- ...MT.cxx => TrigEgammaFastElectronFexMT.cxx} | 14 +- ...nFexMT.h => TrigEgammaFastElectronFexMT.h} | 16 +- ...xx => TrigEgammaFastElectronHypoAlgMT.cxx} | 12 +- ...MT.h => TrigEgammaFastElectronHypoAlgMT.h} | 16 +- ...cxx => TrigEgammaFastElectronHypoTool.cxx} | 18 +- ...ool.h => TrigEgammaFastElectronHypoTool.h} | 12 +- .../src/TrigL2CaloHypoToolInc.cxx | 399 ----------------- .../src/TrigL2PhotonHypoAlgMT.h | 2 +- .../src/components/TrigEgammaHypo_entries.cxx | 24 +- .../CommonSequences/CaloSequenceSetup.py | 12 +- .../Egamma/ElectronSequenceSetup.py | 12 +- .../Electron/ElectronRecoSequences.py | 2 +- .../Electron/generateElectron.py | 4 +- .../HLTMenuConfig/Photon/generatePhoton.py | 4 +- 25 files changed, 589 insertions(+), 581 deletions(-) rename Trigger/TrigHypothesis/TrigEgammaHypo/python/{TrigL2CaloHypoTool.py => TrigEgammaFastCaloHypoTool.py} (92%) rename Trigger/TrigHypothesis/TrigEgammaHypo/python/{TrigL2ElectronFexMTConfig.py => TrigEgammaFastElectronFexMTConfig.py} (54%) rename Trigger/TrigHypothesis/TrigEgammaHypo/python/{TrigL2ElectronHypoTool.py => TrigEgammaFastElectronHypoTool.py} (68%) rename Trigger/TrigHypothesis/TrigEgammaHypo/src/{ITrigL2CaloHypoTool.h => ITrigEgammaFastCaloHypoTool.h} (73%) rename Trigger/TrigHypothesis/TrigEgammaHypo/src/{TrigL2CaloHypoAlgMT.cxx => TrigEgammaFastCaloHypoAlgMT.cxx} (90%) rename Trigger/TrigHypothesis/TrigEgammaHypo/src/{TrigL2CaloHypoAlgMT.h => TrigEgammaFastCaloHypoAlgMT.h} (66%) create mode 100644 Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolInc.cxx rename Trigger/TrigHypothesis/TrigEgammaHypo/src/{TrigL2CaloHypoToolInc.h => TrigEgammaFastCaloHypoToolInc.h} (76%) rename Trigger/TrigHypothesis/TrigEgammaHypo/src/{TrigL2CaloHypoToolMult.cxx => TrigEgammaFastCaloHypoToolMult.cxx} (80%) rename Trigger/TrigHypothesis/TrigEgammaHypo/src/{TrigL2CaloHypoToolMult.h => TrigEgammaFastCaloHypoToolMult.h} (52%) rename Trigger/TrigHypothesis/TrigEgammaHypo/src/{TrigL2ElectronFexMT.cxx => TrigEgammaFastElectronFexMT.cxx} (96%) rename Trigger/TrigHypothesis/TrigEgammaHypo/src/{TrigL2ElectronFexMT.h => TrigEgammaFastElectronFexMT.h} (92%) rename Trigger/TrigHypothesis/TrigEgammaHypo/src/{TrigL2ElectronHypoAlgMT.cxx => TrigEgammaFastElectronHypoAlgMT.cxx} (89%) rename Trigger/TrigHypothesis/TrigEgammaHypo/src/{TrigL2ElectronHypoAlgMT.h => TrigEgammaFastElectronHypoAlgMT.h} (61%) rename Trigger/TrigHypothesis/TrigEgammaHypo/src/{TrigL2ElectronHypoTool.cxx => TrigEgammaFastElectronHypoTool.cxx} (89%) rename Trigger/TrigHypothesis/TrigEgammaHypo/src/{TrigL2ElectronHypoTool.h => TrigEgammaFastElectronHypoTool.h} (90%) delete mode 100644 Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolInc.cxx diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/CMakeLists.txt b/Trigger/TrigHypothesis/TrigEgammaHypo/CMakeLists.txt index 32ff89c5af0..c857d044f3d 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/CMakeLists.txt +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/CMakeLists.txt @@ -19,12 +19,12 @@ atlas_add_component( TrigEgammaHypo atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-extensions=ATL900,ATL901 ) # Unit tests: -atlas_add_test( TrigL2CaloHypoToolConfig - SCRIPT python -m TrigEgammaHypo.TrigL2CaloHypoTool +atlas_add_test( TrigEgammaFastCaloHypoToolConfig + SCRIPT python -m TrigEgammaHypo.TrigEgammaFastCaloHypoTool POST_EXEC_SCRIPT nopost.sh ) -atlas_add_test( TrigL2ElectronHypoToolConfig - SCRIPT python -m TrigEgammaHypo.TrigL2ElectronHypoTool +atlas_add_test( TrigEgammaFastElectronHypoToolConfig + SCRIPT python -m TrigEgammaHypo.TrigEgammaFastElectronHypoTool POST_EXEC_SCRIPT nopost.sh ) atlas_add_test( TrigL2PhotonHypoToolConfig diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2CaloHypoTool.py b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastCaloHypoTool.py similarity index 92% rename from Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2CaloHypoTool.py rename to Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastCaloHypoTool.py index 5db4c760634..00ad67a5637 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2CaloHypoTool.py +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastCaloHypoTool.py @@ -13,7 +13,7 @@ _possibleSel = { 'tight':'Tight', 'medium':'Medium', 'loose':'Loose', 'vloose': from AthenaCommon.Logging import logging -log = logging.getLogger('TrigL2CaloHypoTool') +log = logging.getLogger('TrigEgammaFastCaloHypoTool') def _GetPath( cand, sel, basepath = 'RingerSelectorTools/TrigL2_20180903_v9' ): @@ -39,7 +39,7 @@ def _IncTool(name, cand, threshold, sel): possibleSel = L2CaloCutMaps( threshold ).MapsHADETthr.keys() from AthenaConfiguration.ComponentFactory import CompFactory - tool = CompFactory.TrigL2CaloHypoToolInc( name ) + tool = CompFactory.TrigEgammaFastCaloHypoToolInc( name ) tool.AcceptAll = False tool.UseRinger = False @@ -164,11 +164,11 @@ def _IncTool(name, cand, threshold, sel): def _MultTool(name): from AthenaConfiguration.ComponentFactory import CompFactory - return CompFactory.TrigL2CaloHypoToolMult( name ) + return CompFactory.TrigEgammaFastCaloHypoToolMult( name ) -def TrigL2CaloHypoToolFromDict( d ): +def TrigEgammaFastCaloHypoToolFromDict( d ): """ Use menu decoded chain dictionary to configure the tool """ cparts = [i for i in d['chainParts'] if ((i['signature']=='Electron') or (i['signature']=='Photon'))] @@ -202,38 +202,38 @@ def TrigL2CaloHypoToolFromDict( d ): return _IncTool( name, __cand( cparts[0]), __th( cparts[0]), __sel( cparts[0])) -def TrigL2CaloHypoToolFromName( name, conf ): +def TrigEgammaFastCaloHypoToolFromName( name, conf ): """ To be phased out """ """ set the name of the HypoTool (name=chain) and figure out the threshold and selection from conf """ from TriggerMenuMT.HLTMenuConfig.Menu.DictFromChainName import dictFromChainName decodedDict = dictFromChainName(conf) - return TrigL2CaloHypoToolFromDict( decodedDict ) + return TrigEgammaFastCaloHypoToolFromDict( decodedDict ) if __name__ == "__main__": TriggerFlags.enableMonitoring=['Validation'] - t = TrigL2CaloHypoToolFromName( "HLT_e10_etcut_L1EM3","HLT_e10_etcut_L1EM3" ) + t = TrigEgammaFastCaloHypoToolFromName( "HLT_e10_etcut_L1EM3","HLT_e10_etcut_L1EM3" ) assert t, "cant configure EtCut" - t = TrigL2CaloHypoToolFromName( "HLT_2e5_etcut_L12EM3", "HLT_2e5_etcut_L12EM3" ) + t = TrigEgammaFastCaloHypoToolFromName( "HLT_2e5_etcut_L12EM3", "HLT_2e5_etcut_L12EM3" ) assert t, "cant configure symmetric selection" assert len(t.SubTools) == 2, "Sub-tools not configured" - t = TrigL2CaloHypoToolFromName( "HLT_3e5_etcut_L13EM3", "HLT_3e5_etcut_L13EM3" ) + t = TrigEgammaFastCaloHypoToolFromName( "HLT_3e5_etcut_L13EM3", "HLT_3e5_etcut_L13EM3" ) assert t, "cant configure symmetric selection" assert len(t.SubTools) == 3, "Sub-tools not configured" # Asymmetric chais not working with this. Commenting out for now - # t = TrigL2CaloHypoToolFromName( "HLT_e3_etcut_e5_etcut_L12EM3", "HLT_e3_etcut_e5_etcut_L12EM3" ) + # t = TrigEgammaFastCaloHypoToolFromName( "HLT_e3_etcut_e5_etcut_L12EM3", "HLT_e3_etcut_e5_etcut_L12EM3" ) # assert t, "cant configure asymmetric selection" # assert len(t.SubTools) == 2, "Sub-tools not configured" - t = TrigL2CaloHypoToolFromName( "HLT_e3_etcut_e5_etcut_mu6_L1EM3_MU3", "HLT_e3_etcut_e5_etcut_L1EM3_MU3" ) + t = TrigEgammaFastCaloHypoToolFromName( "HLT_e3_etcut_e5_etcut_mu6_L1EM3_MU3", "HLT_e3_etcut_e5_etcut_L1EM3_MU3" ) assert t, "cant configure asymmetric selection for combined chains" assert len(t.SubTools) == 2, "Sub-tools not configured" - log.info("TrigL2CaloHypoToolFromName ALL OK" ) + log.info("TrigEgammaFastCaloHypoToolFromName ALL OK" ) diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronFexMTConfig.py b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastElectronFexMTConfig.py similarity index 54% rename from Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronFexMTConfig.py rename to Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastElectronFexMTConfig.py index 5bf6d921356..07891a3f43d 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronFexMTConfig.py +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastElectronFexMTConfig.py @@ -1,6 +1,6 @@ # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2ElectronFexMT +from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaFastElectronFexMT from AthenaCommon.SystemOfUnits import GeV, mm from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool @@ -11,10 +11,10 @@ ParticleCaloExtensionTool= Trk__ParticleCaloExtensionTool(Extrapolator = AtlasEx # --------------------------------------------------------------- # class for common setups (like monitoring) -class L2ElectronFexBase(TrigL2ElectronFexMT): +class EgammaFastElectronFexBase(TrigEgammaFastElectronFexMT): __slots__ = [] def __init__(self, name): - super(L2ElectronFexBase,self).__init__(name) + super(EgammaFastElectronFexBase,self).__init__(name) # Tracking cuts self.TrackPt = 1.0 * GeV @@ -33,26 +33,26 @@ class L2ElectronFexBase(TrigL2ElectronFexMT): from TriggerJobOpts.TriggerFlags import TriggerFlags if 'Validation' in TriggerFlags.enableMonitoring() or 'Online' in TriggerFlags.enableMonitoring(): monTool = GenericMonitoringTool('MonTool') - monTool.defineHistogram('CaloTrackdEta', path='EXPERT', type='TH1F', title="L2Electron Hypo #Delta #eta between cluster and track;#Delta #eta;Nevents", xbins=80, xmin=-0.4, xmax=0.4) - monTool.defineHistogram('CaloTrackdPhi', path='EXPERT', type='TH1F', title="L2Electron Hypo #Delta #phi between cluster and track;#Delta #phi;Nevents", xbins=80, xmin=-0.4, xmax=0.4) - monTool.defineHistogram('CaloTrackEoverP', path='EXPERT', type='TH1F', title="L2Electron Hypo E/p;E/p;Nevents", xbins=120, xmin=0, xmax=12) - monTool.defineHistogram('PtTrack', path='EXPERT', type='TH1F', title="L2Electron Hypo p_{T}^{track} [MeV];p_{T}^{track} [MeV];Nevents", xbins=50, xmin=0, xmax=100000) - monTool.defineHistogram('PtCalo', path='EXPERT', type='TH1F', title="L2Electron Hypo p_{T}^{calo} [MeV];p_{T}^{calo} [MeV];Nevents", xbins=50, xmin=0, xmax=100000) - monTool.defineHistogram('CaloEta',path='EXPERT', type='TH1F', title="L2Electron Hypo #eta^{calo} ; #eta^{calo};Nevents", xbins=200, xmin=-2.5, xmax=2.5) - monTool.defineHistogram('CaloPhi', path='EXPERT', type='TH1F', title="L2Electron Hypo #phi^{calo} ; #phi^{calo};Nevents", xbins=320, xmin=-3.2, xmax=3.2) - monTool.defineHistogram('CaloTrackdEtaNoExtrapMon', path='EXPERT',type='TH1F', title="L2Electron Fex #Delta #eta between cluster and track;#Delta #eta;Nevents", xbins=80, xmin=-0.4, xmax=0.4) + monTool.defineHistogram('CaloTrackdEta', path='EXPERT', type='TH1F', title="FastElectron Hypo #Delta #eta between cluster and track;#Delta #eta;Nevents", xbins=80, xmin=-0.4, xmax=0.4) + monTool.defineHistogram('CaloTrackdPhi', path='EXPERT', type='TH1F', title="FastElectron Hypo #Delta #phi between cluster and track;#Delta #phi;Nevents", xbins=80, xmin=-0.4, xmax=0.4) + monTool.defineHistogram('CaloTrackEoverP', path='EXPERT', type='TH1F', title="FastElectron Hypo E/p;E/p;Nevents", xbins=120, xmin=0, xmax=12) + monTool.defineHistogram('PtTrack', path='EXPERT', type='TH1F', title="FastElectron Hypo p_{T}^{track} [MeV];p_{T}^{track} [MeV];Nevents", xbins=50, xmin=0, xmax=100000) + monTool.defineHistogram('PtCalo', path='EXPERT', type='TH1F', title="FastElectron Hypo p_{T}^{calo} [MeV];p_{T}^{calo} [MeV];Nevents", xbins=50, xmin=0, xmax=100000) + monTool.defineHistogram('CaloEta',path='EXPERT', type='TH1F', title="FastElectron Hypo #eta^{calo} ; #eta^{calo};Nevents", xbins=200, xmin=-2.5, xmax=2.5) + monTool.defineHistogram('CaloPhi', path='EXPERT', type='TH1F', title="FastElectron Hypo #phi^{calo} ; #phi^{calo};Nevents", xbins=320, xmin=-3.2, xmax=3.2) + monTool.defineHistogram('CaloTrackdEtaNoExtrapMon', path='EXPERT',type='TH1F', title="FastElectron Fex #Delta #eta between cluster and track;#Delta #eta;Nevents", xbins=80, xmin=-0.4, xmax=0.4) self.MonTool = monTool # --------------------------------------------------------------- -# TrigL2ElectronFex configurations +# TrigEgammaFastElectronFex configurations # --------------------------------------------------------------- -class L2ElectronFex_all(L2ElectronFexBase): +class EgammaFastElectronFex_all(EgammaFastElectronFexBase): __slots__ = [] - def __init__(self,name="L2ElectronFex_all"): - super(L2ElectronFex_all, self).__init__(name) + def __init__(self,name="EgammaFastElectronFex_all"): + super(EgammaFastElectronFex_all, self).__init__(name) # AcceptAll flag: if true take events regardless of cuts self.AcceptAll = False @@ -61,30 +61,30 @@ class L2ElectronFex_all(L2ElectronFexBase): self.RCalBarrelFace = 1470.0*mm self.ZCalEndcapFace = 3800.0*mm -class L2ElectronFex_1(L2ElectronFex_all): +class EgammaFastElectronFex_1(EgammaFastElectronFex_all): __slots__ = [] - def __init__(self,name="L2ElectronFex_1"): - super(L2ElectronFex_1, self).__init__(name) + def __init__(self,name="EgammaFastElectronFex_1"): + super(EgammaFastElectronFex_1, self).__init__(name) self.AcceptAll = True -class L2ElectronFex_Clean(L2ElectronFex_all): +class EgammaFastElectronFex_Clean(EgammaFastElectronFex_all): __slots__ = [] - def __init__(self,name="L2ElectronFex_Clean"): - super(L2ElectronFex_Clean, self).__init__(name) + def __init__(self,name="EgammaFastElectronFex_Clean"): + super(EgammaFastElectronFex_Clean, self).__init__(name) self.AcceptAll = False self.CaloTrackdETA = 0.2 self.CaloTrackdPHI = 0.3 -class L2ElectronFex_LowPt(L2ElectronFex_all): +class EgammaFastElectronFex_LowPt(EgammaFastElectronFex_all): __slots__ = [] - def __init__(self,name="L2ElectronFex_LowPt"): - super(L2ElectronFex_1, self).__init__(name) + def __init__(self,name="EgammaFastElectronFex_LowPt"): + super(EgammaFastElectronFex_1, self).__init__(name) self.AcceptAll = False -class L2ElectronFex_HighPt(L2ElectronFex_all): +class EgammaFastElectronFex_HighPt(EgammaFastElectronFex_all): __slots__ = [] - def __init__(self,name="L2ElectronFex_HighPt"): - super(L2ElectronFex_1, self).__init__(name) + def __init__(self,name="EgammaFastElectronFex_HighPt"): + super(EgammaFastElectronFex_1, self).__init__(name) self.AcceptAll = False self.TrackPt = 2.0 * GeV diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronHypoTool.py b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastElectronHypoTool.py similarity index 68% rename from Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronHypoTool.py rename to Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastElectronHypoTool.py index c2eb94a1b68..abbc46d60ad 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronHypoTool.py +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastElectronHypoTool.py @@ -8,9 +8,9 @@ from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool -log = logging.getLogger('TrigL2ElectronHypoTool') +log = logging.getLogger('TrigEgammaFastElectronHypoTool') -def TrigL2ElectronHypoToolFromDict( chainDict ): +def TrigEgammaFastElectronHypoToolFromDict( chainDict ): """ Use menu decoded chain dictionary to configure the tool """ cparts = [i for i in chainDict['chainParts'] if i['signature']=='Electron'] @@ -18,19 +18,19 @@ def TrigL2ElectronHypoToolFromDict( chainDict ): name = chainDict['chainName'] from AthenaConfiguration.ComponentFactory import CompFactory - tool = CompFactory.TrigL2ElectronHypoTool(name) + tool = CompFactory.TrigEgammaFastElectronHypoTool(name) monTool = GenericMonitoringTool("MonTool"+name) - monTool.defineHistogram('CutCounter', type='TH1I', path='EXPERT', title="L2Electron Hypo Cut Counter;Cut Counter", xbins=8, xmin=-1.5, xmax=7.5, opt="kCumulative") - monTool.defineHistogram('CaloTrackdEta', type='TH1F', path='EXPERT', title="L2Electron Hypo #Delta #eta between cluster and track;#Delta #eta;Nevents", xbins=80, xmin=-0.4, xmax=0.4) - monTool.defineHistogram('CaloTrackdPhi', type='TH1F', path='EXPERT', title="L2Electron Hypo #Delta #phi between cluster and track;#Delta #phi;Nevents", xbins=80, xmin=-0.4, xmax=0.4) - monTool.defineHistogram('CaloTrackEoverP', type='TH1F', path='EXPERT', title="L2Electron Hypo E/p;E/p;Nevents", xbins=120, xmin=0, xmax=12) - monTool.defineHistogram('PtTrack', type='TH1F', path='EXPERT', title="L2Electron Hypo p_{T}^{track} [MeV];p_{T}^{track} [MeV];Nevents", xbins=50, xmin=0, xmax=100000) - monTool.defineHistogram('PtCalo', type='TH1F', path='EXPERT', title="L2Electron Hypo p_{T}^{calo} [MeV];p_{T}^{calo} [MeV];Nevents", xbins=50, xmin=0, xmax=100000) - monTool.defineHistogram('CaloEta', type='TH1F', path='EXPERT', title="L2Electron Hypo #eta^{calo} ; #eta^{calo};Nevents", xbins=200, xmin=-2.5, xmax=2.5) - monTool.defineHistogram('CaloPhi', type='TH1F', path='EXPERT', title="L2Electron Hypo #phi^{calo} ; #phi^{calo};Nevents", xbins=320, xmin=-3.2, xmax=3.2) - - monTool.HistPath = 'L2ElectronHypo/'+tool.getName() + monTool.defineHistogram('CutCounter', type='TH1I', path='EXPERT', title="FastElectron Hypo Cut Counter;Cut Counter", xbins=8, xmin=-1.5, xmax=7.5, opt="kCumulative") + monTool.defineHistogram('CaloTrackdEta', type='TH1F', path='EXPERT', title="FastElectron Hypo #Delta #eta between cluster and track;#Delta #eta;Nevents", xbins=80, xmin=-0.4, xmax=0.4) + monTool.defineHistogram('CaloTrackdPhi', type='TH1F', path='EXPERT', title="FastElectron Hypo #Delta #phi between cluster and track;#Delta #phi;Nevents", xbins=80, xmin=-0.4, xmax=0.4) + monTool.defineHistogram('CaloTrackEoverP', type='TH1F', path='EXPERT', title="FastElectron Hypo E/p;E/p;Nevents", xbins=120, xmin=0, xmax=12) + monTool.defineHistogram('PtTrack', type='TH1F', path='EXPERT', title="FastElectron Hypo p_{T}^{track} [MeV];p_{T}^{track} [MeV];Nevents", xbins=50, xmin=0, xmax=100000) + monTool.defineHistogram('PtCalo', type='TH1F', path='EXPERT', title="FastElectron Hypo p_{T}^{calo} [MeV];p_{T}^{calo} [MeV];Nevents", xbins=50, xmin=0, xmax=100000) + monTool.defineHistogram('CaloEta', type='TH1F', path='EXPERT', title="FastElectron Hypo #eta^{calo} ; #eta^{calo};Nevents", xbins=200, xmin=-2.5, xmax=2.5) + monTool.defineHistogram('CaloPhi', type='TH1F', path='EXPERT', title="FastElectron Hypo #phi^{calo} ; #phi^{calo};Nevents", xbins=320, xmin=-3.2, xmax=3.2) + + monTool.HistPath = 'FastElectronHypo/'+tool.getName() tool.MonTool = monTool nt = len( thresholds ) @@ -58,7 +58,7 @@ def TrigL2ElectronHypoToolFromDict( chainDict ): return tool -def TrigL2ElectronHypoToolFromName( name, conf ): +def TrigEgammaFastElectronHypoToolFromName( name, conf ): """ provides configuration of the hypo tool giben the chain name The argument will be replaced by "parsed" chain dict. For now it only serves simplest chain HLT_eXYZ. """ @@ -66,15 +66,15 @@ def TrigL2ElectronHypoToolFromName( name, conf ): decodedDict = dictFromChainName(conf) - return TrigL2ElectronHypoToolFromDict( decodedDict ) + return TrigEgammaFastElectronHypoToolFromDict( decodedDict ) if __name__ == "__main__": - tool = TrigL2ElectronHypoToolFromName("HLT_e3_etcut_L1EM3", "HLT_e3_etcut_L1EM3") + tool = TrigEgammaFastElectronHypoToolFromName("HLT_e3_etcut_L1EM3", "HLT_e3_etcut_L1EM3") assert tool, "Not configured simple tool" - tool = TrigL2ElectronHypoToolFromName("HLT_2e3_etcut_L1E2M3", "HLT_2e3_etcut_L12EM3") + tool = TrigEgammaFastElectronHypoToolFromName("HLT_2e3_etcut_L1E2M3", "HLT_2e3_etcut_L12EM3") assert tool, "Not configured simple tool" assert len(tool.TrackPt) == 2, "Multiplicity missonfigured, set "+ str( len( tool.TrackPt ) ) diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/ITrigL2CaloHypoTool.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/ITrigEgammaFastCaloHypoTool.h similarity index 73% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/ITrigL2CaloHypoTool.h rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/ITrigEgammaFastCaloHypoTool.h index 2ca149136a1..4aa30e5ee9a 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/ITrigL2CaloHypoTool.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/ITrigEgammaFastCaloHypoTool.h @@ -1,8 +1,8 @@ /* Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGEGAMMAHYPO_ITRIGL2CALOHYPOTOOL_H -#define TRIGEGAMMAHYPO_ITRIGL2CALOHYPOTOOL_H 1 +#ifndef TRIGEGAMMAHYPO_ITRIGEGAMMAFASTCALOHYPOTOOL_H +#define TRIGEGAMMAHYPO_ITRIGEGAMMAFASTCALOHYPOTOOL_H 1 #include "GaudiKernel/IAlgTool.h" #include "AthenaBaseComps/AthAlgTool.h" @@ -16,20 +16,20 @@ /** - * @class Base for tools dooing L2 Calo Hypo selection + * @class Base for tools dooing Egamma Fast Calo Hypo selection * @brief **/ -class ITrigL2CaloHypoTool +class ITrigEgammaFastCaloHypoTool : virtual public ::IAlgTool { public: - DeclareInterfaceID(ITrigL2CaloHypoTool, 1, 0); - virtual ~ITrigL2CaloHypoTool(){} + DeclareInterfaceID(ITrigEgammaFastCaloHypoTool, 1, 0); + virtual ~ITrigEgammaFastCaloHypoTool(){} - struct ClusterInfo { - ClusterInfo( TrigCompositeUtils::Decision* d, + struct FastClusterInfo { + FastClusterInfo( TrigCompositeUtils::Decision* d, const TrigRoiDescriptor* r, const xAOD::TrigEMCluster* c, const xAOD::TrigRingerRings* ring, @@ -56,13 +56,13 @@ class ITrigL2CaloHypoTool * There will be many tools called often to perform this quick operation and we do not want to pay for polymorphism which we do not need to use. * Will actually see when N obj hypos will enter the scene **/ - virtual StatusCode decide( std::vector<ClusterInfo>& input ) const = 0; + virtual StatusCode decide( std::vector<FastClusterInfo>& input ) const = 0; /** * @brief Makes a decision for a single object * The decision needs to be returned **/ - virtual bool decide( const ClusterInfo& i ) const = 0; + virtual bool decide( const FastClusterInfo& i ) const = 0; protected: @@ -70,4 +70,4 @@ class ITrigL2CaloHypoTool }; -#endif //> !TRIGEGAMMAHYPO_ITRIGL2CALOHYPOTOOL_H +#endif //> !TRIGEGAMMAHYPO_ITRIGEGAMMAFASTCALOHYPOTOOL_H diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoAlgMT.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoAlgMT.cxx similarity index 90% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoAlgMT.cxx rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoAlgMT.cxx index 64f2f248753..e8358950217 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoAlgMT.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoAlgMT.cxx @@ -3,19 +3,19 @@ */ #include "GaudiKernel/Property.h" -#include "TrigL2CaloHypoAlgMT.h" +#include "TrigEgammaFastCaloHypoAlgMT.h" #include "TrigCompositeUtils/HLTIdentifier.h" #include "TrigCompositeUtils/TrigCompositeUtils.h" #include "AthViews/ViewHelper.h" using namespace TrigCompositeUtils; -TrigL2CaloHypoAlgMT::TrigL2CaloHypoAlgMT( const std::string& name, +TrigEgammaFastCaloHypoAlgMT::TrigEgammaFastCaloHypoAlgMT( const std::string& name, ISvcLocator* pSvcLocator ) : ::HypoBase( name, pSvcLocator ) {} -StatusCode TrigL2CaloHypoAlgMT::initialize() { +StatusCode TrigEgammaFastCaloHypoAlgMT::initialize() { ATH_CHECK( m_hypoTools.retrieve() ); @@ -29,7 +29,7 @@ StatusCode TrigL2CaloHypoAlgMT::initialize() { } -StatusCode TrigL2CaloHypoAlgMT::execute( const EventContext& context ) const { +StatusCode TrigEgammaFastCaloHypoAlgMT::execute( const EventContext& context ) const { ATH_MSG_DEBUG ( "Executing " << name() << "..." ); auto previousDecisionsHandle = SG::makeHandle( decisionInput(), context ); ATH_CHECK( previousDecisionsHandle.isValid() ); @@ -43,7 +43,7 @@ StatusCode TrigL2CaloHypoAlgMT::execute( const EventContext& context ) const { auto decisions = outputHandle.ptr(); // input for decision - std::vector<ITrigL2CaloHypoTool::ClusterInfo> toolInput; + std::vector<ITrigEgammaFastCaloHypoTool::FastClusterInfo> toolInput; // loop over previous decisions size_t counter=0; diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoAlgMT.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoAlgMT.h similarity index 66% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoAlgMT.h rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoAlgMT.h index e9a531eee86..abdb96f4751 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoAlgMT.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoAlgMT.h @@ -1,8 +1,8 @@ /* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGEGAMMAHYPO_TRIGL2CALOHYPOALGMT_H -#define TRIGEGAMMAHYPO_TRIGL2CALOHYPOALGMT_H 1 +#ifndef TRIGEGAMMAHYPO_TRIGEGAMMAFASTCALOHYPOALGMT_H +#define TRIGEGAMMAHYPO_TRIGEGAMMAFASTCALOHYPOALGMT_H 1 #include <string> @@ -16,25 +16,25 @@ #include "xAODTrigRinger/TrigRingerRingsContainer.h" -#include "ITrigL2CaloHypoTool.h" +#include "ITrigEgammaFastCaloHypoTool.h" /** - * @class TrigL2CaloHypoAlgMT + * @class TrigEgammaFastCaloHypoAlgMT * @brief Implements egamma calo selection for the new HLT framework **/ -class TrigL2CaloHypoAlgMT : public ::HypoBase { +class TrigEgammaFastCaloHypoAlgMT : public ::HypoBase { public: - TrigL2CaloHypoAlgMT( const std::string& name, ISvcLocator* pSvcLocator ); + TrigEgammaFastCaloHypoAlgMT( const std::string& name, ISvcLocator* pSvcLocator ); virtual StatusCode initialize() override; virtual StatusCode execute( const EventContext& context ) const override; private: - ToolHandleArray< ITrigL2CaloHypoTool > m_hypoTools { this, "HypoTools", {}, "Hypo tools" }; + ToolHandleArray< ITrigEgammaFastCaloHypoTool > m_hypoTools { this, "HypoTools", {}, "Hypo tools" }; SG::ReadHandleKey< xAOD::TrigEMClusterContainer > m_clustersKey { this, "CaloClusters", "CaloClusters", "CaloClusters in view" }; SG::ReadHandleKey<xAOD::TrigRingerRingsContainer> m_ringsKey { this, "RingerKey","HLT_FastCaloRinger","Point to RingerKey"}; }; -#endif //> !TRIGEGAMMAHYPO_TESTTRIGL2CALOHYPOALG_H +#endif //> !TRIGEGAMMAHYPO_TESTTRIGEGAMMAFASTCALOHYPOALG_H diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolInc.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolInc.cxx new file mode 100644 index 00000000000..2b541103c94 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolInc.cxx @@ -0,0 +1,403 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include <algorithm> +#include "TrigCompositeUtils/HLTIdentifier.h" +#include "TrigCompositeUtils/Combinators.h" +#include "AthenaMonitoringKernel/Monitored.h" +#include "GaudiKernel/SystemOfUnits.h" + +#include "TrigEgammaFastCaloHypoToolInc.h" + + +using namespace TrigCompositeUtils; + +TrigEgammaFastCaloHypoToolInc::TrigEgammaFastCaloHypoToolInc( const std::string& type, + const std::string& name, + const IInterface* parent ) + : base_class( type, name, parent ), + m_selectorTool(), + m_lumiBlockMuTool("LumiBlockMuTool/LumiBlockMuTool"), + m_decisionId( HLT::Identifier::fromToolName( name ) ) +{ +declareProperty("LumiBlockMuTool", m_lumiBlockMuTool, "Luminosity Tool" ); +} + +StatusCode TrigEgammaFastCaloHypoToolInc::initialize() { + +ATH_MSG_DEBUG("Name: "<<name()<<" UseRinger: "<<m_useRinger); + +if (m_useRinger){ + m_selectorTool.setConstantsCalibPath( m_constantsCalibPath ); + m_selectorTool.setThresholdsCalibPath( m_thresholdsCalibPath ); + + if(m_selectorTool.initialize().isFailure()) + return StatusCode::FAILURE; + + if (m_lumiBlockMuTool.retrieve().isFailure()) + return StatusCode::FAILURE; + + ATH_MSG_INFO("TrigEgammaFastCaloRingerHypo initialization completed successfully."); + +} + ATH_MSG_DEBUG( "Initialization completed successfully" ); + ATH_MSG_DEBUG( "AcceptAll = " << ( m_acceptAll==true ? "True" : "False" ) ); + ATH_MSG_DEBUG( "EtaBins = " << m_etabin ); + ATH_MSG_DEBUG( "ETthr = " << m_eTthr << "( lo )/" << m_eT2thr << "( hi )" ); + ATH_MSG_DEBUG( "HADETthr = " << m_hadeTthr << "( lo )/" << m_hadeT2thr << "( hi )" ); + ATH_MSG_DEBUG( "CARCOREthr = " << m_carcorethr ); + ATH_MSG_DEBUG( "CAERATIOthr = " << m_caeratiothr ); + ATH_MSG_DEBUG( "dPHICLUSTERthr = " << m_dphicluster ); + ATH_MSG_DEBUG( "dETACLUSTERthr = " << m_detacluster ); + ATH_MSG_DEBUG( "WETA2thr = " << m_WETA2thr ); + ATH_MSG_DEBUG( "WSTOTthr = " << m_WSTOTthr ); + ATH_MSG_DEBUG( "F3thr = " << m_F3thr ); + + if ( m_etabin.size() == 0 ) { + ATH_MSG_ERROR( " There are no cuts set (EtaBins property is an empty list)" ); + return StatusCode::FAILURE; + } + + unsigned int nEtaBin = m_etabin.size(); +#define CHECK_SIZE( __n) if ( m_##__n.size() != (nEtaBin - 1) ) \ + { ATH_MSG_DEBUG(" __n size is " << m_##__n.size() << " but needs to be " << (nEtaBin - 1) ); return StatusCode::FAILURE; } + + CHECK_SIZE( eTthr ); + CHECK_SIZE( eT2thr ); + CHECK_SIZE( hadeTthr ); + CHECK_SIZE( hadeT2thr ); + CHECK_SIZE( carcorethr ); + CHECK_SIZE( caeratiothr ); + CHECK_SIZE( WETA2thr ); + CHECK_SIZE( WSTOTthr ); + CHECK_SIZE( F3thr ); +#undef CHECK_SIZE + + ATH_MSG_DEBUG( "Tool configured for chain/id: " << m_decisionId ); + + if ( not m_monTool.name().empty() ) + CHECK( m_monTool.retrieve() ); + + return StatusCode::SUCCESS; +} + + + +TrigEgammaFastCaloHypoToolInc::~TrigEgammaFastCaloHypoToolInc(){} + +int TrigEgammaFastCaloHypoToolInc::findCutIndex( float eta ) const { + const float absEta = std::abs(eta); + + auto binIterator = std::adjacent_find( m_etabin.begin(), m_etabin.end(), [=](float left, float right){ return left < absEta and absEta < right; } ); + if ( binIterator == m_etabin.end() ) { + return -1; + } + return binIterator - m_etabin.begin(); +} + +StatusCode TrigEgammaFastCaloHypoToolInc::decide( std::vector<FastClusterInfo>& input ) const { + for ( auto& i: input ) { + if ( passed ( m_decisionId.numeric(), i.previousDecisionIDs ) ) { + if ( decide( i ) ) { + addDecisionID( m_decisionId, i.decision ); + } + } + } + return StatusCode::SUCCESS; +} + +bool TrigEgammaFastCaloHypoToolInc::decide( const ITrigEgammaFastCaloHypoTool::FastClusterInfo& input ) const { + // ringer selection + if (m_useRinger){ + return decide_ringer( input ); + } + // cutbased selection + else{ + return decide_cutbased( input ); + } +} + +bool TrigEgammaFastCaloHypoToolInc::decide_cutbased( const ITrigEgammaFastCaloHypoTool::FastClusterInfo& input ) const { + + bool pass = false; + + auto dEta = Monitored::Scalar( "dEta", -1. ); + auto dPhi = Monitored::Scalar( "dPhi", -1. ); + auto eT_T2Calo = Monitored::Scalar( "Et_em" , -1.0 ); + auto hadET_T2Calo = Monitored::Scalar( "Et_had", -1.0 ); + auto rCore = Monitored::Scalar( "RCore" , -1.0 ); + auto energyRatio = Monitored::Scalar( "ERatio" , -1.0 ); + auto etaBin = Monitored::Scalar( "EtaBin", -1. ); + auto monEta = Monitored::Scalar( "Eta", -99. ); + auto monPhi = Monitored::Scalar( "Phi", -99. ); + auto F1 = Monitored::Scalar( "F1" , -1.0 ); + auto Weta2 = Monitored::Scalar( "Weta2" , -1.0 ); + auto Wstot = Monitored::Scalar( "Wstot" , -1.0 ); + auto F3 = Monitored::Scalar( "F3" , -1.0 ); + auto PassedCuts = Monitored::Scalar<int>( "CutCounter", -1 ); + auto monitorIt = Monitored::Group( m_monTool, + dEta, dPhi, eT_T2Calo, hadET_T2Calo, + rCore, energyRatio, etaBin, monEta, + monPhi, F1, Weta2, Wstot, F3, PassedCuts ); + // when leaving scope it will ship data to monTool + PassedCuts = PassedCuts + 1; //got called (data in place) + + if ( m_acceptAll ) { + pass = true; + ATH_MSG_DEBUG( "AcceptAll property is set: taking all events" ); + } else { + pass = false; + ATH_MSG_DEBUG( "AcceptAll property not set: applying selection" ); + } + + auto roiDescriptor = input.roi; + + if ( fabs( roiDescriptor->eta() ) > 2.6 ) { + ATH_MSG_DEBUG( "REJECT The cluster had eta coordinates beyond the EM fiducial volume : " << roiDescriptor->eta() << "; stop the chain now" ); + pass=false; // special case + return pass; + } + + ATH_MSG_DEBUG( "; RoI ID = " << roiDescriptor->roiId() + << ": Eta = " << roiDescriptor->eta() + << ", Phi = " << roiDescriptor->phi() ); + + // fill local variables for RoI reference position + double etaRef = roiDescriptor->eta(); + double phiRef = roiDescriptor->phi(); + // correct phi the to right range ( probably not needed anymore ) + if ( fabs( phiRef ) > M_PI ) phiRef -= 2*M_PI; // correct phi if outside range + + auto pClus = input.cluster; + float absEta = fabs( pClus->eta() ); + etaBin = -1; + monEta = pClus->eta(); + monPhi = pClus->phi(); + const int cutIndex = findCutIndex( absEta ); + + // find if electron is in calorimeter crack + bool inCrack = ( absEta > 2.37 || ( absEta > 1.37 && absEta < 1.52 ) ); + dEta = pClus->eta() - etaRef; + + // Deal with angle diferences greater than Pi + dPhi = fabs( pClus->phi() - phiRef ); + dPhi = ( dPhi < M_PI ? dPhi : 2*M_PI - dPhi ); // TB why only < + + // calculate cluster quantities // definition taken from TrigElectron constructor + if ( pClus->emaxs1() + pClus->e2tsts1() > 0 ) + energyRatio = ( pClus->emaxs1() - pClus->e2tsts1() ) / ( pClus->emaxs1() + pClus->e2tsts1() ); + + // ( VD ) here the definition is a bit different to account for the cut of e277 @ EF + if ( pClus->e277()!= 0. ) rCore = pClus->e237() / pClus->e277(); + + //fraction of energy deposited in 1st sampling + if ( fabs( pClus->energy() ) > 0.00001 ) F1 = ( pClus->energy( CaloSampling::EMB1 )+pClus->energy( CaloSampling::EME1 ) )/pClus->energy(); + eT_T2Calo = pClus->et(); + if ( eT_T2Calo!=0 && pClus->eta()!=0 ) hadET_T2Calo = pClus->ehad1()/cosh( fabs( pClus->eta() ) )/eT_T2Calo; + + //extract Weta2 varable + Weta2 = pClus->weta2(); + + //extract Wstot varable + Wstot = pClus->wstot(); + + //extract F3 ( backenergy i EM calorimeter + float e0 = pClus->energy( CaloSampling::PreSamplerB ) + pClus->energy( CaloSampling::PreSamplerE ); + float e1 = pClus->energy( CaloSampling::EMB1 ) + pClus->energy( CaloSampling::EME1 ); + float e2 = pClus->energy( CaloSampling::EMB2 ) + pClus->energy( CaloSampling::EME2 ); + float e3 = pClus->energy( CaloSampling::EMB3 ) + pClus->energy( CaloSampling::EME3 ); + float eallsamples = e0+e1+e2+e3; + F3 = fabs( eallsamples )>0. ? e3/eallsamples : 0.; + + // apply cuts: DeltaEta( clus-ROI ) + ATH_MSG_DEBUG( "TrigEMCluster: eta=" << pClus->eta() + << " roi eta=" << etaRef << " DeltaEta=" << dEta + << " cut: <" << m_detacluster ); + + if ( fabs( pClus->eta() - etaRef ) > m_detacluster ) { + ATH_MSG_DEBUG("REJECT Cluster dEta cut failed"); + return pass; + } + PassedCuts = PassedCuts + 1; //Deta + + // DeltaPhi( clus-ROI ) + ATH_MSG_DEBUG( ": phi=" << pClus->phi() + << " roi phi="<< phiRef << " DeltaPhi="<< dPhi + << " cut: <" << m_dphicluster ); + + if( dPhi > m_dphicluster ) { + ATH_MSG_DEBUG("REJECT Clsuter dPhi cut failed"); + return pass; + } + PassedCuts = PassedCuts + 1; //DPhi + + // eta range + if ( cutIndex == -1 ) { // VD + ATH_MSG_DEBUG( "Cluster eta: " << absEta << " outside eta range " << m_etabin[m_etabin.size()-1] ); + return pass; + } + else { + ATH_MSG_DEBUG( "eta bin used for cuts " << cutIndex ); + } + PassedCuts = PassedCuts + 1; // passed eta cut + + // Rcore + ATH_MSG_DEBUG ( "TrigEMCluster: Rcore=" << rCore + << " cut: >" << m_carcorethr[cutIndex] ); + if ( rCore < m_carcorethr[cutIndex] ) { + ATH_MSG_DEBUG("REJECT rCore cut failed"); + return pass; + } + PassedCuts = PassedCuts + 1; //Rcore + + // Eratio + ATH_MSG_DEBUG( " cut: >" << m_caeratiothr[cutIndex] ); + if ( inCrack || F1 < m_F1thr[0] ) { + ATH_MSG_DEBUG ( "TrigEMCluster: InCrack= " << inCrack << " F1=" << F1 ); + } + else { + if ( energyRatio < m_caeratiothr[cutIndex] ) { + ATH_MSG_DEBUG("REJECT e ratio cut failed"); + return pass; + } + } + PassedCuts = PassedCuts + 1; //Eratio + if( inCrack ) energyRatio = -1; //Set default value in crack for monitoring. + + // ET_em + ATH_MSG_DEBUG( "TrigEMCluster: ET_em=" << eT_T2Calo << " cut: >" << m_eTthr[cutIndex] ); + if ( eT_T2Calo < m_eTthr[cutIndex] ) { + ATH_MSG_DEBUG("REJECT et cut failed"); + return pass; + } + PassedCuts = PassedCuts + 1; // ET_em + + float hadET_cut = 0.0; + // find which ET_had to apply : this depends on the ET_em and the eta bin + if ( eT_T2Calo > m_eT2thr[cutIndex] ) { + hadET_cut = m_hadeT2thr[cutIndex] ; + ATH_MSG_DEBUG ( "ET_em>" << m_eT2thr[cutIndex] << ": use high ET_had cut: <" << hadET_cut ); + } + else { + hadET_cut = m_hadeTthr[cutIndex]; + ATH_MSG_DEBUG ( "ET_em<" << m_eT2thr[cutIndex] << ": use low ET_had cut: <" << hadET_cut ); + } + + // ET_had + ATH_MSG_DEBUG ( "TrigEMCluster: ET_had=" << hadET_T2Calo << " cut: <" << hadET_cut ); + if ( hadET_T2Calo > hadET_cut ) { + ATH_MSG_DEBUG("REJECT et had cut failed"); + return pass; + } + PassedCuts = PassedCuts + 1; //ET_had + + // F1 + ATH_MSG_DEBUG ( "TrigEMCluster: F1=" << F1 << " cut: >" << m_F1thr[0] ); + PassedCuts = PassedCuts + 1; //F1 + + //Weta2 + ATH_MSG_DEBUG ( "TrigEMCluster: Weta2=" << Weta2 << " cut: <" << m_WETA2thr[cutIndex] ); + if ( Weta2 > m_WETA2thr[cutIndex] ) { + ATH_MSG_DEBUG("REJECT weta 2 cut failed"); + return pass; + } + PassedCuts = PassedCuts + 1; //Weta2 + + //Wstot + ATH_MSG_DEBUG ( "TrigEMCluster: Wstot=" <<Wstot << " cut: <" << m_WSTOTthr[cutIndex] ); + if ( Wstot >= m_WSTOTthr[cutIndex] ) { + ATH_MSG_DEBUG("REJECT wstot cut failed"); + return pass; + } + PassedCuts = PassedCuts + 1; //Wstot + + //F3 + ATH_MSG_DEBUG( "TrigEMCluster: F3=" << F3 << " cut: <" << m_F3thr[cutIndex] ); + if ( F3 > m_F3thr[cutIndex] ) { + ATH_MSG_DEBUG("REJECT F3 cut failed"); + return pass; + } + PassedCuts = PassedCuts + 1; //F3 + + // got this far => passed! + pass = true; + + // Reach this point successfully + ATH_MSG_DEBUG( "pass = " << pass ); + + return pass; + +} + +bool TrigEgammaFastCaloHypoToolInc::decide_ringer ( const ITrigEgammaFastCaloHypoTool::FastClusterInfo& input) const{ + + auto etMon = Monitored::Scalar("Et",-100); + auto monEta = Monitored::Scalar("Eta",-100); + auto monPhi = Monitored::Scalar("Phi",-100); + auto rnnOutMon = Monitored::Scalar("RnnOut",-100); + auto total_time = Monitored::Timer("TIME_total"); + auto propagate_time = Monitored::Timer("TIME_propagate"); + auto preproc_time = Monitored::Timer("TIME_preproc"); + auto decide_time = Monitored::Timer("TIME_decide"); + auto mon = Monitored::Group(m_monTool,etMon,monEta,monPhi,rnnOutMon, + total_time,propagate_time,preproc_time,decide_time); + + + if ( m_acceptAll ) { + ATH_MSG_DEBUG( "AcceptAll property is set: taking all events" ); + return true; + } else { + ATH_MSG_DEBUG( "AcceptAll property not set: applying selection" ); + } + + total_time.start(); + auto ringerShape = input.ringerShape; + const xAOD::TrigEMCluster *emCluster = 0; + if(ringerShape){ + emCluster = ringerShape->emCluster(); + //emCluster= input.cluster; + if(!emCluster){ + ATH_MSG_WARNING( "There is no link to xAOD::TrigEMCluster into the Ringer object."); + return false; + } + } + else{ + ATH_MSG_WARNING( "There is no xAOD::TrigRingerRings link into the rnnOutput object."); + return false; + } + + float eta = std::fabs(emCluster->eta()); + float et = emCluster->et() / Gaudi::Units::GeV; + float avgmu = m_lumiBlockMuTool->averageInteractionsPerCrossing(); + + if(eta>2.50) eta=2.50;///fix for events out of the ranger + + // make sure that monitoring histogram will plotting only the events of chain. + ///Et threshold + if(et < m_emEtCut/Gaudi::Units::GeV){ + ATH_MSG_DEBUG( "Event reproved by Et threshold. Et = " << et << ", EtCut = " << m_emEtCut/Gaudi::Units::GeV); + return false; + } + + monEta = emCluster->eta(); + etMon = emCluster->et(); + monPhi = emCluster->phi(); + + const std::vector<float> rings = ringerShape->rings(); + std::vector<float> refRings(rings.size()); + refRings.assign(rings.begin(), rings.end()); + + ATH_MSG_DEBUG("Et = "<< et << " Eta = "<<eta << " mu = " << avgmu << "rsize = "<< refRings.size()); + + auto output = m_selectorTool.calculate( refRings, et, eta, avgmu, propagate_time, preproc_time ); + rnnOutMon = output; + ATH_MSG_DEBUG(name()<< " generate as NN output " << output ); + + decide_time.start(); + bool accept = m_selectorTool.accept(output, et,eta,avgmu); + decide_time.stop(); + + total_time.stop(); + return accept; +} \ No newline at end of file diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolInc.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolInc.h similarity index 76% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolInc.h rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolInc.h index a8b2aacc89e..700726b977b 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolInc.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolInc.h @@ -1,8 +1,8 @@ /* Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGEGAMMAHYPO_TRIGL2CALOHYPOTOOLINC_H -#define TRIGEGAMMAHYPO_TRIGL2CALOHYPOTOOLINC_H 1 +#ifndef TRIGEGAMMAHYPO_TRIGEGAMMAFASTCALOHYPOTOOLINC_H +#define TRIGEGAMMAHYPO_TRIGEGAMMAFASTCALOHYPOTOOLINC_H 1 //#include "GaudiKernel/IAlgTool.h" #include "CLHEP/Units/SystemOfUnits.h" @@ -17,25 +17,29 @@ #include "AthenaMonitoringKernel/GenericMonitoringTool.h" #include "TrigCompositeUtils/HLTIdentifier.h" #include "TrigCompositeUtils/TrigCompositeUtils.h" -#include "ITrigL2CaloHypoTool.h" +#include "ITrigEgammaFastCaloHypoTool.h" /** * @class Implementation of the Egamma selection for CaloClusters * @brief **/ -class TrigL2CaloHypoToolInc : public extends<AthAlgTool, ITrigL2CaloHypoTool> { +class TrigEgammaFastCaloHypoToolInc : public extends<AthAlgTool, ITrigEgammaFastCaloHypoTool> { public: - TrigL2CaloHypoToolInc( const std::string& type, + TrigEgammaFastCaloHypoToolInc( const std::string& type, const std::string& name, const IInterface* parent ); - virtual ~TrigL2CaloHypoToolInc(); + virtual ~TrigEgammaFastCaloHypoToolInc(); virtual StatusCode initialize() override; - virtual StatusCode decide( std::vector<ITrigL2CaloHypoTool::ClusterInfo>& input ) const override; + virtual StatusCode decide( std::vector<ITrigEgammaFastCaloHypoTool::FastClusterInfo>& input ) const override; - virtual bool decide( const ITrigL2CaloHypoTool::ClusterInfo& i ) const override; + virtual bool decide( const ITrigEgammaFastCaloHypoTool::FastClusterInfo& i ) const override; + + // ringer and cutbased selectors + virtual bool decide_cutbased( const ITrigEgammaFastCaloHypoTool::FastClusterInfo& i ) const; + virtual bool decide_ringer( const ITrigEgammaFastCaloHypoTool::FastClusterInfo& i ) const; private: Ringer::RingerSelectorTool m_selectorTool; @@ -67,4 +71,4 @@ class TrigL2CaloHypoToolInc : public extends<AthAlgTool, ITrigL2CaloHypoTool> { int findCutIndex( float eta ) const; }; -#endif //> !TRIGEGAMMAHYPO_TRIGL2CALOHYPOTOOL_H +#endif //> !TRIGEGAMMAHYPO_TRIGEGAMMAFASTCALOHYPOTOOLINC_H diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolMult.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolMult.cxx similarity index 80% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolMult.cxx rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolMult.cxx index 591827f69aa..014f74cc6c1 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolMult.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolMult.cxx @@ -3,18 +3,18 @@ */ #include "TrigCompositeUtils/Combinators.h" #include "TrigCompositeUtils/TrigCompositeUtils.h" -#include "TrigL2CaloHypoToolMult.h" +#include "TrigEgammaFastCaloHypoToolMult.h" using namespace TrigCompositeUtils; -TrigL2CaloHypoToolMult::TrigL2CaloHypoToolMult( const std::string& type, +TrigEgammaFastCaloHypoToolMult::TrigEgammaFastCaloHypoToolMult( const std::string& type, const std::string& name, const IInterface* parent ) : base_class( type, name, parent ), m_decisionId( HLT::Identifier::fromToolName( name ) ) {} -TrigL2CaloHypoToolMult::~TrigL2CaloHypoToolMult() {} +TrigEgammaFastCaloHypoToolMult::~TrigEgammaFastCaloHypoToolMult() {} -StatusCode TrigL2CaloHypoToolMult::initialize() { +StatusCode TrigEgammaFastCaloHypoToolMult::initialize() { if( m_subTools.size() <= 1 ) { ATH_MSG_ERROR( "Number of sub tools " << m_subTools.size() << ", while it has to be > 1, otherwise this is not a multiplicity selection" ); return StatusCode::FAILURE; @@ -23,7 +23,7 @@ StatusCode TrigL2CaloHypoToolMult::initialize() { return StatusCode::SUCCESS; } -StatusCode TrigL2CaloHypoToolMult::decide( std::vector<ITrigL2CaloHypoTool::ClusterInfo>& input ) const { +StatusCode TrigEgammaFastCaloHypoToolMult::decide( std::vector<ITrigEgammaFastCaloHypoTool::FastClusterInfo>& input ) const { HLT::Index2DVec passingSelection( m_subTools.size() ); ATH_MSG_DEBUG( "Applying selection of multiplicity " << m_subTools.size() ); diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolMult.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolMult.h similarity index 52% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolMult.h rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolMult.h index c3e3ea7e175..1cfbb0d1c05 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolMult.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolMult.h @@ -1,8 +1,8 @@ /* Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGEGAMMAHYPO_TRIGL2CALOHYPOTOOLMULT_H -#define TRIGEGAMMAHYPO_TRIGL2CALOHYPOTOOLMULT_H 1 +#ifndef TRIGEGAMMAHYPO_TRIGEGAMMFASTCALOHYPOTOOLMULT_H +#define TRIGEGAMMAHYPO_TRIGEGAMMAFASTCALOHYPOTOOLMULT_H 1 //#include "GaudiKernel/IAlgTool.h" #include "CLHEP/Units/SystemOfUnits.h" @@ -12,7 +12,7 @@ #include "AthenaMonitoringKernel/GenericMonitoringTool.h" #include "TrigCompositeUtils/HLTIdentifier.h" #include "TrigCompositeUtils/TrigCompositeUtils.h" -#include "ITrigL2CaloHypoTool.h" +#include "ITrigEgammaFastCaloHypoTool.h" @@ -21,18 +21,18 @@ * @brief **/ -class TrigL2CaloHypoToolMult : public extends<AthAlgTool, ITrigL2CaloHypoTool> { +class TrigEgammaFastCaloHypoToolMult : public extends<AthAlgTool, ITrigEgammaFastCaloHypoTool> { public: - TrigL2CaloHypoToolMult( const std::string& type, + TrigEgammaFastCaloHypoToolMult( const std::string& type, const std::string& name, const IInterface* parent ); - virtual ~TrigL2CaloHypoToolMult(); + virtual ~TrigEgammaFastCaloHypoToolMult(); virtual StatusCode initialize() override; - virtual StatusCode decide( std::vector<ITrigL2CaloHypoTool::ClusterInfo>& input ) const override; + virtual StatusCode decide( std::vector<ITrigEgammaFastCaloHypoTool::FastClusterInfo>& input ) const override; - virtual bool decide( const ITrigL2CaloHypoTool::ClusterInfo& ) const override { + virtual bool decide( const ITrigEgammaFastCaloHypoTool::FastClusterInfo& ) const override { REPORT_MESSAGE(MSG::ERROR) << "this method should never be called"; return false; } @@ -40,8 +40,8 @@ class TrigL2CaloHypoToolMult : public extends<AthAlgTool, ITrigL2CaloHypoTool> { private: HLT::Identifier m_decisionId; - ToolHandleArray<ITrigL2CaloHypoTool> m_subTools { this, "SubTools", {}, "Sub tools performing cuts" }; + ToolHandleArray<ITrigEgammaFastCaloHypoTool> m_subTools { this, "SubTools", {}, "Sub tools performing cuts" }; }; -#endif //> !TRIGEGAMMAHYPO_TRIGL2CALOHYPOTOOLMULT_H +#endif //> !TRIGEGAMMAHYPO_TRIGEgammaFastCALOHYPOTOOLMULT_H diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFexMT.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronFexMT.cxx similarity index 96% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFexMT.cxx rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronFexMT.cxx index d1f20430465..92d9fea388c 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFexMT.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronFexMT.cxx @@ -20,7 +20,7 @@ **************************************************************************/ #include "TrkCaloExtension/CaloExtensionHelpers.h" -#include "TrigL2ElectronFexMT.h" +#include "TrigEgammaFastElectronFexMT.h" #include "xAODTrigCalo/TrigEMClusterContainer.h" #include "xAODTrigCalo/TrigEMClusterAuxContainer.h" #include "AthenaMonitoringKernel/Monitored.h" @@ -32,7 +32,7 @@ inline const DataVector<xAOD::TrigElectron>** dvec_cast(SRC** ptr) { } -TrigL2ElectronFexMT::TrigL2ElectronFexMT(const std::string & name, ISvcLocator* pSvcLocator) +TrigEgammaFastElectronFexMT::TrigEgammaFastElectronFexMT(const std::string & name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator) { @@ -40,11 +40,11 @@ TrigL2ElectronFexMT::TrigL2ElectronFexMT(const std::string & name, ISvcLocator* } -TrigL2ElectronFexMT::~TrigL2ElectronFexMT() +TrigEgammaFastElectronFexMT::~TrigEgammaFastElectronFexMT() {} -StatusCode TrigL2ElectronFexMT::initialize() +StatusCode TrigEgammaFastElectronFexMT::initialize() { ATH_MSG_DEBUG("Initialization:"); @@ -85,7 +85,7 @@ ATH_CHECK( m_outputElectronsKey.initialize() ); } -StatusCode TrigL2ElectronFexMT::finalize() +StatusCode TrigEgammaFastElectronFexMT::finalize() { if (m_extrapolator_failed) ATH_MSG_INFO("track extrapolation failed " << m_extrapolator_failed << " times"); @@ -94,7 +94,7 @@ StatusCode TrigL2ElectronFexMT::finalize() } -StatusCode TrigL2ElectronFexMT::execute() { +StatusCode TrigEgammaFastElectronFexMT::execute() { using namespace xAOD; ATH_MSG_DEBUG( "Executing " <<name()); @@ -301,7 +301,7 @@ StatusCode TrigL2ElectronFexMT::execute() { return StatusCode::SUCCESS; } -bool TrigL2ElectronFexMT::extrapolate(const xAOD::TrigEMCluster *clus, const xAOD::TrackParticle *trk, double &etaAtCalo, double &phiAtCalo){ +bool TrigEgammaFastElectronFexMT::extrapolate(const xAOD::TrigEMCluster *clus, const xAOD::TrackParticle *trk, double &etaAtCalo, double &phiAtCalo){ CaloExtensionHelpers::LayersToSelect layersToSelect; layersToSelect.insert(CaloSampling::CaloSample::EMB2); layersToSelect.insert(CaloSampling::CaloSample::EME2); diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFexMT.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronFexMT.h similarity index 92% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFexMT.h rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronFexMT.h index 51f8352966e..a074822965c 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFexMT.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronFexMT.h @@ -18,8 +18,8 @@ ** Created: 27 Jul 2017 **************************************************************************/ -#ifndef TRIG_TrigL2ElectronFexMT_H -#define TRIG_TrigL2ElectronFexMT_H +#ifndef TRIG_TrigEgammaFastElectronFexMT_H +#define TRIG_TrigEgammaFastElectronFexMT_H // standard stuff #include <vector> @@ -52,23 +52,23 @@ //{ class IParticleCaloExtensionTool; } /** - * \class TrigL2ElectronFexMT - * \brief TrigL2ElectronFexMT is a Trigger Fex Algorithm that retrieves the L2 TrigEMCluster + * \class TrigEgammaFastElectronFexMT + * \brief TrigEgammaFastElectronFexMT is a Trigger Fex Algorithm that retrieves the L2 TrigEMCluster * container and the L2 TrackCollection containers and then creates a TrigElectron Container * with a subset of calorimeter-ID selection variables that are calculated (eg. E/p) * TrigL2ElectronFexMT will apply some very loose selection cuts to the TrigElectronContainer created * which is of TrigParticle type TrigElectron - * The TrigElectron conatiner will then be retrieved by the hypothesis algorithm TrigL2ElectronHypo + * The TrigElectron conatiner will then be retrieved by the hypothesis algorithm TrigEgammaFastElectronHypo * that will perform the corresponding L2 electron selection * */ -class TrigL2ElectronFexMT : public AthAlgorithm { +class TrigEgammaFastElectronFexMT : public AthAlgorithm { public: - TrigL2ElectronFexMT(const std::string & name, ISvcLocator* pSvcLocator); - ~TrigL2ElectronFexMT(); + TrigEgammaFastElectronFexMT(const std::string & name, ISvcLocator* pSvcLocator); + ~TrigEgammaFastElectronFexMT(); virtual StatusCode initialize() override; virtual StatusCode finalize() override; diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoAlgMT.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoAlgMT.cxx similarity index 89% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoAlgMT.cxx rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoAlgMT.cxx index 7b49b7f03b6..44a064fd9ee 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoAlgMT.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoAlgMT.cxx @@ -3,7 +3,7 @@ */ #include <map> #include "GaudiKernel/Property.h" -#include "TrigL2ElectronHypoAlgMT.h" +#include "TrigEgammaFastElectronHypoAlgMT.h" #include "AthViews/ViewHelper.h" @@ -19,12 +19,12 @@ using TrigCompositeUtils::featureString; using TrigCompositeUtils::findLink; using TrigCompositeUtils::LinkInfo; -TrigL2ElectronHypoAlgMT::TrigL2ElectronHypoAlgMT( const std::string& name, +TrigEgammaFastElectronHypoAlgMT::TrigEgammaFastElectronHypoAlgMT( const std::string& name, ISvcLocator* pSvcLocator ) : ::HypoBase( name, pSvcLocator ) {} -StatusCode TrigL2ElectronHypoAlgMT::initialize() { +StatusCode TrigEgammaFastElectronHypoAlgMT::initialize() { CHECK( m_hypoTools.retrieve() ); CHECK( m_electronsKey.initialize() ); @@ -33,7 +33,7 @@ StatusCode TrigL2ElectronHypoAlgMT::initialize() { return StatusCode::SUCCESS; } -StatusCode TrigL2ElectronHypoAlgMT::execute( const EventContext& context ) const { +StatusCode TrigEgammaFastElectronHypoAlgMT::execute( const EventContext& context ) const { ATH_MSG_DEBUG ( "Executing " << name() << "..." ); auto previousDecisionsHandle = SG::makeHandle( decisionInput(), context ); ATH_CHECK( previousDecisionsHandle.isValid() ); @@ -60,7 +60,7 @@ StatusCode TrigL2ElectronHypoAlgMT::execute( const EventContext& context ) const ATH_MSG_DEBUG( "Cluster ptr to decision map has size " << clusterToIndexMap.size() ); // prepare imput for tools - std::vector<TrigL2ElectronHypoTool::ElectronInfo> hypoToolInput; + std::vector<TrigEgammaFastElectronHypoTool::ElectronInfo> hypoToolInput; for ( auto previousDecision: *previousDecisionsHandle ) { // get View @@ -93,7 +93,7 @@ StatusCode TrigL2ElectronHypoAlgMT::execute( const EventContext& context ) const DecisionIDContainer clusterDecisionIDs; decisionIDs( previousDecisionsHandle->at( origCluster->second ), clusterDecisionIDs ); - hypoToolInput.emplace_back( TrigL2ElectronHypoTool::ElectronInfo{ d, *electronIter, origCluster->first, clusterDecisionIDs } ); + hypoToolInput.emplace_back( TrigEgammaFastElectronHypoTool::ElectronInfo{ d, *electronIter, origCluster->first, clusterDecisionIDs } ); } } diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoAlgMT.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoAlgMT.h similarity index 61% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoAlgMT.h rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoAlgMT.h index e2bdab66c17..50e6206c871 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoAlgMT.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoAlgMT.h @@ -1,8 +1,8 @@ /* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGEGAMMAHYPO_TRIGL2ELECTRONHYPOALGMT_H -#define TRIGEGAMMAHYPO_TRIGL2ELECTRONHYPOALGMT_H 1 +#ifndef TRIGEGAMMAHYPO_TRIGEGAMMAFASTELECTRONHYPOALGMT_H +#define TRIGEGAMMAHYPO_TRIGEGAMMAFASTELECTRONHYPOALGMT_H 1 #include <string> @@ -11,30 +11,30 @@ #include "TrigCompositeUtils/TrigCompositeUtils.h" #include "AthViews/View.h" -#include "TrigL2ElectronHypoTool.h" +#include "TrigEgammaFastElectronHypoTool.h" #include "xAODTrigCalo/TrigEMClusterContainer.h" #include "DecisionHandling/HypoBase.h" /** - * @class TrigL2ElectronHypoAlgMT + * @class TrigEgammaFastElectronHypoAlgMT * @brief Implements Hypo selection on L2 electrons **/ -class TrigL2ElectronHypoAlgMT : public ::HypoBase +class TrigEgammaFastElectronHypoAlgMT : public ::HypoBase { public: - TrigL2ElectronHypoAlgMT( const std::string& name, ISvcLocator* pSvcLocator ); + TrigEgammaFastElectronHypoAlgMT( const std::string& name, ISvcLocator* pSvcLocator ); virtual StatusCode initialize() override; virtual StatusCode execute(const EventContext& context) const override; private: - ToolHandleArray< TrigL2ElectronHypoTool > m_hypoTools {this, "HypoTools", {}, "Tools to perfrom selection"}; + ToolHandleArray< TrigEgammaFastElectronHypoTool > m_hypoTools {this, "HypoTools", {}, "Tools to perfrom selection"}; Gaudi::Property< bool > m_runInView { this, "RunInView", false , "Set input DH for running in views" }; // internally used to getch from views SG::ReadHandleKey< xAOD::TrigElectronContainer > m_electronsKey {this, "Electrons", "L2ElectronContainer", "Input"}; }; -#endif //> !TRIGEGAMMAHYPO_TRIGL2ELECTRONHYPOALGMT_H +#endif //> !TRIGEGAMMAHYPO_TRIGEGAMMAFASTELECTRONHYPOALGMT_H diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoTool.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoTool.cxx similarity index 89% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoTool.cxx rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoTool.cxx index eb65eabc6df..b9f4af0006d 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoTool.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoTool.cxx @@ -7,17 +7,17 @@ #include "TrigCompositeUtils/Combinators.h" #include "AthenaMonitoringKernel/Monitored.h" -#include "TrigL2ElectronHypoTool.h" +#include "TrigEgammaFastElectronHypoTool.h" using namespace TrigCompositeUtils; -TrigL2ElectronHypoTool::TrigL2ElectronHypoTool( const std::string& type, +TrigEgammaFastElectronHypoTool::TrigEgammaFastElectronHypoTool( const std::string& type, const std::string& name, const IInterface* parent ) : AthAlgTool( type, name, parent ), m_decisionId( HLT::Identifier::fromToolName( name ) ) {} -StatusCode TrigL2ElectronHypoTool::initialize() { +StatusCode TrigEgammaFastElectronHypoTool::initialize() { if ( !m_monTool.empty() ) CHECK( m_monTool.retrieve() ); @@ -46,9 +46,9 @@ StatusCode TrigL2ElectronHypoTool::initialize() { } -TrigL2ElectronHypoTool::~TrigL2ElectronHypoTool() {} +TrigEgammaFastElectronHypoTool::~TrigEgammaFastElectronHypoTool() {} -bool TrigL2ElectronHypoTool::decideOnSingleObject( const xAOD::TrigElectron* electron, +bool TrigEgammaFastElectronHypoTool::decideOnSingleObject( const xAOD::TrigElectron* electron, size_t cutIndex ) const { auto cutCounter = Monitored::Scalar<int>( "CutCounter", -1 ); auto cutIndexM = Monitored::Scalar<int>( "CutIndex", cutIndex ); // one can do 2D plots for each cut independently @@ -122,7 +122,7 @@ bool TrigL2ElectronHypoTool::decideOnSingleObject( const xAOD::TrigElectron* ele } -StatusCode TrigL2ElectronHypoTool::inclusiveSelection( std::vector<ElectronInfo>& input ) const { +StatusCode TrigEgammaFastElectronHypoTool::inclusiveSelection( std::vector<ElectronInfo>& input ) const { for ( auto i: input ) { if ( i.previousDecisionIDs.count( m_decisionId.numeric() ) == 0 ) continue; // the decision was negative or not even made in previous stage @@ -135,7 +135,7 @@ StatusCode TrigL2ElectronHypoTool::inclusiveSelection( std::vector<ElectronInfo> } -StatusCode TrigL2ElectronHypoTool::markPassing( std::vector<ElectronInfo>& input, const std::set<size_t>& passing ) const { +StatusCode TrigEgammaFastElectronHypoTool::markPassing( std::vector<ElectronInfo>& input, const std::set<size_t>& passing ) const { for ( auto idx: passing ) addDecisionID( m_decisionId.numeric(), input[idx].decision ); @@ -143,7 +143,7 @@ StatusCode TrigL2ElectronHypoTool::markPassing( std::vector<ElectronInfo>& input } -StatusCode TrigL2ElectronHypoTool::multiplicitySelection( std::vector<ElectronInfo>& input ) const { +StatusCode TrigEgammaFastElectronHypoTool::multiplicitySelection( std::vector<ElectronInfo>& input ) const { HLT::Index2DVec passingSelection( m_multiplicity ); for ( size_t cutIndex = 0; cutIndex < m_multiplicity; ++ cutIndex ) { @@ -186,7 +186,7 @@ StatusCode TrigL2ElectronHypoTool::multiplicitySelection( std::vector<ElectronIn return markPassing( input, passingIndices ); } -StatusCode TrigL2ElectronHypoTool::decide( std::vector<ElectronInfo>& input ) const { +StatusCode TrigEgammaFastElectronHypoTool::decide( std::vector<ElectronInfo>& input ) const { // handle the simplest and most common case ( multiplicity == 1 ) in easiest possible manner if ( m_trackPt.size() == 1 ) { return inclusiveSelection( input ); diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoTool.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoTool.h similarity index 90% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoTool.h rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoTool.h index 736ad880869..d44c13333af 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoTool.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoTool.h @@ -1,8 +1,8 @@ /* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGEGAMMAHYPO_TRIGL2ELECTRONHYPOTOOL_H -#define TRIGEGAMMAHYPO_TRIGL2ELECTRONHYPOTOOL_H 1 +#ifndef TRIGEGAMMAHYPO_TRIGEGAMMAFASTELECTRONHYPOTOOL_H +#define TRIGEGAMMAHYPO_TRIGEGAMMAFASTELECTRONHYPOTOOL_H 1 #include "GaudiKernel/Property.h" #include "CLHEP/Units/SystemOfUnits.h" @@ -19,14 +19,14 @@ * @brief **/ -class TrigL2ElectronHypoTool : virtual public ::AthAlgTool +class TrigEgammaFastElectronHypoTool : virtual public ::AthAlgTool { public: - TrigL2ElectronHypoTool( const std::string& type, + TrigEgammaFastElectronHypoTool( const std::string& type, const std::string& name, const IInterface* parent ); - virtual ~TrigL2ElectronHypoTool(); + virtual ~TrigEgammaFastElectronHypoTool(); virtual StatusCode initialize() override; @@ -85,4 +85,4 @@ class TrigL2ElectronHypoTool : virtual public ::AthAlgTool ToolHandle<GenericMonitoringTool> m_monTool{ this, "MonTool", "", "Monitoring tool" }; }; -#endif //> !TRIGEGAMMAHYPO_TRIGL2CALOHYPOTOOL_H +#endif //> !TRIGEGAMMAHYPO_TRIGEGAMMAFASTCALOHYPOTOOL_H diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolInc.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolInc.cxx deleted file mode 100644 index 1d7cdc08f70..00000000000 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolInc.cxx +++ /dev/null @@ -1,399 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include <algorithm> -#include "TrigCompositeUtils/HLTIdentifier.h" -#include "TrigCompositeUtils/Combinators.h" -#include "AthenaMonitoringKernel/Monitored.h" -#include "GaudiKernel/SystemOfUnits.h" - -#include "TrigL2CaloHypoToolInc.h" - - -using namespace TrigCompositeUtils; - -TrigL2CaloHypoToolInc::TrigL2CaloHypoToolInc( const std::string& type, - const std::string& name, - const IInterface* parent ) - : base_class( type, name, parent ), - m_selectorTool(), - m_lumiBlockMuTool("LumiBlockMuTool/LumiBlockMuTool"), - m_decisionId( HLT::Identifier::fromToolName( name ) ) -{ -declareProperty("LumiBlockMuTool", m_lumiBlockMuTool, "Luminosity Tool" ); -} - -StatusCode TrigL2CaloHypoToolInc::initialize() { - -ATH_MSG_DEBUG("Name: "<<name()<<" UseRinger: "<<m_useRinger); - -if (m_useRinger){ - m_selectorTool.setConstantsCalibPath( m_constantsCalibPath ); - m_selectorTool.setThresholdsCalibPath( m_thresholdsCalibPath ); - - if(m_selectorTool.initialize().isFailure()) - return StatusCode::FAILURE; - - if (m_lumiBlockMuTool.retrieve().isFailure()) - return StatusCode::FAILURE; - - ATH_MSG_INFO("TrigL2CaloRingerHypo initialization completed successfully."); - -} - ATH_MSG_DEBUG( "Initialization completed successfully" ); - ATH_MSG_DEBUG( "AcceptAll = " << ( m_acceptAll==true ? "True" : "False" ) ); - ATH_MSG_DEBUG( "EtaBins = " << m_etabin ); - ATH_MSG_DEBUG( "ETthr = " << m_eTthr << "( lo )/" << m_eT2thr << "( hi )" ); - ATH_MSG_DEBUG( "HADETthr = " << m_hadeTthr << "( lo )/" << m_hadeT2thr << "( hi )" ); - ATH_MSG_DEBUG( "CARCOREthr = " << m_carcorethr ); - ATH_MSG_DEBUG( "CAERATIOthr = " << m_caeratiothr ); - ATH_MSG_DEBUG( "dPHICLUSTERthr = " << m_dphicluster ); - ATH_MSG_DEBUG( "dETACLUSTERthr = " << m_detacluster ); - ATH_MSG_DEBUG( "WETA2thr = " << m_WETA2thr ); - ATH_MSG_DEBUG( "WSTOTthr = " << m_WSTOTthr ); - ATH_MSG_DEBUG( "F3thr = " << m_F3thr ); - - if ( m_etabin.size() == 0 ) { - ATH_MSG_ERROR( " There are no cuts set (EtaBins property is an empty list)" ); - return StatusCode::FAILURE; - } - - unsigned int nEtaBin = m_etabin.size(); -#define CHECK_SIZE( __n) if ( m_##__n.size() != (nEtaBin - 1) ) \ - { ATH_MSG_DEBUG(" __n size is " << m_##__n.size() << " but needs to be " << (nEtaBin - 1) ); return StatusCode::FAILURE; } - - CHECK_SIZE( eTthr ); - CHECK_SIZE( eT2thr ); - CHECK_SIZE( hadeTthr ); - CHECK_SIZE( hadeT2thr ); - CHECK_SIZE( carcorethr ); - CHECK_SIZE( caeratiothr ); - CHECK_SIZE( WETA2thr ); - CHECK_SIZE( WSTOTthr ); - CHECK_SIZE( F3thr ); -#undef CHECK_SIZE - - ATH_MSG_DEBUG( "Tool configured for chain/id: " << m_decisionId ); - - if ( not m_monTool.name().empty() ) - CHECK( m_monTool.retrieve() ); - - return StatusCode::SUCCESS; -} - - - -TrigL2CaloHypoToolInc::~TrigL2CaloHypoToolInc(){} - - -bool TrigL2CaloHypoToolInc::decide( const ITrigL2CaloHypoTool::ClusterInfo& input ) const { - - bool pass = false; - - if ( m_acceptAll ) { - pass = true; - ATH_MSG_DEBUG( "AcceptAll property is set: taking all events" ); - } else { - pass = false; - ATH_MSG_DEBUG( "AcceptAll property not set: applying selection" ); - } - - // TB Not sure if anything else than the CutCounter should monitored it in every cut tool, - // Should quantitities be filled only after the succesful selection? - - auto monEta = Monitored::Scalar("Eta",-100); - auto monPhi = Monitored::Scalar("Phi",-100); - - if(m_useRinger){ - auto etMon = Monitored::Scalar("Et",-100); - auto rnnOutMon = Monitored::Scalar("RnnOut",-100); - auto total_time = Monitored::Timer("TIME_total"); - auto propagate_time = Monitored::Timer("TIME_propagate"); - auto preproc_time = Monitored::Timer("TIME_preproc"); - auto decide_time = Monitored::Timer("TIME_decide"); - auto mon = Monitored::Group(m_monTool,etMon,monEta,monPhi,rnnOutMon,total_time,propagate_time,preproc_time,decide_time); - - total_time.start(); - auto ringerShape = input.ringerShape; - const xAOD::TrigEMCluster *emCluster = 0; - if(ringerShape){ - emCluster = ringerShape->emCluster(); - //emCluster= input.cluster; - if(!emCluster){ - ATH_MSG_WARNING( "There is no link to xAOD::TrigEMCluster into the Ringer object."); - return false; - } - } - else{ - ATH_MSG_WARNING( "There is no xAOD::TrigRingerRings link into the rnnOutput object."); - return false; - } - - float eta = std::fabs(emCluster->eta()); - float et = emCluster->et() / Gaudi::Units::GeV; - float avgmu = m_lumiBlockMuTool->averageInteractionsPerCrossing(); - - if(eta>2.50) eta=2.50;///fix for events out of the ranger - - // make sure that monitoring histogram will plotting only the events of chain. - ///Et threshold - if(et < m_emEtCut/Gaudi::Units::GeV){ - ATH_MSG_DEBUG( "Event reproved by Et threshold. Et = " << et << ", EtCut = " << m_emEtCut/Gaudi::Units::GeV); - return false; - } - - monEta = emCluster->eta(); - etMon = emCluster->et(); - monPhi = emCluster->phi(); - - const std::vector<float> rings = ringerShape->rings(); - std::vector<float> refRings(rings.size()); - refRings.assign(rings.begin(), rings.end()); - - ATH_MSG_DEBUG("Et = "<< et << " Eta = "<<eta << " mu = " << avgmu << "rsize = "<< refRings.size()); - - auto output = m_selectorTool.calculate( refRings, et, eta, avgmu, propagate_time, preproc_time ); - rnnOutMon = output; - ATH_MSG_DEBUG(name()<< " generate as NN output " << output ); - - decide_time.start(); - bool accept = m_selectorTool.accept(output, et,eta,avgmu); - decide_time.stop(); - - total_time.stop(); - return accept; - } - - else{ - auto dEta = Monitored::Scalar( "dEta", -1. ); - auto dPhi = Monitored::Scalar( "dPhi", -1. ); - auto eT_T2Calo = Monitored::Scalar( "Et_em" , -1.0 ); - auto hadET_T2Calo = Monitored::Scalar( "Et_had", -1.0 ); - auto rCore = Monitored::Scalar( "RCore" , -1.0 ); - auto energyRatio = Monitored::Scalar( "ERatio" , -1.0 ); - auto etaBin = Monitored::Scalar( "EtaBin", -1. ); - auto monEta = Monitored::Scalar( "Eta", -99. ); - auto monPhi = Monitored::Scalar( "Phi", -99. ); - auto F1 = Monitored::Scalar( "F1" , -1.0 ); - auto Weta2 = Monitored::Scalar( "Weta2" , -1.0 ); - auto Wstot = Monitored::Scalar( "Wstot" , -1.0 ); - auto F3 = Monitored::Scalar( "F3" , -1.0 ); - auto PassedCuts = Monitored::Scalar<int>( "CutCounter", -1 ); - auto monitorIt = Monitored::Group( m_monTool, - dEta, dPhi, eT_T2Calo, hadET_T2Calo, - rCore, energyRatio, etaBin, monEta, - monPhi, F1, Weta2, Wstot, F3, PassedCuts ); - // when leaving scope it will ship data to monTool - PassedCuts = PassedCuts + 1; //got called (data in place) - - auto roiDescriptor = input.roi; - - - if ( fabs( roiDescriptor->eta() ) > 2.6 ) { - ATH_MSG_DEBUG( "REJECT The cluster had eta coordinates beyond the EM fiducial volume : " << roiDescriptor->eta() << "; stop the chain now" ); - pass=false; // special case - return pass; - } - - ATH_MSG_DEBUG( "; RoI ID = " << roiDescriptor->roiId() - << ": Eta = " << roiDescriptor->eta() - << ", Phi = " << roiDescriptor->phi() ); - - // fill local variables for RoI reference position - double etaRef = roiDescriptor->eta(); - double phiRef = roiDescriptor->phi(); - // correct phi the to right range ( probably not needed anymore ) - if ( fabs( phiRef ) > M_PI ) phiRef -= 2*M_PI; // correct phi if outside range - - auto pClus = input.cluster; - - float absEta = fabs( pClus->eta() ); - etaBin = -1; - monEta = pClus->eta(); - monPhi = pClus->phi(); - - const int cutIndex = findCutIndex( absEta ); - - // find if electron is in calorimeter crack - bool inCrack = ( absEta > 2.37 || ( absEta > 1.37 && absEta < 1.52 ) ); - - - dEta = pClus->eta() - etaRef; - // Deal with angle diferences greater than Pi - dPhi = fabs( pClus->phi() - phiRef ); - dPhi = ( dPhi < M_PI ? dPhi : 2*M_PI - dPhi ); // TB why only < - - - // calculate cluster quantities // definition taken from TrigElectron constructor - if ( pClus->emaxs1() + pClus->e2tsts1() > 0 ) - energyRatio = ( pClus->emaxs1() - pClus->e2tsts1() ) / ( pClus->emaxs1() + pClus->e2tsts1() ); - - // ( VD ) here the definition is a bit different to account for the cut of e277 @ EF - if ( pClus->e277()!= 0. ) rCore = pClus->e237() / pClus->e277(); - - //fraction of energy deposited in 1st sampling - - if ( fabs( pClus->energy() ) > 0.00001 ) F1 = ( pClus->energy( CaloSampling::EMB1 )+pClus->energy( CaloSampling::EME1 ) )/pClus->energy(); - - eT_T2Calo = pClus->et(); - - if ( eT_T2Calo!=0 && pClus->eta()!=0 ) hadET_T2Calo = pClus->ehad1()/cosh( fabs( pClus->eta() ) )/eT_T2Calo; - - - //extract Weta2 varable - Weta2 = pClus->weta2(); - - //extract Wstot varable - Wstot = pClus->wstot(); - - //extract F3 ( backenergy i EM calorimeter - float e0 = pClus->energy( CaloSampling::PreSamplerB ) + pClus->energy( CaloSampling::PreSamplerE ); - float e1 = pClus->energy( CaloSampling::EMB1 ) + pClus->energy( CaloSampling::EME1 ); - float e2 = pClus->energy( CaloSampling::EMB2 ) + pClus->energy( CaloSampling::EME2 ); - float e3 = pClus->energy( CaloSampling::EMB3 ) + pClus->energy( CaloSampling::EME3 ); - float eallsamples = e0+e1+e2+e3; - F3 = fabs( eallsamples )>0. ? e3/eallsamples : 0.; - - // apply cuts: DeltaEta( clus-ROI ) - ATH_MSG_DEBUG( "TrigEMCluster: eta=" << pClus->eta() - << " roi eta=" << etaRef << " DeltaEta=" << dEta - << " cut: <" << m_detacluster ); - - if ( fabs( pClus->eta() - etaRef ) > m_detacluster ) { - ATH_MSG_DEBUG("REJECT Cluster dEta cut failed"); - return pass; - } - PassedCuts = PassedCuts + 1; //Deta - - // DeltaPhi( clus-ROI ) - ATH_MSG_DEBUG( ": phi=" << pClus->phi() - << " roi phi="<< phiRef << " DeltaPhi="<< dPhi - << " cut: <" << m_dphicluster ); - - if( dPhi > m_dphicluster ) { - ATH_MSG_DEBUG("REJECT Clsuter dPhi cut failed"); - return pass; - } - PassedCuts = PassedCuts + 1; //DPhi - - // eta range - if ( cutIndex == -1 ) { // VD - ATH_MSG_DEBUG( "Cluster eta: " << absEta << " outside eta range " << m_etabin[m_etabin.size()-1] ); - return pass; - } - else { - ATH_MSG_DEBUG( "eta bin used for cuts " << cutIndex ); - } - PassedCuts = PassedCuts + 1; // passed eta cut - - // Rcore - ATH_MSG_DEBUG ( "TrigEMCluster: Rcore=" << rCore - << " cut: >" << m_carcorethr[cutIndex] ); - if ( rCore < m_carcorethr[cutIndex] ) { - ATH_MSG_DEBUG("REJECT rCore cut failed"); - return pass; - } - PassedCuts = PassedCuts + 1; //Rcore - - // Eratio - ATH_MSG_DEBUG( " cut: >" << m_caeratiothr[cutIndex] ); - if ( inCrack || F1 < m_F1thr[0] ) { - ATH_MSG_DEBUG ( "TrigEMCluster: InCrack= " << inCrack << " F1=" << F1 ); - } - else { - if ( energyRatio < m_caeratiothr[cutIndex] ) { - ATH_MSG_DEBUG("REJECT e ratio cut failed"); - return pass; - } - } - PassedCuts = PassedCuts + 1; //Eratio - if( inCrack ) energyRatio = -1; //Set default value in crack for monitoring. - - // ET_em - ATH_MSG_DEBUG( "TrigEMCluster: ET_em=" << eT_T2Calo << " cut: >" << m_eTthr[cutIndex] ); - if ( eT_T2Calo < m_eTthr[cutIndex] ) { - ATH_MSG_DEBUG("REJECT et cut failed"); - return pass; - } - PassedCuts = PassedCuts + 1; // ET_em - - float hadET_cut = 0.0; - // find which ET_had to apply : this depends on the ET_em and the eta bin - if ( eT_T2Calo > m_eT2thr[cutIndex] ) { - hadET_cut = m_hadeT2thr[cutIndex] ; - ATH_MSG_DEBUG ( "ET_em>" << m_eT2thr[cutIndex] << ": use high ET_had cut: <" << hadET_cut ); - } - else { - hadET_cut = m_hadeTthr[cutIndex]; - ATH_MSG_DEBUG ( "ET_em<" << m_eT2thr[cutIndex] << ": use low ET_had cut: <" << hadET_cut ); - } - - // ET_had - ATH_MSG_DEBUG ( "TrigEMCluster: ET_had=" << hadET_T2Calo << " cut: <" << hadET_cut ); - - if ( hadET_T2Calo > hadET_cut ) { - ATH_MSG_DEBUG("REJECT et had cut failed"); - return pass; - } - PassedCuts = PassedCuts + 1; //ET_had - - // F1 - ATH_MSG_DEBUG ( "TrigEMCluster: F1=" << F1 << " cut: >" << m_F1thr[0] ); - PassedCuts = PassedCuts + 1; //F1 - - //Weta2 - ATH_MSG_DEBUG ( "TrigEMCluster: Weta2=" << Weta2 << " cut: <" << m_WETA2thr[cutIndex] ); - if ( Weta2 > m_WETA2thr[cutIndex] ) { - ATH_MSG_DEBUG("REJECT weta 2 cut failed"); - return pass; - } - PassedCuts = PassedCuts + 1; //Weta2 - - //Wstot - ATH_MSG_DEBUG ( "TrigEMCluster: Wstot=" <<Wstot << " cut: <" << m_WSTOTthr[cutIndex] ); - if ( Wstot >= m_WSTOTthr[cutIndex] ) { - ATH_MSG_DEBUG("REJECT wstot cut failed"); - return pass; - } - PassedCuts = PassedCuts + 1; //Wstot - - //F3 - ATH_MSG_DEBUG( "TrigEMCluster: F3=" << F3 << " cut: <" << m_F3thr[cutIndex] ); - if ( F3 > m_F3thr[cutIndex] ) { - ATH_MSG_DEBUG("REJECT F3 cut failed"); - return pass; - } - PassedCuts = PassedCuts + 1; //F3 - - // got this far => passed! - pass = true; - - // Reach this point successfully - ATH_MSG_DEBUG( "pass = " << pass ); - - return pass; - } -} - -int TrigL2CaloHypoToolInc::findCutIndex( float eta ) const { - const float absEta = std::abs(eta); - - auto binIterator = std::adjacent_find( m_etabin.begin(), m_etabin.end(), [=](float left, float right){ return left < absEta and absEta < right; } ); - if ( binIterator == m_etabin.end() ) { - return -1; - } - return binIterator - m_etabin.begin(); -} - - -StatusCode TrigL2CaloHypoToolInc::decide( std::vector<ClusterInfo>& input ) const { - for ( auto& i: input ) { - if ( passed ( m_decisionId.numeric(), i.previousDecisionIDs ) ) { - if ( decide( i ) ) { - addDecisionID( m_decisionId, i.decision ); - } - } - } - return StatusCode::SUCCESS; -} diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonHypoAlgMT.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonHypoAlgMT.h index 124f3525503..d70297853d4 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonHypoAlgMT.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonHypoAlgMT.h @@ -16,7 +16,7 @@ #include "TrigL2PhotonHypoTool.h" #include "xAODTrigCalo/TrigEMClusterContainer.h" #include "DecisionHandling/HypoBase.h" -#include "ITrigL2CaloHypoTool.h" +#include "ITrigEgammaFastCaloHypoTool.h" /** diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/components/TrigEgammaHypo_entries.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/components/TrigEgammaHypo_entries.cxx index 0c90140201c..b2f6e16038e 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/components/TrigEgammaHypo_entries.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/components/TrigEgammaHypo_entries.cxx @@ -13,15 +13,15 @@ #include "TrigEgammaHypo/TrigEFPhotonHypo.h" #include "TrigEgammaHypo/TrigEFTrackHypo.h" #include "TrigEgammaHypo/TrigL2CaloLayersHypo.h" -#include "../TrigL2CaloHypoAlgMT.h" -#include "../TrigL2CaloHypoToolInc.h" +#include "../TrigEgammaFastCaloHypoAlgMT.h" +#include "../TrigEgammaFastCaloHypoToolInc.h" #include "../TrigEgammaPrecisionCaloHypoToolInc.h" #include "../TrigEgammaPrecisionPhotonHypoToolInc.h" #include "../TrigEgammaPrecisionElectronHypoToolInc.h" -#include "../TrigL2CaloHypoToolMult.h" -#include "../TrigL2ElectronHypoTool.h" -#include "../TrigL2ElectronFexMT.h" -#include "../TrigL2ElectronHypoAlgMT.h" +#include "../TrigEgammaFastCaloHypoToolMult.h" +#include "../TrigEgammaFastElectronHypoTool.h" +#include "../TrigEgammaFastElectronFexMT.h" +#include "../TrigEgammaFastElectronHypoAlgMT.h" #include "../TrigL2PhotonHypoAlgMT.h" #include "../TrigL2PhotonHypoTool.h" #include "../TrigEgammaPrecisionCaloHypoAlgMT.h" @@ -46,16 +46,16 @@ DECLARE_COMPONENT( TrigEFElectronHypo ) DECLARE_COMPONENT( TrigEFPhotonHypo ) DECLARE_COMPONENT( TrigEFTrackHypo ) DECLARE_COMPONENT( TrigL2CaloLayersHypo ) -DECLARE_COMPONENT( TrigL2CaloHypoAlgMT ) -DECLARE_COMPONENT( TrigL2ElectronHypoAlgMT ) +DECLARE_COMPONENT( TrigEgammaFastCaloHypoAlgMT ) +DECLARE_COMPONENT( TrigEgammaFastElectronHypoAlgMT ) DECLARE_COMPONENT( TrigL2PhotonHypoAlgMT ) -DECLARE_COMPONENT( TrigL2CaloHypoToolInc ) +DECLARE_COMPONENT( TrigEgammaFastCaloHypoToolInc ) DECLARE_COMPONENT( TrigEgammaPrecisionCaloHypoToolInc ) DECLARE_COMPONENT( TrigEgammaPrecisionPhotonHypoToolInc ) DECLARE_COMPONENT( TrigEgammaPrecisionElectronHypoToolInc ) -DECLARE_COMPONENT( TrigL2CaloHypoToolMult ) -DECLARE_COMPONENT( TrigL2ElectronHypoTool ) -DECLARE_COMPONENT( TrigL2ElectronFexMT ) +DECLARE_COMPONENT( TrigEgammaFastCaloHypoToolMult ) +DECLARE_COMPONENT( TrigEgammaFastElectronHypoTool ) +DECLARE_COMPONENT( TrigEgammaFastElectronFexMT ) DECLARE_COMPONENT( TrigL2PhotonHypoTool ) DECLARE_COMPONENT( TrigEgammaPrecisionCaloHypoAlgMT ) DECLARE_COMPONENT( TrigEgammaPrecisionCaloHypoToolMult ) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/CaloSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/CaloSequenceSetup.py index 33dc07b7a24..1c843c440d1 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/CaloSequenceSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/CaloSequenceSetup.py @@ -13,7 +13,7 @@ class CaloMenuDefs(object): def fastCaloSequence(doRinger): - """ Creates L2 Fast Calo sequence""" + """ Creates Fast Calo sequence""" # EV creator from TrigT2CaloCommon.CaloDef import fastCaloEVCreator (fastCaloViewsMaker, InViewRoIs) = fastCaloEVCreator() @@ -28,20 +28,20 @@ def fastCaloSequence(doRinger): def fastCaloMenuSequence(name, doRinger): - """ Creates L2 Fast Calo MENU sequence + """ Creates Egamma Fast Calo MENU sequence The Hypo name changes depending on name, so for different implementations (Electron, Gamma,....) The doRinger flag is to use or not the Ringer hypo """ (sequence, fastCaloViewsMaker, sequenceOut) = RecoFragmentsPool.retrieve(fastCaloSequence, {'doRinger' : doRinger}) # check if use Ringer and are electron because there aren't ringer for photons yet: # hypo - from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2CaloHypoAlgMT - theFastCaloHypo = TrigL2CaloHypoAlgMT(name+"L2CaloHypo") + from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaFastCaloHypoAlgMT + theFastCaloHypo = TrigEgammaFastCaloHypoAlgMT(name+"EgammaFastCaloHypo") theFastCaloHypo.CaloClusters = sequenceOut CaloMenuDefs.L2CaloClusters = sequenceOut - from TrigEgammaHypo.TrigL2CaloHypoTool import TrigL2CaloHypoToolFromDict + from TrigEgammaHypo.TrigEgammaFastCaloHypoTool import TrigEgammaFastCaloHypoToolFromDict return MenuSequence( Sequence = sequence, Maker = fastCaloViewsMaker, Hypo = theFastCaloHypo, - HypoToolGen = TrigL2CaloHypoToolFromDict ) + HypoToolGen = TrigEgammaFastCaloHypoToolFromDict ) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py index 89fc2377eeb..ba95dae7fbe 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py @@ -39,8 +39,8 @@ def fastElectronSequence(ConfigFlags): if "InDetTrigTrackParticleCreatorAlg" in viewAlg.name(): TrackParticlesName = viewAlg.TrackParticlesName - from TrigEgammaHypo.TrigL2ElectronFexMTConfig import L2ElectronFex_1 - theElectronFex= L2ElectronFex_1() + from TrigEgammaHypo.TrigEgammaFastElectronFexMTConfig import EgammaFastElectronFex_1 + theElectronFex= EgammaFastElectronFex_1() theElectronFex.TrigEMClusterName = CaloMenuDefs.L2CaloClusters theElectronFex.TrackParticlesName = TrackParticlesName theElectronFex.ElectronsName=recordable("HLT_L2Electrons") @@ -71,16 +71,16 @@ def fastElectronMenuSequence(): (electronAthSequence, l2ElectronViewsMaker, sequenceOut) = RecoFragmentsPool.retrieve(fastElectronSequence, ConfigFlags) # make the Hypo - from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2ElectronHypoAlgMT - theElectronHypo = TrigL2ElectronHypoAlgMT() + from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaFastElectronHypoAlgMT + theElectronHypo = TrigEgammaFastElectronHypoAlgMT() theElectronHypo.Electrons = sequenceOut theElectronHypo.RunInView=True - from TrigEgammaHypo.TrigL2ElectronHypoTool import TrigL2ElectronHypoToolFromDict + from TrigEgammaHypo.TrigEgammaFastElectronHypoTool import TrigEgammaFastElectronHypoToolFromDict return MenuSequence( Maker = l2ElectronViewsMaker, Sequence = electronAthSequence, Hypo = theElectronHypo, - HypoToolGen = TrigL2ElectronHypoToolFromDict ) + HypoToolGen = TrigEgammaFastElectronHypoToolFromDict ) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/ElectronRecoSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/ElectronRecoSequences.py index c7e2f37c3f3..58f41575ca5 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/ElectronRecoSequences.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/ElectronRecoSequences.py @@ -14,7 +14,7 @@ def l2CaloRecoCfg( flags ): def l2CaloHypoCfg( flags, name="UNSPECIFIED", CaloClusters="UNSPECIFIED" ): from AthenaConfiguration.ComponentFactory import CompFactory - l2CaloHypo = CompFactory.TrigL2CaloHypoAlgMT( name ) + l2CaloHypo = CompFactory.TrigEgammaFastCaloHypoAlgMT( name ) l2CaloHypo.CaloClusters = CaloClusters return l2CaloHypo diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/generateElectron.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/generateElectron.py index 2ef3bef8109..b4469d31342 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/generateElectron.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/generateElectron.py @@ -4,7 +4,7 @@ from TriggerMenuMT.HLTMenuConfig.Electron.ElectronRecoSequences import l2CaloRec from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import CAMenuSequence, \ ChainStep, Chain, getChainStepName, createStepView -from TrigEgammaHypo.TrigL2CaloHypoTool import TrigL2CaloHypoToolFromDict +from TrigEgammaHypo.TrigEgammaFastCaloHypoTool import TrigEgammaFastCaloHypoToolFromDict from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from TrigEDMConfig.TriggerEDMRun3 import recordable from AthenaConfiguration.ComponentFactory import CompFactory @@ -35,7 +35,7 @@ def generateChains( flags, chainDict ): fastCaloSequence = CAMenuSequence( Sequence = l2CaloReco.sequence(), Maker = l2CaloReco.inputMaker(), Hypo = l2CaloHypo, - HypoToolGen = TrigL2CaloHypoToolFromDict, + HypoToolGen = TrigEgammaFastCaloHypoToolFromDict, CA = accCalo) fastCaloSequence.createHypoTools(chainDict) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/generatePhoton.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/generatePhoton.py index c75dc472186..671b70277a1 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/generatePhoton.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/generatePhoton.py @@ -6,7 +6,7 @@ from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import CAMenuSequence, \ ChainStep, Chain, getChainStepName, createStepView from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -from TrigEgammaHypo.TrigL2CaloHypoTool import TrigL2CaloHypoToolFromDict +from TrigEgammaHypo.TrigEgammaFastCaloHypoTool import TrigEgammaFastCaloHypoToolFromDict from TrigEgammaHypo.TrigL2PhotonHypoTool import TrigL2PhotonHypoToolFromDict from TrigEDMConfig.TriggerEDMRun3 import recordable @@ -34,7 +34,7 @@ def generateChains(flags, chainDict): fastCaloSequence = CAMenuSequence( Sequence = l2CaloReco.sequence(), Maker = l2CaloReco.inputMaker(), Hypo = l2CaloHypo, - HypoToolGen = TrigL2CaloHypoToolFromDict, + HypoToolGen = TrigEgammaFastCaloHypoToolFromDict, CA = accCalo ) fastCaloSequence.createHypoTools(chainDict) -- GitLab