diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/CMakeLists.txt b/InnerDetector/InDetMonitoring/SCT_Monitoring/CMakeLists.txt index 65014e9bb110ef37bda65e920ef88919d97f9928..f6266d80a6b3c94dac256f5c9265d6af63b08734 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/CMakeLists.txt +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/CMakeLists.txt @@ -7,27 +7,29 @@ atlas_subdir( SCT_Monitoring ) # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC + Commission/CommissionEvent Control/AthenaMonitoring + Control/StoreGate + Event/EventInfo + Event/xAOD/xAODEventInfo GaudiKernel InnerDetector/InDetConditions/InDetConditionsSummaryService InnerDetector/InDetConditions/SCT_ConditionsServices InnerDetector/InDetDetDescr/InDetReadoutGeometry InnerDetector/InDetRecEvent/InDetPrepRawData + InnerDetector/InDetRawEvent/InDetRawData MagneticField/MagFieldInterfaces Reconstruction/RecoTools/ITrackToVertex + Tracking/TrkEvent/TrkSpacePoint Tracking/TrkEvent/TrkTrack Tracking/TrkTools/TrkToolInterfaces Trigger/TrigAnalysis/TrigAnalysisInterfaces Trigger/TrigAnalysis/TrigDecisionTool PRIVATE - Commission/CommissionEvent Control/AthenaKernel Control/DataModel DetectorDescription/Identifier - Event/EventInfo - Event/xAOD/xAODEventInfo InnerDetector/InDetDetDescr/InDetIdentifier - InnerDetector/InDetRawEvent/InDetRawData InnerDetector/InDetRecEvent/InDetRIO_OnTrack Tools/LWHists Tools/PathResolver @@ -36,7 +38,6 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkEvent/TrkMeasurementBase Tracking/TrkEvent/TrkParameters Tracking/TrkEvent/TrkRIO_OnTrack - Tracking/TrkEvent/TrkSpacePoint Tracking/TrkEvent/TrkTrackSummary ) # External dependencies: diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTErrMonTool.h b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTErrMonTool.h index 98a69ebcd6cff816b6d59128f0bceead5f726f2c..3323a12211c29a08d009afb381efc48d7137533e 100755 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTErrMonTool.h +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTErrMonTool.h @@ -26,6 +26,10 @@ #include "SCT_ConditionsServices/ISCT_ConfigurationConditionsSvc.h" #include "SCT_Monitoring/SCT_MonitoringNumbers.h" +#include "StoreGate/ReadHandleKey.h" +#include "xAODEventInfo/EventInfo.h" +#include "InDetRawData/SCT_RDO_Container.h" + /** Forward declarations*/ class IInterface; class TH1F; @@ -198,7 +202,7 @@ class SCTErrMonTool : public ManagedMonitorToolBase //@{ /// Data object name: for the SCT this is "SCT_RDOs" - std::string m_dataObjectName; + SG::ReadHandle<SCT_RDO_Container> m_dataObjectName; ///SCT Helper class const SCT_ID* m_pSCTHelper; @@ -295,6 +299,8 @@ class SCTErrMonTool : public ManagedMonitorToolBase //TProfile * m_DisabledDetectorCoverageVsLB; //TProfile * m_ErrorDetectorCoverageVsLB; TProfile * m_TotalDetectorCoverageVsLB; + + SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey; }; #endif diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTHitEffMonTool.h b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTHitEffMonTool.h index db12815f3010cd5df454229e59cd24d4d728dfe3..bf6fc76070b9a9521944a1306a351fa9157d37ef 100755 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTHitEffMonTool.h +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTHitEffMonTool.h @@ -42,6 +42,10 @@ #include "InDetPrepRawData/SCT_ClusterContainer.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" +#include "StoreGate/ReadHandleKey.h" +#include "CommissionEvent/ComTime.h" +#include "xAODEventInfo/EventInfo.h" + class Identifier; class PixelID; class SCT_ID; @@ -124,7 +128,7 @@ private: const SCT_ID* m_pSCTHelper; const InDetDD::SCT_DetectorManager* m_pManager; - std::string m_TrackName; + SG::ReadHandle<TrackCollection> m_TrackName; IChronoStatSvc * m_chrono; const TrackCollection * m_tracks; Trk::TrackSummaryTool* m_TrackSum; @@ -150,7 +154,7 @@ private: UInt_t m_maxTracks; std::string m_path; - std::string m_sctContainerName; + SG::ReadHandleKey<InDet::SCT_ClusterContainer> m_sctContainerName; Bool_t m_insideOutOnly; @@ -288,6 +292,9 @@ private: const SCT_ID * m_sctId; const TRT_ID * m_trtId; + SG::ReadHandleKey<ComTime> m_comTimeName; + SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey; + /**Convert a layer/disk number (0-21) to a bec index (0,1,2) according to position of that layer * Numbering is counter-intuitive, would expect C then B then A; in fact the original ordering was A, C, B * I have re-ordered this!!!! so now its C,B,A diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTHitsNoiseMonTool.h b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTHitsNoiseMonTool.h index 401bb5166ec64b0bf23b0f3d4e4e7e682f20b308..47163b28e889d92813d0012deaf9b6f58bee3d13 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTHitsNoiseMonTool.h +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTHitsNoiseMonTool.h @@ -28,6 +28,11 @@ #include "TrkTrack/Track.h" #include "TrkTrack/TrackCollection.h" +#include "StoreGate/ReadHandleKey.h" +#include "TrkSpacePoint/SpacePointContainer.h" +#include "InDetRawData/SCT_RDO_Container.h" +#include "xAODEventInfo/EventInfo.h" +#include "InDetPrepRawData/SCT_ClusterContainer.h" // for CondDB #include "SCT_ConditionsServices/ISCT_ConfigurationConditionsSvc.h" @@ -57,6 +62,7 @@ class SCTHitsNoiseMonTool : public SCTMotherTrigMonTool{ typedef unsigned int ChipNumberType; SCTHitsNoiseMonTool(const std::string & type, const std::string & name,const IInterface* parent); ~SCTHitsNoiseMonTool(); + virtual StatusCode initialize() final; /** @name Book, fill & check (reimplemented from baseclass) */ //@{ ///Book is called at the beginning @@ -193,7 +199,7 @@ class SCTHitsNoiseMonTool : public SCTMotherTrigMonTool{ H1_t m_hitsvsL1ID; /// Name of the Track collection to use - std::string m_tracksName; + SG::ReadHandleKey<TrackCollection> m_tracksName; /// Name of the L1 Type to use for filling the extra NO histograms std::string m_NOTrigger; @@ -263,7 +269,6 @@ class SCTHitsNoiseMonTool : public SCTMotherTrigMonTool{ unsigned int m_maxTracks; std::vector<Identifier> m_RDOsOnTracks; StatusCode makeVectorOfTrackRDOIdentifiers(); - const DataVector<Trk::Track> *m_tracks; VecH2_t m_ptrackhitsHistoVector; VecH2_t m_ptrackhitsHistoVectorECp; VecH2_t m_ptrackhitsHistoVectorECm; @@ -333,7 +338,7 @@ class SCTHitsNoiseMonTool : public SCTMotherTrigMonTool{ ///additional maps for track NO to compare with SP NO calc std::map<Identifier, int> m_RDOs; //CAM adds map for SP NO - std::string m_SCTSPContainerName; + SG::ReadHandle<SpacePointContainer> m_SCTSPContainerName; std::map<Identifier, float> m_occSumUnbiased; std::map<Identifier, float> m_occSumUnbiasedTrigger; @@ -469,7 +474,7 @@ class SCTHitsNoiseMonTool : public SCTMotherTrigMonTool{ //@{ /// Data object name: for the SCT this is "SCT_RDOs" - std::string m_dataObjectName; + SG::ReadHandleKey<SCT_RDO_Container> m_dataObjectName; ///SCT Helper class const SCT_ID* m_pSCTHelper; @@ -508,6 +513,9 @@ class SCTHitsNoiseMonTool : public SCTMotherTrigMonTool{ std::string positionString(const Identifier & plane) const; //@} + + SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey; + SG::ReadHandleKey<InDet::SCT_ClusterContainer> m_clusContainerKey; }; #endif diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTLorentzMonTool.h b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTLorentzMonTool.h index d8cbf151384eedb76cef7cde099a1875517cbcef..4754797c51f42dd174f62c10dd28009fdd5816b3 100755 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTLorentzMonTool.h +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTLorentzMonTool.h @@ -35,6 +35,9 @@ //for vertexTool #include "ITrackToVertex/ITrackToVertex.h" //for m_trackToVertexTool +#include "StoreGate/ReadHandle.h" +#include "TrkTrack/TrackCollection.h" + // Forward declarations class IInterface; class TH1I; @@ -50,6 +53,8 @@ class SCTLorentzMonTool : public SCTMotherTrigMonTool{ public: SCTLorentzMonTool(const std::string & type, const std::string & name, const IInterface* parent); virtual ~SCTLorentzMonTool(); + //initialize + virtual StatusCode initialize() final; /** @name Book, fill & check (reimplemented from baseclass) */ //@{ ///Book histograms in initialization @@ -95,7 +100,7 @@ private: std::string m_path; //@} /// Name of the Track collection to use - std::string m_tracksName; + SG::ReadHandleKey<TrackCollection> m_tracksName; //@name Service members diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTMotherTrigMonTool.h b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTMotherTrigMonTool.h index 780e925481211ae63c655d0d79bce899e750776b..41484fc3a3b509eb470b9de18830a18df6e381e9 100755 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTMotherTrigMonTool.h +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTMotherTrigMonTool.h @@ -20,6 +20,9 @@ #include <string> #include <bitset> +#include "StoreGate/ReadHandleKey.h" +#include "EventInfo/EventInfo.h" + //Fwd declarations class IInterface; class StatusCode; @@ -64,6 +67,7 @@ private: // TrigDecisionTool ToolHandle<Trig::TrigDecisionTool> m_trigDec; + SG::ReadHandleKey<EventInfo> m_eventInfoKey; }; #endif diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTRatioNoiseMonTool.h b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTRatioNoiseMonTool.h index cf65d93d3ce7752556d8451989d043ad96c421a1..0979ba1a041944826ed2cd1f1252e03e51c9bf2a 100755 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTRatioNoiseMonTool.h +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTRatioNoiseMonTool.h @@ -32,6 +32,10 @@ #include "GaudiKernel/ServiceHandle.h" //#include "GaudiKernel/ToolHandle.h" +#include "StoreGate/ReadHandleKey.h" +#include "InDetRawData/SCT_RDO_Container.h" +#include "xAODEventInfo/EventInfo.h" + // Forward declarations class IInterface; class TH1I; @@ -59,6 +63,8 @@ class SCTRatioNoiseMonTool : public SCTMotherTrigMonTool{ public: SCTRatioNoiseMonTool(const std::string & type, const std::string & name, const IInterface* parent); virtual ~SCTRatioNoiseMonTool(); + // initialize + virtual StatusCode initialize() final; /** @name Book, fill & check (reimplemented from baseclass) */ //@{ ///Book histograms in initialization @@ -233,7 +239,8 @@ private: //@name Service members //@{ /// Data object name: for the SCT this is "SCT_RDOs" - std::string m_dataObjectName; + SG::ReadHandleKey<SCT_RDO_Container> m_dataObjectName; + SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey; ///SCT Helper class const SCT_ID* m_pSCTHelper; //SCT Detector Manager diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTTracksMonTool.h b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTTracksMonTool.h index 47af0ded5d34f70541342d4408d9b60898b7b9fa..a08cb83e0b7ecd1f8bd11b423a0c0127d3fd5eba 100755 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTTracksMonTool.h +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTTracksMonTool.h @@ -27,6 +27,9 @@ #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" +#include "StoreGate/ReadHandleKey.h" +#include "TrkTrack/TrackCollection.h" + // Forward declarations class IInterface; class TH1I; @@ -42,6 +45,8 @@ class SCTTracksMonTool : public SCTMotherTrigMonTool{ public: SCTTracksMonTool(const std::string & type, const std::string & name, const IInterface* parent); virtual ~SCTTracksMonTool(); + //initialize + virtual StatusCode initialize() final; /** @name Book, fill & check (reimplemented from baseclass) */ //@{ ///Book histograms in initialization @@ -142,7 +147,7 @@ private: bool m_useIDGlobal; //@} /// Name of the Track collection to use - std::string m_tracksName; + SG::ReadHandleKey<TrackCollection> m_tracksName; /// Cut on number of SCT hits on track int m_trackHitCut; /// CheckHists() frequency diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTErrMonTool.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTErrMonTool.cxx index 04137e543894cbdc8eea912a04f42c32b0e6bc4f..f4241c2dc0b0fec6e4a8b6984740f9fc162d54d2 100755 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTErrMonTool.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTErrMonTool.cxx @@ -37,8 +37,8 @@ #include "InDetIdentifier/SCT_ID.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" #include "InDetReadoutGeometry/SiDetectorElement.h" -#include "xAODEventInfo/EventInfo.h" #include "cArrayUtilities.h" +#include "StoreGate/ReadHandle.h" #include <vector> #include <set> #include <iostream> @@ -180,7 +180,7 @@ SCTErrMonTool::SCTErrMonTool(const std::string &type, const std::string &name, c // m_doPerLumiErrors{}, property // m_doErr2DPerLumiHists{}, property // m_min_stat_ineff_mod{}, property - m_dataObjectName{}, + m_dataObjectName(std::string("SCT_RDOs")), m_pSCTHelper{}, m_ConfigurationSvc("InDetSCT_ConfigurationConditionsSvc", name), m_flaggedSvc("InDetSCT_FlaggedConditionSvc", name), @@ -226,342 +226,346 @@ SCTErrMonTool::SCTErrMonTool(const std::string &type, const std::string &name, c m_ModulesThreshold( 2.5 ), //m_DisabledDetectorCoverageVsLB{}, //m_ErrorDetectorCoverageVsLB{}, - m_TotalDetectorCoverageVsLB{} { - /** - * sroe 3 Sept 2015: - * histoPathBase is declared as a property in the base class, assigned to m_path - * with default as empty string. - * Declaring it here as well gives rise to compilation warning - * WARNING duplicated property name 'histoPathBase', see https://its.cern.ch/jira/browse/GAUDI-1023 - * declareProperty("histoPathBase", m_stream = "/stat"); - **/ - - m_stream = "/stat"; - declareProperty("CheckRate", m_checkrate = 1000); - declareProperty("runOnline", m_runOnline = false); - declareProperty("CheckRecent", m_checkrecent = 20); - declareProperty("doPositiveEndcap", m_doPositiveEndcap = true); - declareProperty("doNegativeEndcap", m_doNegativeEndcap = true); - declareProperty("EvtsBins", m_evtsbins = 5000); - declareProperty("MakeConfHisto", m_makeConfHisto = true); - declareProperty("conditionsService", m_ConfigurationSvc); - declareProperty("flaggedService", m_flaggedSvc); - - // Thresholds for the SCTConf histogram - declareProperty("error_threshold", m_errThreshold = 0.7); - declareProperty("efficiency_threshold", m_effThreshold = 0.9); - declareProperty("noise_threshold", m_noiseThreshold = 150); - // Min stats per layer to use for number of inefficient modules - declareProperty("MinStatsForInEffModules", m_min_stat_ineff_mod = 500.0); - - declareProperty("DoPerLumiErrors", m_doPerLumiErrors = true); - declareProperty("DoErr2DPerLumiHists", m_doErr2DPerLumiHists = false); - declareProperty("checkBadModules", m_checkBadModules); - declareProperty("IgnoreRDOCutOnline", m_ignore_RDO_cut_online); - //Detector Coverage Tool switch - declareProperty("CoverageCheck",m_CoverageCheck=false); - - } - -// ==================================================================================================== -//==================================================================================================== -StatusCode SCTErrMonTool::initialize() { - if (detStore()->retrieve(m_sctManager, "SCT").isFailure()){ - msg(MSG::ERROR) << "Could not retrieve SCT Detector Manager" << endmsg; - return StatusCode::FAILURE; - } - return ManagedMonitorToolBase::initialize(); -} - -//==================================================================================================== -// ==================================================================================================== -SCTErrMonTool::~SCTErrMonTool() { - - for (int reg(0); reg != NREGIONS_INC_GENERAL; ++reg) { - for (int layer(0); layer != SCT_Monitoring::N_ENDCAPSx2; ++layer) { - for (int errType(0); errType != N_ERRTYPES; ++errType) { - if(m_allErrsPerLumi[errType][reg][layer])LWHist::safeDelete(m_allErrsPerLumi[errType][reg][layer]); - if(m_pallErrsPerLumi[errType][reg][layer])LWHist::safeDelete(m_pallErrsPerLumi[errType][reg][layer]); - } - } - } - - free(nErrors_buf); - free(nLinksWithErrors_buf); -} - -// ==================================================================================================== -// SCTErrMonTool :: transfer [enum ErrorTypes] -> [SCT_ByteStreamErrors] -// ==================================================================================================== -int -SCTErrMonTool::errorsToGet(int errtype) { - if (errtype == ABCD) { - return SCT_ByteStreamErrors::ABCDError; - } - if (errtype == RAW) { - return SCT_ByteStreamErrors::RawError; - } - if (errtype == TIMEOUT) { - return SCT_ByteStreamErrors::TimeOutError; - } - if (errtype == LVL1ID) { - return SCT_ByteStreamErrors::LVL1IDError; - } - if (errtype == BCID) { - return SCT_ByteStreamErrors::BCIDError; - } - if (errtype == PREAMBLE) { - return SCT_ByteStreamErrors::PreambleError; - } - if (errtype == FORMATTER) { - return SCT_ByteStreamErrors::FormatterError; - } - if (errtype == MASKEDLINKS) { - return SCT_ByteStreamErrors::MaskedLink; - } - if (errtype == RODCLOCK) { - return SCT_ByteStreamErrors::RODClockError; - } - if (errtype == TRUNCATEDROD) { - return SCT_ByteStreamErrors::TruncatedROD; - } - if (errtype == ROBFRAG) { - return SCT_ByteStreamErrors::ROBFragmentError; - } - if (errtype == BSPARSE) { - return SCT_ByteStreamErrors::ByteStreamParseError; - } - if (errtype == MISSINGLINK) { - return SCT_ByteStreamErrors::MissingLinkHeaderError; - } - if (errtype == MASKEDRODS) { - return SCT_ByteStreamErrors::MaskedROD; - } - if (errtype == ABCDChip0) { - return SCT_ByteStreamErrors::ABCDError_Chip0; - } - if (errtype == ABCDChip1) { - return SCT_ByteStreamErrors::ABCDError_Chip1; - } - if (errtype == ABCDChip2) { - return SCT_ByteStreamErrors::ABCDError_Chip2; - } - if (errtype == ABCDChip3) { - return SCT_ByteStreamErrors::ABCDError_Chip3; - } - if (errtype == ABCDChip4) { - return SCT_ByteStreamErrors::ABCDError_Chip4; - } - if (errtype == ABCDChip5) { - return SCT_ByteStreamErrors::ABCDError_Chip5; - } - if (errtype == ABCDError1) { - return SCT_ByteStreamErrors::ABCDError_Error1; - } - if (errtype == ABCDError2) { - return SCT_ByteStreamErrors::ABCDError_Error2; - } - if (errtype == ABCDError4) { - return SCT_ByteStreamErrors::ABCDError_Error4; - } - return errtype; -} - -// ==================================================================================================== -// SCTErrMonTool :: transfer [enum ErrorTypes] -> [TString ErrorName] -// ==================================================================================================== -TString -SCTErrMonTool::errorsString(int errtype) { - if (errtype == ABCD) { - return "ABCDerrs"; - } - if (errtype == RAW) { - return "Rawerrs"; - } - if (errtype == TIMEOUT) { - return "TimeOut"; - } - if (errtype == LVL1ID) { - return "LVL1IDerrs"; - } - if (errtype == BCID) { - return "BCIDerrs"; - } - if (errtype == PREAMBLE) { - return "Preamble"; - } - if (errtype == FORMATTER) { - return "Formattererrs"; - } - if (errtype == MASKEDLINKS) { - return "MaskedLinkLink"; - } - if (errtype == RODCLOCK) { - return "RODClockerrs"; - } - if (errtype == TRUNCATEDROD) { - return "TruncatedROD"; - } - if (errtype == ROBFRAG) { - return "ROBFragment"; - } - if (errtype == BSPARSE) { - return "BSParseerrs"; - } - if (errtype == MISSINGLINK) { - return "MissingLink"; - } - if (errtype == MASKEDRODS) { - return "MaskedROD"; - } - if (errtype == SUMMARY) { - return "NumberOfErrors"; - } - if (errtype == BADERR) { - return "NumberOfBadErrors"; - } - if (errtype == LINKLEVEL) { - return "NumberOfLinkLevelErrors"; - } - if (errtype == RODLEVEL) { - return "NumberOfRODLevelErrors"; - } - if (errtype == MASKEDLINKALL) { - return "MaskedLink"; - } - if (errtype == ABCDChip0) { - return "ABCDChip0"; - } - if (errtype == ABCDChip1) { - return "ABCDChip1"; - } - if (errtype == ABCDChip2) { - return "ABCDChip2"; - } - if (errtype == ABCDChip3) { - return "ABCDChip3"; - } - if (errtype == ABCDChip4) { - return "ABCDChip4"; - } - if (errtype == ABCDChip5) { - return "ABCDChip5"; - } - if (errtype == ABCDError1) { - return "ABCDError1"; - } - if (errtype == ABCDError2) { - return "ABCDError2"; - } - if (errtype == ABCDError4) { - return "ABCDError4"; - } - return ""; -} - -// ==================================================================================================== -// SCTErrMonTool :: copyHistograms -// This function is used for copying histograms which is required to change their directories. -// If you change original ones immediately, you cannot see them in the web display for a while -// until new configuration for web display is applied. -// So you should copy histograms in the new directories in this function once, -// and then if you have new configuration for the webdisplay, you can delete this function and change original histograms. -// ==================================================================================================== -StatusCode -SCTErrMonTool::copyHistograms() { - - // BSError histograms - int nlayer = 0; - const std::string m_errorsNames[] = { - "ABCD", "Raw", "TimeOut", "", "", "", "", "", "", "", - "", "BSParse", "MissingLink", "", "", "", "", "", - "", "", "", "", "", "", "summary", "badError", "", "" - }; - for (int reg(0); reg != 3; ++reg) { - nlayer = 0; - if(reg==0)nlayer = N_BARRELSx2; - else if(reg==1||reg==2) nlayer = N_DISKSx2; - for (int layer(0); layer != nlayer; ++layer) { - for (int errType(0); errType != N_ERRTYPES; ++errType) { - if(m_errorsNames[errType]=="")continue; - if (m_doPerLumiErrors) { - if (m_doErr2DPerLumiHists) { - const int xbins(m_allErrsPerLumi[errType][reg][layer]->GetNbinsX() + 1); - const int ybins(m_allErrsPerLumi[errType][reg][layer]->GetNbinsY() + 1); - for (int xb(1); xb != xbins; ++xb) { - for (int yb(1); yb != ybins; ++yb) { - m_pallErrsPerLumi_tmp[errType][reg][layer] - ->SetBinContent(xb,yb,m_pallErrsPerLumi[errType][reg][layer]->GetBinContent(xb,yb)); - double nentry=0; - double content=0; - double error=0; - m_allErrsPerLumi[errType][reg][layer]->GetBinInfo(xb,yb,nentry,content,error); - for(int ientry=0; ientry<nentry; ientry++){ - m_allErrsPerLumi_tmp[errType][reg][layer] - ->Fill(m_allErrsPerLumi[errType][reg][layer]->GetXaxis()->GetBinCenter(xb), - m_allErrsPerLumi[errType][reg][layer]->GetYaxis()->GetBinCenter(yb), - m_allErrsPerLumi[errType][reg][layer]->GetBinContent(xb,yb)); - } - } - } - } - } - const int xbins(m_allErrs[errType][reg][layer]->GetNbinsX() + 1); - const int ybins(m_allErrs[errType][reg][layer]->GetNbinsY() + 1); - for (int xb(1); xb != xbins; ++xb) { - for (int yb(1); yb != ybins; ++yb) { - m_pallErrs_tmp[errType][reg][layer] - ->SetBinContent(xb,yb,m_pallErrs[errType][reg][layer]->GetBinContent(xb,yb)); - double nentry=0; - double content=0; - double error=0; - m_allErrs[errType][reg][layer]->GetBinInfo(xb,yb,nentry,content,error); - if(m_allErrs[errType][reg][layer]->GetBinContent(xb,yb)>0) - for(int ientry=0; ientry<nentry; ientry++){ - m_allErrs_tmp[errType][reg][layer] - ->Fill(m_allErrs[errType][reg][layer]->GetXaxis()->GetBinCenter(xb), - m_allErrs[errType][reg][layer]->GetYaxis()->GetBinCenter(yb), - m_allErrs[errType][reg][layer]->GetBinContent(xb,yb)); - } - } - } - } - } - } - - //RODLevelErrors histograms - - for (int reg = 0; reg != NREGIONS_INC_GENERAL; ++reg) { - const int xbins(m_LinksWithRODErrorsVsLB_check[reg]->GetNbinsX() + 1); - for (int xb(1); xb != xbins; ++xb) { - double nentry=m_LinksWithRODErrorsVsLB[reg]->GetBinEntries(xb); - for(int ientry=0; ientry<nentry; ientry++){ - m_LinksWithRODErrorsVsLB_check[reg]->Fill(m_LinksWithRODErrorsVsLB[reg]->GetXaxis()->GetBinCenter(xb), - m_LinksWithRODErrorsVsLB[reg]->GetBinContent(xb)); - } - } - } - - return StatusCode::SUCCESS; -} - -// ==================================================================================================== -// SCTErrMonTool :: bookHistograms -// ==================================================================================================== -StatusCode -SCTErrMonTool::bookHistograms() { - - ATH_MSG_DEBUG(" initialize being called "); - if (newRunFlag()) { - m_numberOfEvents = 0; - if (AthenaMonManager::dataType() == AthenaMonManager::cosmics) { - m_checkrate = 100; - } - } - if (ManagedMonitorToolBase::newLumiBlockFlag()) { - m_numberOfEventsLumi = 0; - } - m_dataObjectName = "SCT_RDOs"; + m_TotalDetectorCoverageVsLB{}, + m_eventInfoKey(std::string("EventInfo")) { + /** + * sroe 3 Sept 2015: + * histoPathBase is declared as a property in the base class, assigned to m_path + * with default as empty string. + * Declaring it here as well gives rise to compilation warning + * WARNING duplicated property name 'histoPathBase', see https://its.cern.ch/jira/browse/GAUDI-1023 + * declareProperty("histoPathBase", m_stream = "/stat"); + **/ + + m_stream = "/stat"; + declareProperty("CheckRate", m_checkrate = 1000); + declareProperty("runOnline", m_runOnline = false); + declareProperty("CheckRecent", m_checkrecent = 20); + declareProperty("doPositiveEndcap", m_doPositiveEndcap = true); + declareProperty("doNegativeEndcap", m_doNegativeEndcap = true); + declareProperty("EvtsBins", m_evtsbins = 5000); + declareProperty("MakeConfHisto", m_makeConfHisto = true); + declareProperty("conditionsService", m_ConfigurationSvc); + declareProperty("flaggedService", m_flaggedSvc); + + // Thresholds for the SCTConf histogram + declareProperty("error_threshold", m_errThreshold = 0.7); + declareProperty("efficiency_threshold", m_effThreshold = 0.9); + declareProperty("noise_threshold", m_noiseThreshold = 150); + // Min stats per layer to use for number of inefficient modules + declareProperty("MinStatsForInEffModules", m_min_stat_ineff_mod = 500.0); + + declareProperty("DoPerLumiErrors", m_doPerLumiErrors = true); + declareProperty("DoErr2DPerLumiHists", m_doErr2DPerLumiHists = false); + declareProperty("checkBadModules", m_checkBadModules); + declareProperty("IgnoreRDOCutOnline", m_ignore_RDO_cut_online); + //Detector Coverage Tool switch + declareProperty("CoverageCheck",m_CoverageCheck=false); + + } + + // ==================================================================================================== + //==================================================================================================== + StatusCode SCTErrMonTool::initialize() { + if (detStore()->retrieve(m_sctManager, "SCT").isFailure()){ + msg(MSG::ERROR) << "Could not retrieve SCT Detector Manager" << endmsg; + return StatusCode::FAILURE; + } + + ATH_CHECK( m_dataObjectName.initialize() ); + ATH_CHECK( m_eventInfoKey.initialize() ); + + return ManagedMonitorToolBase::initialize(); + } + + //==================================================================================================== + // ==================================================================================================== + SCTErrMonTool::~SCTErrMonTool() { + + for (int reg(0); reg != NREGIONS_INC_GENERAL; ++reg) { + for (int layer(0); layer != SCT_Monitoring::N_ENDCAPSx2; ++layer) { + for (int errType(0); errType != N_ERRTYPES; ++errType) { + if(m_allErrsPerLumi[errType][reg][layer])LWHist::safeDelete(m_allErrsPerLumi[errType][reg][layer]); + if(m_pallErrsPerLumi[errType][reg][layer])LWHist::safeDelete(m_pallErrsPerLumi[errType][reg][layer]); + } + } + } + + free(nErrors_buf); + free(nLinksWithErrors_buf); + } + + // ==================================================================================================== + // SCTErrMonTool :: transfer [enum ErrorTypes] -> [SCT_ByteStreamErrors] + // ==================================================================================================== + int + SCTErrMonTool::errorsToGet(int errtype) { + if (errtype == ABCD) { + return SCT_ByteStreamErrors::ABCDError; + } + if (errtype == RAW) { + return SCT_ByteStreamErrors::RawError; + } + if (errtype == TIMEOUT) { + return SCT_ByteStreamErrors::TimeOutError; + } + if (errtype == LVL1ID) { + return SCT_ByteStreamErrors::LVL1IDError; + } + if (errtype == BCID) { + return SCT_ByteStreamErrors::BCIDError; + } + if (errtype == PREAMBLE) { + return SCT_ByteStreamErrors::PreambleError; + } + if (errtype == FORMATTER) { + return SCT_ByteStreamErrors::FormatterError; + } + if (errtype == MASKEDLINKS) { + return SCT_ByteStreamErrors::MaskedLink; + } + if (errtype == RODCLOCK) { + return SCT_ByteStreamErrors::RODClockError; + } + if (errtype == TRUNCATEDROD) { + return SCT_ByteStreamErrors::TruncatedROD; + } + if (errtype == ROBFRAG) { + return SCT_ByteStreamErrors::ROBFragmentError; + } + if (errtype == BSPARSE) { + return SCT_ByteStreamErrors::ByteStreamParseError; + } + if (errtype == MISSINGLINK) { + return SCT_ByteStreamErrors::MissingLinkHeaderError; + } + if (errtype == MASKEDRODS) { + return SCT_ByteStreamErrors::MaskedROD; + } + if (errtype == ABCDChip0) { + return SCT_ByteStreamErrors::ABCDError_Chip0; + } + if (errtype == ABCDChip1) { + return SCT_ByteStreamErrors::ABCDError_Chip1; + } + if (errtype == ABCDChip2) { + return SCT_ByteStreamErrors::ABCDError_Chip2; + } + if (errtype == ABCDChip3) { + return SCT_ByteStreamErrors::ABCDError_Chip3; + } + if (errtype == ABCDChip4) { + return SCT_ByteStreamErrors::ABCDError_Chip4; + } + if (errtype == ABCDChip5) { + return SCT_ByteStreamErrors::ABCDError_Chip5; + } + if (errtype == ABCDError1) { + return SCT_ByteStreamErrors::ABCDError_Error1; + } + if (errtype == ABCDError2) { + return SCT_ByteStreamErrors::ABCDError_Error2; + } + if (errtype == ABCDError4) { + return SCT_ByteStreamErrors::ABCDError_Error4; + } + return errtype; + } + + // ==================================================================================================== + // SCTErrMonTool :: transfer [enum ErrorTypes] -> [TString ErrorName] + // ==================================================================================================== + TString + SCTErrMonTool::errorsString(int errtype) { + if (errtype == ABCD) { + return "ABCDerrs"; + } + if (errtype == RAW) { + return "Rawerrs"; + } + if (errtype == TIMEOUT) { + return "TimeOut"; + } + if (errtype == LVL1ID) { + return "LVL1IDerrs"; + } + if (errtype == BCID) { + return "BCIDerrs"; + } + if (errtype == PREAMBLE) { + return "Preamble"; + } + if (errtype == FORMATTER) { + return "Formattererrs"; + } + if (errtype == MASKEDLINKS) { + return "MaskedLinkLink"; + } + if (errtype == RODCLOCK) { + return "RODClockerrs"; + } + if (errtype == TRUNCATEDROD) { + return "TruncatedROD"; + } + if (errtype == ROBFRAG) { + return "ROBFragment"; + } + if (errtype == BSPARSE) { + return "BSParseerrs"; + } + if (errtype == MISSINGLINK) { + return "MissingLink"; + } + if (errtype == MASKEDRODS) { + return "MaskedROD"; + } + if (errtype == SUMMARY) { + return "NumberOfErrors"; + } + if (errtype == BADERR) { + return "NumberOfBadErrors"; + } + if (errtype == LINKLEVEL) { + return "NumberOfLinkLevelErrors"; + } + if (errtype == RODLEVEL) { + return "NumberOfRODLevelErrors"; + } + if (errtype == MASKEDLINKALL) { + return "MaskedLink"; + } + if (errtype == ABCDChip0) { + return "ABCDChip0"; + } + if (errtype == ABCDChip1) { + return "ABCDChip1"; + } + if (errtype == ABCDChip2) { + return "ABCDChip2"; + } + if (errtype == ABCDChip3) { + return "ABCDChip3"; + } + if (errtype == ABCDChip4) { + return "ABCDChip4"; + } + if (errtype == ABCDChip5) { + return "ABCDChip5"; + } + if (errtype == ABCDError1) { + return "ABCDError1"; + } + if (errtype == ABCDError2) { + return "ABCDError2"; + } + if (errtype == ABCDError4) { + return "ABCDError4"; + } + return ""; + } + + // ==================================================================================================== + // SCTErrMonTool :: copyHistograms + // This function is used for copying histograms which is required to change their directories. + // If you change original ones immediately, you cannot see them in the web display for a while + // until new configuration for web display is applied. + // So you should copy histograms in the new directories in this function once, + // and then if you have new configuration for the webdisplay, you can delete this function and change original histograms. + // ==================================================================================================== + StatusCode + SCTErrMonTool::copyHistograms() { + + // BSError histograms + int nlayer = 0; + const std::string m_errorsNames[] = { + "ABCD", "Raw", "TimeOut", "", "", "", "", "", "", "", + "", "BSParse", "MissingLink", "", "", "", "", "", + "", "", "", "", "", "", "summary", "badError", "", "" + }; + for (int reg(0); reg != 3; ++reg) { + nlayer = 0; + if(reg==0)nlayer = N_BARRELSx2; + else if(reg==1||reg==2) nlayer = N_DISKSx2; + for (int layer(0); layer != nlayer; ++layer) { + for (int errType(0); errType != N_ERRTYPES; ++errType) { + if(m_errorsNames[errType]=="")continue; + if (m_doPerLumiErrors) { + if (m_doErr2DPerLumiHists) { + const int xbins(m_allErrsPerLumi[errType][reg][layer]->GetNbinsX() + 1); + const int ybins(m_allErrsPerLumi[errType][reg][layer]->GetNbinsY() + 1); + for (int xb(1); xb != xbins; ++xb) { + for (int yb(1); yb != ybins; ++yb) { + m_pallErrsPerLumi_tmp[errType][reg][layer] + ->SetBinContent(xb,yb,m_pallErrsPerLumi[errType][reg][layer]->GetBinContent(xb,yb)); + double nentry=0; + double content=0; + double error=0; + m_allErrsPerLumi[errType][reg][layer]->GetBinInfo(xb,yb,nentry,content,error); + for(int ientry=0; ientry<nentry; ientry++){ + m_allErrsPerLumi_tmp[errType][reg][layer] + ->Fill(m_allErrsPerLumi[errType][reg][layer]->GetXaxis()->GetBinCenter(xb), + m_allErrsPerLumi[errType][reg][layer]->GetYaxis()->GetBinCenter(yb), + m_allErrsPerLumi[errType][reg][layer]->GetBinContent(xb,yb)); + } + } + } + } + } + const int xbins(m_allErrs[errType][reg][layer]->GetNbinsX() + 1); + const int ybins(m_allErrs[errType][reg][layer]->GetNbinsY() + 1); + for (int xb(1); xb != xbins; ++xb) { + for (int yb(1); yb != ybins; ++yb) { + m_pallErrs_tmp[errType][reg][layer] + ->SetBinContent(xb,yb,m_pallErrs[errType][reg][layer]->GetBinContent(xb,yb)); + double nentry=0; + double content=0; + double error=0; + m_allErrs[errType][reg][layer]->GetBinInfo(xb,yb,nentry,content,error); + if(m_allErrs[errType][reg][layer]->GetBinContent(xb,yb)>0) + for(int ientry=0; ientry<nentry; ientry++){ + m_allErrs_tmp[errType][reg][layer] + ->Fill(m_allErrs[errType][reg][layer]->GetXaxis()->GetBinCenter(xb), + m_allErrs[errType][reg][layer]->GetYaxis()->GetBinCenter(yb), + m_allErrs[errType][reg][layer]->GetBinContent(xb,yb)); + } + } + } + } + } + } + + //RODLevelErrors histograms + + for (int reg = 0; reg != NREGIONS_INC_GENERAL; ++reg) { + const int xbins(m_LinksWithRODErrorsVsLB_check[reg]->GetNbinsX() + 1); + for (int xb(1); xb != xbins; ++xb) { + double nentry=m_LinksWithRODErrorsVsLB[reg]->GetBinEntries(xb); + for(int ientry=0; ientry<nentry; ientry++){ + m_LinksWithRODErrorsVsLB_check[reg]->Fill(m_LinksWithRODErrorsVsLB[reg]->GetXaxis()->GetBinCenter(xb), + m_LinksWithRODErrorsVsLB[reg]->GetBinContent(xb)); + } + } + } + + return StatusCode::SUCCESS; + } + + // ==================================================================================================== + // SCTErrMonTool :: bookHistograms + // ==================================================================================================== + StatusCode + SCTErrMonTool::bookHistograms() { + + ATH_MSG_DEBUG(" initialize being called "); + if (newRunFlag()) { + m_numberOfEvents = 0; + if (AthenaMonManager::dataType() == AthenaMonManager::cosmics) { + m_checkrate = 100; + } + } + if (ManagedMonitorToolBase::newLumiBlockFlag()) { + m_numberOfEventsLumi = 0; + } const InDetDD::SCT_DetectorManager *mgr; // confusingly this is in a dedicated namespace ATH_CHECK(detStore()->retrieve(mgr, "SCT")); ATH_CHECK(detStore()->retrieve(m_pSCTHelper, "SCT_ID")); @@ -671,8 +675,8 @@ StatusCode SCTErrMonTool::fillHistograms() { typedef SCT_RDORawData SCTRawDataType; - const xAOD::EventInfo *pEvent(0); - if (evtStore()->retrieve(pEvent).isFailure()) { + SG::ReadHandle<xAOD::EventInfo> pEvent(m_eventInfoKey); + if (not pEvent.isValid()) { ATH_MSG_WARNING("Could not retrieve event info!"); return StatusCode::RECOVERABLE; } @@ -698,8 +702,7 @@ SCTErrMonTool::fillHistograms() { } m_NumberOfEventsVsLB->Fill(m_current_lb); - const SCT_RDO_Container *p_rdocontainer; - ATH_CHECK(evtStore()->retrieve(p_rdocontainer, m_dataObjectName)); + SG::ReadHandle<SCT_RDO_Container> p_rdocontainer(m_dataObjectName); Identifier SCT_Identifier; // Define variables for error histograms @@ -1010,10 +1013,10 @@ SCTErrMonTool::numByteStreamErrors(const std::set<IdentifierHash> *errors, int & StatusCode SCTErrMonTool::fillByteStreamErrors() { // Masked and ROB Fragment vs. lb - const xAOD::EventInfo *pEvent(0); + SG::ReadHandle<xAOD::EventInfo> pEvent(m_eventInfoKey); msg(MSG::INFO) << "INFO|| monitor ||INFO" << endmsg; - if (evtStore()->retrieve(pEvent).isFailure()) { + if (not pEvent.isValid()) { if (msgLvl(MSG::ERROR)) { msg(MSG::ERROR) << "Could not retrieve event info!" << endmsg; } diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonTool.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonTool.cxx index ebe167deb26f9f855956cf680626b76c13c011a0..3247b426656d21c01269a4635906390f9ec27cd5 100755 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonTool.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonTool.cxx @@ -29,8 +29,7 @@ #include "AthenaKernel/errorcheck.h" #include "Identifier/IdentifierHash.h" #include "AthenaMonitoring/AthenaMonManager.h" -#include "EventInfo/EventID.h" -#include "EventInfo/EventInfo.h" +#include "StoreGate/ReadHandle.h" #include "SCT_ConditionsServices/ISCT_ConfigurationConditionsSvc.h" @@ -51,7 +50,6 @@ #include "TrkMeasurementBase/MeasurementBase.h" #include "TrkParameters/TrackParameters.h" -#include "CommissionEvent/ComTime.h" #include "TrkTrackSummary/TrackSummary.h" // SCT @@ -135,7 +133,7 @@ SCTHitEffMonTool::SCTHitEffMonTool(const string &type, const string &name, const mgr(nullptr), m_pSCTHelper(0), m_pManager(0), - m_TrackName("ResolvedSCTTracks"),// original track collection + m_TrackName(std::string("ResolvedSCTTracks")),// original track collection m_chrono(nullptr), m_tracks(nullptr),// original tracks m_TrackSum(nullptr), @@ -201,7 +199,9 @@ SCTHitEffMonTool::SCTHitEffMonTool(const string &type, const string &name, const m_badChipMap(nullptr), m_pixelId(nullptr), m_sctId(nullptr), - m_trtId(nullptr) { + m_trtId(nullptr), + m_comTimeName(std::string("TRT_Phase")), + m_eventInfoKey(std::string("EventInfo")){ declareProperty("TrackName", m_TrackName); declareProperty("IsCosmic", m_isCosmic); declareProperty("IsSim", m_isSim); @@ -231,7 +231,7 @@ SCTHitEffMonTool::SCTHitEffMonTool(const string &type, const string &name, const declareProperty("RunningMode", m_RunningMode); declareProperty("effDistanceCut", m_effdistcut); declareProperty("ChronoTime", m_chronotime); - declareProperty("SCT_ClusterContainer", m_sctContainerName = "SCT_ClusterCollection"); + declareProperty("SCT_ClusterContainer", m_sctContainerName = std::string("SCT_Clusters")); declareProperty("ROTCreator", m_rotcreator); declareProperty("HoleSearch", m_holeSearchTool); declareProperty("ResPullCalc", m_residualPullCalculator); @@ -388,6 +388,11 @@ SCTHitEffMonTool::initialize() { } } + ATH_CHECK( m_comTimeName.initialize(m_useTRTPhase or m_isCosmic) ); + ATH_CHECK( m_eventInfoKey.initialize() ); + ATH_CHECK( m_TrackName.initialize() ); + ATH_CHECK( m_sctContainerName.initialize() ); + return StatusCode::SUCCESS; } @@ -1102,32 +1107,28 @@ SCTHitEffMonTool::fillHistograms() { errorcheck::ReportMessage::hideErrorLocus(true); VERBOSE("SCTHitEffMonTool::fillHistograms()"); - string m_comTimeName("TRT_Phase"); Double_t timecor(-20.); - const ComTime *theComTime; if (m_useTRTPhase or m_isCosmic) { - if (evtStore()->contains<ComTime>(m_comTimeName)) { - if (StatusCode::SUCCESS == evtStore()->retrieve(theComTime, m_comTimeName)) { + if (evtStore()->contains<ComTime>(m_comTimeName.key())) { + SG::ReadHandle<ComTime> theComTime(m_comTimeName); + if (theComTime.isValid()) { timecor = theComTime->getTime(); - VERBOSE("Retrieved ComTime object with name " << m_comTimeName << " found: Time = " << timecor); + VERBOSE("Retrieved ComTime object with name " << m_comTimeName.key() << " found: Time = " << timecor); } else { timecor = -18.; - WARNING("ComTime object not found with name " << m_comTimeName); + WARNING("ComTime object not found with name " << m_comTimeName.key()); } } else { timecor = -16.; - ERROR("ComTime object not in store with name " << m_comTimeName); + ERROR("ComTime object not in store with name " << m_comTimeName.key()); } } // If we are going to use TRT phase in anger, need run-dependent corrections. - EventID *eventID; - const EventInfo *pEvent(0); - CHECK(evtStore()->retrieve(pEvent)); - if (not pEvent) { - return ERROR("Could not find event pointer"), StatusCode::FAILURE; + SG::ReadHandle<xAOD::EventInfo> pEvent(m_eventInfoKey); + if (not pEvent.isValid()) { + return ERROR("Could not find EventInfo"), StatusCode::FAILURE; } - eventID = pEvent->event_ID(); - unsigned BCID = eventID->bunch_crossing_id(); + unsigned BCID = pEvent->bcid(); int BCIDpos = m_bunchCrossingTool->distanceFromFront(BCID); bool InTrain = m_bunchCrossingTool->isInTrain(BCID); @@ -1138,28 +1139,28 @@ SCTHitEffMonTool::fillHistograms() { } // ---- First try if m_tracksName is a TrackCollection - const TrackCollection *m_tracks(0); - if (evtStore()->contains<TrackCollection> (m_TrackName)) { - if (evtStore()->retrieve(m_tracks, m_TrackName).isFailure()) { - WARNING("Tracks not found: " << m_tracks << " / " << m_TrackName); + SG::ReadHandle<TrackCollection>m_tracks(m_TrackName); + if (evtStore()->contains<TrackCollection> (m_TrackName.key())) { + if (not m_tracks.isValid()) { + WARNING("Tracks not found: " << m_tracks << " / " << m_TrackName.key()); if (m_chronotime) { m_chrono->chronoStop("SCTHitEff"); } return StatusCode::SUCCESS; }else { - VERBOSE("Successfully retrieved " << m_TrackName << " : " << m_tracks->size() << " items"); + VERBOSE("Successfully retrieved " << m_TrackName.key() << " : " << m_tracks->size() << " items"); } } else { - WARNING("Collection " << m_TrackName << " not found"); + WARNING("Collection " << m_TrackName.key() << " not found"); if (m_chronotime) { m_chrono->chronoStop("SCTHitEff"); } return StatusCode::SUCCESS; } - const InDet::SCT_ClusterContainer *p_sctclcontainer; - if (evtStore()->retrieve(p_sctclcontainer, "SCT_Clusters").isFailure()) { - WARNING("SCT clusters container not found: " << p_sctclcontainer); + SG::ReadHandle<InDet::SCT_ClusterContainer> p_sctclcontainer(m_sctContainerName); + if (not p_sctclcontainer.isValid()) { + WARNING("SCT clusters container not found: " << m_sctContainerName.key()); if (m_chronotime) { m_chrono->chronoStop("SCTHitEff"); } @@ -1307,7 +1308,7 @@ SCTHitEffMonTool::fillHistograms() { } if (m_sctId->is_sct(surfaceID)) { m_NHits[bec2Index(m_sctId->barrel_ec(surfaceID))]++; - mapOfTrackHitResiduals[surfaceID] = getResidual(surfaceID, (*TSOSItr)->trackParameters(), p_sctclcontainer); + mapOfTrackHitResiduals[surfaceID] = getResidual(surfaceID, (*TSOSItr)->trackParameters(), &*p_sctclcontainer); } } @@ -1374,7 +1375,7 @@ SCTHitEffMonTool::fillHistograms() { Float_t layerPlusHalfSide(float(layer) + float(side) * 0.5); Float_t dedicated_layerPlusHalfSide(float(layer) + float((side + 1) % 2) * 0.5); const Trk::TrackParameters *trkParamOnSurface((*TSOSItr)->trackParameters()); - Double_t trackHitResidual(getResidual(surfaceID, trkParamOnSurface, p_sctclcontainer)); + Double_t trackHitResidual(getResidual(surfaceID, trkParamOnSurface, &*p_sctclcontainer)); Float_t distCut(m_effdistcut); @@ -1461,17 +1462,17 @@ SCTHitEffMonTool::fillHistograms() { } Double_t tmin(1.); Double_t tmax(40.); - if (eventID->run_number() > 96000) { + if (pEvent->runNumber() > 96000) { /// Guess that all this set are the same timing. tmin = -5; tmax = 20; } - if (eventID->run_number() > 110000) { + if (pEvent->runNumber() > 110000) { /// Guess that all this set are the same timing. tmin = -15; tmax = 10; } - switch (eventID->run_number()) { + switch (pEvent->runNumber()) { case 91885: tmin = 1; tmax = 40; break; @@ -1712,16 +1713,16 @@ SCTHitEffMonTool::fillHistograms() { m_Eff_summaryHisto_old[isub]->Fill(layerPlusHalfSide, m_eff); // in order to calculate m_EffsummaryIncBadMod m_Eff_summaryHisto[isub]->Fill(dedicated_layerPlusHalfSide, m_eff); // adjustment for dedicated_title() m_Eff_hashCodeHisto->Fill(Double_t(sideHash), m_eff);// 15.12.2014 - m_Eff_LumiBlockHisto[isub]->Fill(eventID->lumi_block(), m_eff);// 20.01.2015 - m_Eff_LumiBlockHisto_Total->Fill(eventID->lumi_block(), m_eff);// 02.09.2016 + m_Eff_LumiBlockHisto[isub]->Fill(pEvent->lumiBlock(), m_eff);// 20.01.2015 + m_Eff_LumiBlockHisto_Total->Fill(pEvent->lumiBlock(), m_eff);// 02.09.2016 if (BCIDpos == 0 && InTrain) { m_Eff_summaryHistoFirstBCID[isub]->Fill(dedicated_layerPlusHalfSide, m_eff); // adjustment for dedicated_title() } if (m_detailed) { m_SelectionHisto[isub]->Fill(9.); // Past bad chip m_Eff_SelectionHisto[isub]->Fill(9., m_eff); // Past bad chip - m_EventHisto[isub]->Fill(eventID->event_number()); - m_Eff_EventHisto[isub]->Fill(eventID->event_number(), m_eff); + m_EventHisto[isub]->Fill(pEvent->eventNumber()); + m_Eff_EventHisto[isub]->Fill(pEvent->eventNumber(), m_eff); m_hashCodeHisto->Fill(Double_t(sideHash)); m_Unas_summaryHisto[isub]->Fill(layerPlusHalfSide, m_unas); m_Eff_etaHisto[isub]->Fill(eta, m_eff); @@ -1741,7 +1742,7 @@ SCTHitEffMonTool::fillHistograms() { m_Eff_nGoodTrk[isub]->Fill(nTrkGood, m_eff); } if (m_superDetailed) { - // m_Eff_LumiBlockHisto[isub]->Fill(eventID->lumi_block(), m_eff);//20.01.2015 + // m_Eff_LumiBlockHisto[isub]->Fill(pEvent->lumiBlock(), m_eff);//20.01.2015 chipPos = (side == 1) ? 11 - chipPos : chipPos; m_inEffChip[isub]->Fill(sideHash, chipPos, int(m_eff == 0)); m_inEffStrip[isub]->Fill(sideHash, xl / 79.95e-3 + 768. / 2., int(m_eff == 0)); @@ -1774,7 +1775,7 @@ SCTHitEffMonTool::fillHistograms() { const int ieta(m_sctId->eta_module(surfaceID)); const int iphi(m_sctId->phi_module(surfaceID)); m_effMap[histnumber][side]->Fill(ieta, iphi, m_eff); - m_effLumiBlock[histnumber][side]->Fill(eventID->lumi_block(), m_eff);// 23.01.2015 + m_effLumiBlock[histnumber][side]->Fill(pEvent->lumiBlock(), m_eff);// 23.01.2015 if (testOffline) { m_ineffMap[histnumber][side]->Fill(ieta, iphi, 1); // dummyfill for testing @@ -1828,7 +1829,7 @@ SCTHitEffMonTool::fillHistograms() { m_nTrkGoodHisto->Fill(nTrkGood); } if (m_superDetailed) { - m_LumiBlock->Fill(eventID->lumi_block()); + m_LumiBlock->Fill(pEvent->lumiBlock()); } m_countEvent++; if (m_chronotime) { diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.cxx index fe6cff824a50401d2978abd8780b96eca3f7dee5..c725ef63a96e00c086bc06805ca4e6fc07b87ef0 100755 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.cxx @@ -49,21 +49,17 @@ #include "InDetPrepRawData/SCT_ClusterContainer.h" // ? #include "TrkSpacePoint/SpacePoint.h" #include "TrkSpacePoint/SpacePointCollection.h" -#include "TrkSpacePoint/SpacePointContainer.h" #include "TrkSpacePoint/SpacePointOverlapCollection.h" #include "TrkSpacePoint/SpacePointCLASS_DEF.h" -// for TriggerType -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" -#include "InDetPrepRawData/SCT_ClusterContainer.h" -#include "TrkTrack/TrackCollection.h" #include "TrkRIO_OnTrack/RIO_OnTrack.h" #include "TrkEventUtils/RoT_Extractor.h" #include "InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h" // ? #include "InDetRIO_OnTrack/PixelClusterOnTrack.h" // ? #include "cArrayUtilities.h" +#include "StoreGate/ReadHandle.h" + typedef Trk::SpacePoint SpacePoint; using namespace std; using namespace SCT_Monitoring; @@ -219,7 +215,6 @@ SCTHitsNoiseMonTool::SCTHitsNoiseMonTool(const std::string &type, m_booltxscan(false), m_current_lb(0), m_last_reset_lb(0), - m_tracks(nullptr), m_tbinHisto(nullptr), m_tbinHistoECp(nullptr), m_tbinHistoECm(nullptr), @@ -231,6 +226,7 @@ SCTHitsNoiseMonTool::SCTHitsNoiseMonTool(const std::string &type, m_tbinfracVsLBECp(nullptr), m_tbinfracVsLBECm(nullptr), m_initialize(false), + m_SCTSPContainerName(std::string("SCT_SpacePoints")), m_noisyM100{}, m_noisyM1000{}, m_noisyM10000{}, @@ -300,8 +296,11 @@ SCTHitsNoiseMonTool::SCTHitsNoiseMonTool(const std::string &type, m_hitoccTriggerECp_lb{}, m_hitoccTriggerECm_lb{}, // + m_dataObjectName(std::string("SCT_RDOs")), m_pSCTHelper(nullptr), - m_ConfigurationSvc("InDetSCT_ConfigurationConditionsSvc", name) { + m_ConfigurationSvc("InDetSCT_ConfigurationConditionsSvc", name), + m_eventInfoKey(std::string("EventInfo")), + m_clusContainerKey("SCT_Clusters") { /** sroe 3 Sept 2015: histoPathBase is declared as a property in the base class, assigned to m_path with default as empty string. @@ -348,6 +347,20 @@ SCTHitsNoiseMonTool::~SCTHitsNoiseMonTool() { free(nHits_buf); } +// ==================================================================================================== +// ==================================================================================================== +StatusCode SCTHitsNoiseMonTool::initialize() { + ATH_CHECK(SCTMotherTrigMonTool::initialize()); + + ATH_CHECK(m_SCTSPContainerName.initialize()); + ATH_CHECK(m_dataObjectName.initialize()); + ATH_CHECK(m_eventInfoKey.initialize()); + ATH_CHECK(m_clusContainerKey.initialize()); + ATH_CHECK(m_tracksName.initialize()); + + return StatusCode::SUCCESS; +} + // ==================================================================================================== // SCTHitsNoiseMonTool :: bookHistograms // ==================================================================================================== @@ -357,7 +370,6 @@ SCTHitsNoiseMonTool::bookHistograms() { if (newRunFlag()) { m_numberOfEvents = 0; } - m_dataObjectName = "SCT_RDOs"; // Get the helper: ATH_CHECK(detStore()->retrieve(m_pSCTHelper, "SCT_ID")); ATH_CHECK(m_ConfigurationSvc.retrieve()); @@ -449,7 +461,6 @@ StatusCode SCTHitsNoiseMonTool::bookHistogramsRecurrent() { ATH_MSG_DEBUG("bookHistogramsRecurrent being called"); m_numberOfEvents = 0; - m_dataObjectName = "SCT_RDOs"; // Get the helper: ATH_CHECK(detStore()->retrieve(m_pSCTHelper, "SCT_ID")); ATH_CHECK(m_ConfigurationSvc.retrieve()); @@ -538,14 +549,14 @@ StatusCode SCTHitsNoiseMonTool::fillHistograms() { ++m_numberOfEvents; ++m_numberOfEventsRecent; - const EventInfo *pEvent(0); - if (evtStore()->retrieve(pEvent).isFailure()) { + SG::ReadHandle<xAOD::EventInfo> pEvent(m_eventInfoKey); + if (not pEvent.isValid()) { if (msgLvl(MSG::ERROR)) { msg(MSG::ERROR) << "Could not retrieve event info!" << endmsg; } return StatusCode::RECOVERABLE; } - int tmp_lb = pEvent->event_ID()->lumi_block(); + int tmp_lb = pEvent->lumiBlock(); if ((tmp_lb > m_current_lb) and (m_current_lb<=SCT_Monitoring::NBINS_LBs)) { m_noisyM100[m_current_lb] = 0; m_noisyM1000[m_current_lb] = 0; @@ -705,7 +716,7 @@ SCTHitsNoiseMonTool::fillHistograms() { m_events_lb = 0; m_eventsTrigger_lb = 0; } - m_current_lb = pEvent->event_ID()->lumi_block(); + m_current_lb = pEvent->lumiBlock(); // If track hits are selected, make the vector of track rdo identifiers if (m_doTrackHits) { if (makeVectorOfTrackRDOIdentifiers().isFailure() and msgLvl(MSG::WARNING)) { @@ -795,22 +806,21 @@ SCTHitsNoiseMonTool::checkHists(bool /*fromFinalize*/) { StatusCode SCTHitsNoiseMonTool::generalHistsandNoise() { typedef SCT_RDORawData SCTRawDataType; - const SCT_RDO_Container *p_rdocontainer; - const EventInfo *pEvent(0); - if (evtStore()->retrieve(pEvent).isFailure()) { + SG::ReadHandle<SCT_RDO_Container> p_rdocontainer(m_dataObjectName); + SG::ReadHandle<xAOD::EventInfo> pEvent(m_eventInfoKey); + if (not pEvent.isValid()) { if (msgLvl(MSG::ERROR)) { msg(MSG::ERROR) << "Could not retrieve event info!" << endmsg; } return StatusCode::FAILURE; } - unsigned int current_lb = pEvent->event_ID()->lumi_block(); - if (evtStore()->retrieve(p_rdocontainer, m_dataObjectName).isFailure()) { + unsigned int current_lb = pEvent->lumiBlock(); + if (not p_rdocontainer.isValid()) { return StatusCode::FAILURE; } // Get the space point container - const SpacePointContainer *sctContainer; - m_SCTSPContainerName = "SCT_SpacePoints"; - if (evtStore()->retrieve(sctContainer, m_SCTSPContainerName).isFailure()) { + SG::ReadHandle<SpacePointContainer> sctContainer(m_SCTSPContainerName); + if (not sctContainer.isValid()) { return StatusCode::FAILURE; } Identifier SCT_Identifier; @@ -1255,9 +1265,8 @@ SCTHitsNoiseMonTool::generalHistsandNoise() { // if(m_environment!=AthenaMonManager::online){ // Uncomment this line to turn off cluster hists in online // Fill Cluster size histogram - const InDet::SCT_ClusterContainer *p_clucontainer; - StatusCode sc = evtStore()->retrieve(p_clucontainer, "SCT_Clusters"); - if (sc.isFailure()) { + SG::ReadHandle<InDet::SCT_ClusterContainer> p_clucontainer(m_clusContainerKey); + if (not p_clucontainer.isValid()) { if (msgLvl(MSG::WARNING)) { msg(MSG::WARNING) << "Couldn't retrieve clusters" << endmsg; } @@ -3058,12 +3067,10 @@ SCTHitsNoiseMonTool::bookSPvsEventNumber() { StatusCode SCTHitsNoiseMonTool::makeSPvsEventNumber() { // Retrieve the spacepoint collection - StatusCode sc; - const SpacePointContainer *m_SCT_spcontainer; + SG::ReadHandle<SpacePointContainer> SCT_spcontainer(m_SCTSPContainerName); // get space points for SCT from TDS - sc = evtStore()->retrieve(m_SCT_spcontainer, "SCT_SpacePoints"); - if (sc.isFailure() || !m_SCT_spcontainer) { + if (not SCT_spcontainer.isValid()) { if (msgLvl(MSG::WARNING)) { msg(MSG::WARNING) << "Si SpacePoint container for SCT not found" << endmsg; } @@ -3071,8 +3078,8 @@ SCTHitsNoiseMonTool::makeSPvsEventNumber() { } int m_sct_nspacepoints(0); // loop over SCT space points collections - SpacePointContainer::const_iterator it = m_SCT_spcontainer->begin(); - SpacePointContainer::const_iterator endit = m_SCT_spcontainer->end(); + SpacePointContainer::const_iterator it = SCT_spcontainer->begin(); + SpacePointContainer::const_iterator endit = SCT_spcontainer->end(); for (; it != endit; ++it) { const SpacePointCollection *colNext = &(**it); if (!colNext) { @@ -3139,28 +3146,25 @@ SCTHitsNoiseMonTool::positionString(const Identifier &plane) const { StatusCode SCTHitsNoiseMonTool::makeVectorOfTrackRDOIdentifiers() { - StatusCode sc; - // Clear the RDOsOnTracks vector m_RDOsOnTracks.clear(); - const SCT_RDO_Container *p_rdocontainer; - sc = evtStore()->retrieve(p_rdocontainer, m_dataObjectName); - if (sc.isFailure() || !p_rdocontainer) { - msg(MSG::FATAL) << "Could not find the data object " << m_dataObjectName << " !" << endmsg; + SG::ReadHandle<SCT_RDO_Container> p_rdocontainer(m_dataObjectName); + if (not p_rdocontainer.isValid()) { + msg(MSG::FATAL) << "Could not find the data object " << m_dataObjectName.key() << " !" << endmsg; return StatusCode::FAILURE; } else { if (msgLvl(MSG::DEBUG)) { - msg(MSG::DEBUG) << "Data object " << m_dataObjectName << " found" << endmsg; + msg(MSG::DEBUG) << "Data object " << m_dataObjectName.key() << " found" << endmsg; } } - - sc = evtStore()->retrieve(m_tracks, m_tracksName); - if (sc.isFailure()) { + + SG::ReadHandle<TrackCollection> tracks(m_tracksName); + if (not tracks.isValid()) { msg(MSG::FATAL) << "No tracks for you!" << endmsg; - return sc; + return StatusCode::FAILURE; } // Only do for events with less than some number of tracks - if (m_tracks->size() > m_maxTracks) { + if (tracks->size() > m_maxTracks) { if (msgLvl(MSG::DEBUG)) { msg(MSG::DEBUG) << "The event has more than " << m_maxTracks << " tracks. Don't do hits-on-track-hists" << endmsg; @@ -3168,8 +3172,8 @@ SCTHitsNoiseMonTool::makeVectorOfTrackRDOIdentifiers() { return StatusCode::SUCCESS; } // assemble list of rdo ids associated with tracks - for (int i = 0; i < (int) m_tracks->size(); i++) { - const Trk::Track *track = (*m_tracks)[i]; + for (int i = 0; i < (int) tracks->size(); i++) { + const Trk::Track *track = (*tracks)[i]; if (track == 0) { if (msgLvl(MSG::WARNING)) { msg(MSG::WARNING) << "no pointer to track!!!" << endmsg; diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTLorentzMonTool.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTLorentzMonTool.cxx index 58abc0f6db43922ed6fd794376ebd42f09eb42a0..ed29921d217738ece270a53e0aae3fbc555aa793 100755 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTLorentzMonTool.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTLorentzMonTool.cxx @@ -16,6 +16,7 @@ #include "GaudiKernel/StatusCode.h" #include "GaudiKernel/IToolSvc.h" +#include "StoreGate/ReadHandle.h" #include "TH1F.h" #include "TH2F.h" @@ -25,7 +26,6 @@ #include "Identifier/Identifier.h" #include "InDetIdentifier/SCT_ID.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" -#include "TrkTrack/TrackCollection.h" #include "InDetRIO_OnTrack/SiClusterOnTrack.h" #include "InDetPrepRawData/SiCluster.h" #include "TrkParameters/TrackParameters.h" @@ -63,7 +63,7 @@ SCTLorentzMonTool::SCTLorentzMonTool(const string &type, const string &name, declareProperty("histoPathBase", m_stream = "/stat"); **/ m_stream = "/stat"; - declareProperty("tracksName", m_tracksName = "CombinedInDetTracks"); // this recommended + declareProperty("tracksName", m_tracksName = std::string("CombinedInDetTracks")); // this recommended declareProperty("TrackToVertexTool", m_trackToVertexTool); // for TrackToVertexTool m_numberOfEvents = 0; } @@ -74,6 +74,16 @@ SCTLorentzMonTool::~SCTLorentzMonTool() { // nada } +// ==================================================================================================== +// ==================================================================================================== +StatusCode SCTLorentzMonTool::initialize() { + ATH_CHECK( SCTMotherTrigMonTool::initialize() ); + + ATH_CHECK( m_tracksName.initialize() ); + + return StatusCode::SUCCESS; +} + // ==================================================================================================== // SCTLorentzMonTool :: bookHistograms // ==================================================================================================== @@ -158,14 +168,14 @@ SCTLorentzMonTool::fillHistograms() { ATH_MSG_DEBUG("enters fillHistograms"); - const TrackCollection *tracks(0); - if (evtStore()->contains<TrackCollection> (m_tracksName)) { - if (evtStore()->retrieve(tracks, m_tracksName).isFailure()) { - msg(MSG::WARNING) << " TrackCollection not found: Exit SCTLorentzTool" << m_tracksName << endmsg; + SG::ReadHandle<TrackCollection> tracks(m_tracksName); + if (evtStore()->contains<TrackCollection> (m_tracksName.key())) { + if (not tracks.isValid()) { + msg(MSG::WARNING) << " TrackCollection not found: Exit SCTLorentzTool" << m_tracksName.key() << endmsg; return StatusCode::SUCCESS; } } else { - msg(MSG::WARNING) << "Container " << m_tracksName << " not found. Exit SCTLorentzMonTool" << endmsg; + msg(MSG::WARNING) << "Container " << m_tracksName.key() << " not found. Exit SCTLorentzMonTool" << endmsg; return StatusCode::SUCCESS; } diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTMotherTrigMonTool.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTMotherTrigMonTool.cxx index b2aa155c89cdcace8ea954f48cb06b5be3a44ba4..cb6e7f963cf8d7eb979b5c143b8e19275f0d7fb5 100755 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTMotherTrigMonTool.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTMotherTrigMonTool.cxx @@ -14,6 +14,7 @@ #include "GaudiKernel/StatusCode.h" #include "EventInfo/EventInfo.h" #include "EventInfo/TriggerInfo.h" +#include "StoreGate/ReadHandle.h" const std::string SCTMotherTrigMonTool::m_triggerNames[] = { "RNDM", "BPTX", "L1CAL", "TGC", "RPC", "MBTS", "COSM", "Calib" @@ -24,7 +25,8 @@ SCTMotherTrigMonTool::SCTMotherTrigMonTool(const std::string &type, const std::s m_doTrigger(true), m_isStream(false), m_firedTriggers(0), - m_trigDec("Trig::TrigDecisionTool/TrigDecisionTool") { + m_trigDec("Trig::TrigDecisionTool/TrigDecisionTool"), + m_eventInfoKey(std::string("ByteStreamEventInfo")) { declareProperty("doTrigger", m_doTrigger); } @@ -34,16 +36,17 @@ SCTMotherTrigMonTool::initialize() { msg(MSG::ERROR) << "Could not initialize Monitor tool base!" << endmsg; return StatusCode::FAILURE; } + + ATH_CHECK( m_eventInfoKey.initialize() ); + return StatusCode::SUCCESS; } // --------------------------------------------------------- StatusCode SCTMotherTrigMonTool::checkTriggers() { - const EventInfo *evtInfo(0); - - if (evtStore()->contains<EventInfo>("ByteStreamEventInfo")) { - evtStore()->retrieve(evtInfo, "ByteStreamEventInfo"); + if (evtStore()->contains<EventInfo>(m_eventInfoKey.key())) { + SG::ReadHandle<EventInfo> evtInfo(m_eventInfoKey); m_firedTriggers = evtInfo->trigger_info()->level1TriggerType(); return StatusCode::SUCCESS; @@ -83,10 +86,8 @@ SCTMotherTrigMonTool::isCalibrationNoise(const std::string &L1_Item) { bool SCTMotherTrigMonTool::isStream(const std::string &StreamName) { - const EventInfo *evtInfo(0); - - if (evtStore()->contains<EventInfo>("ByteStreamEventInfo")) { - evtStore()->retrieve(evtInfo, "ByteStreamEventInfo"); + if (evtStore()->contains<EventInfo>(m_eventInfoKey.key())) { + SG::ReadHandle<EventInfo> evtInfo(m_eventInfoKey); m_isStream = false; diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTRatioNoiseMonTool.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTRatioNoiseMonTool.cxx index 0418652c781ae0522cc5811574b5a4d0d1f73b02..eeeb7f1a523484cc41e65d4b2eedd79afb4252a4 100755 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTRatioNoiseMonTool.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTRatioNoiseMonTool.cxx @@ -45,8 +45,7 @@ #include "InDetIdentifier/SCT_ID.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" #include "InDetConditionsSummaryService/IInDetConditionsSvc.h" -#include "EventInfo/EventID.h" -#include "EventInfo/EventInfo.h" +#include "StoreGate/ReadHandle.h" // using namespace std; @@ -231,7 +230,8 @@ SCTRatioNoiseMonTool::SCTRatioNoiseMonTool(const string &type, m_path(""), m_tracksName(""), // never used? m_NOTrigger("L1_RD0_EMPTY"), - m_dataObjectName("SCT_RDOs"), + m_dataObjectName(std::string("SCT_RDOs")), + m_eventInfoKey(std::string("EventInfo")), m_pSCTHelper(nullptr), m_sctmgr(nullptr), m_pSummarySvc("SCT_ConditionsSummarySvc", name), @@ -262,6 +262,17 @@ SCTRatioNoiseMonTool::~SCTRatioNoiseMonTool() { // nada } +// ==================================================================================================== +// ==================================================================================================== +StatusCode SCTRatioNoiseMonTool::initialize() { + ATH_CHECK( SCTMotherTrigMonTool::initialize() ); + + ATH_CHECK( m_dataObjectName.initialize() ); + ATH_CHECK( m_eventInfoKey.initialize() ); + + return StatusCode::SUCCESS; +} + // ==================================================================================================== // SCTRatioNoiseMonTool :: bookHistograms // ==================================================================================================== @@ -271,7 +282,6 @@ SCTRatioNoiseMonTool::bookHistogramsRecurrent() { if (newRunFlag()) { m_numberOfEvents = 0; } - m_dataObjectName = "SCT_RDOs"; ATH_MSG_DEBUG("initialize being called"); ATH_CHECK(detStore()->retrieve(m_pSCTHelper, "SCT_ID")); if (m_checkBadModules) { @@ -295,7 +305,6 @@ StatusCode SCTRatioNoiseMonTool::bookHistograms() { m_path = ""; m_numberOfEvents = 0; - m_dataObjectName = "SCT_RDOs"; ATH_MSG_DEBUG("initialize being called"); ATH_CHECK(detStore()->retrieve(m_pSCTHelper, "SCT_ID")); if (m_checkBadModules) { @@ -322,8 +331,8 @@ SCTRatioNoiseMonTool::fillHistograms() { ATH_MSG_DEBUG("enters fillHistograms"); // lets get the raw hit container typedef SCT_RDORawData SCTRawDataType; - const SCT_RDO_Container *p_rdocontainer; - if (evtStore()->retrieve(p_rdocontainer, m_dataObjectName).isFailure()) { + SG::ReadHandle<SCT_RDO_Container> p_rdocontainer(m_dataObjectName); + if (not p_rdocontainer.isValid()) { return StatusCode::FAILURE; } @@ -364,14 +373,13 @@ SCTRatioNoiseMonTool::fillHistograms() { goodModules[i] = true; } - const EventInfo *pEvent(0); - CHECK(evtStore()->retrieve(pEvent)); - if (not pEvent) { + SG::ReadHandle<xAOD::EventInfo> pEvent(m_eventInfoKey); + if (not pEvent.isValid()) { return ERROR("Could not find event pointer"), StatusCode::FAILURE; } const bool isSelectedTrigger = true; - int tmplb = pEvent->event_ID()->lumi_block(); + int tmplb = pEvent->lumiBlock(); if (tmplb > m_current_lb) { for (int i = 0; i < n_mod[GENERAL_INDEX]; i++) { nNoSides_lb[i] = 0; diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTTracksMonTool.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTTracksMonTool.cxx index 37d6b1cdfc797d27eb52d697cfffb5386a264a72..381e8725ab0a458cbec2559ad84ac03894ee2939 100755 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTTracksMonTool.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTTracksMonTool.cxx @@ -23,7 +23,6 @@ #include "Identifier/Identifier.h" #include "InDetIdentifier/SCT_ID.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" -#include "TrkTrack/TrackCollection.h" #include "InDetRIO_OnTrack/SiClusterOnTrack.h" #include "InDetPrepRawData/SiCluster.h" #include "TrkParameters/TrackParameters.h" @@ -33,6 +32,8 @@ // for GetKalmanUpdator #include "GaudiKernel/ListItem.h" +#include "StoreGate/ReadHandle.h" + using namespace std; using namespace SCT_Monitoring; @@ -128,7 +129,7 @@ SCTTracksMonTool::SCTTracksMonTool(const string &type, declareProperty("histoPathBase", m_stream = "/stat"); **/ m_stream = "/stat"; - declareProperty("tracksName", m_tracksName = "SCT_Cosmic_Tracks"); // "ExtendedTracks"); + declareProperty("tracksName", m_tracksName = std::string("SCT_Cosmic_Tracks")); // "ExtendedTracks"); declareProperty("trackHitCut", m_trackHitCut = 3); declareProperty("CheckRate", m_checkrate = 1000); declareProperty("doPositiveEndcap", m_doPositiveEndcap = true); @@ -147,6 +148,16 @@ SCTTracksMonTool::~SCTTracksMonTool() { // nop } +// ==================================================================================================== +// ==================================================================================================== +StatusCode SCTTracksMonTool::initialize() { + ATH_CHECK( SCTMotherTrigMonTool::initialize() ); + + ATH_CHECK( m_tracksName.initialize() ); + + return StatusCode::SUCCESS; +} + // ==================================================================================================== // SCTTracksMonTool :: bookHistograms // ==================================================================================================== @@ -273,14 +284,12 @@ SCTTracksMonTool::fillHistograms() { if (m_doTrigger and SCTMotherTrigMonTool::CheckTriggers() != StatusCode::SUCCESS) { ATH_MSG_WARNING("Triggers not found!"); } - const TrackCollection *tracks(nullptr); + SG::ReadHandle<TrackCollection> tracks(m_tracksName); const bool doThisSubsystem[N_REGIONS] = { m_doNegativeEndcap, true, m_doPositiveEndcap }; - if (evtStore()->contains<TrackCollection> (m_tracksName)) { - CHECK(evtStore()->retrieve(tracks, m_tracksName)); - }else { - ATH_MSG_WARNING("No collection named " << m_tracksName << " in StoreGate"); + if (not evtStore()->contains<TrackCollection> (m_tracksName.key())) { + ATH_MSG_WARNING("No collection named " << m_tracksName.key() << " in StoreGate"); return StatusCode::SUCCESS; } int local_tot_trkhits(0);