From 12933178f3231d52d695b2d89dc969e85ead8dd7 Mon Sep 17 00:00:00 2001 From: Stewart Martin-Haugh <Stewart.Martin-Haugh@cern.ch> Date: Thu, 4 Dec 2014 20:00:27 +0100 Subject: [PATCH] 'fixes for JIRA ATR-9604' (TrigEgammaMonitoring-00-01-32) * Remove extrapolation tool from config * TrigEgammaMonitoring-00-01-31 2014-11-04 Ryan White <ryan.white@cern.ch> * Removing extrapolation tool from monitoring * If required see TrigL2ElectronFex for new track-calo extrap * TrigEgammaMonitoring-00-01-30 --- .../HLTEgammaFEXBaseTool.h | 5 - .../HLTEgammaFEXNavSigTEBaseTool.h | 30 +- .../TrigEgammaMonitoring/HLTEgammaMonTool.h | 3 - .../HLTEgammaNavMonTool.h | 4 - .../HLTEgammaNavSigTEMonTool.h | 14 +- .../TrigEgammaMonitoring/cmt/requirements | 7 +- .../python/TrigEgammaMonitoringConfig.py | 50 +- .../src/HLTEgammaFEXBaseTool.cxx | 44 +- .../src/HLTEgammaFEXNavSigTEBaseTool.cxx | 558 +++++++++++++++++- .../src/HLTEgammaMonTool.cxx | 27 +- .../src/HLTEgammaNavMonTool.cxx | 65 +- .../src/HLTEgammaNavSigTEMonTool.cxx | 313 ++++++---- 12 files changed, 837 insertions(+), 283 deletions(-) diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/TrigEgammaMonitoring/HLTEgammaFEXBaseTool.h b/Trigger/TrigMonitoring/TrigEgammaMonitoring/TrigEgammaMonitoring/HLTEgammaFEXBaseTool.h index 3f99af6931e..efebc5228e3 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/TrigEgammaMonitoring/HLTEgammaFEXBaseTool.h +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/TrigEgammaMonitoring/HLTEgammaFEXBaseTool.h @@ -41,9 +41,6 @@ namespace Rec { class TrackParticle; } -class IExtrapolateToCaloTool; -class CaloDepthTool; - class HLTEgammaFEXBaseTool : public IHLTMonTool { public: @@ -84,8 +81,6 @@ class HLTEgammaFEXBaseTool : public IHLTMonTool { virtual void divide(TH1 *num, TH1 *den, TH1 *quo); IToolSvc* m_toolSvc; - IExtrapolateToCaloTool* m_toCalo; - CaloDepthTool* m_calodepth; bool m_doExtrapol; std::string m_EMClusterKey; diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/TrigEgammaMonitoring/HLTEgammaFEXNavSigTEBaseTool.h b/Trigger/TrigMonitoring/TrigEgammaMonitoring/TrigEgammaMonitoring/HLTEgammaFEXNavSigTEBaseTool.h index 54710cbc07e..624a1f187c8 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/TrigEgammaMonitoring/HLTEgammaFEXNavSigTEBaseTool.h +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/TrigEgammaMonitoring/HLTEgammaFEXNavSigTEBaseTool.h @@ -13,10 +13,14 @@ #include "AnalysisTriggerEvent/LVL1_ROI.h" #include "AnalysisTriggerEvent/EmTau_ROI.h" +#include "xAODTrigger/EmTauRoI.h" #include "TrigCaloEvent/TrigEMCluster.h" #include "TrigCaloEvent/TrigEMClusterContainer.h" +#include "xAODTrigCalo/TrigEMCluster.h" +#include "xAODTrigCalo/TrigEMClusterContainer.h" + #include "CaloEvent/CaloClusterContainer.h" #include "CaloEvent/CaloCluster.h" @@ -34,6 +38,11 @@ #include "egammaEvent/ElectronContainer.h" #include "egammaEvent/Electron.h" +#include "xAODEgamma/ElectronContainer.h" +#include "xAODEgamma/Electron.h" +#include "xAODEgamma/EgammaContainer.h" +#include "xAODEgamma/Egamma.h" + class TrigInDetTrackCollection; class TrigInDetTrack; @@ -43,8 +52,6 @@ namespace Reco { class ITrackToVertex; } using std::vector; using std::string; -class IExtrapolateToCaloTool; -class CaloDepthTool; /** * class HLTEgammaFEXNavSigTEBaseTool @@ -165,84 +172,101 @@ class HLTEgammaFEXNavSigTEBaseTool : public IHLTMonTool { * Fills histograms corresponding to L1 quantities */ void fillL1(const EmTau_ROI &itEMTau, const string &grp); + void fillL1(const xAOD::EmTauRoI &itEMTau, const string &grp); /** * Fills resolution L1<->Offline * - ratios L1/offline for et, eta, and phi */ void fillL1OffRes(const EmTau_ROI &itEMTau, const egamma* matchedEgamma, const string &grp); + void fillL1OffRes(const xAOD::EmTauRoI &itEMTau, const xAOD::Egamma* matchedEgamma, const string &grp); /** * Fills L2 calo observables */ void fillL2Calo(const TrigEMCluster *matchedL2, const string &grp); + void fillL2Calo(const xAOD::TrigEMCluster *matchedL2, const string &grp); + /** * Fills resolution L2Calo<-> Offline */ void fillL2CaloOffRes(const TrigEMCluster *matchedL2, const egamma* matchedEgamma, const string &grp); + void fillL2CaloOffRes(const xAOD::TrigEMCluster *matchedL2, const xAOD::Egamma* matchedEgamma, const string &grp); /** * Fills L2 track observable histograms */ void fillL2ID(const TrigInDetTrack* track, const TrigEMCluster* cluster, const string &grp); + void fillL2ID(const xAOD::TrackParticle* track, const xAOD::TrigEMCluster* cluster, const string &grp); /** * Fills L2 track resolution histograms */ void fillL2IDOffRes(const TrigInDetTrack* track, const egamma* matchedEgamma, const string &grp); + void fillL2IDOffRes(const xAOD::TrackParticle* track, const xAOD::Electron* matchedEgamma, const string &grp); /** * Fills EF calo observables */ void fillEFCalo(const CaloCluster* cluster, const TrigEMCluster* l2Cluster, const string &grp); + void fillEFCalo(const xAOD::CaloCluster* cluster, const xAOD::TrigEMCluster* l2Cluster, const string &grp); /** * Fills EF calo shower observables */ void fillEFCaloShower(const egamma* EFeg, const string &grp); + void fillEFCaloShower(const xAOD::Egamma* EFeg, const string &grp); /** * Fills EF Calo resolution histograms */ void fillEFCaloOffRes(const CaloCluster* cluster, const egamma* offline, const string &grp); + void fillEFCaloOffRes(const xAOD::CaloCluster* cluster, const xAOD::Egamma* offline, const string &grp); /** * Fills event filter/offline track information */ void fillEFID(const egamma *matchedEFTrk, const string &grp); + void fillEFID(const xAOD::Electron *matchedEFTrk, const string &grp); /** * Fills EF track resolutions */ void fillEFIDOffRes(const egamma *matchedEFTrk, const egamma *matchedEgamma, const string &grp); + void fillEFIDOffRes(const xAOD::Electron *matchedEFTrk, const xAOD::Electron *matchedEgamma, const string &grp); /** * Fills event filter/offline egamma information */ void fillEFeg(const egamma* matchedEFeg, const string &grp, const double pt_cut); + void fillEFeg(const xAOD::Egamma* matchedEFeg, const string &grp, const double pt_cut); /** * Fills event match offline egamma information for efficiencies */ void fillEFMatch(const egamma* matchedEFeg, const string &grp, const double pt_cut); + void fillEFMatch(const xAOD::Egamma* matchedEFeg, const string &grp, const double pt_cut); /** * Fills EF egamma resolutions */ void fillEFegOffRes(const egamma* matchedEFeg, const egamma* matchedEgamma, const string &grp); + void fillEFegOffRes(const xAOD::Egamma* matchedEFeg, const xAOD::Egamma* matchedEgamma, const string &grp); /** * Fills offline egamma histograms * - calls event filter egamma filler (and track filler for electrons) */ void fillOfflineEgamma(const egamma* eg, bool isPhoton, const string path, const double elec_cut, const double phot_cut); + void fillOfflineEgamma(const xAOD::Electron* eg, bool isPhoton, const string path, const double elec_cut, const double phot_cut); /** * Fills offline egamma histograms * - calls event match efficiency egamma filler */ void fillOfflineMatches(const egamma* eg, bool isPhoton, const string path, const double elec_cut, const double phot_cut); + void fillOfflineMatches(const xAOD::Egamma* eg, bool isPhoton, const string path, const double elec_cut, const double phot_cut); /** @@ -371,8 +395,6 @@ class HLTEgammaFEXNavSigTEBaseTool : public IHLTMonTool { IToolSvc* m_toolSvc; //!< Central tool service - IExtrapolateToCaloTool* m_toCalo; //!< Interface to calo depth tool - CaloDepthTool* m_calodepth; //!< Calo depth tool bool m_doExtrapol; //!< Switch for track->calo extrapolation //storegate keys diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/TrigEgammaMonitoring/HLTEgammaMonTool.h b/Trigger/TrigMonitoring/TrigEgammaMonitoring/TrigEgammaMonitoring/HLTEgammaMonTool.h index 7040e8c994d..9619ac834cd 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/TrigEgammaMonitoring/HLTEgammaMonTool.h +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/TrigEgammaMonitoring/HLTEgammaMonTool.h @@ -35,9 +35,6 @@ namespace Rec { class TrackParticle; } -class IExtrapolateToCaloTool; -class CaloDepthTool; - class HLTEgammaMonTool : public HLTEgammaFEXBaseTool { public: diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/TrigEgammaMonitoring/HLTEgammaNavMonTool.h b/Trigger/TrigMonitoring/TrigEgammaMonitoring/TrigEgammaMonitoring/HLTEgammaNavMonTool.h index 7d570af9ec9..258d842babb 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/TrigEgammaMonitoring/HLTEgammaNavMonTool.h +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/TrigEgammaMonitoring/HLTEgammaNavMonTool.h @@ -40,9 +40,6 @@ namespace Rec { class TrackParticle; } -class IExtrapolateToCaloTool; -class CaloDepthTool; - class HLTEgammaNavMonTool : public HLTEgammaFEXBaseTool { public: @@ -74,7 +71,6 @@ class HLTEgammaNavMonTool : public HLTEgammaFEXBaseTool { unsigned int m_fill_condition; unsigned int m_rate_condition; std::map< std::string, std::vector<unsigned int> > m_counters; - ToolHandle<IExtrapolateToCaloTool> m_trackExtrapolator; }; #endif diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/TrigEgammaMonitoring/HLTEgammaNavSigTEMonTool.h b/Trigger/TrigMonitoring/TrigEgammaMonitoring/TrigEgammaMonitoring/HLTEgammaNavSigTEMonTool.h index a3ab9a80ce7..27ee865162d 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/TrigEgammaMonitoring/HLTEgammaNavSigTEMonTool.h +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/TrigEgammaMonitoring/HLTEgammaNavSigTEMonTool.h @@ -38,6 +38,8 @@ #include "egammaEvent/PhotonContainer.h" #include "egammaEvent/Photon.h" +#include "xAODEgamma/ElectronContainer.h" + //ROOT and STL #include <map> #include <set> @@ -46,7 +48,7 @@ //Lumi #include "GaudiKernel/ServiceHandle.h" #include "LumiBlockComps/ILumiCalcSvc.h" -#include "LumiBlockComps/CoolQuery.h" +#include "LumiCalc/CoolQuery.h" //for convenience (TODO find out whether this is allowed in ATLAS software) using std::string; @@ -57,9 +59,6 @@ using std::set; class TrigInDetTrackCollection; namespace Rec { class TrackParticle; } -//forward declare classes needed for track->calo extrapolation -class IExtrapolTrackToCaloTool; -class CaloDepthTool; /** * HLTEgammaNavSigTEMonTool @@ -118,6 +117,7 @@ class HLTEgammaNavSigTEMonTool : public HLTEgammaFEXNavSigTEBaseTool { * - survivors are filled using offline filler derived from base class */ void fillOfflineEgammas(const egammaContainer* egCont); + void fillOfflineEgammas(const xAOD::ElectronContainer* egCont); @@ -152,7 +152,7 @@ class HLTEgammaNavSigTEMonTool : public HLTEgammaFEXNavSigTEBaseTool { * - applies author and minimum pt cuts (the latter are set in joboptions) * - returns best match */ - const egamma* matchOffline(const float eta, const float phi, bool useCalo, bool isPhoton); + const xAOD::Electron* matchOffline(const float eta, const float phi, bool useCalo, bool isPhoton); /** @@ -200,8 +200,8 @@ class HLTEgammaNavSigTEMonTool : public HLTEgammaFEXNavSigTEBaseTool { bool m_doOfflineComparisons; string m_electronContainerName; string m_photonContainerName; - egammaContainer const* m_elecTES; - egammaContainer const* m_photTES; + xAOD::ElectronContainer const* m_elecTES; + xAOD::ElectronContainer const* m_photTES; float m_offEle_minptcut; float m_offPho_minptcut; float m_dR_off; diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/cmt/requirements b/Trigger/TrigMonitoring/TrigEgammaMonitoring/cmt/requirements index bee503567da..5120226770a 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/cmt/requirements +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/cmt/requirements @@ -10,19 +10,17 @@ use ITrackToVertex ITrackToVertex-* Reconstruction/RecoTools use xAODTrigCalo xAODTrigCalo-* Event/xAOD use xAODTrigger xAODTrigger-* Event/xAOD use xAODCaloEvent xAODCaloEvent-* Event/xAOD +use xAODEgamma xAODEgamma-* Event/xAOD private # xAOD material use xAODTracking xAODTracking-* Event/xAOD use xAODTrigEgamma xAODTrigEgamma-* Event/xAOD -use xAODEgamma xAODEgamma-* Event/xAOD apply_tag ROOTGraphicsLibs apply_tag ROOTMathLibs use EventInfo EventInfo-* Event +use xAODEventInfo xAODEventInfo-* Event/xAOD use LArRecEvent LArRecEvent-* LArCalorimeter -use CaloDetDescr CaloDetDescr-* Calorimeter -#use ITrackToCalo ITrackToCalo-* Reconstruction/RecoTools -use RecoToolInterfaces RecoToolInterfaces-* Reconstruction/RecoTools use Particle Particle-* Reconstruction use AtlasBoost AtlasBoost-* External end_private @@ -44,6 +42,7 @@ use TrigSteeringEvent TrigSteeringEvent-* Trigger/TrigEvent #AT: To access Lumi use LumiBlockComps LumiBlockComps-* LumiBlock +use LumiCalc LumiCalc-* LumiBlock #use AtlasCOOL AtlasCOOL-* External #use AtlasCORAL AtlasCORAL-* External #use CoraCool CoraCool-* Database diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringConfig.py b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringConfig.py index 3bd015b5c4a..ca91cc98099 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringConfig.py +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringConfig.py @@ -4,60 +4,58 @@ def HLTEgammaMonitoringTool(): from AthenaCommon.AppMgr import ToolSvc - from TrackToCalo.ExtrapolateToCaloToolBase import \ - ExtrapolateToCaloToolFactory - extrap = ExtrapolateToCaloToolFactory (depth='showerdefault', - straightLine=False) - ToolSvc+=extrap - from TrigEgammaMonitoring.TrigEgammaMonitoringConf import HLTEgammaMonTool HLTEgammaMon = HLTEgammaMonTool(name = 'HLTEgammaMon', histoPathBase = "/Trigger/HLT") ToolSvc += HLTEgammaMon; from TrigEgammaMonitoring.TrigEgammaMonitoringConf import HLTEgammaNavMonTool HLTEgammaNavMon = HLTEgammaNavMonTool(name = 'HLTEgammaNavMon', histoPathBase = "/Trigger/HLT") - HLTEgammaNavMon.signatures = ['e5_loose1','e24_medium_iloose','e28_tight_iloose','e28_tight_iloose_L2StarA'] + HLTEgammaNavMon.signatures = ['e5_loose1','e24_medium_iloose','e28_tight_iloose','e28_tight_iloose_L2StarA','e24_medium_L1EM20V'] #HLTEgammaNavMon.signatures = ['e5_NoCut','e5_medium1','e10_loose','e20_loose_IdScan'] #HLTEgammaNavMon.signatures +=['e5_NoCut_cosmic','e10_loose_cosmic','e10_medium_cosmic'] #HLTEgammaNavMon.doExtrapol=False - HLTEgammaNavMon.TrackExtrapolator=extrap ToolSvc += HLTEgammaNavMon; list = ['HLTEgammaNavMonTool/HLTEgammaNavMon']; - return list + #return list from TrigEgammaMonitoring.TrigEgammaMonitoringConf import HLTEgammaNavSigTEMonTool - HLTEgammaNavSigTEMon = HLTEgammaNavSigTEMonTool(name = 'HLTEgammaNavSigTEMon', histoPathBase = "/Trigger/HLT") + HLTEgammaNavSigTEMon = HLTEgammaNavSigTEMonTool(name = 'HLTEgammaNavSigTEMon', histoPathBase = "/Trigger/HLT",doExtrapol=False) #---Electron Signatures for Collisions: - HLTEgammaNavSigTEMon.signatures = ['e24vh_medium1'] - HLTEgammaNavSigTEMon.signatures +=['e24vhi_medium1'] - HLTEgammaNavSigTEMon.signatures +=['2e12Tvh_loose1'] - HLTEgammaNavSigTEMon.signatures +=['e24vh_tight1_e15_NoCut_Zee'] - HLTEgammaNavSigTEMon.signatures +=['e24vh_medium1_L2StarB'] + #HLTEgammaNavSigTEMon.signatures = ['e28_tight_iloose'] + HLTEgammaNavSigTEMon.signatures =['e5_loose1','e24_medium_iloose','e28_tight_iloose','e28_tight_iloose_L2StarA','e24_medium_L1EM20V','e24_medium1_L1EM20V','e28_lhtight_iloose'] + #HLTEgammaNavSigTEMon.signatures +=['e5_loose1','e24_medium_iloose','e28_tight_iloose','e28_tight_iloose_L2StarA'] + #HLTEgammaNavSigTEMon.signatures += ['e24vh_medium1'] + #HLTEgammaNavSigTEMon.signatures +=['e24vhi_medium1'] + #HLTEgammaNavSigTEMon.signatures +=['2e12Tvh_loose1'] + #HLTEgammaNavSigTEMon.signatures +=['e24vh_tight1_e15_NoCut_Zee'] + #HLTEgammaNavSigTEMon.signatures +=['e24vh_medium1_L2StarB'] #---Photon Signatures for Collisions: - HLTEgammaNavSigTEMon.signatures += ['g35_loose_g25_loose'] + #HLTEgammaNavSigTEMon.signatures += ['g35_loose_g25_loose'] #---Cosmics Signatures: - HLTEgammaNavSigTEMon.signatures += ['g5_NoCut_cosmic'] + #HLTEgammaNavSigTEMon.signatures += ['g5_NoCut_cosmic'] #---HeavyIon signatures: - HLTEgammaNavSigTEMon.signatures += ['e5_medium1_IDTrkNoCut'] - HLTEgammaNavSigTEMon.signatures += ['e5_tight1_e5_NoCut'] - HLTEgammaNavSigTEMon.signatures += ['e15_loose1'] - HLTEgammaNavSigTEMon.signatures += ['g20_medium'] + #HLTEgammaNavSigTEMon.signatures += ['e5_medium1_IDTrkNoCut'] + #HLTEgammaNavSigTEMon.signatures += ['e5_tight1_e5_NoCut'] + #HLTEgammaNavSigTEMon.signatures += ['e15_loose1'] + #HLTEgammaNavSigTEMon.signatures += ['g20_medium'] #---Configure pass-states to be monitored - HLTEgammaNavSigTEMon.doActiveChain = True - HLTEgammaNavSigTEMon.doActiveTe = False + HLTEgammaNavSigTEMon.doActiveChain = False + HLTEgammaNavSigTEMon.doActiveTe = True HLTEgammaNavSigTEMon.doAllTe = False #---Turns off PassedTE plots (partially covered by the doActiveTe option, but this # suppresses booking and plotting entirely) - HLTEgammaNavSigTEMon.skipActiveTe = True + HLTEgammaNavSigTEMon.skipActiveTe = False #---Configure rest HLTEgammaNavSigTEMon.UsePreConditionalPassThroughChain = False - HLTEgammaNavSigTEMon.OfflineEleMinPTCut = 25. #GeV - HLTEgammaNavSigTEMon.OfflinePhoMinPTCut = 40. #GeV + HLTEgammaNavSigTEMon.OfflineEleMinPTCut = 2. #GeV + HLTEgammaNavSigTEMon.OfflinePhoMinPTCut = 2. #GeV HLTEgammaNavSigTEMon.DoLumiCalc = False HLTEgammaNavSigTEMon.DatabaseName = "COOLONL_TRIGGER/COMP200" HLTEgammaNavSigTEMon.CoolFolderName = "/TRIGGER/LUMI/LBLESTONL" HLTEgammaNavSigTEMon.TagName = "OflLumi-7TeV-001" ToolSvc += HLTEgammaNavSigTEMon; + list = ['HLTEgammaNavSigTEMonTool/HLTEgammaNavSigTEMon', 'HLTEgammaNavMonTool/HLTEgammaNavMon']; + return list list = ['HLTEgammaMonTool/HLTEgammaMon', 'HLTEgammaNavSigTEMonTool/HLTEgammaNavSigTEMon', 'HLTEgammaNavMonTool/HLTEgammaNavMon']; return list diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/HLTEgammaFEXBaseTool.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/HLTEgammaFEXBaseTool.cxx index ca454352cd6..c89b09b466b 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/HLTEgammaFEXBaseTool.cxx +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/HLTEgammaFEXBaseTool.cxx @@ -25,10 +25,6 @@ #include "Particle/TrackParticle.h" #include "Particle/TrackParticleContainer.h" -//for extrapolation -#include "CaloDetDescr/CaloDepthTool.h" -#include "RecoToolInterfaces/IExtrapolateToCaloTool.h" - #include "egammaEvent/egammaContainer.h" #include "egammaEvent/egamma.h" #include "egammaEvent/EMTrackMatch.h" @@ -243,45 +239,29 @@ void HLTEgammaFEXBaseTool::FillEFCalo(const xAOD::CaloCluster *matchedEFCalo, fl void HLTEgammaFEXBaseTool::extrapolateToFirstSurface(const Rec::TrackParticle* m_track, double &caloeta, double &calophi ) { //bool got_a_track = false; + // Removing extrapolator -- need to migrate to new extrapolation if (!m_track) { (*m_log) << MSG::DEBUG << "m_track is NULL!!" << endreq; caloeta = -1111.; calophi = -1111.; return; } + caloeta = -1111.; + calophi = -1111.; + // HepGeom::Point3D<double> *pt_calo_ctb = new HepGeom::Point3D<double>; // HepGeom::Point3D<double> *pt_calo_local = new HepGeom::Point3D<double>; - double trketa = -std::log(tan(((m_track)->perigee())->parameters()[Trk::theta]/2.)); - - double distbar = 0.; - double distec = 0.; - double offset = 0.; - bool result = false; - CaloCell_ID::CaloSample sample; - distbar = m_calodepth->deta(CaloCell_ID::EMB1,trketa); - distec = m_calodepth->deta(CaloCell_ID::EME1,trketa); - if (distbar < 0 ) sample = CaloCell_ID::EMB1; - else if (distec < 0 ) sample = CaloCell_ID::EME1; - else if ( distbar < distec) sample = CaloCell_ID::EMB1; - else sample = CaloCell_ID::EME1; - - (*m_log) << MSG::DEBUG << "Calculating track seen by Calo ..." << endreq; - const Trk::TrackParameters * SeenByCalo = m_toCalo->extrapolate(*(m_track->originalTrack()),sample,offset) ; - result = ( SeenByCalo != NULL ); - - if (result) { - //got_a_track=true; - caloeta = SeenByCalo->eta(); - calophi = SeenByCalo->momentum().phi(); - } else { - caloeta = -1111.; - calophi = -1111.; - } + // double trketa = -std::log(tan(((m_track)->perigee())->parameters()[Trk::theta]/2.)); + + // double distbar = 0.; + // double distec = 0.; + // double offset = 0.; + // bool result = false; - //delete pt_calo_ctb; - //delete pt_calo_local; + // delete pt_calo_ctb; + // delete pt_calo_local; } bool HLTEgammaFEXBaseTool::runTrack(const DataHandle<TrigInDetTrackCollection> lvl2t_first, const DataHandle<TrigInDetTrackCollection> lvl2t_last, float l2eta, float l2phi, \ diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/HLTEgammaFEXNavSigTEBaseTool.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/HLTEgammaFEXNavSigTEBaseTool.cxx index cfd52b684a6..60c142b31c8 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/HLTEgammaFEXNavSigTEBaseTool.cxx +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/HLTEgammaFEXNavSigTEBaseTool.cxx @@ -32,10 +32,6 @@ #include "Particle/TrackParticle.h" #include "Particle/TrackParticleContainer.h" -//for extrapolation -#include "CaloDetDescr/CaloDepthTool.h" -#include "RecoToolInterfaces/IExtrapolateToCaloTool.h" - #include "egammaEvent/egammaContainer.h" #include "egammaEvent/egamma.h" #include "egammaEvent/EMTrackMatch.h" @@ -93,7 +89,7 @@ HLTEgammaFEXNavSigTEBaseTool::HLTEgammaFEXNavSigTEBaseTool(const string & type, declareProperty("lowEtCut", m_lowEtCut = 3.*CLHEP::GeV); declareProperty("maxEtaCut", m_maxEtaCut = 2.5); - declareProperty("doExtrapol", m_doExtrapol = true); + declareProperty("doExtrapol", m_doExtrapol = false); declareProperty("TrigEMClusterKey", m_EMClusterKey = "HLT_TrigT2CaloEgamma"); declareProperty("egDetailKey", m_egDetailKey = "egDetailContainer");//for AOD: egDetailAOD @@ -330,13 +326,13 @@ StatusCode HLTEgammaFEXNavSigTEBaseTool::book_per_signature_res(const string sig //---L1 addMonGroup(new MonGroup(this,*pathIt+"/L1/Resolution",run)); - addHistogram(new TH1F("EmClus", "L1 EM Cluster Energy Resolution; L1 E_{T} / Off CaloCluster E_{T}; Entries", 21, -0.05, 2.05)); - addHistogram(new TH1F("Eta", "L1 \\eta Resolution; L1 \\eta / Off CaloCluster \\eta ; Entries", 21, -0.05, 2.05)); - addHistogram(new TH1F("Phi", "L1 \\phi Resolution; L1 \\phi / Off CaloCluster \\phi; Entries", 21, -0.05, 2.05)); + addHistogram(new TH1F("EmClus", "L1 EM Cluster Energy Resolution; L1 E_{T} / Off CaloCluster E_{T}; Entries", 63, -0.05, 2.05)); + addHistogram(new TH1F("Eta", "L1 \\eta Resolution; L1 \\eta / Off CaloCluster \\eta ; Entries", 63, -0.05, 2.05)); + addHistogram(new TH1F("Phi", "L1 \\phi Resolution; L1 \\phi / Off CaloCluster \\phi; Entries", 63, -0.05, 2.05)); //---L2Calo addMonGroup(new MonGroup(this,*pathIt+"/L2Calo/Resolution",run)); - addHistogram(new TH1F("Rcore", "L2 Calo R\\eta Resolution; L2 Calo R\\eta / Off R\\eta; Entries", 21, -0.05, 2.05)); + addHistogram(new TH1F("Rcore", "L2 Calo R\\eta Resolution; L2 Calo R\\eta / Off R\\eta; Entries", 63, -0.05, 2.05)); addHistogram(new TH1F("Rstrip", "L2 Calo E_{ratio} Resolution; L2 Calo E_{ratio} / Off E_{ratio} ; Entries", 21, -0.05, 2.05)); addHistogram(new TH1F("HadEt", "L2 Hadronic Calo E_{T} Resolution; L2 Hadronic Calo E_{T} / Off Hadronic Calo E_{T}; Entries", 51, -0.05, 5.05)); addHistogram(new TH1F("Et", "L2 EM Calo E_{T} Resolution; L2 EM Calo E_{T} / Off CaloCluster E_{T}; Entries", 21, -0.05, 2.05)); @@ -748,6 +744,17 @@ void HLTEgammaFEXNavSigTEBaseTool::fillL1(const EmTau_ROI &itEMTau, const std::s hist("Phi", grp)->Fill(itEMTau.getPhi()); hist2("EtaPhiMap", grp)->Fill(itEMTau.getEta(),itEMTau.getPhi(),1.); } +void HLTEgammaFEXNavSigTEBaseTool::fillL1(const xAOD::EmTauRoI &itEMTau, const std::string &grp) +{ + hist("EmClus", grp)->Fill(itEMTau.emClus() / CLHEP::GeV); + hist("EmIsol", grp)->Fill(itEMTau.emIsol() / CLHEP::GeV); + hist("HadCore", grp)->Fill(itEMTau.hadCore() / CLHEP::GeV); + hist("HadIsol", grp)->Fill(itEMTau.hadIsol() / CLHEP::GeV); + hist("ECore", grp)->Fill(itEMTau.core() / CLHEP::GeV); + hist("Eta", grp)->Fill(itEMTau.eta()); + hist("Phi", grp)->Fill(itEMTau.phi()); + hist2("EtaPhiMap", grp)->Fill(itEMTau.eta(),itEMTau.phi(),1.); +} //END OF LEVEL 1 OBSERVABLE HISTOGRAM FILLING @@ -777,6 +784,27 @@ void HLTEgammaFEXNavSigTEBaseTool::fillL1OffRes(const EmTau_ROI &itEMTau, hist("Phi", grp)->Fill(egamma_clus_phi); } +void HLTEgammaFEXNavSigTEBaseTool::fillL1OffRes(const xAOD::EmTauRoI &itEMTau, + const xAOD::Egamma* matchedEgamma, const std::string &grp) { + + //check a valid offline match was supplied + if(!matchedEgamma){ return; } + + //fetch associated CaloCluster and make sure it's valid + const xAOD::CaloCluster* cluster = matchedEgamma->caloCluster(); + if(!cluster){ + ATH_MSG_WARNING("Couldn't fetch CaloCluster for filling histograms in group "<<grp); + return; + } + + //calculate and fill resolutions + float egamma_clus_et = calcRatio(itEMTau.emClus(), calcEt(cluster->e(), cluster->eta())); + float egamma_clus_eta = calcRatio(itEMTau.eta(), cluster->eta()); + float egamma_clus_phi = calcRatio(itEMTau.phi(), cluster->phi()); + hist("EmClus", grp)->Fill(egamma_clus_et); + hist("Eta", grp)->Fill(egamma_clus_eta ); + hist("Phi", grp)->Fill(egamma_clus_phi); +} //END OF LEVEL 1 RESOLUTION FILLING @@ -806,6 +834,29 @@ void HLTEgammaFEXNavSigTEBaseTool::fillL2Calo(const TrigEMCluster *matchedL2, co hist("f1", grp)->Fill(ES1 / Etotal); hist2("EtaPhiMap", grp)->Fill(matchedL2->eta(),matchedL2->phi(),1.); } + +void HLTEgammaFEXNavSigTEBaseTool::fillL2Calo(const xAOD::TrigEMCluster *matchedL2, const string &grp) { + //check if were given a valid cluster + if(!matchedL2){ return; } + + //calculate and fill quantities + float rcore = calcRatio(matchedL2->e237(), matchedL2->e277()); + float rstrip = calcRStrips(matchedL2->emaxs1(), matchedL2->e2tsts1()); + float et = calcEt(matchedL2->energy(), matchedL2->eta()); + float hadEt = calcEt(matchedL2->ehad1(), matchedL2->eta()); + float ES1 = matchedL2->energy(CaloSampling::EMB1) + matchedL2->energy(CaloSampling::EME1); + float Etotal = matchedL2->energy(); + + hist("Rcore", grp)->Fill(rcore); + hist("Rstrip", grp)->Fill(rstrip); + hist("eta", grp)->Fill(matchedL2->eta()); + hist("phi", grp)->Fill(matchedL2->phi()); + hist("Et", grp)->Fill(et / CLHEP::GeV); + hist("HadEt", grp)->Fill(hadEt / CLHEP::GeV); + hist("HadLeak", grp)->Fill(hadEt / et); + hist("f1", grp)->Fill(ES1 / Etotal); + hist2("EtaPhiMap", grp)->Fill(matchedL2->eta(),matchedL2->phi(),1.); +} //END OF LEVEL 2 CALO OBSERVABLE FILLING @@ -866,6 +917,60 @@ void HLTEgammaFEXNavSigTEBaseTool::fillL2CaloOffRes(const TrigEMCluster *matched hist("HadEt", grp)->Fill(ratio_ethad1); } +void HLTEgammaFEXNavSigTEBaseTool::fillL2CaloOffRes(const xAOD::TrigEMCluster *matchedL2, + const xAOD::Egamma* matchedEgamma, const string &grp) { + + //skip if we don't have valid pointers to offline or L2 cluster + if(!matchedL2 || !matchedEgamma){ + ATH_MSG_WARNING("Cannot fill L2Calo resolutions."); + return; + } + + float egamma_ethad1 = 0; + float egamma_rcore = 0; + float egamma_rstrip = 0; + matchedEgamma->showerShapeValue(egamma_ethad1,xAOD::EgammaParameters::ethad1); + float egamma_e237,egamma_e277; + matchedEgamma->showerShapeValue(egamma_e237,xAOD::EgammaParameters::e237); + matchedEgamma->showerShapeValue(egamma_e277,xAOD::EgammaParameters::e277); + + egamma_rcore = calcRatio(egamma_e237, egamma_e277); + float egamma_emaxs1,egamma_etsts1; + matchedEgamma->showerShapeValue(egamma_emaxs1,xAOD::EgammaParameters::emaxs1); + matchedEgamma->showerShapeValue(egamma_etsts1,xAOD::EgammaParameters::e2tsts1); + egamma_rstrip = calcRStrips(egamma_emaxs1, egamma_etsts1); + + const xAOD::CaloCluster* cluster = matchedEgamma->caloCluster(); + float egamma_clus_et = 0; + float egamma_clus_eta = 0; + float egamma_clus_phi = 0; + if(cluster) { + egamma_clus_et = calcEt(cluster->e(), cluster->eta()); + egamma_clus_eta = cluster->eta(); + egamma_clus_phi = cluster->phi(); + } else { + ATH_MSG_WARNING("Couldn't fetch CaloCluster for filling histograms in group "<<grp); + } + float matchedL2_rcore = calcRatio(matchedL2->e237(), matchedL2->e277()); + float matchedL2_rstrip = calcRStrips(matchedL2->emaxs1(), matchedL2->e2tsts1()); + float matchedL2_et = calcEt(matchedL2->energy(), matchedL2->eta()); + float matchedL2_ethad1 = calcEt(matchedL2->ehad1(), matchedL2->eta()); + + float ratio_rcore = calcRatio(matchedL2_rcore, egamma_rcore); + float ratio_rstrip = calcRatio(matchedL2_rstrip, egamma_rstrip); + float ratio_eta = calcRatio(matchedL2->eta(), egamma_clus_eta); + float ratio_phi = calcRatio(matchedL2->phi(), egamma_clus_phi); + float ratio_et = calcRatio(matchedL2_et, egamma_clus_et); + float ratio_ethad1 = calcRatio(matchedL2_ethad1, egamma_ethad1); + hist("Rcore", grp)->Fill(ratio_rcore); + hist("Rstrip", grp)->Fill(ratio_rstrip); + hist("eta", grp)->Fill(ratio_eta);// eg-cluster eta + hist("phi", grp)->Fill(ratio_phi);// eg-cluster phi + hist("Et", grp)->Fill(ratio_et); //eg-cluster Et + hist("HadEt", grp)->Fill(ratio_ethad1); + +} + //END OF LEVEL 2 CALORIMETER RESOLUTION FILLING @@ -918,6 +1023,64 @@ void HLTEgammaFEXNavSigTEBaseTool::fillL2ID(const TrigInDetTrack* trk, const Tri hist("AlgoId", grp)->Fill(algoId); hist2("EtaPhiAtCaloMap", grp)->Fill(etac, phic, 1.); } + +void HLTEgammaFEXNavSigTEBaseTool::fillL2ID(const xAOD::TrackParticle* trk, const xAOD::TrigEMCluster* clus, + const string& grp) +{ + //skip if the object pointers are no good + if(!clus || !trk){ + ATH_MSG_DEBUG("fillL2ID(...) got bad input. Skipping."); + return; + } + + //fetch variables + // - note: only reading magnitude of pT + // - note: eta/phi are at perigee, must be extrapolated to calo for dEta/dPhi + int algoId = 0; //(*trkIter)->algorithmId(); + if ( trk->patternRecoInfo()[xAOD::TrackPatternRecoInfo::FastTrackFinderSeed] ) algoId=9; + if ( trk->patternRecoInfo()[xAOD::TrackPatternRecoInfo::strategyA] ) algoId=5; + if ( trk->patternRecoInfo()[xAOD::TrackPatternRecoInfo::strategyB] ) algoId=6; + if ( trk->patternRecoInfo()[xAOD::TrackPatternRecoInfo::strategyC] ) algoId=7; + //unsigned int algoId = (unsigned int)trk->algorithmId(); + float pt = fabsf((float)trk->pt()); + float eta = (float)trk->eta(); + float phi = (float)trk->phi0(); + float eOverP = calcRatio(calcEt(clus->energy(), clus->eta()), pt); +// float n_trt = (float)trk->NStrawHits(); +// float n_httrt = (float)trk->NTRHits(); + uint8_t number=0; + trk->summaryValue(number,xAOD::numberOfTRTHits); + float n_trt = (float) number; + trk->summaryValue(number,xAOD::numberOfTRTHighThresholdHits ); + float n_httrt = (float) number; + + //calc R_trt, prevent division by zero for 0 hits + float rtrt = 0; + if(n_trt > 0){rtrt = n_httrt/n_trt;} + + //extrapolate eta/phi to calo + // - note: if this fails we are filling -999 to histograms + float etac(-999), phic(-999); +/* + if(extrapolateTrackToCalo(trk)){ + etac = m_extrapolatedEta; + phic = m_extrapolatedPhi; + } +*/ + + //fill histograms + hist("Eta_AtPeri", grp)->Fill(eta); + hist("Phi_AtPeri", grp)->Fill(phi); + hist("Pt", grp)->Fill(pt / CLHEP::GeV); + hist("Deta", grp)->Fill(calcDeltaEta(etac, clus->eta())); + hist("Dphi", grp)->Fill(calcDeltaPhi(phic, clus->phi())); + hist("EP", grp)->Fill(eOverP); + hist("RTRT", grp)->Fill(rtrt); //prevent div-by-0 + hist("AlgoId", grp)->Fill(algoId); + hist2("EtaPhiAtCaloMap", grp)->Fill(etac, phic, 1.); +} + + //END OF LEVEL2 TRACK OBSERVABLE HISTOGRAM FILLING @@ -963,6 +1126,46 @@ void HLTEgammaFEXNavSigTEBaseTool::fillL2IDOffRes(const TrigInDetTrack* track, c hist("Eta", grp)->Fill(ratio_eta); hist("Phi", grp)->Fill(ratio_phi); } + +void HLTEgammaFEXNavSigTEBaseTool::fillL2IDOffRes(const xAOD::TrackParticle* track, const xAOD::Electron* matchedEgamma, + const string &grp) +{ + //skip if we got bad pointers + if(!track || !matchedEgamma){ + ATH_MSG_WARNING("fillL2IDOffRes(...) got bad pointers. Skipping."); + return; + } + + //try to fetch offline egamma track particle and perigee + // - note: the protections might not be necessary, since the matching should have done this + if(!matchedEgamma->trackParticle()){ + ATH_MSG_WARNING("fillL2IDOffRes(...) cannot fetch track associated with egamma. Skipping."); + return; + } + + //try to fetch perigee + const xAOD::TrackParticle* matchedTrack = matchedEgamma->trackParticle(); + if(!matchedTrack){ + ATH_MSG_WARNING("fillL2IDOffRes(...) cannot fetch track associated with egamma. Skipping."); + return; + } + + //fetch offline values + float pt_matchedEgamma = matchedTrack->pt(); + float phi_matchedEgamma = matchedTrack->phi(); + float eta_matchedEgamma = matchedTrack->eta() ; + + //calculate ratios + float ratio_pt = calcRatio(fabsf(track->pt()), pt_matchedEgamma); + float ratio_eta = calcRatio(track->eta(), eta_matchedEgamma); + float ratio_phi = calcRatio(track->phi(), phi_matchedEgamma); + + //fill histograms + hist("Pt", grp)->Fill(ratio_pt); + hist("Eta", grp)->Fill(ratio_eta); + hist("Phi", grp)->Fill(ratio_phi); +} + //END OF L2 TRACK RESOLUTION HISTOGRAM FILLING @@ -991,6 +1194,29 @@ void HLTEgammaFEXNavSigTEBaseTool::fillEFCalo(const CaloCluster* cluster, const hist("Deta", grp)->Fill(dEta); hist2("EtaPhiMap", grp)->Fill(cluster->eta(), cluster->phi(), 1.); } + +void HLTEgammaFEXNavSigTEBaseTool::fillEFCalo(const xAOD::CaloCluster* cluster, const xAOD::TrigEMCluster *l2Cluster, + const string &grp) { + + //check pointers + if(!cluster || !l2Cluster){ + ATH_MSG_DEBUG("fillEFCalo(...) got bad pointers. Skipping."); + return; + } + + //calculate L2<->EF resolutions + float dEta = calcDeltaEta(cluster->eta(), l2Cluster->eta()); + float dPhi = calcDeltaPhi(cluster->phi(), l2Cluster->phi()); + + //fill histograms + hist("Et", grp)->Fill(cluster->et() / CLHEP::GeV); + hist("Eta", grp)->Fill(cluster->eta()); + hist("Phi", grp)->Fill(cluster->phi()); + hist("Dphi", grp)->Fill(dPhi); + hist("Deta", grp)->Fill(dEta); + hist2("EtaPhiMap", grp)->Fill(cluster->eta(), cluster->phi(), 1.); +} + //END OF EVENT FILTER CALORIMETER OBSERVABLE HISTOGRAM FILLING /* FILL EVENT FILTER CALORIMETER SHOWER OBSERVABLE HISTOGRAMS @@ -1059,6 +1285,89 @@ void HLTEgammaFEXNavSigTEBaseTool::fillEFCaloShower(const egamma* EFeg, const st hist("CaloIso", grp)->Fill(caloiso20); } + +void HLTEgammaFEXNavSigTEBaseTool::fillEFCaloShower(const xAOD::Egamma* EFeg, const string &grp) +{ + + //check pointer + if(!EFeg){ + ATH_MSG_WARNING("fillEFCaloShower(...) got bad pointer. Skipping."); + return; + } + + + //check whether we get the shower & cluster, otherwise get out + if(!(EFeg->caloCluster())){ + ATH_MSG_DEBUG("Cannot fill EFCalo shower histograms: EMShower (or cluster) not found!"); + return; + } + + + //try and load shower + + + //get transverse energy from cluster + float et = 0; + et = EFeg->caloCluster()->et(); + + //calculate eratio + float shower_emaxs1,shower_e2tsts1; + EFeg->showerShapeValue(shower_emaxs1,xAOD::EgammaParameters::emaxs1); + EFeg->showerShapeValue(shower_e2tsts1,xAOD::EgammaParameters::e2tsts1); + float emax1plus2 = shower_emaxs1 + shower_e2tsts1; + float emax1minus2 = shower_emaxs1 - shower_e2tsts1; + float eratio = 0; + if(emax1plus2 > 0){ + eratio = emax1minus2 / emax1plus2; + } + + //calculate et-based ratios, catch E_T of 0 + float caloiso20 = 0; + float hadleak = 0; + float hadleak1 = 0; + float demax2 = 0; + float shower_ethad,shower_ethad1,shower_etcone20; + if(et > 0){ + EFeg->showerShapeValue(shower_ethad,xAOD::EgammaParameters::ethad); + EFeg->showerShapeValue(shower_ethad1,xAOD::EgammaParameters::ethad1); + EFeg->isolationValue(shower_etcone20,xAOD::Iso::etcone20); + hadleak = shower_ethad / et; + hadleak1 = shower_ethad1 / et; + demax2 = shower_e2tsts1 / (1000 + 0.009 * et); + caloiso20 = shower_etcone20/et; + } + else{ + demax2 = shower_e2tsts1 / 1000; + } + + //fill histograms + setCurrentMonGroup(grp); + float shower_e277,shower_weta1,shower_wtots1,shower_weta2,shower_emins1, + shower_f1,shower_fracs1; + EFeg->showerShapeValue(shower_e277,xAOD::EgammaParameters::e277); + EFeg->showerShapeValue(shower_weta1,xAOD::EgammaParameters::weta1); + EFeg->showerShapeValue(shower_wtots1,xAOD::EgammaParameters::wtots1); + EFeg->showerShapeValue(shower_weta2,xAOD::EgammaParameters::weta2); + EFeg->showerShapeValue(shower_emins1,xAOD::EgammaParameters::emins1); + EFeg->showerShapeValue(shower_f1,xAOD::EgammaParameters::f1); + EFeg->showerShapeValue(shower_fracs1,xAOD::EgammaParameters::fracs1); + hist("f1", grp)->Fill(shower_f1); + hist("raphad", grp)->Fill(hadleak); + hist("raphad1", grp)->Fill(hadleak1); + hist("E277", grp)->Fill(shower_e277 / CLHEP::GeV); + hist("wetas1", grp)->Fill(shower_weta1); + hist("wtots1", grp)->Fill(shower_wtots1); + hist("wetas2", grp)->Fill(shower_weta2); + hist("DES1", grp)->Fill((shower_e2tsts1 - shower_emins1) / CLHEP::GeV); + hist("DEmax2", grp)->Fill(demax2); + hist("fracs1", grp)->Fill(shower_fracs1); + hist("Eratio", grp)->Fill(eratio); + hist("CaloIso", grp)->Fill(caloiso20); + +} + + + //END OF EVENT FILTER EGAMMA CALORIMETER SHOWER OBSERVABLE FILLING @@ -1097,6 +1406,41 @@ void HLTEgammaFEXNavSigTEBaseTool::fillEFCaloOffRes(const CaloCluster* cluster, hist("Phi", grp)->Fill(ratio_phi);//eg-cluster info } + +void HLTEgammaFEXNavSigTEBaseTool::fillEFCaloOffRes(const xAOD::CaloCluster* cluster, const xAOD::Egamma* offline, + const std::string &grp) +{ + + //check pointers + if(!cluster || !offline){ + ATH_MSG_DEBUG("fillEFCaloOffRes(...) got bad pointers. Skipping."); + return; + } + + //fetch offline cluster + const xAOD::CaloCluster* offCluster = offline->caloCluster(); + if(!offCluster){ + ATH_MSG_DEBUG("fillEFCaloOffRes(...) couldn't retrieve offline cluster. Skipping."); + return; + } + + //fetch offline variables + float offEt = calcEt(offCluster->e(), offCluster->eta()); + float offEta = offCluster->eta(); + float offPhi = offCluster->phi(); + + //calculate ratios + float ratio_et = calcRatio(cluster->et(), offEt); + float ratio_eta = calcRatio(cluster->eta(), offEta); + float ratio_phi = calcRatio(cluster->phi(), offPhi); + + //fill histograms + hist("Et", grp)->Fill(ratio_et);//eg-cluster info + hist("Eta", grp)->Fill(ratio_eta);//eg-cluster info + hist("Phi", grp)->Fill(ratio_phi);//eg-cluster info + +} + //END OF EVENT FILTER CALORIMETER RESOLUTION HISTOGRAM FILLING @@ -1167,6 +1511,76 @@ void HLTEgammaFEXNavSigTEBaseTool::fillEFID(const egamma *eg, const string &grp) return; } + +void HLTEgammaFEXNavSigTEBaseTool::fillEFID(const xAOD::Electron *eg, const string &grp) +{ + //check we have access to track and bail out if not + if(!eg || !(eg->trackParticle())){ + ATH_MSG_DEBUG("Cannot fill EF/Offline track histograms: TrackParticle not found."); + return; + } + + //load track and perigee, check perigee, load match + const xAOD::TrackParticle* track = eg->trackParticle(); + + //fetch track directions + float phi = track->phi(); + float eta = track->eta(); + + //fetch impact parameter + float a0 = -999; +/* + if(m_doExtrapol){ + const Trk::Perigee* bsPrg = m_trackToVertexTool->perigeeAtBeamspot(*track); + if(bsPrg){ + a0 = bsPrg->parameters()[Trk::d0]; + delete bsPrg; + } + } +*/ + + + //intermediate TRT hit observables + float rtottrt = 0; + float nTRTht=0; + float nTRTtotal= 0; +/* + float nTRTht = (float)track->trackSummary()->get(Trk::numberOfTRTHighThresholdHits) + + (float)track->trackSummary()->get(Trk::numberOfTRTHighThresholdOutliers); + float nTRTtotal = (float)track->trackSummary()->get(Trk::numberOfTRTOutliers) + + (float)track->trackSummary()->get(Trk::numberOfTRTHits); +*/ + + //calc R_tot_trt, prevent division by zero for 0 hits + if(nTRTtotal > 0){rtottrt = nTRTht / nTRTtotal;} + + //fill histograms + setCurrentMonGroup(grp); + hist("trkPhi")->Fill(phi); + hist("trkEta")->Fill(eta); + hist("trkPt")->Fill(track->pt() / CLHEP::GeV); + hist2("trkEtaPhiMap")->Fill(eta, phi, 1.); +/* + hist("Deta")->Fill(match->deltaEta(1)); + hist("Dphi")->Fill(match->deltaPhi(2)); +*/ + hist("EoverP")->Fill( fabsf( eg->caloCluster()->et() / track->pt() ) ); + hist("Qual")->Fill(track->chiSquared()); +/* + hist("Pixel")->Fill(track->trackSummary()->get(Trk::numberOfPixelHits)); + hist("SCT")->Fill(track->trackSummary()->get(Trk::numberOfSCTHits)); + hist("TRT")->Fill(track->trackSummary()->get(Trk::numberOfTRTHits)); +*/ + hist("TRTtotal")->Fill(nTRTtotal); + hist("TRTHT")->Fill(nTRTht); + //hist("BLayer")->Fill(track->trackSummary()->get(Trk::numberOfBLayerHits)); + hist("A0")->Fill(a0); + hist("RtotTRT")->Fill(rtottrt); //prevent div-by-0 + + return; +} + + //END OF EVENT FILTER/OFFLINE TRACK HISTOGRAM FILLING @@ -1174,6 +1588,7 @@ void HLTEgammaFEXNavSigTEBaseTool::fillEFID(const egamma *eg, const string &grp) /* FILL EVENT FILTER TRACK RESOLUTION HISTOGRAMS */ + void HLTEgammaFEXNavSigTEBaseTool::fillEFIDOffRes(const egamma* egEF, const egamma* egOff, const string &grp) { //check input pointers @@ -1215,8 +1630,44 @@ void HLTEgammaFEXNavSigTEBaseTool::fillEFIDOffRes(const egamma* egEF, const egam hist("Pt", grp)->Fill(ratio_pt); } -//END OF EVENT FILTER TRACK RESOLUTION HISTOGRAM FILLING +void HLTEgammaFEXNavSigTEBaseTool::fillEFIDOffRes(const xAOD::Electron* egEF, const xAOD::Electron* egOff, const string &grp) +{ + //check input pointers + if(!egEF || !egOff){ + ATH_MSG_WARNING("fillEFIDOffRes(...) got bad pointers. Skipping."); + return; + } + + //try and fetch track particles + if ( !(egEF->trackParticle()) || !(egOff->trackParticle())){ + ATH_MSG_DEBUG("fillEFIDOffRes(...) couldn't retrieve TrackParticle(s). Skipping."); + return; + } + const xAOD::TrackParticle *ef, *off; + ef = egEF->trackParticle(); + off = egOff->trackParticle(); + + + //fetch variables + float phi_egEF = ef->phi(); + float phi_egOff = off->phi(); + float eta_egEF = ef->eta(); + float eta_egOff = off->eta(); + float pt_egEF = ef->pt(); + float pt_egOff = off->pt(); + //calculate ratios + float ratio_phi = calcRatio(phi_egEF, phi_egOff); + float ratio_eta = calcRatio(eta_egEF, eta_egOff); + float ratio_pt = calcRatio(pt_egEF, pt_egOff); + + //fill histograms + hist("Phi", grp)->Fill(ratio_phi); + hist("Eta", grp)->Fill(ratio_eta ); + hist("Pt", grp)->Fill(ratio_pt); + +} +//END OF EVENT FILTER TRACK RESOLUTION HISTOGRAM FILLING @@ -1239,6 +1690,25 @@ void HLTEgammaFEXNavSigTEBaseTool::fillEFeg(const egamma* eg, const string &grp, } hist2("egEtaPhiMap", grp)->Fill(eg->eta(), eg->phi(), 1.); +} + +void HLTEgammaFEXNavSigTEBaseTool::fillEFeg(const xAOD::Egamma* eg, const string &grp, const double pt_cut) +{ + //check pointer + if(!eg){ + ATH_MSG_WARNING("fillEFeg(...) got bad pointer. Skipping."); + return; + } + + //fill histograms + setCurrentMonGroup(grp); + hist("egEt")->Fill(eg->caloCluster()->et() / CLHEP::GeV); + if(eg->pt()/CLHEP::GeV > pt_cut){ + hist("egEta")->Fill(eg->eta()); + hist("egPhi")->Fill(eg->phi()); + } + hist2("egEtaPhiMap", grp)->Fill(eg->eta(), eg->phi(), 1.); + } //END OF EVENT FILTER/OFFLINE EGAMMA HISTOGRAM FILLING @@ -1261,6 +1731,23 @@ void HLTEgammaFEXNavSigTEBaseTool::fillEFMatch(const egamma* eg, const string &g hist("egPhi")->Fill(eg->phi()); } +} +void HLTEgammaFEXNavSigTEBaseTool::fillEFMatch(const xAOD::Egamma* eg, const string &grp, const double pt_cut) +{ + //check pointer + if(!eg){ + ATH_MSG_WARNING("fillEFMatch(...) got bad pointer. Skipping."); + return; + } + + //fill histograms + setCurrentMonGroup(grp); + hist("egEt")->Fill(eg->caloCluster()->et() / CLHEP::GeV); + if(eg->pt()/CLHEP::GeV > pt_cut){ + hist("egEta")->Fill(eg->eta()); + hist("egPhi")->Fill(eg->phi()); + } + } //END OF OFFLINE EFFICIENCY HISTOGRAMS @@ -1286,6 +1773,26 @@ void HLTEgammaFEXNavSigTEBaseTool::fillEFegOffRes(const egamma* egEF, const egam hist("Phi", grp)->Fill(ratio_phi); } +void HLTEgammaFEXNavSigTEBaseTool::fillEFegOffRes(const xAOD::Egamma* egEF, const xAOD::Egamma* egOff, const string &grp) +{ + //check pointers + if(!egEF && !egOff){ + ATH_MSG_WARNING("fillEFefOffRes(...) got bad pointers. Skipping."); + return; + } + + //calculate ratios + float ratio_et = calcRatio(egEF->caloCluster()->et(), egOff->pt()); + float ratio_eta = calcRatio(egEF->eta(), egOff->eta()); + float ratio_phi = calcRatio(egEF->phi(), egOff->phi()); + + //fill histos + hist("Et", grp)->Fill(ratio_et); + hist("Eta", grp)->Fill(ratio_eta); + hist("Phi", grp)->Fill(ratio_phi); + +} + //END OF EVENT FILTER EGAMMA RESOLUTION HISTOGRAM FILLING @@ -1312,6 +1819,21 @@ void HLTEgammaFEXNavSigTEBaseTool::fillOfflineEgamma(const egamma* eg, bool isPh else fillEFeg(eg, path, phot_cut); if(!isPhoton){ fillEFID(eg, path); } } +void HLTEgammaFEXNavSigTEBaseTool::fillOfflineEgamma(const xAOD::Electron* eg, bool isPhoton, string path="", const double elec_cut=0., const double phot_cut=0.) +{ + //set path if none was supplied + if(path==""){path = m_histoBasePath + "/" + (isPhoton ? m_offPhoPath : m_offElePath); } + //otherwise append match foldername + else{ path += "/" + (isPhoton ? m_matchedOffPhoPath : m_matchedOffElePath); } + ATH_MSG_DEBUG("Filling offline "<<(isPhoton ? "photon" : "electron")<<" histograms to path "<<path); + + //call event filter filling functions + if(!isPhoton) fillEFeg(eg, path, elec_cut); + else fillEFeg(eg, path, phot_cut); + if(!isPhoton){ fillEFID(eg, path); } +} + + void HLTEgammaFEXNavSigTEBaseTool::fillOfflineMatches(const egamma* eg, bool isPhoton, string path="", const double elec_cut=0., const double phot_cut=0.) { //set path if none was supplied @@ -1324,6 +1846,20 @@ void HLTEgammaFEXNavSigTEBaseTool::fillOfflineMatches(const egamma* eg, bool isP if(!isPhoton) fillEFMatch(eg, path, elec_cut); else fillEFMatch(eg, path, phot_cut); } + +void HLTEgammaFEXNavSigTEBaseTool::fillOfflineMatches(const xAOD::Egamma* eg, bool isPhoton, string path="", const double elec_cut=0., const double phot_cut=0.) +{ + //set path if none was supplied + if(path==""){path = m_histoBasePath + "/" + (isPhoton ? m_offPhoPath : m_offElePath); } + //otherwise append match foldername + else{ path += "/" + (isPhoton ? m_matchedOffPhoPath : m_matchedOffElePath); } + ATH_MSG_DEBUG("Filling offline "<<(isPhoton ? "photon" : "electron")<<" histograms to path "<<path); + + //call event filter filling functions + if(!isPhoton) fillEFMatch(eg, path, elec_cut); + else fillEFMatch(eg, path, phot_cut); +} + //END OF OFFLINE EGAMMA HISTOGRAM FILLING @@ -1536,6 +2072,8 @@ void HLTEgammaFEXNavSigTEBaseTool::scaleError(float factor, TH1 *h) { */ void HLTEgammaFEXNavSigTEBaseTool::histDivide(TH1* num, TH1* den, TH1* quo, bool scale) { + num->Sumw2(); + den->Sumw2(); quo->Divide(num, den, 1., 1., "b"); if(scale){ quo->Scale(100.); } } diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/HLTEgammaMonTool.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/HLTEgammaMonTool.cxx index e647c7b2747..cd6849f743f 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/HLTEgammaMonTool.cxx +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/HLTEgammaMonTool.cxx @@ -24,10 +24,6 @@ #include "Particle/TrackParticle.h" #include "Particle/TrackParticleContainer.h" -//for extrapolation -#include "CaloDetDescr/CaloDepthTool.h" -#include "RecoToolInterfaces/IExtrapolateToCaloTool.h" - #include "egammaEvent/egammaContainer.h" #include "egammaEvent/egamma.h" #include "egammaEvent/EMTrackMatch.h" @@ -51,27 +47,8 @@ StatusCode HLTEgammaMonTool::init() { return StatusCode::FAILURE; } - // extrapolation - IAlgTool* algtool; - if (m_doExtrapol) { - sc = m_toolSvc->retrieveTool("ExtrapolTrackToCaloTool/extrapolTrackToCaloTool", algtool, this ); - if (sc.isFailure()) { - (*m_log) << MSG::ERROR << "Cannot get ExtrapolTrackToCaloTool" << endreq; - return StatusCode::FAILURE; - } - - m_toCalo=dynamic_cast<IExtrapolateToCaloTool*>(algtool); - - // retrived via the Extrapolator to make sure that jobOpt setting is consistent. - m_calodepth = &(*m_toCalo->getCaloDepth()); - if (!m_calodepth) { - (*m_log) << MSG::ERROR << "Cannot get CaloDepthTool" << endreq; - return StatusCode::FAILURE; - } - } else { - m_toCalo = 0; - m_calodepth = 0; - } + // extrapolation -- removed + m_doExtrapol = false; return StatusCode::SUCCESS; } diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/HLTEgammaNavMonTool.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/HLTEgammaNavMonTool.cxx index a8332b36c91..f574f5540eb 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/HLTEgammaNavMonTool.cxx +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/HLTEgammaNavMonTool.cxx @@ -29,10 +29,6 @@ #include "Particle/TrackParticle.h" #include "Particle/TrackParticleContainer.h" -//for extrapolation -#include "CaloDetDescr/CaloDepthTool.h" -#include "RecoToolInterfaces/IExtrapolateToCaloTool.h" - #include "egammaEvent/egammaContainer.h" #include "egammaEvent/egamma.h" #include "egammaEvent/EMTrackMatch.h" @@ -54,11 +50,9 @@ std::string rtti_real_name() { */ HLTEgammaNavMonTool::HLTEgammaNavMonTool(const std::string & type, const std::string & name, const IInterface* parent) - : HLTEgammaFEXBaseTool(type,name,parent), - m_trackExtrapolator("IExtrapolateToCaloTool/ExtrapolateToCaloTool") { + : HLTEgammaFEXBaseTool(type,name,parent){ m_firstTimeStamp = m_lastTimeStamp = 0; declareProperty("signatures",m_signatures); - declareProperty( "TrackExtrapolator", m_trackExtrapolator); } StatusCode HLTEgammaNavMonTool::init() { @@ -69,33 +63,8 @@ StatusCode HLTEgammaNavMonTool::init() { return StatusCode::FAILURE; } -#ifdef DONTDO - // extrapolation - IAlgTool* algtool; - if (m_doExtrapol) { - sc = m_toolSvc->retrieveTool("ExtrapolTrackToCaloTool/extrapolTrackToCaloTool", algtool, this ); - if (sc.isFailure()) { - (*m_log) << MSG::ERROR << "Cannot get ExtrapolTrackToCaloTool" << endreq; - return StatusCode::FAILURE; - } - - m_toCalo=dynamic_cast<IExtrapolateToCaloTool*>(algtool); - - // retrived via the Extrapolator to make sure that jobOpt setting is consistent. - m_calodepth = &(*m_toCalo->getCaloDepth()) ; - if (!m_calodepth) { - (*m_log) << MSG::ERROR << "Cannot get CaloDepthTool" << endreq; - return StatusCode::FAILURE; - } - } else { - m_toCalo = 0; - m_calodepth = 0; - } -#endif - if ( (m_trackExtrapolator.retrieve()).isFailure() ) { - (*m_log) << MSG::FATAL << "Unable to locate TrackExtrapolator tool " << endreq; - return StatusCode::FAILURE; - } + // extrapolation -- removed + m_doExtrapol = false; m_fill_condition=TrigDefs::alsoDeactivateTEs; m_rate_condition=TrigDefs::Physics; @@ -357,19 +326,11 @@ StatusCode HLTEgammaNavMonTool::fill_per_signature(const std::string signature) float pt = (float)trk->param()->pT(); */ // ToolHandle<IExtrapolateToCaloTool> m_trackExtrapolator("IExtrapolateToCaloTool/ExtrapolateToCaloTool"); - const Trk::TrackParameters* parametersInCalo (0); - float offset=0.0; - if ( mL2->energy( CaloSampling::CaloSample::EMB2 ) > mL2->energy( CaloSampling::CaloSample::EMB2 ) ) { - parametersInCalo = m_trackExtrapolator->extrapolate( *(trk), (CaloCell_ID::CaloSample)CaloSampling::CaloSample::EMB2,offset); - } else { - parametersInCalo = m_trackExtrapolator->extrapolate( *(trk), (CaloCell_ID::CaloSample)CaloSampling::CaloSample::EME2,offset); - } + // Removing extrapolator -- requires migration to new tools + // See TrigL2ElectronFex + float offset=0.0; float etacf = 999.0; float phicf = 999.0; - if ( parametersInCalo ) { - etacf = parametersInCalo->position().eta(); - phicf = parametersInCalo->position().phi(); - } float pt = trk->pt(); float ll=0; float jj=0; std::cout << "Track pt : " << trk->pt(); @@ -396,18 +357,10 @@ StatusCode HLTEgammaNavMonTool::fill_per_signature(const std::string signature) bool passSiTrk = false; float etacf = 999.0; float phicf = 999.0; - const Trk::TrackParameters* parametersInCalo (0); - float offset=0.0; + // Removing extrapolator -- requires migration to new tools + // See TrigL2ElectronFex + // float offset=0.0; const xAOD::TrackParticle* trk = ((myL2->trackParticle())); - if ( mL2->energy( CaloSampling::CaloSample::EMB2 ) > mL2->energy( CaloSampling::CaloSample::EMB2 ) ) { - parametersInCalo = m_trackExtrapolator->extrapolate( *(trk), (CaloCell_ID::CaloSample)CaloSampling::CaloSample::EMB2,offset); - } else { - parametersInCalo = m_trackExtrapolator->extrapolate( *(trk), (CaloCell_ID::CaloSample)CaloSampling::CaloSample::EME2,offset); - } - if ( parametersInCalo ) { - etacf = parametersInCalo->position().eta(); - phicf = parametersInCalo->position().phi(); - } float pt = trk->pt(); float ll=0; float jj=0; if ( trk->patternRecoInfo()[xAOD::TrackPatternRecoInfo::FastTrackFinderSeed] ){ diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/HLTEgammaNavSigTEMonTool.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/HLTEgammaNavSigTEMonTool.cxx index 8597712a349..37a14effc23 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/HLTEgammaNavSigTEMonTool.cxx +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/HLTEgammaNavSigTEMonTool.cxx @@ -17,6 +17,7 @@ #include "TrigInDetEvent/TrigInDetTrackCollection.h" #include "TrigInDetEvent/TrigInDetTrackHelper.h" +#include "xAODTracking/TrackParticleContainer.h" #include "CaloEvent/CaloClusterContainer.h" #include "CaloEvent/CaloCluster.h" @@ -26,15 +27,12 @@ #include "Particle/TrackParticle.h" #include "Particle/TrackParticleContainer.h" -//for extrapolation -#include "CaloDetDescr/CaloDepthTool.h" -#include "RecoToolInterfaces/IExtrapolateToCaloTool.h" - #include "egammaEvent/egammaContainer.h" #include "egammaEvent/egamma.h" #include "egammaEvent/EMTrackMatch.h" #include "EventInfo/EventInfo.h" +#include "xAODEventInfo/EventInfo.h" #include <EventInfo/EventID.h> //for LAr Cleaning @@ -71,10 +69,10 @@ HLTEgammaNavSigTEMonTool::HLTEgammaNavSigTEMonTool(const string & type, const st declareProperty("egammaContainer", m_electronContainerName="ElectronCollection"); declareProperty("egammaContainer", m_photonContainerName="PhotonCollection"); declareProperty("DoOffline", m_doOfflineComparisons=true); - declareProperty("OfflineEleMinPTCut", m_offEle_minptcut= 25.);//GeV - declareProperty("OfflinePhoMinPTCut", m_offPho_minptcut= 25.);//GeV + declareProperty("OfflineEleMinPTCut", m_offEle_minptcut= 2.);//GeV + declareProperty("OfflinePhoMinPTCut", m_offPho_minptcut= 2.);//GeV declareProperty("DRmatchToOffline", m_dR_off= 0.15);//GeV - declareProperty("DoLumiCalc", m_doLumiCalc = true);//Lumi + declareProperty("DoLumiCalc", m_doLumiCalc = false);//Lumi declareProperty("PayloadName",m_payload = "LBAvInstLumi");//Lumi declareProperty("DatabaseName", m_database = "COOLOFL_TRIGGER/COMP200"); /* "COOLONL_TRIGGER/COMP200" //Online for data commissioning @@ -98,10 +96,6 @@ HLTEgammaNavSigTEMonTool::HLTEgammaNavSigTEMonTool(const string & type, const st m_elecTES = NULL; m_photTES = NULL; - //initialise pointers to extrapolation tool and interface - m_toCalo = NULL; - m_calodepth = NULL; - //reset timestamps m_firstTimeStamp = m_lastTimeStamp = 0; } @@ -135,30 +129,9 @@ StatusCode HLTEgammaNavSigTEMonTool::init() return(StatusCode::FAILURE); } - //fetch extrapolation tool if requested - if(m_doExtrapol){ - - //set up generic interface pointer - IAlgTool* algtool = NULL; - - //try to fetch tool - sc = m_toolSvc->retrieveTool("ExtrapolTrackToCaloTool/extrapolTrackToCaloTool", algtool, this); - if (sc.isFailure()) { - ATH_MSG_ERROR("Cannot get ExtrapolTrackToCaloTool"); - return(StatusCode::FAILURE); - } - - //cast to correct interface pointer species - m_toCalo=dynamic_cast<IExtrapolateToCaloTool*>(algtool); - - //retrieve calo depth tool through interface - m_calodepth = &(*m_toCalo->getCaloDepth()); - if (!m_calodepth) { - ATH_MSG_ERROR("Cannot get CaloDepthTool"); - return(StatusCode::FAILURE); - } - - }//done fetching extrapolation tool + // Remove extrapolation tools + // See TrigL2ElectronFex + m_doExtrapol = false; //setup fill/rate condiftions //TODO might not be needed anymore @@ -207,7 +180,7 @@ StatusCode HLTEgammaNavSigTEMonTool::book() for(; monSigIt!=m_signatures.end();){ //form EF-item name of chain - string efItemName = "EF_" + *monSigIt; + string efItemName = "HLT_" + *monSigIt; bool signatureFound = false; //loop through running signatures @@ -305,7 +278,7 @@ StatusCode HLTEgammaNavSigTEMonTool::fill() // but the rest is working fine. // - note: we might also try and use the run/LB/event numbers already // supplied by IHLTMonTool, but would still need to read timestamps. - const EventInfo *eventInfo = NULL; + const xAOD::EventInfo *eventInfo = NULL; if((m_storeGate->retrieve(eventInfo)).isFailure()) { ATH_MSG_ERROR("Cannot retrieve EventInfo container for this event."); }else if(!eventInfo){ @@ -313,10 +286,14 @@ StatusCode HLTEgammaNavSigTEMonTool::fill() }else{ //fetch run/LB/event numbers and timestamp - m_runnbr = eventInfo->event_ID()->run_number() ; - m_lumiblocknbr = eventInfo->event_ID()->lumi_block(); - m_eventnbr = eventInfo->event_ID()->event_number(); - unsigned int timeStamp = eventInfo->event_ID()->time_stamp(); + //m_runnbr = eventInfo->event_ID()->run_number() ; + m_runnbr = eventInfo->runNumber() ; + //m_lumiblocknbr = eventInfo->event_ID()->lumi_block(); + m_lumiblocknbr = eventInfo->lumiBlock(); + //m_eventnbr = eventInfo->event_ID()->event_number(); + m_eventnbr = eventInfo->eventNumber(); + //unsigned int timeStamp = eventInfo->event_ID()->time_stamp(); + unsigned int timeStamp = eventInfo->timeStamp(); ATH_MSG_DEBUG("EventInfo: Run "<<m_runnbr<<", LB "<<m_lumiblocknbr<<", event "<<m_eventnbr <<", timestamp "<<timeStamp); @@ -324,7 +301,8 @@ StatusCode HLTEgammaNavSigTEMonTool::fill() if(!m_firstTimeStamp){ m_firstTimeStamp = timeStamp; } //update last timestamp - m_lastTimeStamp = eventInfo->event_ID()->time_stamp(); + //m_lastTimeStamp = eventInfo->event_ID()->time_stamp(); + m_lastTimeStamp = eventInfo->timeStamp(); //add LB to list of processed LBs // - first need to check whether we've seen it already @@ -339,7 +317,7 @@ StatusCode HLTEgammaNavSigTEMonTool::fill() }//done fetching event info //apply LAr cleaning - if ( eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::BADFEBS) ){ + if ( eventInfo->isEventFlagBitSet(xAOD::EventInfo::LAr,LArEventBitInfo::BADFEBS) ){ ATH_MSG_DEBUG("Event rejected by LAr Cleaning"); return(StatusCode::SUCCESS); } @@ -355,9 +333,8 @@ StatusCode HLTEgammaNavSigTEMonTool::fill() ATH_MSG_DEBUG("Retrieving offline egamma containers."); //first check that Electron and Photon Container exist in Storegate, if not quit - if(!m_storeGate->contains<egammaContainer>(m_electronContainerName) || - !m_storeGate->contains<egammaContainer>(m_photonContainerName)){ - ATH_MSG_WARNING("Electron or photon containers not found in TDS."); + if(!m_storeGate->contains<xAOD::ElectronContainer>(m_electronContainerName) ){ + ATH_MSG_WARNING("Electron containers not found in TDS."); return(StatusCode::SUCCESS); } @@ -368,19 +345,22 @@ StatusCode HLTEgammaNavSigTEMonTool::fill() ATH_MSG_WARNING("Couldn't retrieve offline electron container."); } +#ifdef PHOTON //retrieve offline photon container if (m_storeGate->retrieve( m_photTES, m_photonContainerName).isSuccess() && m_photTES ) { ATH_MSG_DEBUG("Successfully retrieved offline photon container."); }else{ ATH_MSG_WARNING("Couldn't retrieve offline photon container."); } +#endif //fill from containers fillOfflineEgammas(m_elecTES); - fillOfflineEgammas(m_photTES); + //fillOfflineEgammas(m_photTES); }//done filling offline egamma info +#ifdef DONTDO //OVERLAPTEST // - collect chains that sent this event to express stream tmp_chainsToEs.clear(); @@ -411,6 +391,7 @@ StatusCode HLTEgammaNavSigTEMonTool::fill() } //OVERLAPTEST +#endif //////////////////////// // Fill Per Signature // @@ -482,6 +463,7 @@ StatusCode HLTEgammaNavSigTEMonTool::fill_per_signature(const string signature) unsigned int condition = conditions.at(i_passStates); bool onlyActiveTe = activeTeSwitches.at(i_passStates); +#ifdef DONTDO //get L2 chains // - note: this can be skipped for ActiveChain filling, because by definition // the chain must have made it through to EF and we can pick up the L2 part @@ -489,7 +471,7 @@ StatusCode HLTEgammaNavSigTEMonTool::fill_per_signature(const string signature) if(condition!=TrigDefs::Physics){ //get chain groups for signatures - const Trig::ChainGroup* L2_Chains = getTDT()->getChainGroup("L2_"+signature); + const Trig::ChainGroup* L2_Chains = getTDT()->getChainGroup("HLT_"+signature); //get features for this chain group Trig::FeatureContainer L2_features = getTDT()->features(L2_Chains,condition); @@ -518,9 +500,10 @@ StatusCode HLTEgammaNavSigTEMonTool::fill_per_signature(const string signature) }//done looping over l2 combinations }//finished with L2 chains +#endif - const Trig::ChainGroup* EF_Chains = getTDT()->getChainGroup("EF_"+signature); + const Trig::ChainGroup* EF_Chains = getTDT()->getChainGroup("HLT_"+signature); const Trig::ChainGroup* SelChains = EF_Chains; @@ -884,6 +867,42 @@ void HLTEgammaNavSigTEMonTool::fillOfflineEgammas(const egammaContainer* egCont) ATH_MSG_DEBUG("Finished filling offline egamma histograms."); } +void HLTEgammaNavSigTEMonTool::fillOfflineEgammas(const xAOD::ElectronContainer* egCont) +{ + ATH_MSG_DEBUG("Filling offline egamma histograms."); + + //loop over container + ATH_MSG_VERBOSE("Looping over offline egamma container."); + xAOD::ElectronContainer::const_iterator egIt = egCont->begin(); + for (; egIt != egCont->end() ; ++egIt) { + + //decide on electron/photon based on permitted authors & ID + // - note: it's not either/or, because egamma can fail our author selection + // that's also why we can't just check the first object in the container + bool isElectron = (*egIt)->author(egammaParameters::AuthorElectron); + bool isPhoton(false); +/* + bool isPhoton = (*egIt)->author(egammaParameters::AuthorPhoton) || + (*egIt)->author(egammaParameters::AuthorRConv); +*/ + + bool isMediumPPElectron(false); + (*egIt)->passSelection(isMediumPPElectron,"Medium"); + //bool isTightPhoton = (*egIt)->passID(egammaPID::PhotonIDTight); + + //now apply appropriate pt cut and call egamma filling function + if(isElectron && isMediumPPElectron){ + fillOfflineEgamma((*egIt), isPhoton, "", m_offEle_minptcut, m_offPho_minptcut); + } +/* + }else if(isPhoton && isTightPhoton){ + fillOfflineEgamma((*egIt), isPhoton, "", m_offEle_minptcut, m_offPho_minptcut); + } +*/ + }//done looping over container + //all done + ATH_MSG_DEBUG("Finished filling offline egamma histograms."); +} @@ -906,8 +925,12 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con ATH_MSG_VERBOSE("Path set to "<<path); ATH_MSG_VERBOSE("Filling combination "<<comb); + //find out whether this is a photon signature - bool isPhoton = isPhotonSignature(signature); + + //bool isPhoton = isPhotonSignature(signature); + bool isPhoton = false; + //abort if we require a passthrough chain to have passed and it didn't //TODO find out what effect an active passThroughChain would have @@ -946,7 +969,7 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con bool chainToEs = false; if(condition==TrigDefs::Physics){ for(unsigned int iChainsToEs=0; iChainsToEs<tmp_chainsToEs.size(); iChainsToEs++){ - if(tmp_chainsToEs.at(iChainsToEs)=="EF_"+signature){ + if(tmp_chainsToEs.at(iChainsToEs)=="HLT_"+signature){ chainToEs = true; break; } @@ -967,16 +990,16 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con <<Trig::getTEName(*te)); //get EMTAU ROI associated to this initial ROI - Trig::Feature<EmTau_ROI> emTauRoi = getTDT()->ancestor<EmTau_ROI>(*initRoiIt); + Trig::Feature<xAOD::EmTauRoI> emTauRoi = getTDT()->ancestor<xAOD::EmTauRoI>(*initRoiIt); if (emTauRoi.empty()){ ATH_MSG_DEBUG("No EmTau_ROI for this TrigRoiDescriptor. Aborting L2 filling."); return(StatusCode::SUCCESS); } //store kinematic info - m_roi_et.push_back((emTauRoi.cptr())->getEMClus()); - m_roi_eta.push_back((emTauRoi.cptr())->getEta()); - m_roi_phi.push_back((emTauRoi.cptr())->getPhi()); + m_roi_et.push_back((emTauRoi.cptr())->emClus()); + m_roi_eta.push_back((emTauRoi.cptr())->eta()); + m_roi_phi.push_back((emTauRoi.cptr())->phi()); //OVERLAPTEST @@ -985,9 +1008,9 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con string overlapTestPath = m_histoBasePath+"/"+signature+"/OverlapTest"; ATH_MSG_VERBOSE("Filling OVERLAPTEST histograms at path "<<overlapTestPath); if(chainToEs){ - hist("l1pt_this",overlapTestPath)->Fill((emTauRoi.cptr())->getEMClus()/CLHEP::GeV); + hist("l1pt_this",overlapTestPath)->Fill((emTauRoi.cptr())->emClus()/CLHEP::GeV); }else{ - hist("l1pt_other",overlapTestPath)->Fill((emTauRoi.cptr())->getEMClus()/CLHEP::GeV); + hist("l1pt_other",overlapTestPath)->Fill((emTauRoi.cptr())->emClus()/CLHEP::GeV); } } //OVERLAPTEST @@ -998,8 +1021,8 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con //if we are only filling for active trigger elements (enforce a pass decision later on) //fill PreRejection histograms using this ROI if(onlyActiveTe){ - if(!skipActiveTE) FillRates((emTauRoi.cptr())->getEMClus(),(emTauRoi.cptr())->getEta(), - (emTauRoi.cptr())->getPhi(), "L1" ,path+"/PreRejection"); + if(!skipActiveTE) FillRates((emTauRoi.cptr())->emClus(),(emTauRoi.cptr())->eta(), + (emTauRoi.cptr())->phi(), "L1" ,path+"/PreRejection"); //if we are not requiring a passed chain, also fill L1 counter //this is so we won't loose L1 counts by only looking at chains @@ -1016,13 +1039,13 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con } //print kinematic info - ATH_MSG_VERBOSE("L1 ROI info: thresholdname "<<(emTauRoi.cptr())->getThresholdNames() - <<", et "<<(emTauRoi.cptr())->getEMClus() / CLHEP::GeV<<", eta "<< (emTauRoi.cptr())->getEta() - <<", phi "<<(emTauRoi.cptr())->getPhi()); + ATH_MSG_VERBOSE("L1 ROI info: thresholdname "<<(emTauRoi.cptr())->thrNames() + <<", et "<<(emTauRoi.cptr())->emClus() / CLHEP::GeV<<", eta "<< (emTauRoi.cptr())->eta() + <<", phi "<<(emTauRoi.cptr())->phi()); //match to offline using calo information ATH_MSG_VERBOSE("- Trying to match L1 to offline"); - const egamma* matchedEgamma = matchOffline((emTauRoi.cptr())->getEta(),(emTauRoi.cptr())->getPhi(), + const xAOD::Egamma* matchedEgamma = matchOffline((emTauRoi.cptr())->eta(),(emTauRoi.cptr())->phi(), true, isPhoton); if(matchedEgamma){ @@ -1036,7 +1059,7 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con //get L2 clusters - vector< Trig::Feature<TrigEMCluster> > L2Calo = comb.get<TrigEMCluster>("",condition); + vector< Trig::Feature<xAOD::TrigEMCluster> > L2Calo = comb.get<xAOD::TrigEMCluster>("",condition); ATH_MSG_VERBOSE("- Number of L2Calo Clusters "<<L2Calo.size()); if(L2Calo.size() < 1){ ATH_MSG_DEBUG("- No TrigEMClusters found. Aborting L2 combination filling."); @@ -1048,13 +1071,13 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con // - reused during L2ID filling (dEta/dPhi etc.) // - reused during EFCalo filling // TODO: find out whether picking the last cluster in the loop is appropriate - const TrigEMCluster* l2CaloCluster = NULL; + const xAOD::TrigEMCluster* l2CaloCluster = NULL; //create set of offline matches; - set<const egamma*> L2CalomatchedEgamma; + set<const xAOD::Egamma*> L2CalomatchedEgamma; //loop over clusters - vector< Trig::Feature<TrigEMCluster> >::const_iterator clusIt = L2Calo.begin(); + vector< Trig::Feature<xAOD::TrigEMCluster> >::const_iterator clusIt = L2Calo.begin(); for(; clusIt!= L2Calo.end(); ++clusIt){ //fetch pointer to cluster and print kinematic info @@ -1090,7 +1113,7 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con //match to Offline using calorimeter info ATH_MSG_VERBOSE(" - Trying to match L2Calo to offline"); - const egamma* matchedEgamma = matchOffline(l2CaloCluster->eta(),l2CaloCluster->phi(), true, isPhoton); + const xAOD::Egamma* matchedEgamma = matchOffline(l2CaloCluster->eta(),l2CaloCluster->phi(), true, isPhoton); //fill L2Calo resolutions if a match was found, insert pointer in set if(matchedEgamma){ @@ -1102,7 +1125,7 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con //fill matches for efficiencies L2Calo if(L2CalomatchedEgamma.size() > 0){ - set<const egamma*>::const_iterator L2CalomatchIt = L2CalomatchedEgamma.begin(); + set<const xAOD::Egamma*>::const_iterator L2CalomatchIt = L2CalomatchedEgamma.begin(); for(; L2CalomatchIt != L2CalomatchedEgamma.end(); ++L2CalomatchIt){ if(!skipActiveTE) fillOfflineMatches(*L2CalomatchIt, isPhoton, path+"/L2Calo", m_offEle_minptcut, m_offPho_minptcut); } @@ -1111,7 +1134,7 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con //get TrigInDetTrackCollections and check their number // - we will bail out if processing an electron chain but no track collections have been found - vector< Trig::Feature<TrigInDetTrackCollection> > L2ID = comb.get<TrigInDetTrackCollection>("",condition); + vector< Trig::Feature<xAOD::TrackParticleContainer> > L2ID = comb.get<xAOD::TrackParticleContainer>("",condition); ATH_MSG_VERBOSE(" - Number of L2ID Collections = "<<L2ID.size()); if (!isPhoton && !L2ID.size()){ ATH_MSG_DEBUG(" - No L2ID Collections. Skipping L2 combination."); @@ -1119,14 +1142,16 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con } //create set of offline matches for L2Track - set<const egamma*> L2TrackmatchedEgamma; + set<const xAOD::Egamma*> L2TrackmatchedEgamma; + //loop over track collections // - skipped in its entirety for photon chains, regardless of whether we do have track collections // in this combination or not (we probably shouldn't anyway, but let's be on the safe side) // -- this is done in the "continue if"-part of the foor loop - vector< Trig::Feature<TrigInDetTrackCollection> >::const_iterator trackCollIt = L2ID.begin(); + vector< Trig::Feature<xAOD::TrackParticleContainer> >::const_iterator trackCollIt = L2ID.begin(); for(; !isPhoton && trackCollIt!= L2ID.end(); ++ trackCollIt ){ + if ( (trackCollIt->label().find("xAODCnv_Electron_FTF")==std::string::npos) && ( trackCollIt->label().find("xAODCnv_Electron_L2ID")==std::string::npos) ) continue; //skip collection if it's not active and we only look at active ones if (!(trackCollIt->te()->getActiveState()) && onlyActiveTe){ @@ -1144,7 +1169,7 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con } //loop over tracks in collection - TrigInDetTrackCollection::const_iterator trackIt = trackCollIt->cptr()->begin(); + xAOD::TrackParticleContainer::const_iterator trackIt = trackCollIt->cptr()->begin(); for(; trackIt != trackCollIt->cptr()->end(); ++trackIt ){ @@ -1158,10 +1183,12 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con //extrapolate (again, after the L2ID filler already did it) to find eta/phi for L1 match float etac(-999), phic(-999); + /* if(extrapolateTrackToCalo(*trackIt)){ etac = m_extrapolatedEta; phic = m_extrapolatedPhi; } + */ //match to L1 using calo position and fill rejection histograms bool l1Matched = matchL1(etac, phic); @@ -1177,7 +1204,7 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con } //match to offline using track eta/phi for both l2 track and offline - const egamma* matchedEgamma = matchOffline((*trackIt)->param()->eta(), (*trackIt)->param()->phi0(), + const xAOD::Electron* matchedEgamma = matchOffline((*trackIt)->eta(), (*trackIt)->phi(), false, isPhoton); //fill L2 Track resolution histos if a match was found, insert pointer in L2 Track set @@ -1192,7 +1219,7 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con //fill L2Track matched objects in efficiency histos if(!L2TrackmatchedEgamma.empty()){ - set<const egamma*>::iterator L2TrackmatchIt; + set<const xAOD::Egamma*>::iterator L2TrackmatchIt; for(L2TrackmatchIt = L2TrackmatchedEgamma.begin(); L2TrackmatchIt!=L2TrackmatchedEgamma.end(); ++L2TrackmatchIt){ if(!skipActiveTE) fillOfflineMatches(*L2TrackmatchIt, isPhoton, path+"/L2ID", m_offEle_minptcut, m_offPho_minptcut); } @@ -1215,7 +1242,7 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con } //fetch EFCalo containers - vector< Trig::Feature<CaloClusterContainer> > EFCalo = comb.get<CaloClusterContainer>("",condition); + vector< Trig::Feature<xAOD::CaloClusterContainer> > EFCalo = comb.get<xAOD::CaloClusterContainer>("",condition); ATH_MSG_VERBOSE("- Number of EFCalo ClusterContainers "<<EFCalo.size()); if(!EFCalo.size()){ ATH_MSG_DEBUG("- No CaloClusterContainers found. Aborting combination filling."); @@ -1223,10 +1250,12 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con } //loop over EFCalo containers - vector< Trig::Feature<CaloClusterContainer> >::const_iterator clusContIt = EFCalo.begin(); + vector< Trig::Feature<xAOD::CaloClusterContainer> >::const_iterator clusContIt = EFCalo.begin(); + int clusternumber=0; for(; clusContIt!= EFCalo.end(); ++ clusContIt){ //check if CaloCluster is active and skip it if we're only looking at active TEs and it's not + clusternumber++; if(onlyActiveTe && !clusContIt->te()->getActiveState()) { ATH_MSG_VERBOSE(" - EFCalo ClusterContainer not active. Skipping."); continue; @@ -1235,10 +1264,10 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con //report on number of clusters in container ATH_MSG_VERBOSE(" - Number of CaloClusters in EFCalo container = "<<clusContIt->cptr()->size()); - set<const egamma*> EFCalomatchedEgamma; + set<const xAOD::Egamma*> EFCalomatchedEgamma; //loop over clusters - CaloClusterContainer::const_iterator clusIt = clusContIt->cptr()->begin(); + xAOD::CaloClusterContainer::const_iterator clusIt = clusContIt->cptr()->begin(); for(; clusIt != clusContIt->cptr()->end(); ++clusIt ){ //---Fill EFCalo Plots @@ -1261,7 +1290,7 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con //match to offline using calorimeter info ATH_MSG_VERBOSE("Trying to match EFCalo to offline"); - const egamma* matchedEgamma = matchOffline((*clusIt)->eta(),(*clusIt)->phi(), true, isPhoton); + const xAOD::Egamma* matchedEgamma = matchOffline((*clusIt)->eta(),(*clusIt)->phi(), true, isPhoton); //fill EFCalo resolutions and offline efficiency if a match was found if(matchedEgamma){ @@ -1273,25 +1302,86 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con //fill EFCalo matched objects in efficiency histos if(!EFCalomatchedEgamma.empty()){ - set<const egamma*>::iterator EFCalomatchIt; + set<const xAOD::Egamma*>::iterator EFCalomatchIt; for(EFCalomatchIt = EFCalomatchedEgamma.begin(); EFCalomatchIt!=EFCalomatchedEgamma.end(); ++EFCalomatchIt){ if(!skipActiveTE) fillOfflineMatches(*EFCalomatchIt, isPhoton, path+"/EFCalo", m_offEle_minptcut, m_offPho_minptcut); +#ifdef TEST + std::cout << "Passed cluster : " << signature << " : " << (*EFCalomatchIt)->caloCluster()->et() << " " << (*EFCalomatchIt)->caloCluster()->eta() << " " << (*EFCalomatchIt)->caloCluster()->phi() << std::endl; +#endif } } }//done looping over ClusterContainers + //fetch EFID containers + vector< Trig::Feature<xAOD::TrackParticleContainer> > EFtrk = comb.get<xAOD::TrackParticleContainer>("",condition); + ATH_MSG_VERBOSE("- Number of EFtrk "<<EFtrk.size()); + if(!EFtrk.size()){ + ATH_MSG_DEBUG("- No TrackParticleContainers found. Aborting combination filling."); + return(StatusCode::SUCCESS); + } + + vector< Trig::Feature<xAOD::TrackParticleContainer> >::const_iterator trkContIt = EFtrk.begin(); + for(; trkContIt!= EFtrk.end(); ++ trkContIt){ + + //check if CaloCluster is active and skip it if we're only looking at active TEs and it's not + if(onlyActiveTe && !trkContIt->te()->getActiveState()) { + ATH_MSG_VERBOSE(" - EFtrk ClusterContainer not active. Skipping."); + continue; + } + + ATH_MSG_VERBOSE(" - Number of CaloClusters in EFtrk container = "<<trkContIt->cptr()->size()); + + set<const xAOD::Egamma*> EFtrkmatchedEgamma; + xAOD::TrackParticleContainer::const_iterator trkIt = trkContIt->cptr()->begin(); + for(; trkIt != trkContIt->cptr()->end(); ++trkIt ){ + + //if(!skipActiveTE) fillEFID(*trkIt, path+"/EFID"); + + if(onlyActiveTe){ + + bool l1Matched = matchL1((*trkIt)->eta(), (*trkIt)->phi()); + if(l1Matched && !skipActiveTE){ FillRates(m_roiMatch_et,m_roiMatch_eta,m_roiMatch_phi, "EFID" ,path+"/PreRejection"); } + + if(condition== TrigDefs::alsoDeactivateTEs){ m_counters_perLB_activeTE[signature][4]++; } + if(condition== TrigDefs::Physics){ + m_counters[signature][4]++; + m_counters_perLB[signature][4]++; + } + + } + + ATH_MSG_VERBOSE("Trying to match EFID to offline"); + const xAOD::Egamma* matchedEgamma = matchOffline((*trkIt)->eta(),(*trkIt)->phi(), true, isPhoton); + + if(matchedEgamma){ + //if(!skipActiveTE) fillEFIDOffRes(*trkIt, matchedEgamma, path+"/EFID/Resolution"); + EFtrkmatchedEgamma.insert(matchedEgamma); + } + + }//done looping over TrackParticle + + if(!EFtrkmatchedEgamma.empty()){ + set<const xAOD::Egamma*>::iterator EFIDmatchIt; + for(EFIDmatchIt = EFtrkmatchedEgamma.begin(); EFIDmatchIt!=EFtrkmatchedEgamma.end(); ++EFIDmatchIt){ + if(!skipActiveTE) fillOfflineMatches(*EFIDmatchIt, isPhoton, path+"/EFID", m_offEle_minptcut, m_offPho_minptcut); + } + } + + }//done looping over TrackParticleContainers + //get EF egamma containers - vector< Trig::Feature<egammaContainer> > EFeg = comb.get<egammaContainer>("",condition); + vector< Trig::Feature<xAOD::ElectronContainer> > EFeg = comb.get<xAOD::ElectronContainer>("",condition); ATH_MSG_VERBOSE(" - Number of EFeg Collections = "<<EFeg.size()); if (!EFeg.size()){ - ATH_MSG_DEBUG(" - No EFeg Collections. Aborting combination filling."); + //std::cout << "Passed cluster : " << signature << " : " << (*clusIt)->et() << " " << (*clusIt)->eta() << " " << (*clusIt)->phi() << std::endl; return(StatusCode::SUCCESS); } //loop over EF egammaContainers - vector< Trig::Feature<egammaContainer> >::const_iterator egContIt = EFeg.begin(); + vector< Trig::Feature<xAOD::ElectronContainer> >::const_iterator egContIt = EFeg.begin(); + int electronnumber=0; for(; egContIt != EFeg.end() ; ++egContIt){ //skip container if it's not active and we only look at active ones @@ -1299,6 +1389,7 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con // it looks like we might allow conversions without asking them to be active // unless this is checked later on somewhere, which raises the question why we // aren't checking it here + electronnumber++; if(onlyActiveTe && !egContIt->te()->getActiveState() && ((egContIt->label().find("Electron") != string::npos || (egContIt->label().find("Photon") != string::npos)))) { @@ -1308,9 +1399,11 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con //loop over EFegamma objects ATH_MSG_VERBOSE(" - Number of objects in EFeg container = "<<egContIt->cptr()->size()); - egammaContainer::const_iterator egIt = egContIt->cptr()->begin(); + xAOD::ElectronContainer::const_iterator egIt = egContIt->cptr()->begin(); - set<const egamma*> EFegmatchedEgamma; + set<const xAOD::Electron*> EFegmatchedEgamma; + + // bool foundTrack (false); for(; egIt != egContIt->cptr()->end(); ++egIt){ @@ -1333,7 +1426,7 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con //match to offline using track directions and fill EFeg resolution and efficiency ATH_MSG_VERBOSE("Trying to match EFeg to offline."); - const egamma* matchedEgamma = matchOffline((*egIt)->eta(),(*egIt)->phi(), false, isPhoton); + const xAOD::Electron* matchedEgamma = matchOffline((*egIt)->eta(),(*egIt)->phi(), false, isPhoton); if(matchedEgamma){ if(!skipActiveTE) fillEFegOffRes(*egIt,matchedEgamma, path+"/EFeg/Resolution" ); @@ -1341,19 +1434,19 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con } - set<const egamma*> EFIDmatchedEgamma; + set<const xAOD::Electron*> EFIDmatchedEgamma; //try getting associated track // - note: this relies on the compiler skipping the "if"'ed instructions as // soon as no trackParticle pointer is returned. is this always safe? - if((*egIt)->trackParticle() && (*egIt)->trackParticle()->measuredPerigee() ) { + if((*egIt)->trackParticle() ) { //fetch track directions for matching - float trk_eta = calcEta((*egIt)->trackParticle()->measuredPerigee()->parameters()[Trk::theta]); - float trk_phi = (*egIt)->trackParticle()->measuredPerigee()->parameters()[Trk::phi]; + float trk_eta = (*egIt)->trackParticle()->eta(); + float trk_phi = (*egIt)->trackParticle()->phi(); //fill EFID histograms - if(!skipActiveTE) fillEFID(*egIt, path+"/EFID"); + //if(!skipActiveTE) fillEFID(*egIt, path+"/EFID"); //if we're only looking at active TEs fill rejection histograms and update pointers // - note: are we not active by definition? @@ -1369,7 +1462,7 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con //---Match to Offline and fill resolutions/efficiencies ATH_MSG_VERBOSE("Trying to match EFID to offline using track directions."); - const egamma* matchedEgamma = matchOffline(trk_eta,trk_phi, false, isPhoton); + const xAOD::Electron* matchedEgamma = matchOffline(trk_eta,trk_phi, false, isPhoton); if(matchedEgamma){ if(!skipActiveTE) fillEFIDOffRes(*egIt, matchedEgamma, path+"/EFID/Resolution"); EFIDmatchedEgamma.insert(matchedEgamma); @@ -1378,18 +1471,22 @@ StatusCode HLTEgammaNavSigTEMonTool::fillCombination(Trig::Combination comb, con }//done processing track //fill EFCalo matched objects in efficiency histos + /* if(!EFIDmatchedEgamma.empty()){ - set<const egamma*>::iterator EFIDmatchIt; + set<const xAOD::Electron*>::iterator EFIDmatchIt; for(EFIDmatchIt = EFIDmatchedEgamma.begin(); EFIDmatchIt!=EFIDmatchedEgamma.end(); ++EFIDmatchIt){ if(!skipActiveTE) fillOfflineMatches(*EFIDmatchIt, isPhoton, path+"/EFID", m_offEle_minptcut, m_offPho_minptcut); + foundTrack=true; } + } else { } + */ }//done looping over egamma objects //fill EFeg matched objects in efficiency histos if(!EFegmatchedEgamma.empty()){ - set<const egamma*>::iterator EFegmatchIt; + set<const xAOD::Electron*>::iterator EFegmatchIt; for(EFegmatchIt = EFegmatchedEgamma.begin(); EFegmatchIt!=EFegmatchedEgamma.end(); ++EFegmatchIt){ if(!skipActiveTE) fillOfflineMatches(*EFegmatchIt, isPhoton, path+"/EFeg", m_offEle_minptcut, m_offPho_minptcut); } @@ -1466,22 +1563,22 @@ bool HLTEgammaNavSigTEMonTool::matchL1(const float eta, const float phi) * - returns pointer to closest object within dR < 0.15 (configurable in JOs) * or NULL in case no suitable match is found */ -const egamma* HLTEgammaNavSigTEMonTool::matchOffline(const float eta, const float phi, bool useCalo, bool isPhoton) +const xAOD::Electron* HLTEgammaNavSigTEMonTool::matchOffline(const float eta, const float phi, bool useCalo, bool isPhoton) { ATH_MSG_DEBUG("Starting to match eta/phi to offline egamma object."); //initialise pointer to return object - const egamma* match = NULL; + const xAOD::Electron* match = NULL; //initialise distance of current match to maximum allowed (in job options) float match_dr = m_dR_off; //set egammaContainer based on isPhoton - egammaContainer const* cont = NULL; - if(isPhoton){ cont = m_photTES; } - else{ cont = m_elecTES; } + if(isPhoton) return NULL; + xAOD::ElectronContainer const* cont = NULL; + cont = m_elecTES; //set up container iterators - egammaContainer::const_iterator egIt = cont->begin(); - egammaContainer::const_iterator egItE = cont->end(); + xAOD::ElectronContainer::const_iterator egIt = cont->begin(); + xAOD::ElectronContainer::const_iterator egItE = cont->end(); //loop over container for(; egIt != egItE ; ++egIt){ @@ -1492,9 +1589,9 @@ const egamma* HLTEgammaNavSigTEMonTool::matchOffline(const float eta, const floa float eg_phi = -999; //try getting handle on cluster if we are going to use it - const CaloCluster* clus = NULL; + const xAOD::CaloCluster* clus = NULL; if(useCalo){ - clus = (*egIt)->cluster(); + clus = (*egIt)->caloCluster(); if(!clus){ ATH_MSG_DEBUG(" - cluster use requested but no cluster found. falling back to egamma info"); } } @@ -1515,14 +1612,16 @@ const egamma* HLTEgammaNavSigTEMonTool::matchOffline(const float eta, const floa //apply author / minimum pt cuts bool pass_author(false), pass_ID(false); +/* if(isPhoton){ pass_author = ((*egIt)->author(egammaParameters::AuthorPhoton) || (*egIt)->author(egammaParameters::AuthorRConv)); - pass_ID = (*egIt)->passID(egammaPID::PhotonIDTight); + //pass_ID = (*egIt)->passID(egammaPID::PhotonIDTight); }else{ +*/ pass_author = (*egIt)->author(egammaParameters::AuthorElectron); - pass_ID = (*egIt)->passID(egammaPID::ElectronIDMediumPP); - } + (*egIt)->passSelection(pass_ID,"Medium"); +// } if(!pass_author || !pass_ID){ continue; } ATH_MSG_VERBOSE(" -- egamma object passes author and ID cuts."); -- GitLab