Skip to content
Snippets Groups Projects
Commit dc226b4f authored by Walter Lampl's avatar Walter Lampl
Browse files

migrate Pedestal and Ramp ntuple dumper to CondReadHandle

parent a8d013bc
No related merge requests found
......@@ -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
......@@ -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
......@@ -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;
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment