From 287c8c34a0e0681a2707a827255d867e84da6c49 Mon Sep 17 00:00:00 2001 From: Susumu Oda <susumu.oda@cern.ch> Date: Thu, 20 Dec 2018 08:42:44 +0000 Subject: [PATCH] SCT alg code cleanup for ATLASRECTS-4575 --- .../share/TestSCT_DistortionsTool.py | 2 +- .../src/SCT_TestDistortionsTool.cxx | 46 ++++------ .../src/SCT_TestDistortionsTool.h | 41 +++++---- .../SCT_ClusterValidationNtupleWriter.h | 45 +++++----- .../src/SCT_ClusterValidationNtupleWriter.cxx | 54 +++++------- .../RDOAnalysis/src/SCT_FastRDOAnalysis.cxx | 84 +++++++++---------- .../RDOAnalysis/src/SCT_FastRDOAnalysis.h | 12 +-- .../Tools/RDOAnalysis/src/SCT_RDOAnalysis.cxx | 84 +++++++++---------- .../Tools/RDOAnalysis/src/SCT_RDOAnalysis.h | 12 +-- 9 files changed, 176 insertions(+), 204 deletions(-) diff --git a/InnerDetector/InDetDetDescr/SCT_ModuleDistortions/share/TestSCT_DistortionsTool.py b/InnerDetector/InDetDetDescr/SCT_ModuleDistortions/share/TestSCT_DistortionsTool.py index 5d4d81c6bf7b..31d3105d3232 100644 --- a/InnerDetector/InDetDetDescr/SCT_ModuleDistortions/share/TestSCT_DistortionsTool.py +++ b/InnerDetector/InDetDetDescr/SCT_ModuleDistortions/share/TestSCT_DistortionsTool.py @@ -57,7 +57,7 @@ theApp.EvtMax = 1 from GaudiSvc.GaudiSvcConf import THistSvc ServiceMgr += THistSvc() -ServiceMgr.THistSvc.Output =["disto DATAFILE='test.root' opt='RECREATE'"]; +ServiceMgr.THistSvc.Output =["SCT_TestDistortionsTool DATAFILE='test.root' opt='RECREATE'"]; ##-------------------------------------------------------------- ## Load IOVDbSvc diff --git a/InnerDetector/InDetDetDescr/SCT_ModuleDistortions/src/SCT_TestDistortionsTool.cxx b/InnerDetector/InDetDetDescr/SCT_ModuleDistortions/src/SCT_TestDistortionsTool.cxx index 45863864af36..763525a5dbb9 100644 --- a/InnerDetector/InDetDetDescr/SCT_ModuleDistortions/src/SCT_TestDistortionsTool.cxx +++ b/InnerDetector/InDetDetDescr/SCT_ModuleDistortions/src/SCT_TestDistortionsTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ // Test SCT_DistortionsTool.cxx @@ -7,26 +7,9 @@ //Package #include "SCT_TestDistortionsTool.h" -//Athena -#include "InDetIdentifier/SCT_ID.h" -#include "AthenaKernel/IAtRndmGenSvc.h" -#include "PathResolver/PathResolver.h" - //Gaudi #include "GaudiKernel/ITHistSvc.h" -//CLHEP -#include "CLHEP/Geometry/Vector3D.h" -#include "CLHEP/Geometry/Point3D.h" -#include "CLHEP/Random/RandGauss.h" -#include "CLHEP/Units/SystemOfUnits.h" - -//STL -#include <cmath> -#include <fstream> -#include <sstream> -#include <string> - SCT_TestDistortionsTool::SCT_TestDistortionsTool(const std::string& name, ISvcLocator* pSvcLocator): AthAlgorithm(name, pSvcLocator) { @@ -38,20 +21,27 @@ SCT_TestDistortionsTool::initialize() { ITHistSvc* tHistSvc; StatusCode sc = Gaudi::svcLocator()->service("THistSvc", tHistSvc); if (sc.isFailure()) { - ATH_MSG_FATAL ("THistSvc not found!"); - return StatusCode::FAILURE; - } + ATH_MSG_FATAL ("THistSvc not found!"); + return StatusCode::FAILURE; + } ATH_CHECK(m_SCTDistoTool.retrieve()); ATH_MSG_INFO("Test algorithm for SCT_DistortionsTool"); - m_ZvsX = std::make_unique<TH2F>("delZvsX", "delZvsX", 128, -64, 64, 100, -0.05, 0.15); - m_ZvsY = std::make_unique<TH2F>("delZvsY", "delZvsY", 66, -33, 33, 100, -0.05, 0.15); - m_XYZ = std::make_unique<TH3F>("3Dplot", "3Dplot", 128, -64, 64, 66, -33, 33, 100, -0.05, 0.15); - m_outerXedge = std::make_unique<TH2F>("outerXedge", "outerXedge", 128, -64, 64, 100, -0.05, 0.15); - m_outerYedge = std::make_unique<TH2F>("outerYedge", "outerYedge", 66, -33, 33, 100, -0.05, 0.15); - m_outerX = std::make_unique<TH2F>("outerXedge2D", "outerXedge2D", 128, -64, 64, 100, -0.05, 0.15); - m_outerY = std::make_unique<TH2F>("outerYedge2D", "outerYedge2D", 66, -33, 33, 100, -0.05, 0.15); + m_ZvsX = new TH2F("delZvsX", "delZvsX", 128, -64, 64, 100, -0.05, 0.15); + ATH_CHECK(tHistSvc->regHist("/SCT_TestDistortionsTool/delZvsX", m_ZvsX)); + m_ZvsY = new TH2F("delZvsY", "delZvsY", 66, -33, 33, 100, -0.05, 0.15); + ATH_CHECK(tHistSvc->regHist("/SCT_TestDistortionsTool/delZvsY", m_ZvsY)); + m_XYZ = new TH3F("3Dplot", "3Dplot", 128, -64, 64, 66, -33, 33, 100, -0.05, 0.15); + ATH_CHECK(tHistSvc->regHist("/SCT_TestDistortionsTool/3Dplot", m_XYZ)); + m_outerXedge = new TH2F("outerXedge", "outerXedge", 128, -64, 64, 100, -0.05, 0.15); + ATH_CHECK(tHistSvc->regHist("/SCT_TestDistortionsTool/outerXedge", m_outerXedge)); + m_outerYedge = new TH2F("outerYedge", "outerYedge", 66, -33, 33, 100, -0.05, 0.15); + ATH_CHECK(tHistSvc->regHist("/SCT_TestDistortionsTool/outerYedge", m_outerYedge)); + m_outerX = new TH2F("outerXedge2D", "outerXedge2D", 128, -64, 64, 100, -0.05, 0.15); + ATH_CHECK(tHistSvc->regHist("/SCT_TestDistortionsTool/outerXedge2D", m_outerX)); + m_outerY = new TH2F("outerYedge2D", "outerYedge2D", 66, -33, 33, 100, -0.05, 0.15); + ATH_CHECK(tHistSvc->regHist("/SCT_TestDistortionsTool/outerYedge2D", m_outerY)); return StatusCode::SUCCESS; } diff --git a/InnerDetector/InDetDetDescr/SCT_ModuleDistortions/src/SCT_TestDistortionsTool.h b/InnerDetector/InDetDetDescr/SCT_ModuleDistortions/src/SCT_TestDistortionsTool.h index 82f322af34fd..421ee81e7c9b 100644 --- a/InnerDetector/InDetDetDescr/SCT_ModuleDistortions/src/SCT_TestDistortionsTool.h +++ b/InnerDetector/InDetDetDescr/SCT_ModuleDistortions/src/SCT_TestDistortionsTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ #ifndef SCT_TestDistortionsTool_h @@ -15,32 +15,31 @@ //STL #include <string> -#include <memory> //ROOT #include "TH2F.h" #include "TH3F.h" class SCT_TestDistortionsTool:public AthAlgorithm { - public: - SCT_TestDistortionsTool(const std::string& name, ISvcLocator* pSvcLocator); - ~SCT_TestDistortionsTool() = default; - // Standard Gaudi functions - StatusCode initialize(); //!< Gaudi initialiser - StatusCode execute(); //!< Gaudi executer - StatusCode finalize(); //!< Gaudi finaliser + public: + SCT_TestDistortionsTool(const std::string& name, ISvcLocator* pSvcLocator); + ~SCT_TestDistortionsTool() = default; + // Standard Gaudi functions + virtual StatusCode initialize() override; //!< Gaudi initialiser + virtual StatusCode execute() override; //!< Gaudi executer + virtual StatusCode finalize() override; //!< Gaudi finaliser - private: - ToolHandle<ISCT_ModuleDistortionsTool> m_SCTDistoTool - {this,"SCT_DistortionsTool","SCT_DistortionsTool",""}; - - std::unique_ptr<TH2F> m_ZvsX; - std::unique_ptr<TH2F> m_ZvsY; - std::unique_ptr<TH3F> m_XYZ; - std::unique_ptr<TH2F> m_outerXedge; - std::unique_ptr<TH2F> m_outerYedge; - std::unique_ptr<TH2F> m_outerX; - std::unique_ptr<TH2F> m_outerY; + private: + ToolHandle<ISCT_ModuleDistortionsTool> m_SCTDistoTool + {this,"SCT_DistortionsTool","SCT_DistortionsTool",""}; + + TH2F* m_ZvsX; + TH2F* m_ZvsY; + TH3F* m_XYZ; + TH2F* m_outerXedge; + TH2F* m_outerYedge; + TH2F* m_outerX; + TH2F* m_outerY; }; -#endif +#endif // SCT_TestDistortionsTool_h diff --git a/InnerDetector/InDetValidation/InDetTrackValidation/InDetTrackValidation/SCT_ClusterValidationNtupleWriter.h b/InnerDetector/InDetValidation/InDetTrackValidation/InDetTrackValidation/SCT_ClusterValidationNtupleWriter.h index 734bba237e0e..bd446cfd7587 100755 --- a/InnerDetector/InDetValidation/InDetTrackValidation/InDetTrackValidation/SCT_ClusterValidationNtupleWriter.h +++ b/InnerDetector/InDetValidation/InDetTrackValidation/InDetTrackValidation/SCT_ClusterValidationNtupleWriter.h @@ -3,7 +3,7 @@ */ ////////////////////////////////////////////////////////////////// -// SCT_ClusterValidationNtupleWriter.h, (c) ATLAS Detector software +// SCT_ClusterValidationNtupleWriter.h /////////////////////////////////////////////////////////////////// #ifndef INDET_SCT_CLUSTERVALIDATIONNTUPLEWRITER_H @@ -32,30 +32,30 @@ class TTree; namespace InDet { -/** @class SCT_ClusterValidationNtupleWriter + /** @class SCT_ClusterValidationNtupleWriter - Validation Algorithm to retrieve a SCT_ClusterContainer, loop over the entries and fill - the validation ntuple with RIO specific entries. + Validation Algorithm to retrieve a SCT_ClusterContainer, loop over the entries and fill + the validation ntuple with RIO specific entries. - @author Sebastian.Fleischmann@cern.ch - @author Peter.Vankov@cern.ch -*/ + @author Sebastian.Fleischmann@cern.ch + @author Peter.Vankov@cern.ch + */ -class SCT_ClusterValidationNtupleWriter : public AthAlgorithm { -public: + class SCT_ClusterValidationNtupleWriter : public AthAlgorithm { + public: /** Standard Athena-Algorithm Constructor */ SCT_ClusterValidationNtupleWriter(const std::string& name, ISvcLocator* pSvcLocator); /** Default Destructor */ ~SCT_ClusterValidationNtupleWriter() = default; /** standard Athena-Algorithm method */ - StatusCode initialize(); + virtual StatusCode initialize() override; /** standard Athena-Algorithm method */ - StatusCode execute(); + virtual StatusCode execute() override; /** standard Athena-Algorithm method */ - StatusCode finalize(); + virtual StatusCode finalize() override; -private: + private: const SCT_ID* m_sctid; //!< SCT ID helper const InDet::SCT_ClusterContainer* m_riocontainer; //!< container of RIOs @@ -70,14 +70,14 @@ private: ToolHandle<ISCT_ByteStreamErrorsTool> m_byteStreamErrTool{this, "ByteStreamErrTool", "SCT_ByteStreamErrorsTool", "Tool to retrieve SCT ByteStream Errors"}; ToolHandle<ISCT_CablingTool> m_cabling{this, "SCT_CablingTool", "SCT_CablingTool", "Tool to retrieve SCT Cabling"}; - std::string m_ntupleFileName; //!< jobOption: Ntuple file name - std::string m_ntupleDirName; //!< jobOption: Ntuple directory name - std::string m_ntupleTreeName; //!< jobOption: Ntuple tree name - bool m_fillCluster; //!< flag to book, access and fill Cluster or not - bool m_fillRDO; //!< flag to book, access and fill RDO or not - bool m_fillSpacePoint; //!< flag to book, access and fill SpacePoints or not - bool m_fillBSErrs; //!< flag to book, access and fill ByteStream errors or not - bool m_doHitsOnTracks; //!< flag to book, access and fill RDO isOnTrack or not + StringProperty m_ntupleFileName{this, "NtupleFileName", "/NTUPLES/FILE1"}; //!< jobOption: Ntuple file name + StringProperty m_ntupleDirName{this, "NtupleDirectoryName", "FitterValidation"}; //!< jobOption: Ntuple directory name + StringProperty m_ntupleTreeName{this, "NtupleTreeName", "RIOs"}; //!< jobOption: Ntuple tree name + BooleanProperty m_fillCluster{this, "FillCluster", false}; //!< flag to book, access and fill Cluster or not + BooleanProperty m_fillRDO{this, "FillRDO", true}; //!< flag to book, access and fill RDO or not + BooleanProperty m_fillSpacePoint{this, "FillSpacePoint", false}; //!< flag to book, access and fill SpacePoints or not + BooleanProperty m_fillBSErrs{this, "FillBSErrs", true}; //!< flag to book, access and fill ByteStream errors or not + BooleanProperty m_doHitsOnTracks{this, "DoHitsOnTracks", false}; //!< flag to book, access and fill RDO isOnTrack or not //! pointer to the ntuple tree. TTree* m_nt; @@ -145,9 +145,8 @@ private: std::vector<int>* m_scterr_channel; //!< online channel no. of link. std::vector<int>* m_scterr_type; //!< type of BS error (as defined in SCT_ByteStreamErrs enum in ISCT_ByteStreamErrorsSvc.h) -}; + }; } // close of namespace #endif // INDET_SCT_CLUSTERVALIDATIONNTUPLEWRITER_H - diff --git a/InnerDetector/InDetValidation/InDetTrackValidation/src/SCT_ClusterValidationNtupleWriter.cxx b/InnerDetector/InDetValidation/InDetTrackValidation/src/SCT_ClusterValidationNtupleWriter.cxx index 13e5eac16465..bdaacff46313 100755 --- a/InnerDetector/InDetValidation/InDetTrackValidation/src/SCT_ClusterValidationNtupleWriter.cxx +++ b/InnerDetector/InDetValidation/InDetTrackValidation/src/SCT_ClusterValidationNtupleWriter.cxx @@ -3,7 +3,7 @@ */ /////////////////////////////////////////////////////////////////// -// SCT_ClusterValidationNtupleWriter.cxx, (c) ATLAS Detector Software +// SCT_ClusterValidationNtupleWriter.cxx /////////////////////////////////////////////////////////////////// #include "InDetTrackValidation/SCT_ClusterValidationNtupleWriter.h" @@ -84,21 +84,13 @@ InDet::SCT_ClusterValidationNtupleWriter::SCT_ClusterValidationNtupleWriter(cons m_scterr_type{nullptr} { - declareProperty("NtupleFileName", m_ntupleFileName="/NTUPLES/FILE1"); - declareProperty("NtupleDirectoryName", m_ntupleDirName="FitterValidation"); - declareProperty("NtupleTreeName", m_ntupleTreeName="RIOs"); - declareProperty("FillCluster", m_fillCluster=false); - declareProperty("FillSpacePoint", m_fillSpacePoint=false); - declareProperty("FillRDO", m_fillRDO=true); - declareProperty("FillBSErrs", m_fillBSErrs=true); - declareProperty("DoHitsOnTracks", m_doHitsOnTracks=false); } StatusCode InDet::SCT_ClusterValidationNtupleWriter::initialize() { ATH_CHECK(detStore()->retrieve(m_sctid, "SCT_ID")); - if (m_fillBSErrs) { + if (m_fillBSErrs.value()) { ATH_CHECK(m_byteStreamErrTool.retrieve()); ATH_MSG_INFO("Retrieved tool " << m_byteStreamErrTool); @@ -117,9 +109,9 @@ StatusCode InDet::SCT_ClusterValidationNtupleWriter::initialize() { // --------------------------- // create tree and register it to THistSvc - m_nt = new TTree(TString(m_ntupleTreeName), "SCT_Clusters"); + m_nt = new TTree(TString(m_ntupleTreeName.value()), "SCT_Clusters"); // NB: we must not delete the tree, this is done by THistSvc - std::string fullNtupleName = "/"+m_ntupleFileName+"/"+m_ntupleDirName+"/"+m_ntupleTreeName; + std::string fullNtupleName = "/"+m_ntupleFileName.value()+"/"+m_ntupleDirName.value()+"/"+m_ntupleTreeName.value(); StatusCode sc = tHistSvc->regTree(fullNtupleName, m_nt); if (sc.isFailure()) { ATH_MSG_ERROR( "Unable to register TTree : " << fullNtupleName ); @@ -181,7 +173,7 @@ StatusCode InDet::SCT_ClusterValidationNtupleWriter::initialize() { m_scterr_channel = new std::vector<int>(); m_scterr_type = new std::vector<int>(); - if (m_fillCluster) { + if (m_fillCluster.value()) { m_nt->Branch("SCT_DriftRadius", &m_rioLoc1); m_nt->Branch("SCT_SurfaceX", &m_rioSurfaceX); m_nt->Branch("SCT_SurfaceY", &m_rioSurfaceY); @@ -195,7 +187,7 @@ StatusCode InDet::SCT_ClusterValidationNtupleWriter::initialize() { m_nt->Branch("SCT_DeltaPhi", &m_SctDeltaPhi); m_nt->Branch("SCT_HitErr", &m_SctHitErr); } - if (m_fillSpacePoint) { + if (m_fillSpacePoint.value()) { m_nt->Branch("SP_SCT_nSpacePoints", &m_nSP); m_nt->Branch("SP_SCT_BarrelEndcap", &m_sp_bec); m_nt->Branch("SP_SCT_EtaModule", &m_sp_eta); @@ -205,7 +197,7 @@ StatusCode InDet::SCT_ClusterValidationNtupleWriter::initialize() { m_nt->Branch("SP_SCT_Y", &m_sp_y); m_nt->Branch("SP_SCT_Z", &m_sp_z); } - if (m_fillRDO) { + if (m_fillRDO.value()) { m_nt->Branch("RDO_SCT_nRDOs", &m_nRDOs); m_nt->Branch("RDO_SCT_RDO_Group_Size", &m_sct_rdoGroupSize); m_nt->Branch("RDO_SCT_Layer", &m_sct_layer); @@ -219,11 +211,11 @@ StatusCode InDet::SCT_ClusterValidationNtupleWriter::initialize() { m_nt->Branch("RDO_SCT_TimeBin", &m_sct_tbin); m_nt->Branch("RDO_SCT_RODId", &m_sct_rodid); m_nt->Branch("RDO_SCT_Channel", &m_sct_channel); - if (m_doHitsOnTracks) { + if (m_doHitsOnTracks.value()) { m_nt->Branch("RDO_SCT_isOnTrack", &m_sct_rdoIsOnTrack); } } - if (m_fillBSErrs) { + if (m_fillBSErrs.value()) { m_nt->Branch("SCTErr_TotalNumBSErrs", &m_totalNumErrors,"numBSerrs/I"); m_nt->Branch("SCTErr_BEC", &m_scterr_bec); m_nt->Branch("SCTErr_Layer", &m_scterr_layer); @@ -237,13 +229,13 @@ StatusCode InDet::SCT_ClusterValidationNtupleWriter::initialize() { // Read Handle Key ATH_CHECK( m_eventInfoKey.initialize() ); - ATH_CHECK( m_jo_riocontainername.initialize(m_fillCluster) ); - ATH_CHECK( m_dataObjectName.initialize(m_fillRDO) ); - ATH_CHECK( m_spacePointContainerName.initialize(m_fillSpacePoint) ); - ATH_CHECK( m_inputTrackCollection.initialize(m_fillRDO and m_doHitsOnTracks) ); + ATH_CHECK( m_jo_riocontainername.initialize(m_fillCluster.value()) ); + ATH_CHECK( m_dataObjectName.initialize(m_fillRDO.value()) ); + ATH_CHECK( m_spacePointContainerName.initialize(m_fillSpacePoint.value()) ); + ATH_CHECK( m_inputTrackCollection.initialize(m_fillRDO.value() and m_doHitsOnTracks.value()) ); // Read Cond Handle Key - if (m_fillCluster) { + if (m_fillCluster.value()) { ATH_CHECK( m_SCTDetEleCollKey.initialize() ); } @@ -318,7 +310,7 @@ StatusCode InDet::SCT_ClusterValidationNtupleWriter::execute() { // Container with SCT RIOs m_riocontainer = 0; - if ( m_fillCluster) { + if ( m_fillCluster.value()) { SG::ReadHandle<SCT_ClusterContainer> h_riocontainer(m_jo_riocontainername); if (not h_riocontainer.isValid()) { ATH_MSG_DEBUG("Could not get PrepRawDataContainer"); @@ -329,7 +321,7 @@ StatusCode InDet::SCT_ClusterValidationNtupleWriter::execute() { // SpacePoint container const SpacePointContainer* p_spContainer = 0; - if (m_fillSpacePoint) { + if (m_fillSpacePoint.value()) { SG::ReadHandle<SpacePointContainer> h_spContainer(m_spacePointContainerName); if (not h_spContainer.isValid()) { ATH_MSG_DEBUG("Could not get SpacePointContainer"); @@ -342,14 +334,14 @@ StatusCode InDet::SCT_ClusterValidationNtupleWriter::execute() { typedef SCT_RDORawData SCTRawDataType; const SCT_RDO_Container* p_rdocontainer = 0; std::vector<Identifier> RDOsOnTracks; - if (m_fillRDO) { + if (m_fillRDO.value()) { SG::ReadHandle<SCT_RDO_Container> h_rdocontainer(m_dataObjectName); if (not h_rdocontainer.isValid()) { ATH_MSG_DEBUG( "Failed to retrieve SCT RDO container" ); } else { p_rdocontainer = &*h_rdocontainer; } - if (m_doHitsOnTracks) { + if (m_doHitsOnTracks.value()) { //Track container SG::ReadHandle<TrackCollection> tracks(m_inputTrackCollection); if (not tracks.isValid()) { @@ -396,7 +388,7 @@ StatusCode InDet::SCT_ClusterValidationNtupleWriter::execute() { // Fill clusters - if (m_fillCluster && m_riocontainer !=0) { + if (m_fillCluster.value() && m_riocontainer !=0) { int RIOindex = 0; @@ -471,7 +463,7 @@ StatusCode InDet::SCT_ClusterValidationNtupleWriter::execute() { //////// fill SpacePoint stuff if required//////////////////////////////////////////////////////////////// - if (m_fillSpacePoint && p_spContainer != 0) { + if (m_fillSpacePoint.value() && p_spContainer != 0) { DataVector<Trk::SpacePoint>::const_iterator p_sp; std::pair<IdentifierHash, IdentifierHash> sp_clusInfo; //loop over SCT space points collections @@ -501,7 +493,7 @@ StatusCode InDet::SCT_ClusterValidationNtupleWriter::execute() { } } //// Get the RDO information ///////////////////////////////////////////////////////////////////// - if (m_fillRDO && p_rdocontainer !=0) { + if (m_fillRDO.value() && p_rdocontainer !=0) { SCT_RDO_Container::const_iterator col_it = p_rdocontainer->begin(); SCT_RDO_Container::const_iterator lastCol = p_rdocontainer->end(); @@ -556,7 +548,7 @@ StatusCode InDet::SCT_ClusterValidationNtupleWriter::execute() { m_sct_rodid->push_back(rod); m_sct_channel->push_back(fibre); - if (m_doHitsOnTracks) { + if (m_doHitsOnTracks.value()) { int isOnTrack = 0; if (find(RDOsOnTracks.begin(),RDOsOnTracks.end(),SCT_Identifier) != RDOsOnTracks.end()) isOnTrack = 1; @@ -567,7 +559,7 @@ StatusCode InDet::SCT_ClusterValidationNtupleWriter::execute() { } /// Fill ByteStream errors block if requested. - if (m_fillBSErrs) { + if (m_fillBSErrs.value()) { m_totalNumErrors = 0; /** types of errors are defined in the enum in ISCT_ByteStreamErrorsSvc. * At the moment there are 15 different types of BS error. diff --git a/Simulation/Tools/RDOAnalysis/src/SCT_FastRDOAnalysis.cxx b/Simulation/Tools/RDOAnalysis/src/SCT_FastRDOAnalysis.cxx index 4bfbd3efb9e5..43dfaf174cef 100644 --- a/Simulation/Tools/RDOAnalysis/src/SCT_FastRDOAnalysis.cxx +++ b/Simulation/Tools/RDOAnalysis/src/SCT_FastRDOAnalysis.cxx @@ -97,10 +97,6 @@ SCT_FastRDOAnalysis::SCT_FastRDOAnalysis(const std::string& name, ISvcLocator* p , m_tree{nullptr} , m_thistSvc{"THistSvc", name} { - declareProperty("NtupleFileName", m_ntupleFileName="/ntuples/file1"); - declareProperty("NtupleDirectoryName", m_ntupleDirName="/SCT_FastRDOAnalysis/"); - declareProperty("NtupleTreeName", m_ntupleTreeName="/SCT_FastRDOAna"); - declareProperty("HistPath", m_path="/SCT_FastRDOAnalysis/"); } StatusCode SCT_FastRDOAnalysis::initialize() { @@ -116,8 +112,8 @@ StatusCode SCT_FastRDOAnalysis::initialize() { // Grab Ntuple and histogramming service for tree ATH_CHECK(m_thistSvc.retrieve()); - m_tree = new TTree(TString(m_ntupleTreeName), "SCT_FastRDOAna"); - std::string fullNtupleName = m_ntupleFileName + m_ntupleDirName + m_ntupleTreeName; + m_tree = new TTree(TString(m_ntupleTreeName.value()), "SCT_FastRDOAna"); + std::string fullNtupleName = m_ntupleFileName.value() + m_ntupleDirName.value() + m_ntupleTreeName.value(); ATH_CHECK(m_thistSvc->regTree(fullNtupleName, m_tree)); if (m_tree) { // TREE BRANCHES @@ -171,155 +167,155 @@ StatusCode SCT_FastRDOAnalysis::initialize() { // HISTOGRAMS m_h_hitsTimeBin3 = new TH1F("h_hitsTimeBin3", "hitsTimeBine3", 100, 0, 2); m_h_hitsTimeBin3->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_hitsTimeBin3->GetName(), m_h_hitsTimeBin3)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_hitsTimeBin3->GetName(), m_h_hitsTimeBin3)); m_h_siCol = new TH1F("h_siCol", "siCol", 100, 0, 25); m_h_siCol->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siCol->GetName(), m_h_siCol)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siCol->GetName(), m_h_siCol)); m_h_siRow = new TH1F("h_siRow", "siRow", 100, 0, 2); m_h_siRow->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siRow->GetName(), m_h_siRow)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siRow->GetName(), m_h_siRow)); m_h_siPhiR = new TH1F("h_siPhiR", "siPhiR", 100, 0, 3.5); m_h_siPhiR->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siPhiR->GetName(), m_h_siPhiR)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siPhiR->GetName(), m_h_siPhiR)); m_h_siZ = new TH1F("h_siZ", "siZ", 100, 0, 130); m_h_siZ->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siZ->GetName(), m_h_siZ)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siZ->GetName(), m_h_siZ)); m_h_siPos_x = new TH1F("h_siPos_x", "siPos_x", 100, -600, 600); m_h_siPos_x->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siPos_x->GetName(), m_h_siPos_x)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siPos_x->GetName(), m_h_siPos_x)); m_h_siPos_y = new TH1F("h_siPos_y", "siPos_y", 100, -600, 600); m_h_siPos_y->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siPos_y->GetName(), m_h_siPos_y)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siPos_y->GetName(), m_h_siPos_y)); m_h_siPos_z = new TH1F("h_siPos_z", "siPos_z", 100, -3000, 3000); m_h_siPos_z->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siPos_z->GetName(), m_h_siPos_z)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siPos_z->GetName(), m_h_siPos_z)); m_h_siGangPix = new TH1F("h_siGangPix", "siGangPix", 100, 0, 2); m_h_siGangPix->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siGangPix->GetName(), m_h_siGangPix)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siGangPix->GetName(), m_h_siGangPix)); m_h_siDetID = new TH1F("h_siDetID", "siDetID", 100, 0, 1e18); m_h_siDetID->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetID->GetName(), m_h_siDetID)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetID->GetName(), m_h_siDetID)); m_h_siDetPix = new TH1F("h_siDetPix", "siDetPix", 100, 0, 2); m_h_siDetPix->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetPix->GetName(), m_h_siDetPix)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetPix->GetName(), m_h_siDetPix)); m_h_siDetSCT = new TH1F("h_siDetSCT", "siDetSCT", 100, 0, 2); m_h_siDetSCT->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetSCT->GetName(), m_h_siDetSCT)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetSCT->GetName(), m_h_siDetSCT)); m_h_siDetBrl = new TH1F("h_siDetBrl", "siDetBrl", 100, 0, 2); m_h_siDetBrl->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetBrl->GetName(), m_h_siDetBrl)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetBrl->GetName(), m_h_siDetBrl)); m_h_siDetEc = new TH1F("h_siDetEc", "siDetEc", 100, 0, 2); m_h_siDetEc->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetEc->GetName(), m_h_siDetEc)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetEc->GetName(), m_h_siDetEc)); m_h_siDetBlay = new TH1F("h_siDetBlay", "siDetBlay", 100, 0, 2); m_h_siDetBlay->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetBlay->GetName(), m_h_siDetBlay)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetBlay->GetName(), m_h_siDetBlay)); m_h_siDetInPixLay = new TH1F("h_siDetInPixLay", "siDetInPixLay", 100, 0, 2); m_h_siDetInPixLay->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetInPixLay->GetName(), m_h_siDetInPixLay)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetInPixLay->GetName(), m_h_siDetInPixLay)); m_h_siDetNtInPixLay = new TH1F("h_siDetNtInPixLay", "siDetNtInPixLay", 100, 0, 2); m_h_siDetNtInPixLay->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetNtInPixLay->GetName(), m_h_siDetNtInPixLay)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetNtInPixLay->GetName(), m_h_siDetNtInPixLay)); m_h_siDetDBM = new TH1F("h_siDetDBM", "siDetDBM", 100, 0, 2); m_h_siDetDBM->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetDBM->GetName(), m_h_siDetDBM)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetDBM->GetName(), m_h_siDetDBM)); m_h_siDetHitDepthDir = new TH1F("h_siDetHitDepthDir", "siDetHitDepthDir", 100, -2, 2); m_h_siDetHitDepthDir->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetHitDepthDir->GetName(), m_h_siDetHitDepthDir)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetHitDepthDir->GetName(), m_h_siDetHitDepthDir)); m_h_siDetHitPhiDir = new TH1F("h_siDetHitPhiDir", "siDetHitPhiDir", 100, -2, 2); m_h_siDetHitPhiDir->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetHitPhiDir->GetName(), m_h_siDetHitPhiDir)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetHitPhiDir->GetName(), m_h_siDetHitPhiDir)); m_h_siDetHitEtaDir = new TH1F("h_siDetHitEtaDir", "siDetHitEtaDir", 100, -2, 2); m_h_siDetHitEtaDir->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetHitEtaDir->GetName(), m_h_siDetHitEtaDir)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetHitEtaDir->GetName(), m_h_siDetHitEtaDir)); m_h_siDetMinR = new TH1F("h_siDetMinR", "siDetMinR", 100, 0, 600); m_h_siDetMinR->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetMinR->GetName(), m_h_siDetMinR)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetMinR->GetName(), m_h_siDetMinR)); m_h_siDetMaxR = new TH1F("h_siDetMaxR", "siDetMaxR", 100, 0, 600); m_h_siDetMaxR->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetMaxR->GetName(), m_h_siDetMaxR)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetMaxR->GetName(), m_h_siDetMaxR)); m_h_siDetMinZ = new TH1F("h_siDetMinZ", "siDetMinZ", 100, -3000, 3000); m_h_siDetMinZ->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetMinZ->GetName(), m_h_siDetMinZ)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetMinZ->GetName(), m_h_siDetMinZ)); m_h_siDetMaxZ = new TH1F("h_siDetMaxZ", "siDetMaxZ", 100, -3000, 3000); m_h_siDetMaxZ->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetMaxZ->GetName(), m_h_siDetMaxZ)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetMaxZ->GetName(), m_h_siDetMaxZ)); m_h_siDetMinPhi = new TH1F("h_siDetMinPhi", "siDetMinPhi", 100, -3.5, 3.5); m_h_siDetMinPhi->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetMinPhi->GetName(), m_h_siDetMinPhi)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetMinPhi->GetName(), m_h_siDetMinPhi)); m_h_siDetMaxPhi = new TH1F("h_siDetMaxPhi", "siDetMaxPhi", 100, 3.5, 3.5); m_h_siDetMaxPhi->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetMaxPhi->GetName(), m_h_siDetMaxPhi)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetMaxPhi->GetName(), m_h_siDetMaxPhi)); m_h_siDetWidth = new TH1F("h_siDetWidth", "siDetWidth", 100, 0, 75); m_h_siDetWidth->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetWidth->GetName(), m_h_siDetWidth)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetWidth->GetName(), m_h_siDetWidth)); m_h_siDetMinWidth = new TH1F("h_siDetMinWidth", "siDetMinWidth", 100, 0, 75); m_h_siDetMinWidth->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetMinWidth->GetName(), m_h_siDetMinWidth)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetMinWidth->GetName(), m_h_siDetMinWidth)); m_h_siDetMaxWidth = new TH1F("h_siDetMaxWidth", "siDetMaxWidth", 100, 0, 75); m_h_siDetMaxWidth->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetMaxWidth->GetName(), m_h_siDetMaxWidth)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetMaxWidth->GetName(), m_h_siDetMaxWidth)); m_h_siDetLength = new TH1F("h_siDetLength", "siDetLength", 100, 0, 150); m_h_siDetLength->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetLength->GetName(), m_h_siDetLength)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetLength->GetName(), m_h_siDetLength)); m_h_siDetThick = new TH1F("h_siDetThick", "siDetThick", 100, 0, 1); m_h_siDetThick->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetThick->GetName(), m_h_siDetThick)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetThick->GetName(), m_h_siDetThick)); m_h_siDetEtaPitch = new TH1F("h_siDetEtaPitch", "siDetEtaPitch", 100, 0, 150); m_h_siDetEtaPitch->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetEtaPitch->GetName(), m_h_siDetEtaPitch)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetEtaPitch->GetName(), m_h_siDetEtaPitch)); m_h_siDetPhiPitch = new TH1F("h_siDetPhiPitch", "siDetPhiPitch", 100, 0, 0.1); m_h_siDetPhiPitch->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_siDetPhiPitch->GetName(), m_h_siDetPhiPitch)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_siDetPhiPitch->GetName(), m_h_siDetPhiPitch)); m_h_clusID = new TH1F("h_clusID", "clusID", 100, 0, 1e18); m_h_clusID->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_clusID->GetName(), m_h_clusID)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_clusID->GetName(), m_h_clusID)); m_h_locpos_x = new TH1F("h_locpos_x", "locpos_x", 100, -40, 40); m_h_locpos_x->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_locpos_x->GetName(), m_h_locpos_x)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_locpos_x->GetName(), m_h_locpos_x)); m_h_locpos_y = new TH1F("h_locpos_y", "locpos_y", 100, -1, 1); m_h_locpos_y->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_locpos_y->GetName(), m_h_locpos_y)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_locpos_y->GetName(), m_h_locpos_y)); m_h_rdoID_prd = new TH1F("h_rdoID_prd", "rdoID_prd", 100, 0, 1e18); m_h_rdoID_prd->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_rdoID_prd->GetName(), m_h_rdoID_prd)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_rdoID_prd->GetName(), m_h_rdoID_prd)); return StatusCode::SUCCESS; } diff --git a/Simulation/Tools/RDOAnalysis/src/SCT_FastRDOAnalysis.h b/Simulation/Tools/RDOAnalysis/src/SCT_FastRDOAnalysis.h index 30b86411c2aa..3c5378bc8ef8 100644 --- a/Simulation/Tools/RDOAnalysis/src/SCT_FastRDOAnalysis.h +++ b/Simulation/Tools/RDOAnalysis/src/SCT_FastRDOAnalysis.h @@ -24,7 +24,7 @@ class TH1; class SCT_FastRDOAnalysis : public AthAlgorithm { -public: + public: SCT_FastRDOAnalysis(const std::string& name, ISvcLocator* pSvcLocator); ~SCT_FastRDOAnalysis() = default; @@ -32,7 +32,7 @@ public: virtual StatusCode execute() override final; virtual StatusCode finalize() override final; -private: + private: SG::ReadHandleKey<InDet::SCT_ClusterContainer> m_inputKey{this, "InputKey", "SCT_Clusters"}; // SCT_Cluster std::vector<uint16_t>* m_hitsTimeBin3; @@ -122,10 +122,10 @@ private: TH1* m_h_rdoID_prd; TTree* m_tree; - std::string m_ntupleFileName; - std::string m_ntupleDirName; - std::string m_ntupleTreeName; - std::string m_path; + StringProperty m_ntupleFileName{this, "NtupleFileName", "/ntuples/file1"}; + StringProperty m_ntupleDirName{this, "NtupleDirectoryName", "/SCT_FastRDOAnalysis/"}; + StringProperty m_ntupleTreeName{this, "NtupleTreeName", "/SCT_FastRDOAna"}; + StringProperty m_path{this, "HistPath", "/SCT_FastRDOAnalysis/"}; ServiceHandle<ITHistSvc> m_thistSvc; }; diff --git a/Simulation/Tools/RDOAnalysis/src/SCT_RDOAnalysis.cxx b/Simulation/Tools/RDOAnalysis/src/SCT_RDOAnalysis.cxx index bf4d4fa38c0d..03eb2d3bfbfa 100644 --- a/Simulation/Tools/RDOAnalysis/src/SCT_RDOAnalysis.cxx +++ b/Simulation/Tools/RDOAnalysis/src/SCT_RDOAnalysis.cxx @@ -84,12 +84,8 @@ SCT_RDOAnalysis::SCT_RDOAnalysis(const std::string& name, ISvcLocator *pSvcLocat , m_tree{nullptr} , m_thistSvc("THistSvc", name) -{ - declareProperty("NtupleFileName", m_ntupleFileName="/ntuples/file1"); - declareProperty("NtupleDirectoryName", m_ntupleDirName="/SCT_RDOAnalysis/"); - declareProperty("NtupleTreeName", m_ntupleTreeName="SCT_RDOAna"); - declareProperty("HistPath", m_path="/SCT_RDOAnalysis/"); -} + { + } StatusCode SCT_RDOAnalysis::initialize() { ATH_MSG_DEBUG( "Initializing SCT_RDOAnalysis" ); @@ -105,8 +101,8 @@ StatusCode SCT_RDOAnalysis::initialize() { // Grab Ntuple and histogramming service for tree ATH_CHECK(m_thistSvc.retrieve()); - m_tree = new TTree(TString(m_ntupleTreeName), "SCT_RDOAna"); - std::string fullNtupleName = m_ntupleFileName + m_ntupleDirName + m_ntupleTreeName; + m_tree = new TTree(TString(m_ntupleTreeName.value()), "SCT_RDOAna"); + std::string fullNtupleName = m_ntupleFileName.value() + m_ntupleDirName.value() + m_ntupleTreeName.value(); ATH_CHECK(m_thistSvc->regTree(fullNtupleName, m_tree)); if (m_tree) { // SCT RDO @@ -144,147 +140,147 @@ StatusCode SCT_RDOAnalysis::initialize() { // HISTOGRAMS m_h_rdoID = new TH1F("h_rdoID", "rdoID", 100, 0, 1e18); m_h_rdoID->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_rdoID->GetName(), m_h_rdoID)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_rdoID->GetName(), m_h_rdoID)); m_h_rdoWord = new TH1F("h_rdoWord", "rdoWord", 100, 0, 1e7); m_h_rdoWord->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_rdoWord->GetName(), m_h_rdoWord)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_rdoWord->GetName(), m_h_rdoWord)); m_h_barrelEndcap = new TH1F("h_barrelEndcap", "Barrel or Endcap", 100, -3, 3); m_h_barrelEndcap->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_barrelEndcap->GetName(), m_h_barrelEndcap)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_barrelEndcap->GetName(), m_h_barrelEndcap)); m_h_layerDisk = new TH1F("h_layerDisk", "Barrel layer or Endcap disk", 100, 0, 10); m_h_layerDisk->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_layerDisk->GetName(), m_h_layerDisk)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_layerDisk->GetName(), m_h_layerDisk)); m_h_phiModule = new TH1F("h_phiModule", "Phi module", 100, 0, 60); m_h_phiModule->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_phiModule->GetName(), m_h_phiModule)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_phiModule->GetName(), m_h_phiModule)); m_h_etaModule = new TH1F("h_etaModule", "Eta module", 100, -7, 7); m_h_etaModule->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_etaModule->GetName(), m_h_etaModule)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_etaModule->GetName(), m_h_etaModule)); m_h_side = new TH1F("h_side", "Side", 100, 0, 1.5); m_h_side->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_side->GetName(), m_h_side)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_side->GetName(), m_h_side)); m_h_strip = new TH1F("h_strip", "Strip", 100, 0, 800); m_h_strip->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_strip->GetName(), m_h_strip)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_strip->GetName(), m_h_strip)); m_h_groupSize = new TH1F("h_groupSize", "Group size", 100, 0, 150); m_h_groupSize->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_groupSize->GetName(), m_h_groupSize)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_groupSize->GetName(), m_h_groupSize)); m_h_phi_v_eta = new TH2F("h_phi_v_eta", "Phi module vs eta module", 100, -7, 7, 100, 0, 60); m_h_phi_v_eta->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_phi_v_eta->GetName(), m_h_phi_v_eta)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_phi_v_eta->GetName(), m_h_phi_v_eta)); m_h_brlLayer = new TH1F("h_brlLayer", "Barrel layer", 100, 0, 10); m_h_brlLayer->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_brlLayer->GetName(), m_h_brlLayer)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_brlLayer->GetName(), m_h_brlLayer)); m_h_brlPhiMod = new TH1F("h_brlPhiMod", "Barrel phi module", 100, 0, 60); m_h_brlPhiMod->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_brlPhiMod->GetName(), m_h_brlPhiMod)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_brlPhiMod->GetName(), m_h_brlPhiMod)); m_h_brlEtaMod = new TH1F("h_brlEtaMod", "Barrel eta module", 100, -7, 7); m_h_brlEtaMod->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_brlEtaMod->GetName(), m_h_brlEtaMod)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_brlEtaMod->GetName(), m_h_brlEtaMod)); m_h_brlSide = new TH1F("h_brlSide", "Barrel side", 100, 0, 1.5); m_h_brlSide->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_brlSide->GetName(), m_h_brlSide)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_brlSide->GetName(), m_h_brlSide)); m_h_brlStrip = new TH1F("h_brlStrip", "Barrel strip", 100, 0, 800); m_h_brlStrip->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_brlStrip->GetName(), m_h_brlStrip)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_brlStrip->GetName(), m_h_brlStrip)); m_h_brlGroupSize = new TH1F("h_brlGroupSize", "Barrel group size", 100, 0, 150); m_h_brlGroupSize->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_brlGroupSize->GetName(), m_h_brlGroupSize)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_brlGroupSize->GetName(), m_h_brlGroupSize)); m_h_brl_phi_v_eta = new TH2F("h_brl_phi_v_eta", "Barrel phi module vs eta module", 100, -7, 7, 100, 0, 60); m_h_brl_phi_v_eta->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_brl_phi_v_eta->GetName(), m_h_brl_phi_v_eta)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_brl_phi_v_eta->GetName(), m_h_brl_phi_v_eta)); m_h_ecDisk = new TH1F("h_ecDisk", "Endcap disk", 100, 0, 10); m_h_ecDisk->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_ecDisk->GetName(), m_h_ecDisk)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_ecDisk->GetName(), m_h_ecDisk)); m_h_ecPhiMod = new TH1F("h_ecPhiMod", "Endcap phi module", 100, 0, 60); m_h_ecPhiMod->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_ecPhiMod->GetName(), m_h_ecPhiMod)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_ecPhiMod->GetName(), m_h_ecPhiMod)); m_h_ecEtaMod = new TH1F("h_ecEtaMod", "Endcap eta module", 100, -7, 7); m_h_ecEtaMod->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_ecEtaMod->GetName(), m_h_ecEtaMod)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_ecEtaMod->GetName(), m_h_ecEtaMod)); m_h_ecSide = new TH1F("h_ecSide", "Endcap side", 100, 0, 1.5); m_h_ecSide->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_ecSide->GetName(), m_h_ecSide)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_ecSide->GetName(), m_h_ecSide)); m_h_ecStrip = new TH1F("h_ecStrip", "Endcap strip", 100, 0, 800); m_h_ecStrip->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_ecStrip->GetName(), m_h_ecStrip)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_ecStrip->GetName(), m_h_ecStrip)); m_h_ecGroupSize = new TH1F("h_ecGroupSize", "Endcap group size", 100, 0, 150); m_h_ecGroupSize->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_ecGroupSize->GetName(), m_h_ecGroupSize)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_ecGroupSize->GetName(), m_h_ecGroupSize)); m_h_ec_phi_v_eta = new TH2F("h_ec_phi_v_eta", "Endcap phi module vs eta module", 100, -7.5, 7.5, 100, 0, 60); m_h_ec_phi_v_eta->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_ec_phi_v_eta->GetName(), m_h_ec_phi_v_eta)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_ec_phi_v_eta->GetName(), m_h_ec_phi_v_eta)); m_h_sdoID = new TH1F("h_sdoID", "sdoID", 100, 0, 1e18); m_h_sdoID->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_sdoID->GetName(), m_h_sdoID)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_sdoID->GetName(), m_h_sdoID)); m_h_sdoWord = new TH1F("h_sdoWord", "sdoWord", 100, 0, 1e7); m_h_sdoWord->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_sdoWord->GetName(), m_h_sdoWord)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_sdoWord->GetName(), m_h_sdoWord)); m_h_barrelEndcap_sdo = new TH1F("h_barrelEndcap_sdo", "Barrel or Endcap (SDO)", 100, -3, 3); m_h_barrelEndcap_sdo->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_barrelEndcap_sdo->GetName(), m_h_barrelEndcap_sdo)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_barrelEndcap_sdo->GetName(), m_h_barrelEndcap_sdo)); m_h_layerDisk_sdo = new TH1F("h_layerDisk_sdo", "Barrel layer or Endcap disk (SDO)", 100, 0, 10); m_h_layerDisk_sdo->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_layerDisk_sdo->GetName(), m_h_layerDisk_sdo)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_layerDisk_sdo->GetName(), m_h_layerDisk_sdo)); m_h_phiModule_sdo = new TH1F("h_phiModule_sdo", "Phi module (SDO)", 100, 0, 60); m_h_phiModule_sdo->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_phiModule_sdo->GetName(), m_h_phiModule_sdo)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_phiModule_sdo->GetName(), m_h_phiModule_sdo)); m_h_etaModule_sdo = new TH1F("h_etaModule_sdo", "Eta module (SDO)", 100, -7, 7); m_h_etaModule_sdo->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_etaModule_sdo->GetName(), m_h_etaModule_sdo)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_etaModule_sdo->GetName(), m_h_etaModule_sdo)); m_h_side_sdo = new TH1F("h_side_sdo", "Side (SDO)", 100, 0, 1.5); m_h_side_sdo->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_side_sdo->GetName(), m_h_side_sdo)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_side_sdo->GetName(), m_h_side_sdo)); m_h_strip_sdo = new TH1F("h_strip_sdo", "Strip (SDO)", 100, 0, 800); m_h_strip_sdo->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_strip_sdo->GetName(), m_h_strip_sdo)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_strip_sdo->GetName(), m_h_strip_sdo)); m_h_barcode = new TH1F("h_barcode", "Barcode (SDO)", 100, 0, 2.2e5); m_h_barcode->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_barcode->GetName(), m_h_barcode)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_barcode->GetName(), m_h_barcode)); m_h_eventIndex = new TH1F("h_eventIndex", "Event index (SDO)", 100, 0, 10); m_h_eventIndex->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_eventIndex->GetName(), m_h_eventIndex)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_eventIndex->GetName(), m_h_eventIndex)); m_h_charge = new TH1F("h_charge", "Charge (SDO)", 100, 0, 6e6); m_h_charge->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_charge->GetName(), m_h_charge)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_charge->GetName(), m_h_charge)); m_h_phi_v_eta_sdo = new TH2F("h_phi_v_eta_sdo", "Phi module vs eta module (SDO)", 100, -7, 7, 100, 0, 60); m_h_phi_v_eta_sdo->StatOverflows(); - ATH_CHECK(m_thistSvc->regHist(m_path + m_h_phi_v_eta_sdo->GetName(), m_h_phi_v_eta_sdo)); + ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_phi_v_eta_sdo->GetName(), m_h_phi_v_eta_sdo)); return StatusCode::SUCCESS; } diff --git a/Simulation/Tools/RDOAnalysis/src/SCT_RDOAnalysis.h b/Simulation/Tools/RDOAnalysis/src/SCT_RDOAnalysis.h index 5b4519f0fa91..38f7864104db 100644 --- a/Simulation/Tools/RDOAnalysis/src/SCT_RDOAnalysis.h +++ b/Simulation/Tools/RDOAnalysis/src/SCT_RDOAnalysis.h @@ -27,7 +27,7 @@ class SCT_ID; class SCT_RDOAnalysis : public AthAlgorithm { -public: + public: SCT_RDOAnalysis(const std::string& name, ISvcLocator* pSvcLocator); ~SCT_RDOAnalysis() = default; @@ -35,7 +35,7 @@ public: virtual StatusCode execute() override final; virtual StatusCode finalize() override final; -private: + private: SG::ReadHandleKey<SCT_RDO_Container> m_inputKey{this, "InputKey", "SCT_RDOs"}; SG::ReadHandleKey<InDetSimDataCollection> m_inputTruthKey{this, "InputTruthKey", "SCT_SDO_Map"}; const SCT_ID* m_sctID; @@ -115,10 +115,10 @@ private: TH2* m_h_phi_v_eta_sdo; TTree* m_tree; - std::string m_ntupleFileName; - std::string m_ntupleDirName; - std::string m_ntupleTreeName; - std::string m_path; + StringProperty m_ntupleFileName{this, "NtupleFileName", "/ntuples/file1"}; + StringProperty m_ntupleDirName{this, "NtupleDirectoryName", "/SCT_RDOAnalysis/"}; + StringProperty m_ntupleTreeName{this, "NtupleTreeName", "SCT_RDOAna"}; + StringProperty m_path{this, "HistPath", "/SCT_RDOAnalysis/"}; ServiceHandle<ITHistSvc> m_thistSvc; }; -- GitLab