From 5bcb84afa85efce1f6022fdaf9e10a1256ecc047 Mon Sep 17 00:00:00 2001 From: Ryan Mackenzie White <ryan.white@cern.ch> Date: Thu, 9 Feb 2017 15:40:06 +0100 Subject: [PATCH] info msgs (TrigEgammaHypo-01-01-84) * Remove the info msgs from L2Calo config * TrigEgammaHypo-01-01-83 2017-02-07 Ryan White <ryan.white@cern.ch> * Cleanup L2Electron code * Remove eta dependent cuts * Flat cuts for pt,dEta,dPhi * Remove old configuration classes * Requires new menu tag * TrigEgammaHypo-01-01-82 Former-commit-id: 698315f2851674024ab4152d2b66cea4aab5dd0b --- .../TrigEgammaHypo/TrigL2ElectronFex.h | 62 +--- .../TrigEgammaHypo/TrigL2ElectronHypo.h | 45 +-- .../TrigEgammaHypo/doc/mainpage.h | 33 -- .../python/TrigL2CaloHypoCutDefs.py | 4 - .../python/TrigL2ElectronFexConfig.py | 170 +-------- .../python/TrigL2ElectronHypoConfig.py | 63 +--- .../TrigEgammaHypo/src/TrigL2ElectronFex.cxx | 293 +++++++--------- .../TrigEgammaHypo/src/TrigL2ElectronHypo.cxx | 326 +++++++----------- 8 files changed, 296 insertions(+), 700 deletions(-) delete mode 100755 Trigger/TrigHypothesis/TrigEgammaHypo/doc/mainpage.h diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/TrigEgammaHypo/TrigL2ElectronFex.h b/Trigger/TrigHypothesis/TrigEgammaHypo/TrigEgammaHypo/TrigL2ElectronFex.h index 6524aeea396..33a1364510a 100755 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/TrigEgammaHypo/TrigL2ElectronFex.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/TrigEgammaHypo/TrigL2ElectronFex.h @@ -17,7 +17,7 @@ ** ** Created: Tue Nov 28 0:56:50 CET 2006 ** Modified: V. Perez Reale added doxygen comments 26/6/07 - ** + ** Modified: R. White optimisation for v7 menu (Run2) 07/02/2017 **************************************************************************/ #ifndef TRIG_TrigL2ElectronFex_H @@ -36,24 +36,11 @@ #include "TrigT1Interfaces/RecEmTauRoI.h" #include "TrigSteeringEvent/TrigRoiDescriptor.h" -// trigger EDM -//#include "TrigInDetEvent/TrigInDetTrack.h" -//#include "TrigInDetEvent/TrigInDetTrackCollection.h" #include "xAODTracking/TrackParticleContainer.h" - -//#include "TrigCaloEvent/TrigEMCluster.h" -//#include "TrigParticle/TrigElectron.h" -//#include "TrigParticle/TrigElectronContainer.h" - #include "xAODTrigCalo/TrigEMCluster.h" #include "xAODTrigEgamma/TrigElectron.h" #include "xAODTrigEgamma/TrigElectronContainer.h" -//#include "TrigCaloEvent/RingerEvent.h" // will be moved to TrigEvent -//#include "TrigCaloEvent/RingerEventContainer.h" // will be moved to TrigEvent - -//class ITrigInDetTrackExtrapolator; -//class IExtrapolateToCaloTool; namespace Trk { class IParticleCaloExtensionTool; } @@ -67,6 +54,12 @@ namespace Trk * The TrigElectron conatiner will then be retrieved by the hypothesis algorithm TrigL2ElectronHypo * that will perform the corresponding L2 electron selection * + * Cleanup / Update for Run2 + * Remove m_calo_algoID; m_trackalgoID -- only 1 type of track + * Remove deta/dphi cluster -- this is checked at L2Calo + * Remove track pt for TRT tracks -- TRT only not used + * Remove m_calotrackdeta/dphiTRT -- not cutting on TRT tracks + * calotrack deta/dphi and eoverp cuts flat (not as function of eta) */ class TrigL2ElectronFex : public HLT::FexAlgo { @@ -80,49 +73,27 @@ class TrigL2ElectronFex : public HLT::FexAlgo { HLT::ErrorCode hltFinalize(); HLT::ErrorCode hltExecute(const HLT::TriggerElement* inputTE, HLT::TriggerElement* outputTE); - - //HLT::ErrorCode acceptInput(const HLT::TriggerElement* inputTE, bool& pass); private: - // Properties: - unsigned int m_trackalgoID; // used to select algorithm producing tracks, 0: all, 1: SiTrack, 2: IDScan, 4: TRTxK, 5: SiTrack+IDScan - unsigned int m_calo_algoID; // used to run from either TrigEMCluster or RingerEvent - - //L1-L2 matching variables - float m_detacluster; - float m_dphicluster; - //tracking cut float m_trackPtthr; - float m_trackPtthrTRT; //Track pt cut on TRT tracks //calo-tracking cuts - std::vector<float> m_etabin; - std::vector<float> m_calotrackdeta; //!< deta between calo and track - std::vector<float> m_calotrackdphi; //!< dphi between calo and track - std::vector<float> m_calotrackdeoverp_low; //!< E/p lower cut between calo and track - std::vector<float> m_calotrackdeoverp_high; //!< E/p upper cut between calo and track - - //TRTSegFinder specific calo-track cuts - std::vector<float> m_calotrackdetaTRT; //!< deta between calo and track - std::vector<float> m_calotrackdphiTRT; //!< dphi between calo and track - + float m_calotrackdeta; //!< deta between calo and track + float m_calotrackdphi; //!< dphi between calo and track + float m_calotrackdeoverp_low; //!< E/p lower cut between calo and track + float m_calotrackdeoverp_high; //!< E/p upper cut between calo and track //radius and Z of calorimeter face float m_RCAL; //!< radious of calorimeter face float m_ZCAL; //!< Z of calorimeter face - // to set Accept-All mode and to be able - // to avoid generating TrigElectrons + // build electrons for all tracks bool m_acceptAll; - // bool m_saveTrigEl; // now needed to transfer information to hypo // for extrapolating TrigInDetTracks to calorimeter surface -// ITrigInDetTrackExtrapolator* m_trackExtrapolator; //!< pointer for extrapolating TrigInDetTracks to calorimeter surface - //ToolHandle<IExtrapolateToCaloTool> m_trackExtrapolator; ToolHandle< Trk::IParticleCaloExtensionTool > m_caloExtensionTool; -// std::string m_trackExtrapolatorName; xAOD::TrigElectronContainer* m_trigElecColl; //!< pointer to TrigElectron container @@ -131,16 +102,17 @@ class TrigL2ElectronFex : public HLT::FexAlgo { ///Static getter methods for monitoring of TrigElectron container static inline double getCaloPt(const xAOD::TrigElectron* aElectron){ - if(!aElectron) return -999.0; return aElectron->pt(); } static inline double getTkPt(const xAOD::TrigElectron* aElectron){ + if(!aElectron) return -999.0; + return (aElectron->trackParticle() ? aElectron->trackParticle()->pt() : -999); + } + + bool extrapolate(const xAOD::TrigEMCluster *, const xAOD::TrackParticle *, double &, double &); - if(!aElectron) return -999.0; - return (aElectron->trackParticle() ? aElectron->trackParticle()->pt() : -999); -} }; diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/TrigEgammaHypo/TrigL2ElectronHypo.h b/Trigger/TrigHypothesis/TrigEgammaHypo/TrigEgammaHypo/TrigL2ElectronHypo.h index f085a0739f0..469ce7fb880 100755 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/TrigEgammaHypo/TrigL2ElectronHypo.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/TrigEgammaHypo/TrigL2ElectronHypo.h @@ -15,7 +15,7 @@ ** ** Created: Sat Mar 1 19:55:56 GMT 2005 ** Modified: V. Perez Reale added doxygen comments 26/6/07 - ** + ** Modified: R. White optimisation for v7 menu (Run2) 07/02/2017 **************************************************************************/ #ifndef TRIG_TrigL2ElectronHypo_H @@ -44,6 +44,12 @@ * \brief TrigL2ElectronHypo is a Trigger Hypo Algorithm that retrieves the L2 TrigElectronContainer * created by TrigL2ElectronFex and then apply a subset of electron selection cuts. A TE will be * set active if the selection cuts are fullfilled. + * Cleanup / Update for Run2 + * Remove m_calo_algoID; m_trackalgoID -- only 1 type of track + * Remove deta/dphi cluster -- this is checked at L2Calo + * Remove track pt for TRT tracks -- TRT only not used + * Remove m_calotrackdeta/dphiTRT -- not cutting on TRT tracks + * calotrack deta/dphi and eoverp cuts flat (not as function of eta) * * */ @@ -61,31 +67,15 @@ class TrigL2ElectronHypo: public HLT::HypoAlgo { private: - // Properties: - unsigned int m_trackalgoID; //!< integer that assigns the tracking algorihtm used - - //tracking cut float m_trackPtthr; //!< pT cut on track //calo-tracking cuts - std::vector<float> m_etabin; - std::vector<float> m_calotrackdeta; //!< deta between calo and track - std::vector<float> m_calotrackdphi; //!< dphi between calo and track - std::vector<float> m_calotrackdeoverp_low; //!< E/p lower cut between calo and track - std::vector<float> m_calotrackdeoverp_high; //!< E/p upper cut between calo and track - - //TRT cuts - std::vector<float> m_trtratio; //!< cut on ratio of NTRHits/NTRStrawHits for IDScan and SiTrack tracks - - //TRTSegFinder cuts - float m_trackPtthrTRT; //!< pT cut on track - std::vector<float> m_etabinTRT; //!< eta bins for TRT cuts - std::vector<float> m_trtratioTRT; //!< cut on ratio of NTRHits/NTRStrawHits for TRTSegFinder tracks - std::vector<float> m_calotrackdetaTRT; //!< deta between calo and track - std::vector<float> m_calotrackdphiTRT; //!< dphi between calo and track - std::vector<float> m_calotrackdeoverp_lowTRT; //!< E/p lower cut between calo and track - std::vector<float> m_calotrackdeoverp_highTRT; //!< E/p upper cut between calo and track + float m_calotrackdeta; //!< deta between calo and track + float m_calotrackdphi; //!< dphi between calo and track + float m_calotrackdeoverp_low; //!< E/p lower cut between calo and track + float m_calotrackdeoverp_high; //!< E/p upper cut between calo and track + float m_trtratio; //!< trt ratio cut // to set Accept-All mode @@ -99,20 +89,15 @@ class TrigL2ElectronHypo: public HLT::HypoAlgo { ///Static getter methods for monitoring of TrigElectron container static inline double getCaloPt(const xAOD::TrigElectron* aElectron){ - if(!aElectron) return -999.0; return aElectron->pt(); } static inline double getTkPt(const xAOD::TrigElectron* aElectron){ + if(!aElectron) return -999.0; + return (aElectron->trackParticle() ? aElectron->trackParticle()->pt() : -999); + } - if(!aElectron) return -999.0; - return (aElectron->trackParticle() ? aElectron->trackParticle()->pt() : -999); -} - - // for extrapolating TrigInDetTracks to calorimeter surface -// ITrigInDetTrackExtrapolator* m_trackExtrapolator; -// std::string m_trackExtrapolatorName; }; #endif diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/doc/mainpage.h b/Trigger/TrigHypothesis/TrigEgammaHypo/doc/mainpage.h deleted file mode 100755 index 91d0faa9805..00000000000 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/doc/mainpage.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - - -/** - -@mainpage -@author R. Goncalo -@author J. Baines -@author I. Graboska-Bold -@author T. Fonseca-Martin -@author D. Damazio -@author V. Perez-Reale -@author C. SantaMarina -@author P. Urquijo - -@section MyPackageOverview Overview -This package contains the fex and hypo trigger algorithms for the Electron and Photon Slice -It contains 2 algorithm classes: <br/> -Fex - which create a feature extraction object <br/> -Hypo - performs a selection on a feature extraction object created by a fex and creates timing -and monitoring histograms <br/> - -The package also contains the configuration files for the Electron and Photon Slice for all -electron and photon trigger menus. - - -@htmlinclude used_packages.html - - -*/ - diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2CaloHypoCutDefs.py b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2CaloHypoCutDefs.py index f83d144f4a8..3e7f81b8f8d 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2CaloHypoCutDefs.py +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2CaloHypoCutDefs.py @@ -20,7 +20,6 @@ class L2CaloCutMaps(): # Cut maps are grouped by Et threshold # Adding vloose working points, same cuts as loose def __init__(self, threshold): - log_trigegL2.info("Configuring L2CaloCuts with threshold %s",threshold) ########################## # Et 5 GeV ########################## @@ -40,7 +39,6 @@ class L2CaloCutMaps(): # self.CAERATIOthr = [0.57, 0.532, 0.342, 0.228, -9999., 0.304, 0.608, 0.722, -9999.] ########################## if(float(threshold) < 12): - log_trigegL2.info("Configuring L2CaloCuts for low Et %s",threshold) self.MapsHADETthr = { 'vloose': [0.2337, 0.20976, 0.1392, 0.1872, 0.1315, 0.3234, 0.384, 0.1901, 0.1901], 'loose': [0.2337, 0.2097, 0.1392, 0.1872, 0.1255, 0.3234, 0.3840, 0.1901, 0.1901], @@ -92,7 +90,6 @@ class L2CaloCutMaps(): # self.CARCOREthr = [0.90, 0.89, 0.89, 0.89, 0.90, 0.89, 0.89, 0.89, 0.89] # self.CAERATIOthr = [0.60, 0.70, 0.70, 0.75, 0.85, 0.90, 0.90, 0.90, 0.90] if(float(threshold) >= 12. and float(threshold) < 22): - log_trigegL2.info("Configuring L2CaloCuts for mid Et %s",threshold) self.MapsHADETthr = { 'vloose': [0.0871, 0.0617, 0.0564, 0.0827, 0.0889, 0.2052, 0.1674, 0.1481, 0.1481], 'loose': [0.08472, 0.05928, 0.054, 0.0803, 0.0829, 0.1932, 0.1590, 0.1384 , 0.1384], @@ -139,7 +136,6 @@ class L2CaloCutMaps(): # self.HADETthr = [0.0275625, 0.0259875, 0.0291375, 0.0228375, 0.0259875, 0.0391125, 0.0359625, 0.0370125, 0.0291375] # self.CARCOREthr = [0.819375, 0.819375, 0.800375, 0.828875, 0.7125, 0.805125, 0.843125, 0.824125, 0.700625] if(float(threshold) >= 22.): - log_trigegL2.info("Configuring L2CaloCuts for high Et %s",threshold) self.MapsHADETthr = { 'vloose': [0.0612, 0.0588, 0.0564, 0.0504, 0.0357, 0.072, 0.0684, 0.0696, 0.0636], 'loose': [0.0588, 0.0564, 0.054, 0.048, 0.0297, 0.06, 0.06, 0.06, 0.054], diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronFexConfig.py b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronFexConfig.py index 8ff2c428ab4..33d68d4901a 100755 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronFexConfig.py +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronFexConfig.py @@ -9,11 +9,6 @@ from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2ElectronFex from AthenaCommon.SystemOfUnits import GeV, mm from AthenaCommon.AppMgr import ToolSvc -#from TrackToCalo.ExtrapolateToCaloToolBase import \ -# ExtrapolateToCaloToolFactory -#extrap = ExtrapolateToCaloToolFactory (depth='showerdefault', -# straightLine=False) -#ToolSvc+=extrap # --------------------------------------------------------------- # class for common setups (like monitoring) @@ -29,17 +24,13 @@ class L2ElectronFexBase(TrigL2ElectronFex): self.AthenaMonTools = [ time, validation, online ] - self.EtaBins = [0.0, 0.6, 0.8, 1.15, 1.37, 1.52, 1.81, 2.01, 2.37, 2.47] # Tracking cuts self.TrackPt = 1.0 * GeV # Calo-Tracking matching cuts - self.CaloTrackdETA = [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5] - self.CaloTrackdPHI = [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5] - self.CaloTrackdEoverPLow = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] - self.CaloTrackdEoverPHigh = [999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0] - self.dETACLUSTERthr = 0.1 #not used any more - self.dPHICLUSTERthr = 0.1 #not used any more -# self.TrackExtrapolator=extrap + self.CaloTrackdETA = 0.5 + self.CaloTrackdPHI = 0.5 + self.CaloTrackdEoverPLow = 0.0 + self.CaloTrackdEoverPHigh = 999.0 # --------------------------------------------------------------- # TrigL2ElectronFex configurations @@ -52,166 +43,27 @@ class L2ElectronFex_all(L2ElectronFexBase): # AcceptAll flag: if true take events regardless of cuts self.AcceptAll = False - - # Select tracking algorithm - self.TrackAlgoId = 9 # IDscan [1=SiTrack, 4=TRT, 0=use all, 5: SiTrack+IDScan] # Co-ordinates of calorimeter face for extrapolation self.RCalBarrelFace = 1470.0*mm self.ZCalEndcapFace = 3800.0*mm +class L2ElectronFex_1(L2ElectronFex_all): + __slots__ = [] + def __init__(self,name="L2ElectronFex_1"): + super(L2ElectronFex_1, self).__init__(name) + self.AcceptAll = True class L2ElectronFex_LowPt(L2ElectronFex_all): __slots__ = [] - def __init__(self,name="L2ElectronFex_1"): + def __init__(self,name="L2ElectronFex_LowPt"): super(L2ElectronFex_1, self).__init__(name) self.AcceptAll = False class L2ElectronFex_HighPt(L2ElectronFex_all): __slots__ = [] - def __init__(self,name="L2ElectronFex_1"): + def __init__(self,name="L2ElectronFex_HighPt"): super(L2ElectronFex_1, self).__init__(name) self.AcceptAll = False self.TrackPt = 2.0 * GeV -class L2ElectronFex_all_L2SW(L2ElectronFex_all): - __slots__ = [] - def __init__(self,name="L2ElectronFex_all_L2SW"): - super(L2ElectronFex_all_L2SW, self).__init__(name) - -#No Cut chains -class L2ElectronFex_all_NoCut(L2ElectronFex_all): - __slots__ = [] - def __init__(self,name="L2ElectronFex_all_NoCut"): - super(L2ElectronFex_all_NoCut, self).__init__(name) - self.AcceptAll = True - -class L2ElectronFex_1(L2ElectronFex_all): - __slots__ = [] - def __init__(self,name="L2ElectronFex_1"): - super(L2ElectronFex_1, self).__init__(name) - self.AcceptAll = True - -class L2ElectronFex_all_L2SW_NoCut(L2ElectronFex_all): - __slots__ = [] - def __init__(self,name="L2ElectronFex_all_L2SW_NoCut"): - super(L2ElectronFex_all_L2SW_NoCut, self).__init__(name) - self.AcceptAll = True - -class L2ElectronFex_all_Ringer_NoCut(L2ElectronFex_all): - __slots__ = [] - def __init__(self,name="L2ElectronFex_all_Ringer_NoCut"): - super(L2ElectronFex_all_Ringer_NoCut, self).__init__(name) - self.CaloAlgoId = 2 #CaloRinger - self.AcceptAll = True - -#L2 IDScan chains -class L2ElectronFex_IdScan(L2ElectronFex_all): - __slots__ = [] - def __init__(self,name="L2ElectronFex_IdScan"): - super(L2ElectronFex_IdScan, self).__init__(name) - self.TrackAlgoId = 2 # IDscan - -class L2ElectronFex_IdScan_NoCut(L2ElectronFex_IdScan): - __slots__ = [] - def __init__(self,name="L2ElectronFex_IdScan_NoCut"): - super(L2ElectronFex_IdScan_NoCut, self).__init__(name) - self.AcceptAll = True - -#L2 SiTrack chains -class L2ElectronFex_SiTrack(L2ElectronFex_all): - __slots__ = [] - def __init__(self,name="L2ElectronFex_SiTrack"): - super(L2ElectronFex_SiTrack, self).__init__(name) - self.TrackAlgoId = 1 # SiTrack - -class L2ElectronFex_SiTrack_NoCut(L2ElectronFex_SiTrack): - __slots__ = [] - def __init__(self,name="L2ElectronFex_SiTrack_NoCut"): - super(L2ElectronFex_SiTrack_NoCut, self).__init__(name) - self.AcceptAll = True - -#L2 TRTSegFinder chains -class L2ElectronFex_TRTSegFinder(L2ElectronFex_all): - __slots__ = [] - def __init__(self,name="L2ElectronFex_TRTSegFinder"): - super(L2ElectronFex_TRTSegFinder, self).__init__(name) - - # AcceptAll flag: if true take events regardless of cuts - self.AcceptAll = False - - # Select tracking algorithm - self.TrackAlgoId = 3 #TRTSegFinder - - # Calo-Tracking matching cuts - self.TrackPtTRT = 1.0 * GeV - self.CaloTrackdETATRT = [999., 999., 999., 999., 999., 999., 999., 999., 999.] - self.CaloTrackdPHITRT = [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5] - - -class L2ElectronFex_TRTSegFinder_NoCut(L2ElectronFex_TRTSegFinder): - __slots__ = [] - def __init__(self,name="L2ElectronFex_TRTSegFinder_NoCut"): - super(L2ElectronFex_TRTSegFinder_NoCut, self).__init__(name) - self.AcceptAll = True - -#L2 Use all tracks, EF forward+back tracking for photon conversion studies -class L2ElectronFex_FwdBackTracking(L2ElectronFexBase): - __slots__ = [] - def __init__(self,name="L2ElectronFex_FwdBackTracking"): - super(L2ElectronFex_FwdBackTracking, self).__init__(name) - - # AcceptAll flag: if true take events regardless of cuts - self.AcceptAll = False - - # Select tracking algorithm - self.TrackAlgoId = 0 # Use all tracks - - # Calo-Tracking matching cuts - self.TrackPtTRT = 1.0 * GeV - self.CaloTrackdETATRT = [999., 999., 999., 999., 999., 999., 999., 999., 999.] - self.CaloTrackdPHITRT = [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5] - -# L2Star strategy A,B,C -class L2ElectronFex_L2StarA(L2ElectronFex_all): - __slots__ = [] - def __init__(self,name="L2ElectronFex_L2StarA"): - super(L2ElectronFex_L2StarA, self).__init__(name) - self.TrackAlgoId = 5 # L2Star strategy A - -class L2ElectronFex_L2StarB(L2ElectronFex_all): - __slots__ = [] - def __init__(self,name="L2ElectronFex_L2StarB"): - super(L2ElectronFex_L2StarB, self).__init__(name) - self.TrackAlgoId = 6 # L2Star strategy B - -class L2ElectronFex_L2StarC(L2ElectronFex_all): - __slots__ = [] - def __init__(self,name="L2ElectronFex_L2StarC"): - super(L2ElectronFex_L2StarC, self).__init__(name) - self.TrackAlgoId = 7 # L2Star strategy C - -class L2ElectronFex_FTK(L2ElectronFex_all): - __slots__ = [] - def __init__(self,name="L2ElectronFex_FTK"): - super(L2ElectronFex_FTK, self).__init__(name) - self.TrackAlgoId = 8 - -class L2ElectronFex_IDComb(L2ElectronFex_FwdBackTracking): - __slots__ = [] - def __init__(self,name="L2ElectronFex_IDComb"): - super(L2ElectronFex_IDComb, self).__init__(name) - - -class L2ElectronFex_FwdBackTracking_NoCut(L2ElectronFex_FwdBackTracking): - __slots__ = [] - def __init__(self,name="L2ElectronFex_FwdBackTracking_NoCut"): - super(L2ElectronFex_FwdBackTracking_NoCut, self).__init__(name) - self.AcceptAll = True - -class L2ElectronFex_Ringer(L2ElectronFex_all): - __slots__ = [] - def __init__(self,name="L2ElectronFex_Ringer"): - super(L2ElectronFex_Ringer, self).__init__(name) - self.CaloAlgoId = 2 # CaloRinger - diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronHypoConfig.py b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronHypoConfig.py index 811b7f64a28..f76bd5eeaae 100755 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronHypoConfig.py +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronHypoConfig.py @@ -28,15 +28,9 @@ class L2ElectronHypoBase(TrigL2ElectronHypo): self.AthenaMonTools = [ time, validation, online ] #common attributes - self.EtaBins = [0.0, 0.6, 0.8, 1.15, 1.37, 1.52, 1.81, 2.01, 2.37, 2.47] - self.CaloTrackdEoverPLow = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] - self.CaloTrackdEoverPHigh = [999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0] - self.TRTRatio = [-999., -999., -999., -999., -999., -999., -999., -999., -999.] - self.EtaBinsTRT = [0.0, 0.6, 0.8, 1.15, 1.37, 1.52, 1.81, 2.01, 2.37, 2.47] - self.CaloTrackdEoverPLowTRT = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] - self.CaloTrackdEoverPHighTRT = [999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0] - self.TRTRatioTRT = [-999., -999., -999., -999., -999., -999., -999., -999., -999.] - self.CaloTrackdETATRT = [999., 999., 999., 999., 999., 999., 999., 999., 999.] + self.CaloTrackdEoverPLow = 0.0 + self.CaloTrackdEoverPHigh = 999.0 + self.TRTRatio = -999. # --------------------------------------------------------------- @@ -54,13 +48,6 @@ class L2ElectronHypo_e_NoCut(L2ElectronHypoBase): super( L2ElectronHypo_e_NoCut, self).__init__(name) self.AcceptAll = True -# --- No Cut but set the track algorithm -class L2ElectronHypo_e_NoCut_TrkAlgo(L2ElectronHypoBase): - __slots__ = [] - def __init__(self, name, threshold): - super( L2ElectronHypo_e_NoCut, self).__init__(name) - self.AcceptAll = True - # Configurable L2 Electron class via menu # Using cuts based on Et threshold # Only depends on threshold @@ -69,11 +56,10 @@ class L2ElectronHypo_e_ID (L2ElectronHypoBase): def __init__(self, name, threshold, IDinfo): super( L2ElectronHypo_e_ID, self ).__init__( name ) self.AcceptAll = False - self.TrackAlgoId = 9 # [0=All, 3=TRT, 5=SiTrack or IdScan, 6, strategyB, 7, strategyC, 9 new Fast Tracking] # cuts self.TrackPt = 1.0 * GeV - self.CaloTrackdETA = [ 0.2 , 0.2 , 0.2 , 0.2 , 0.2 , 0.2 , 0.2 , 0.2 , 0.2 ] - self.CaloTrackdPHI = [ 999., 999., 999., 999., 999., 999., 999., 999., 999.] + self.CaloTrackdETA = 0.2 + self.CaloTrackdPHI = 999. if(float(threshold) < 15): self.TrackPt = 1.0 * GeV elif (float(threshold) >= 15 and float(threshold) < 20): @@ -82,41 +68,11 @@ class L2ElectronHypo_e_ID (L2ElectronHypoBase): self.TrackPt = 3.0 * GeV elif (float(threshold) >= 50): self.TrackPt = 5.0 * GeV - self.CaloTrackdETA = [ 999., 999., 999., 999., 999., 999., 999., 999., 999.] - self.CaloTrackdPHI = [ 999., 999., 999., 999., 999., 999., 999., 999., 999.] + self.CaloTrackdETA = 999. + self.CaloTrackdPHI = 999. else: raise RuntimeError('No threshold: Default cut configured') -# Configurable L2 Track Algorithm -class L2ElectronHypo_e_ID_L2TrkAlg (L2ElectronHypo_e_ID): - __slots__ = [] - def __init__(self, name, threshold, IDinfo, L2IDAlg): - super( L2ElectronHypo_e_ID_L2TrkAlg, self ).__init__( name, threshold, IDinfo ) - # Here we need to set the TrackAlgoID from the menu name - if L2IDAlg == 'TRT': - self.TrackAlgoId = 3 - elif L2IDAlg == 'L2StarA': - self.TrackAlgoId = 5 - elif L2IDAlg == 'L2StarB': - self.TrackAlgoId = 6 - elif L2IDAlg == 'L2StarC': - self.TrackAlgoId = 7 - elif L2IDAlg == 'FTK': - self.TrackAlgoId = 8 - else: - self.TrackAlgoId = 9 # [0=All, 3=TRT, 5=SiTrack or IdScan, 6=L2StarB, 7=L2StarC, 8=FTK, 9=Fast] - -# TRT has different cuts -class L2ElectronHypo_e_ID_TRT (L2ElectronHypo_e_ID): - __slots__ = [] - def __init__(self, name, threshold, IDinfo): - super( L2ElectronHypo_e_ID_TRT, self ).__init__( name, threshold, IDinfo ) - # Here we need to set the TrackAlgoID from the menu name - self.TrackAlgoId = 3 # [0=All, 3=TRT, 5=SiTrack or IdScan, 6=L2StarB, 7=L2StarC] - # cuts - self.TrackPtTRT = 1.0 * GeV - self.CaloTrackdPHITRT = [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3] - # --------------------------------------------------------------- # NoCut @@ -127,10 +83,9 @@ class L2ElectronHypo_1(L2ElectronHypoBase): # AcceptTrigIDCaloHypoAll flag: if true take events regardless of cuts self.AcceptAll = True - self.TrackAlgoId = 9 # [0=All, 3=TRT, 5=SiTrack or IdScan] # cuts self.TrackPt = 2.0 * GeV - self.CaloTrackdETA = [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1] - self.CaloTrackdPHI = [ 999., 999., 999., 999., 999., 999., 999., 999., 999.] + self.CaloTrackdETA = 0.1 + self.CaloTrackdPHI = 999. diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFex.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFex.cxx index 98a10201da5..6f88adc5328 100755 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFex.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFex.cxx @@ -20,13 +20,10 @@ ** N.Berger Dec.06 - migrate to new steering (RG) **************************************************************************/ -//#include "TrigInDetToolInterfaces/ITrigInDetTrackExtrapolator.h" -//#include "RecoToolInterfaces/IExtrapolateToCaloTool.h" #include "RecoToolInterfaces/IParticleCaloExtensionTool.h" #include "TrkCaloExtension/CaloExtensionHelpers.h" #include "TrigEgammaHypo/TrigL2ElectronFex.h" #include "xAODTrigCalo/TrigEMClusterContainer.h" - class ISvcLocator; template <class SRC> @@ -42,24 +39,15 @@ TrigL2ElectronFex::TrigL2ElectronFex(const std::string & name, ISvcLocator* pSvc { // Read cuts - should probably get these from an xml file declareProperty( "AcceptAll", m_acceptAll = false ); - declareProperty( "EtaBins", m_etabin ); declareProperty( "TrackPt", m_trackPtthr = 5.0*CLHEP::GeV ); declareProperty( "CaloTrackdETA", m_calotrackdeta ); declareProperty( "CaloTrackdPHI", m_calotrackdphi ); declareProperty( "CaloTrackdEoverPLow", m_calotrackdeoverp_low ); declareProperty( "CaloTrackdEoverPHigh", m_calotrackdeoverp_high ); - declareProperty( "TrackAlgoId", m_trackalgoID = 0 ); - declareProperty( "CaloAlgoId", m_calo_algoID = 1 ); // 0=all (N/A); 1=T2Calo; 2=CaloRinger - declareProperty( "dETACLUSTERthr", m_detacluster = 0.1 ); - declareProperty( "dPHICLUSTERthr", m_dphicluster = 0.1 ); declareProperty( "RCalBarrelFace", m_RCAL = 1470.0*CLHEP::mm ); declareProperty( "ZCalEndcapFace", m_ZCAL = 3800.0*CLHEP::mm ); declareProperty( "ParticleCaloExtensionTool", m_caloExtensionTool); - declareProperty( "TrackPtTRT", m_trackPtthrTRT = 5.0*CLHEP::GeV ); - declareProperty( "CaloTrackdETATRT", m_calotrackdetaTRT ); - declareProperty( "CaloTrackdPHITRT", m_calotrackdphiTRT ); - declareMonitoredCollection("PtCalo",*dvec_cast(&m_trigElecColl),&TrigL2ElectronFex::getCaloPt); declareMonitoredCollection("PtTrack",*dvec_cast(&m_trigElecColl),&TrigL2ElectronFex::getTkPt); declareMonitoredCollection("CaloTrackdEta",*dvec_cast(&m_trigElecColl),&xAOD::TrigElectron::trkClusDeta); @@ -92,15 +80,10 @@ HLT::ErrorCode TrigL2ElectronFex::hltInitialize() ATH_MSG_DEBUG( "AcceptAll = "<< (m_acceptAll==true ? "True" : "False")); ATH_MSG_DEBUG("TrackPt = " << m_trackPtthr); - ATH_MSG_DEBUG("EtaBins = " << m_etabin); ATH_MSG_DEBUG("CaloTrackdETA = " << m_calotrackdeta); ATH_MSG_DEBUG("CaloTrackdPHI = " << m_calotrackdphi); ATH_MSG_DEBUG("CaloTrackdEoverPLow = " << m_calotrackdeoverp_low); ATH_MSG_DEBUG("CaloTrackdEoverPHigh = " << m_calotrackdeoverp_high); - ATH_MSG_DEBUG("TrackAlgoId = " << m_trackalgoID); - ATH_MSG_DEBUG("CaloAlgoId = " << m_calo_algoID); - ATH_MSG_DEBUG("dETACLUSTERthr = " << m_detacluster); - ATH_MSG_DEBUG("dPHICLUSTERthr = " << m_dphicluster); return HLT::OK; } @@ -166,14 +149,6 @@ HLT::ErrorCode TrigL2ElectronFex::hltExecute(const HLT::TriggerElement* inputTE, << ": Eta = " << roiDescriptor->eta() << ", Phi = " << roiDescriptor->phi()); - // fill local variables for RoI reference position - double etaRef = roiDescriptor->eta(); - double phiRef = roiDescriptor->phi(); - - // CaloAlgoId now isn't used anymore, as TrigCaloRinger also dumps a TrigEMCluster - // It is kept for backward compability. - // Eventually it can be passed to the next algos for information?! - float calo_eta(999), calo_phi(999), calo_et(-1); // the ElementLink pointing to a TrigEMCluster needs to be declared in this scope ElementLink<xAOD::TrigEMClusterContainer> el_t2calo_clus; @@ -192,43 +167,6 @@ HLT::ErrorCode TrigL2ElectronFex::hltExecute(const HLT::TriggerElement* inputTE, return HLT::MISSING_FEATURE; } - - // figure out what eta bin this cluster is in - float absEta = fabs(calo_eta); - int etaBin = 0; - - if(m_etabin.size()<2 ) { - ATH_MSG_WARNING("etaBin not configured correctly"); - return HLT::OK;//eta bins not configured correctly - } - - for (unsigned int iBin = 0; iBin < (m_etabin.size()-1); iBin++ ) - if ( absEta > m_etabin[iBin] && absEta < m_etabin[iBin+1] ) etaBin = iBin; - - ATH_MSG_DEBUG("eta bin used for cuts: " << etaBin); - - - // calculate eta and phi distances (deal with angle diferences > Pi) - float dPhi = calo_phi - phiRef; - dPhi = ( fabs(dPhi) < M_PI ? dPhi : 2*M_PI - dPhi ); - - float dEta = fabs( etaRef - calo_eta ); - - - // Following code was previously commented out - // VD already cutting on TriL2CaloHypo - // Accept only L2 em clusters which are "close" to the one provided by L1 - - ATH_MSG_DEBUG("Not cutting on dEta=" << dEta << " or dPhi=" << dPhi); - - //if ( dEta > m_detacluster || dPhi > m_dphicluster ) { - // if ( msgLvl() <= MSG::DEBUG ) { - // msg() << MSG::DEBUG << "Cluster doesn't match RoI! Leaving." << endmsg; - // } - // return HLT::OK; - //} - - // Transverse em energy ATH_MSG_DEBUG("Cluster: ET=" << calo_et); ATH_MSG_DEBUG("searching a matching track: loop over tracks"); @@ -238,12 +176,27 @@ HLT::ErrorCode TrigL2ElectronFex::hltExecute(const HLT::TriggerElement* inputTE, stat = getFeaturesLinks< xAOD::TrackParticleContainer, xAOD::TrackParticleContainer > (inputTE, v_inputTracks, ""); if ( stat != HLT::OK){ - ATH_MSG_WARNING("Failed to retrieve track collection"); + ATH_MSG_WARNING("Failed to retrieve track EL collection"); return HLT::MISSING_FEATURE; } ATH_MSG_DEBUG("Got vector of " << v_inputTracks.size() << " InDetTrackCollections"); + std::vector<const xAOD::TrackParticleContainer*> vectorTrackParticleContainer; + stat = getFeatures(inputTE, vectorTrackParticleContainer); + if (stat != HLT::OK){ + ATH_MSG_WARNING("Failed to retrieve track collection"); + return HLT::MISSING_FEATURE; + } + if (vectorTrackParticleContainer.size() < 1){ + ATH_MSG_ERROR("No track collection, vector < 1"); + return HLT::MISSING_FEATURE; + } + const xAOD::TrackParticleContainer *tracks = vectorTrackParticleContainer.back(); + if(!tracks){ + ATH_MSG_WARNING("Track collection is null"); + return HLT::MISSING_FEATURE; + } CaloExtensionHelpers::LayersToSelect layersToSelect; layersToSelect.insert(CaloSampling::CaloSample::EMB2); @@ -260,120 +213,81 @@ HLT::ErrorCode TrigL2ElectronFex::hltExecute(const HLT::TriggerElement* inputTE, ATH_MSG_VERBOSE(" eta = " << fabs((trkIter)->eta())); ATH_MSG_VERBOSE(" z0 = " << fabs((trkIter)->z0())); - // algorithm ID - int algoId = 0; - if ( trkIter->patternRecoInfo()[xAOD::TrackPatternRecoInfo::FastTrackFinderSeed] ) algoId=9; - if ( trkIter->patternRecoInfo()[xAOD::TrackPatternRecoInfo::strategyA] ) algoId=5; - if ( trkIter->patternRecoInfo()[xAOD::TrackPatternRecoInfo::strategyB] ) algoId=6; - if ( trkIter->patternRecoInfo()[xAOD::TrackPatternRecoInfo::strategyC] ) algoId=7; - - // ======== Following to be checked ============== // - // do not try track/cluster match if produced by wrong algo (0=all algos) - // Following code needs to be checked for rel21 - // Is it required to check for track algorithm ID? - if (m_trackalgoID == 0 || (unsigned int)algoId == m_trackalgoID || m_acceptAll || - (m_trackalgoID == 5 && (unsigned int)algoId <= 2 )) { - // =============================== ============== // - - ATH_MSG_VERBOSE("good track AlgoId"); - - //Use SiTrack/IDScan cuts or TRT cuts - std::vector<float> temp_calotrackdeta; - std::vector<float> temp_calotrackdphi; - float temp_trackPtthr; - temp_calotrackdeta = m_calotrackdeta; - temp_calotrackdphi = m_calotrackdphi; - temp_trackPtthr = m_trackPtthr; - - // ======== Following to be checked ============== // - // The following should be checked at initialize or before loop - // throw a warning/error and quit chain due to misconfiguration - // - //ignore tracks that don't have cuts - if(temp_calotrackdeta.size()<1 || temp_calotrackdphi.size()<1 ){ - ATH_MSG_DEBUG("Track type does not have corresponding cut configuration"); + // ============================================= // + // Pt cut + float trkPt = fabs((trkIter)->pt()); + float etoverpt = fabs(calo_et/trkPt); + double etaAtCalo=999.; + double phiAtCalo=999.; + if(m_acceptAll){ + if(!extrapolate(*el_t2calo_clus,trkIter,etaAtCalo,phiAtCalo)){ + ATH_MSG_VERBOSE("extrapolator failed"); + continue; + } + else{ + ATH_MSG_DEBUG("REGTEST: TrigElectron: cluster = " << + el_t2calo_clus.getStorableObjectPointer() << " index = " << el_t2calo_clus.index() << + " track = " << trkIter << " eta = " << etaAtCalo << " phi = " << phiAtCalo); + xAOD::TrigElectron* trigElec = new xAOD::TrigElectron(); + m_trigElecColl->push_back(trigElec); + trigElec->init( initialRoI->roiWord(), + etaAtCalo, phiAtCalo, etoverpt, + el_t2calo_clus, + trkLink); + } + } + else { + ATH_MSG_VERBOSE("Apply cuts"); + if(trkPt < m_trackPtthr){ + ATH_MSG_VERBOSE("Failed track pt cut"); continue; } - //ignore incorrect cut configurations - if(temp_calotrackdeta.size()!=(m_etabin.size()-1) || temp_calotrackdphi.size()!=(m_etabin.size()-1) ){ - ATH_MSG_DEBUG("Track type has inconsistent cut configuration"); + if (etoverpt < m_calotrackdeoverp_low){ + ATH_MSG_VERBOSE("failed low cut on ET/PT"); continue; } - // ============================================= // - // Pt cut - float trkPt = fabs((trkIter)->pt()); - if (trkPt > temp_trackPtthr || m_acceptAll) { - ATH_MSG_VERBOSE("passed pT cut"); - - // match in ET/PT - float etoverpt = fabs(calo_et/trkPt); - if (etoverpt > m_calotrackdeoverp_low[etaBin] || m_acceptAll) { - ATH_MSG_VERBOSE("passed low cut on ET/PT"); - - if (etoverpt < m_calotrackdeoverp_high[etaBin] || m_acceptAll) { - ATH_MSG_VERBOSE("passed high cut on ET/PT"); - - // extrapolate track using tool - // get calo extension - const Trk::CaloExtension* caloExtension = 0; - bool useCaching = false; - - if( !m_caloExtensionTool->caloExtension(*trkIter,caloExtension,useCaching) || caloExtension->caloLayerIntersections().empty() ) { - ATH_MSG_VERBOSE("extrapolator failed 1"); - m_extrapolator_failed++; - continue; - } - // extract eta/phi in EM2 - CaloExtensionHelpers::EtaPhiPerLayerVector intersections; - CaloExtensionHelpers::midPointEtaPhiPerLayerVector( *caloExtension, intersections, &layersToSelect ); - if( intersections.empty() ) { - ATH_MSG_VERBOSE("extrapolator failed 2"); - m_extrapolator_failed++; - continue; - } - // pick the correct sample in case of ambiguity - std::tuple<CaloSampling::CaloSample, double, double> etaPhiTuple = intersections.front(); - if( intersections.size() == 2 ) - if ( (*el_t2calo_clus)->energy(CaloSampling::CaloSample::EME2) > (*el_t2calo_clus)->energy(CaloSampling::CaloSample::EMB2) ) - etaPhiTuple=intersections.back(); - double etaAtCalo = std::get<1>(etaPhiTuple); - double phiAtCalo = std::get<2>(etaPhiTuple); - - // all ok: do track-matching cuts - ATH_MSG_VERBOSE("extrapolated eta/phi=" << etaAtCalo << "/" << phiAtCalo); - - // match in eta - float dEtaCalo = fabs(etaAtCalo - calo_eta); - if ( dEtaCalo < temp_calotrackdeta[etaBin] || m_acceptAll) { - ATH_MSG_VERBOSE("passed eta match cut"); - - // match in phi: deal with differences larger than Pi - float dPhiCalo = fabs(phiAtCalo - calo_phi); - dPhiCalo = ( dPhiCalo < M_PI ? dPhiCalo : 2*M_PI - dPhiCalo ); - if ( dPhiCalo < temp_calotrackdphi[etaBin] || m_acceptAll) { - ATH_MSG_VERBOSE("passed phi match cut"); - // all cuts passed - result = true; - /** Create a TrigElectron corresponding to this candidate - assume cluster quantities give better estimate of transverse energy - (probably a safe assumption for large pT) and that track parameters - at perigee give better estimates of angular quantities */ - - ATH_MSG_DEBUG("REGTEST: TrigElectron: cluster = " << - el_t2calo_clus.getStorableObjectPointer() << " index = " << el_t2calo_clus.index() << - " track = " << trkIter << " eta = " << etaAtCalo << " phi = " << phiAtCalo); - xAOD::TrigElectron* trigElec = new xAOD::TrigElectron(); - m_trigElecColl->push_back(trigElec); - trigElec->init( initialRoI->roiWord(), - etaAtCalo, phiAtCalo, etoverpt, - el_t2calo_clus, - trkLink); - } // dphi - } // deta - } //eoverPhi - } //eoverPlow - } //tmp track pt - } // track type + if (etoverpt > m_calotrackdeoverp_high){ + ATH_MSG_VERBOSE("failed high cut on ET/PT"); + continue; + } + if(!extrapolate(*el_t2calo_clus,trkIter,etaAtCalo,phiAtCalo)){ + ATH_MSG_VERBOSE("extrapolator failed 1"); + m_extrapolator_failed++; + continue; + } + // all ok: do track-matching cuts + ATH_MSG_VERBOSE("extrapolated eta/phi=" << etaAtCalo << "/" << phiAtCalo); + // match in eta + float dEtaCalo = fabs(etaAtCalo - calo_eta); + if ( dEtaCalo > m_calotrackdeta){ + ATH_MSG_VERBOSE("failed eta match cut"); + continue; + } + + // match in phi: deal with differences larger than Pi + float dPhiCalo = fabs(phiAtCalo - calo_phi); + dPhiCalo = ( dPhiCalo < M_PI ? dPhiCalo : 2*M_PI - dPhiCalo ); + if ( dPhiCalo > m_calotrackdphi) { + ATH_MSG_VERBOSE("failed phi match cut"); + continue; + } + // all cuts passed + result = true; + /** Create a TrigElectron corresponding to this candidate + assume cluster quantities give better estimate of transverse energy + (probably a safe assumption for large pT) and that track parameters + at perigee give better estimates of angular quantities */ + + ATH_MSG_DEBUG("REGTEST: TrigElectron: cluster = " << + el_t2calo_clus.getStorableObjectPointer() << " index = " << el_t2calo_clus.index() << + " track = " << trkIter << " eta = " << etaAtCalo << " phi = " << phiAtCalo); + xAOD::TrigElectron* trigElec = new xAOD::TrigElectron(); + m_trigElecColl->push_back(trigElec); + trigElec->init( initialRoI->roiWord(), + etaAtCalo, phiAtCalo, etoverpt, + el_t2calo_clus, + trkLink); + } } // set output TriggerElement unless acceptAll is set @@ -399,3 +313,36 @@ HLT::ErrorCode TrigL2ElectronFex::hltExecute(const HLT::TriggerElement* inputTE, m_trigElecColl = nullptr; return HLT::OK; } + +bool TrigL2ElectronFex::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); + // extrapolate track using tool + // get calo extension + const Trk::CaloExtension* caloExtension = 0; + bool useCaching = false; + + if( !m_caloExtensionTool->caloExtension(*trk,caloExtension,useCaching) || caloExtension->caloLayerIntersections().empty() ) { + ATH_MSG_VERBOSE("extrapolator failed 1"); + m_extrapolator_failed++; + return false; + } + // extract eta/phi in EM2 + CaloExtensionHelpers::EtaPhiPerLayerVector intersections; + CaloExtensionHelpers::midPointEtaPhiPerLayerVector( *caloExtension, intersections, &layersToSelect ); + if( intersections.empty() ) { + ATH_MSG_VERBOSE("extrapolator failed 2"); + m_extrapolator_failed++; + return false; + } + // pick the correct sample in case of ambiguity + std::tuple<CaloSampling::CaloSample, double, double> etaPhiTuple = intersections.front(); + if( intersections.size() == 2 ) + if ( clus->energy(CaloSampling::CaloSample::EME2) > clus->energy(CaloSampling::CaloSample::EMB2) ) + etaPhiTuple=intersections.back(); + etaAtCalo = std::get<1>(etaPhiTuple); + phiAtCalo = std::get<2>(etaPhiTuple); + + return true; +} diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypo.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypo.cxx index e30ed11a4ed..a4435a684bf 100755 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypo.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypo.cxx @@ -18,6 +18,7 @@ ** Modified: RG 18 Mar 06 - fix to always generate TrigElectrons ** - use key2keyStore for collection names ** N.Berger Dec.06 - migrate to new steering (RG) + ** Modified: R. White Feb 17 - cleanup and remove eta dependence **************************************************************************/ #include "TrigEgammaHypo/TrigL2ElectronHypo.h" @@ -34,23 +35,12 @@ TrigL2ElectronHypo::TrigL2ElectronHypo(const std::string & name, ISvcLocator* pS HLT::HypoAlgo(name, pSvcLocator) { declareProperty( "AcceptAll", m_acceptAll = true ); - declareProperty( "TrackAlgoId", m_trackalgoID = 0 ); - - declareProperty( "EtaBins", m_etabin ); declareProperty( "TrackPt", m_trackPtthr = 5.0*CLHEP::GeV ); declareProperty( "CaloTrackdETA", m_calotrackdeta ); //loose cut declareProperty( "CaloTrackdPHI", m_calotrackdphi ); //loose cut declareProperty( "CaloTrackdEoverPLow", m_calotrackdeoverp_low ); declareProperty( "CaloTrackdEoverPHigh", m_calotrackdeoverp_high ); - declareProperty( "TRTRatio", m_trtratio ); - - declareProperty( "EtaBinsTRT", m_etabinTRT ); - declareProperty( "TrackPtTRT", m_trackPtthrTRT = 5.0*CLHEP::GeV ); - declareProperty( "CaloTrackdETATRT", m_calotrackdetaTRT ); //loose cut - declareProperty( "CaloTrackdPHITRT", m_calotrackdphiTRT ); //loose cut - declareProperty( "TRTRatioTRT", m_trtratioTRT ); - declareProperty( "CaloTrackdEoverPLowTRT", m_calotrackdeoverp_lowTRT ); - declareProperty( "CaloTrackdEoverPHighTRT", m_calotrackdeoverp_highTRT ); + declareProperty( "TRTRatio", m_trtratio); declareMonitoredVariable("CutCounter",m_cutCounter); declareMonitoredCollection("PtCalo",*dvec_cast(&m_egamma_container),&TrigL2ElectronHypo::getCaloPt); @@ -63,11 +53,9 @@ TrigL2ElectronHypo::TrigL2ElectronHypo(const std::string & name, ISvcLocator* pS m_egamma_container = nullptr; } - TrigL2ElectronHypo::~TrigL2ElectronHypo() { } - HLT::ErrorCode TrigL2ElectronHypo::hltInitialize() { ATH_MSG_DEBUG("Initialization:" ); @@ -75,220 +63,154 @@ HLT::ErrorCode TrigL2ElectronHypo::hltInitialize() ATH_MSG_DEBUG("Initialization completed successfully:" ); ATH_MSG_DEBUG("AcceptAll = " << (m_acceptAll==true ? "True" : "False") ); - ATH_MSG_DEBUG("EtaBins = " << m_etabin ); ATH_MSG_DEBUG("TrackPt = " << m_trackPtthr ); ATH_MSG_DEBUG("CaloTrackdETA = " << m_calotrackdeta ); ATH_MSG_DEBUG("CaloTrackdPHI = " << m_calotrackdphi ); ATH_MSG_DEBUG("CaloTrackdEoverPLow = " << m_calotrackdeoverp_low ); ATH_MSG_DEBUG("CaloTrackdEoverPHigh = " << m_calotrackdeoverp_high); - ATH_MSG_DEBUG("TrackAlgoId = " << m_trackalgoID ); - ATH_MSG_DEBUG("TRTRatio = " << m_trtratio ); - - ATH_MSG_DEBUG("EtaBinsTRT = " << m_etabinTRT ); - ATH_MSG_DEBUG("TrackPtTRT = " << m_trackPtthrTRT ); - ATH_MSG_DEBUG("CaloTrackdETATRT = " << m_calotrackdetaTRT ); - ATH_MSG_DEBUG("CaloTrackdPHITRT = " << m_calotrackdphiTRT ); - ATH_MSG_DEBUG("CaloTrackdEoverPLowTRT = " << m_calotrackdeoverp_lowTRT ); - ATH_MSG_DEBUG("CaloTrackdEoverPHighTRT = " << m_calotrackdeoverp_highTRT); - ATH_MSG_DEBUG("TRTRatioTRT = " << m_trtratioTRT ); - + ATH_MSG_DEBUG("TRTRatio = " << m_trtratio); return HLT::OK; } - HLT::ErrorCode TrigL2ElectronHypo::hltFinalize() { ATH_MSG_INFO("in finalize()" ); - - return HLT::OK; + return HLT::OK; } HLT::ErrorCode TrigL2ElectronHypo::hltExecute(const HLT::TriggerElement* outputTE, bool& pass) { - // initialize monitoring counter - m_cutCounter=-1; - m_egamma_container = 0; - - bool hasInput=false; - bool hasContainer=false; - // Accept-All mode - // Allows algorithm to run - 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"); - } - - // get RoI descriptor - const TrigRoiDescriptor* roiDescriptor = 0; - if (getFeature(outputTE, roiDescriptor) != HLT::OK) roiDescriptor = 0; - - if ( !roiDescriptor ) { - ATH_MSG_WARNING("No RoI for this Trigger Element! " ); - - return HLT::NAV_ERROR; - } - - ATH_MSG_DEBUG("Using outputTE("<< outputTE <<")->getId(): " << outputTE->getId() - << "; RoI = " << *roiDescriptor); - - - // get TrigElectrons from the steering - const xAOD::TrigElectronContainer* trigElecColl = 0; - HLT::ErrorCode stat = getFeature(outputTE, trigElecColl, "L2ElectronFex"); - - if ( stat != HLT::OK || trigElecColl == 0) { - if ( msgLvl() <= MSG::DEBUG) { - ATH_MSG_DEBUG("Failed to get TrigElectron collection" ); + // initialize monitoring counter + m_cutCounter=-1; + m_egamma_container = 0; + + bool hasInput=false; + bool hasContainer=false; + // Accept-All mode + // Allows algorithm to run + 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"); } - return HLT::OK; - } - - hasInput=true; - ATH_MSG_DEBUG("Got collection with " << trigElecColl->size() - << " TrigElectrons" ); - - - // if no electrons were found, just leave TrigElectronColl. empty and leave - if ( trigElecColl->size() == 0 ) { - ATH_MSG_DEBUG("No electrons to analyse, leaving!" ); - hasContainer=false; - } - else - hasContainer=true; - // initialize counter after all error conditions checked - m_egamma_container = trigElecColl; - m_cutCounter=0; - bool pTcaloCut=false; - bool dEtaCaloCut=false; - bool dPhiCaloCut=false; - bool eTOverPtCut_lo=false; - bool eTOverPtCut_hi=false; - bool TRTRatioCut=false; - - // generate TrigPassBits mask to flag which TrigElectrons pass hypo cuts - std::unique_ptr<xAOD::TrigPassBits> xBits = xAOD::makeTrigPassBits<xAOD::TrigElectronContainer>(trigElecColl); - - // Now loop over electrons, see if at least one passes all cuts - xAOD::TrigElectronContainer::const_iterator elecIter, elecEnd=trigElecColl->end(); - for (elecIter = trigElecColl->begin(); elecIter != elecEnd; ++elecIter) { - - if(m_acceptAll){ - xBits->markPassing((*elecIter),trigElecColl,true); - continue; - } - const xAOD::TrackParticle* trkIter = (*elecIter)-> trackParticle(); - if (trkIter==NULL) continue; // disconsider candidates without track - int algoId = 0; - if ( trkIter->patternRecoInfo()[xAOD::TrackPatternRecoInfo::FastTrackFinderSeed] ) algoId=9; - if ( trkIter->patternRecoInfo()[xAOD::TrackPatternRecoInfo::strategyA] ) algoId=5; - if ( trkIter->patternRecoInfo()[xAOD::TrackPatternRecoInfo::strategyB] ) algoId=6; - if ( trkIter->patternRecoInfo()[xAOD::TrackPatternRecoInfo::strategyC] ) algoId=7; - ATH_MSG_DEBUG("Trackalgo: "<< algoId ); - // do not try track/cluster match if produced by wrong algo (0=all algos) - if (m_trackalgoID == 0 || (unsigned int)algoId == m_trackalgoID || m_acceptAll || - (m_trackalgoID == 5 && (unsigned int)algoId <= 2 )) { - - // Retrieve all quantities - float absEta = fabs((*elecIter)->caloEta()); - float dPhiCalo = (*elecIter)->trkClusDphi(); - float dEtaCalo = (*elecIter)->trkClusDeta(); - float pTcalo = (*elecIter)->pt(); - float eTOverPt = (*elecIter)->etOverPt(); - // int trackIndx = (*elecIter)->trackIndx(); - float NTRHits = (float)((*elecIter)->nTRTHits()); - float NStrawHits = (float)((*elecIter)->nTRTHiThresholdHits()); - float TRTHitRatio = NStrawHits==0 ? 1e10 : NTRHits/NStrawHits; - - // figure out what eta bin this cluster is in - //Separate binning for IDScan/SiTrack and TRTSegFinder tracks - std::vector<float> temp_etabin; - std::vector<float> temp_calotrackdeta; - std::vector<float> temp_calotrackdphi; - std::vector<float> temp_calotrackdeoverp_low; - std::vector<float> temp_calotrackdeoverp_high; - float temp_trackPtthr = m_trackPtthr; - std::vector<float> temp_trtratio; - temp_etabin = m_etabin; - temp_calotrackdeta = m_calotrackdeta; - temp_calotrackdphi = m_calotrackdphi; - temp_calotrackdeoverp_low = m_calotrackdeoverp_low; - temp_calotrackdeoverp_high = m_calotrackdeoverp_high; - temp_trackPtthr = m_trackPtthr; - temp_trtratio = m_trtratio; + // get RoI descriptor + const TrigRoiDescriptor* roiDescriptor = 0; + if (getFeature(outputTE, roiDescriptor) != HLT::OK) roiDescriptor = 0; - //ignore if cuts/binning not configured - int etaBin = 0; - if(temp_etabin.size()<2 || temp_calotrackdeta.size()<1 || temp_calotrackdphi.size()<1 - || temp_calotrackdeoverp_low.size()<1 || temp_calotrackdeoverp_high.size()<1 || temp_trtratio.size()<1) { - ATH_MSG_DEBUG("Track type "<< algoId<<" does not have corresponding cut configuration" ); - continue;//eta bins and cuts not defined for this track type, ignore track + if ( !roiDescriptor ) { + ATH_MSG_WARNING("No RoI for this Trigger Element! " ); + return HLT::NAV_ERROR; } - - //ignore misconfigured cuts - if(temp_calotrackdeta.size()!= (temp_etabin.size()-1)|| temp_calotrackdphi.size()!= (temp_etabin.size()-1) - || temp_calotrackdeoverp_low.size()!= (temp_etabin.size()-1)|| temp_calotrackdeoverp_high.size()!= (temp_etabin.size()-1) - || temp_trtratio.size()!= (temp_etabin.size()-1)){ - if ( msgLvl() <= MSG::DEBUG ) ATH_MSG_DEBUG("Track type has inconsistent cut configuration" ); - continue; - } - - //## + ATH_MSG_DEBUG("Using outputTE("<< outputTE <<")->getId(): " << outputTE->getId() + << "; RoI = " << *roiDescriptor); - for (std::size_t iBin = 0; iBin < (temp_etabin.size()-1); iBin++ ) - if ( absEta > temp_etabin[iBin] && absEta < temp_etabin[iBin+1] ) etaBin = iBin; - + // get TrigElectrons from the steering + const xAOD::TrigElectronContainer* trigElecColl = 0; + HLT::ErrorCode stat = getFeature(outputTE, trigElecColl, "L2ElectronFex"); - //## - - - ATH_MSG_DEBUG("absEta = " << absEta << " ==> etaBin = " << etaBin ); - ATH_MSG_DEBUG("pT (Calo) = " << pTcalo ); - ATH_MSG_DEBUG("dEtaCalo = " << dEtaCalo << ", cut = " << temp_calotrackdeta[etaBin] ); - ATH_MSG_DEBUG("dPhiCalo = " << dPhiCalo << ", cut = " << temp_calotrackdphi[etaBin] ); - ATH_MSG_DEBUG("eTOverPt = " << eTOverPt << ", cuts = [" - << temp_calotrackdeoverp_low[etaBin] << ", " << temp_calotrackdeoverp_high[etaBin] << "]" ); - - // apply cuts - - if (pTcalo > temp_trackPtthr) { - pTcaloCut=true; - if (dEtaCalo < temp_calotrackdeta[etaBin]) { - dEtaCaloCut=true; - if (dPhiCalo < temp_calotrackdphi[etaBin]) { - dPhiCaloCut=true; - if(eTOverPt > temp_calotrackdeoverp_low[etaBin] ) { - eTOverPtCut_lo = true; - if ( eTOverPt < temp_calotrackdeoverp_high[etaBin] ) { - eTOverPtCut_hi = true; - if (TRTHitRatio > temp_trtratio[etaBin]){ - TRTRatioCut = true; - - // TrigElectron passed all cuts: set flags - pass = true; - xBits->markPassing((*elecIter),trigElecColl,true); + if ( stat != HLT::OK || trigElecColl == 0) { + if ( msgLvl() <= MSG::DEBUG) { + ATH_MSG_DEBUG("Failed to get TrigElectron collection" ); + } + return HLT::OK; + } - ATH_MSG_DEBUG("Event accepted !" ); + hasInput=true; + ATH_MSG_DEBUG("Got collection with " << trigElecColl->size() + << " TrigElectrons" ); - } - } - } - } - } - } + // if no electrons were found, just leave TrigElectronColl. empty and leave + if ( trigElecColl->size() == 0 ) { + ATH_MSG_DEBUG("No electrons to analyse, leaving!" ); + hasContainer=false; } - } // end of loop over electrons - - m_cutCounter=hasInput+hasContainer+pTcaloCut+dEtaCaloCut+dPhiCaloCut+eTOverPtCut_lo+eTOverPtCut_hi+TRTRatioCut; - // store TrigPassBits result - if(attachFeature(outputTE, xBits.release(),"passbits") != HLT::OK) - ATH_MSG_ERROR("Could not store TrigPassBits! "); + else { + hasContainer=true; + } + // initialize counter after all error conditions checked + m_egamma_container = trigElecColl; + m_cutCounter=0; + bool pTcaloCut=false; + bool dEtaCaloCut=false; + bool dPhiCaloCut=false; + bool eTOverPtCut_lo=false; + bool eTOverPtCut_hi=false; + bool TRTRatioCut=false; + + // generate TrigPassBits mask to flag which TrigElectrons pass hypo cuts + std::unique_ptr<xAOD::TrigPassBits> xBits = xAOD::makeTrigPassBits<xAOD::TrigElectronContainer>(trigElecColl); + + // Now loop over electrons, see if at least one passes all cuts + xAOD::TrigElectronContainer::const_iterator elecIter, elecEnd=trigElecColl->end(); + for (elecIter = trigElecColl->begin(); elecIter != elecEnd; ++elecIter) { + + if(m_acceptAll){ + xBits->markPassing((*elecIter),trigElecColl,true); + continue; + } + const xAOD::TrackParticle* trkIter = (*elecIter)-> trackParticle(); + if (trkIter==NULL) continue; // disconsider candidates without track + + // Retrieve all quantities + float dPhiCalo = (*elecIter)->trkClusDphi(); + float dEtaCalo = (*elecIter)->trkClusDeta(); + float pTcalo = (*elecIter)->pt(); + float eTOverPt = (*elecIter)->etOverPt(); + // int trackIndx = (*elecIter)->trackIndx(); + float NTRHits = (float)((*elecIter)->nTRTHits()); + float NStrawHits = (float)((*elecIter)->nTRTHiThresholdHits()); + float TRTHitRatio = NStrawHits==0 ? 1e10 : NTRHits/NStrawHits; + + // apply cuts + + if (pTcalo < m_trackPtthr){ + ATH_MSG_VERBOSE("Fails pt cut"); + continue; + } + pTcaloCut=true; + if (dEtaCalo > m_calotrackdeta) { + ATH_MSG_VERBOSE("Fails dEta cut"); + continue; + } + dEtaCaloCut=true; + if (dPhiCalo > m_calotrackdphi) { + ATH_MSG_VERBOSE("Fails dPhi cut"); + continue; + } + dPhiCaloCut=true; + if(eTOverPt < m_calotrackdeoverp_low ) { + ATH_MSG_VERBOSE("Fails eoverp low cut"); + continue; + } + eTOverPtCut_lo = true; + if ( eTOverPt > m_calotrackdeoverp_high ) { + ATH_MSG_VERBOSE("Fails eoverp high cut"); + continue; + } + eTOverPtCut_hi = true; + if (TRTHitRatio < m_trtratio){ + ATH_MSG_VERBOSE("Fails TRT cut"); + continue; + } + TRTRatioCut = true; + + // TrigElectron passed all cuts: set flags + pass = true; + xBits->markPassing((*elecIter),trigElecColl,true); + + ATH_MSG_DEBUG("Event accepted !" ); + } // end of loop over electrons + + m_cutCounter=hasInput+hasContainer+pTcaloCut+dEtaCaloCut+dPhiCaloCut+eTOverPtCut_lo+eTOverPtCut_hi+TRTRatioCut; + // store TrigPassBits result + if(attachFeature(outputTE, xBits.release(),"passbits") != HLT::OK) + ATH_MSG_ERROR("Could not store TrigPassBits! "); - return HLT::OK; + return HLT::OK; } -- GitLab