diff --git a/LArCalorimeter/LArCalibTools/LArCalibTools/LArPedestals2Ntuple.h b/LArCalorimeter/LArCalibTools/LArCalibTools/LArPedestals2Ntuple.h index 65789549f33d9595a4a6deaecb5067a7d1955c8b..35efea09dbd7172d59077ac6467a80cf85156135 100755 --- a/LArCalorimeter/LArCalibTools/LArCalibTools/LArPedestals2Ntuple.h +++ b/LArCalorimeter/LArCalibTools/LArCalibTools/LArPedestals2Ntuple.h @@ -20,7 +20,8 @@ #define LARPEDESTALS2NTUPLE_H #include "LArCalibTools/LArCond2NtupleBase.h" - +#include "StoreGate/ReadCondHandleKey.h" +#include "LArElecCalib/ILArPedestal.h" class LArPedestals2Ntuple : public LArCond2NtupleBase { @@ -30,10 +31,11 @@ class LArPedestals2Ntuple : public LArCond2NtupleBase //standard algorithm methods virtual StatusCode stop(); + StatusCode initialize(); StatusCode finalize(){return StatusCode::SUCCESS;} private: - std::string m_contKey; + SG::ReadCondHandleKey<ILArPedestal> m_pedKey; }; #endif diff --git a/LArCalorimeter/LArCalibTools/LArCalibTools/LArRamps2Ntuple.h b/LArCalorimeter/LArCalibTools/LArCalibTools/LArRamps2Ntuple.h index e64b032d8a0d6ab25b20231b306669d9b44caa97..d67c439b72c344e42186a3b3a356145d1edd26a5 100755 --- a/LArCalorimeter/LArCalibTools/LArCalibTools/LArRamps2Ntuple.h +++ b/LArCalorimeter/LArCalibTools/LArCalibTools/LArRamps2Ntuple.h @@ -20,6 +20,9 @@ #ifndef LARRAMPS2NTUPLE_H #define LARRAMPS2NTUPLE_H #include "LArCalibTools/LArCond2NtupleBase.h" +#include "StoreGate/ReadCondHandleKey.h" +#include "LArElecCalib/ILArRamp.h" +#include "LArRawConditions/LArRampSym.h" class LArRamps2Ntuple : public LArCond2NtupleBase { @@ -38,9 +41,10 @@ class LArRamps2Ntuple : public LArCond2NtupleBase bool m_applyCorr; bool m_addCorrUndo; std::vector<std::string> m_contKey; - std::string m_rampKey; + SG::ReadCondHandleKey<ILArRamp> m_rampKey; std::string m_ntName; bool m_isMC; + }; #endif diff --git a/LArCalorimeter/LArCalibTools/src/LArPedestals2Ntuple.cxx b/LArCalorimeter/LArCalibTools/src/LArPedestals2Ntuple.cxx index ed6e0e9ca9b182541bca556ec497cec6f8f40031..7af09ac91c246659b3f39841f0cc9c9fb7cc5bc1 100755 --- a/LArCalorimeter/LArCalibTools/src/LArPedestals2Ntuple.cxx +++ b/LArCalorimeter/LArCalibTools/src/LArPedestals2Ntuple.cxx @@ -7,9 +7,11 @@ #include "CaloIdentifier/CaloGain.h" -LArPedestals2Ntuple::LArPedestals2Ntuple(const std::string& name, ISvcLocator* pSvcLocator): LArCond2NtupleBase(name, pSvcLocator) -{ - declareProperty("ContainerKey",m_contKey); +LArPedestals2Ntuple::LArPedestals2Ntuple(const std::string& name, ISvcLocator* pSvcLocator): + LArCond2NtupleBase(name, pSvcLocator), + m_pedKey("Pedestal"){ + + declareProperty("ContainerKey",m_pedKey); m_ntTitle="Pedestals"; m_ntpath="/NTUPLES/FILE1/PEDESTALS"; @@ -18,22 +20,29 @@ LArPedestals2Ntuple::LArPedestals2Ntuple(const std::string& name, ISvcLocator* p LArPedestals2Ntuple::~LArPedestals2Ntuple() {} +StatusCode LArPedestals2Ntuple::initialize() { + ATH_CHECK(m_pedKey.initialize()); + return LArCond2NtupleBase::initialize(); +} + StatusCode LArPedestals2Ntuple::stop() { - StatusCode sc; - const ILArPedestal* larPedestal; - sc=m_detStore->retrieve(larPedestal,m_contKey); - if (sc!=StatusCode::SUCCESS) { - (*m_log) << MSG::ERROR << "Unable to retrieve ILArPedestal with key " - << m_contKey << " from DetectorStore" << endmsg; + + + SG::ReadCondHandle<ILArPedestal> pedHandle{m_pedKey}; + const ILArPedestal* larPedestal{*pedHandle}; + + if (larPedestal==nullptr) { + ATH_MSG_ERROR( "Unable to retrieve ILArPedestal with key " + << m_pedKey.key() << " from DetectorStore"); return StatusCode::FAILURE; - } + } NTuple::Item<long> cellIndex,gain; NTuple::Item<double> ped; NTuple::Item<double> rms; - sc=m_nt->addItem("icell",cellIndex,0,200000); + StatusCode sc=m_nt->addItem("icell",cellIndex,0,200000); if (sc!=StatusCode::SUCCESS) {(*m_log) << MSG::ERROR << "addItem 'Cell Index' failed" << endmsg; return StatusCode::FAILURE; diff --git a/LArCalorimeter/LArCalibTools/src/LArRamps2Ntuple.cxx b/LArCalorimeter/LArCalibTools/src/LArRamps2Ntuple.cxx index 8f4e491643ab3f4f80e4f5db45cdbc9b12d1207f..839a3547dadba333f530d9689cd336fc0d6bfc67 100755 --- a/LArCalorimeter/LArCalibTools/src/LArRamps2Ntuple.cxx +++ b/LArCalorimeter/LArCalibTools/src/LArRamps2Ntuple.cxx @@ -5,17 +5,19 @@ #include "LArCalibTools/LArRamps2Ntuple.h" #include "LArRawConditions/LArRawRampContainer.h" #include "LArRawConditions/LArRampComplete.h" -#include "LArRawConditions/LArRampMC.h" +#include "LArRawConditions/LArRampSym.h" //#include "CaloIdentifier/CaloIdManager.h" #include <math.h> -LArRamps2Ntuple::LArRamps2Ntuple(const std::string& name, ISvcLocator* pSvcLocator): LArCond2NtupleBase(name, pSvcLocator) -{ +LArRamps2Ntuple::LArRamps2Ntuple(const std::string& name, ISvcLocator* pSvcLocator): + LArCond2NtupleBase(name, pSvcLocator), + m_rampKey("LArRamp"){ + declareProperty("ContainerKey", m_contKey, "List of keys of RawRamp containers"); - declareProperty("RampKey", m_rampKey="LArRamp", + declareProperty("RampKey", m_rampKey, "Key of LArRampComplete or LArRampMC objects"); declareProperty("NtupleName", m_ntName ="RAMPS"); declareProperty("RawRamp", m_rawRamp = false); @@ -28,6 +30,8 @@ LArRamps2Ntuple::LArRamps2Ntuple(const std::string& name, ISvcLocator* pSvcLocat StatusCode LArRamps2Ntuple::initialize() { m_ntTitle="Ramps"; m_ntpath=std::string("/NTUPLES/FILE1/")+m_ntName; + + ATH_CHECK(m_rampKey.initialize()); return LArCond2NtupleBase::initialize(); } @@ -90,11 +94,14 @@ StatusCode LArRamps2Ntuple::stop() { } //end-if m_rawRamp + - const ILArRamp* ramp=NULL; - sc=m_detStore->retrieve(ramp,m_rampKey); - if (sc!=StatusCode::SUCCESS) { - (*m_log) << MSG::WARNING << "Unable to retrieve ILArRamp with key: "<<m_rampKey << " from DetectorStore" << endmsg; + SG::ReadCondHandle<ILArRamp> readHandle{m_rampKey}; + const ILArRamp* ramp{*readHandle}; + + + if (ramp==nullptr) { + (*m_log) << MSG::WARNING << "Unable to retrieve ILArRamp with key: "<<m_rampKey << " from DetectorStore" << endmsg; } if (!ramp && !hasRawRampContainer) { @@ -102,6 +109,7 @@ StatusCode LArRamps2Ntuple::stop() { return StatusCode::FAILURE; } + /* LArConditionsContainer<LArRampP1>* myramp = NULL; if(m_applyCorr) { const LArRampComplete *rampComplete=NULL; @@ -124,7 +132,7 @@ StatusCode LArRamps2Ntuple::stop() { } } } - + */ sc=m_nt->addItem("cellIndex",cellIndex,0,2000); if (sc!=StatusCode::SUCCESS) { @@ -449,13 +457,14 @@ StatusCode LArRamps2Ntuple::stop() { }//end loop over gains }//end if add corrections + /* if(m_applyCorr && myramp) { sc = myramp->undoCorrections(); if (sc!=StatusCode::SUCCESS) { (*m_log) << MSG::ERROR << "Undo corrections failed" << endmsg; } } - + */ (*m_log) << MSG::INFO << "LArRamps2Ntuple has finished." << endmsg; return StatusCode::SUCCESS;