ATLAS Offline Software
LArHVScaleCorr2Ntuple.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 
9 LArHVScaleCorr2Ntuple::LArHVScaleCorr2Ntuple(const std::string& name, ISvcLocator* pSvcLocator):
10  LArCond2NtupleBase(name, pSvcLocator)
11 {
12  m_ntTitle="HV Scale Correction";
13 }
14 
19 }
20 
22 
23  const EventContext& ctx = Gaudi::Hive::currentContext();
25  const ILArHVScaleCorr* larHVScaleCorr = hvHdl.cptr();
26  if(!larHVScaleCorr) {
27  ATH_MSG_WARNING("Could not retrieve the ILArHVScaleCorr from CondStore with key: " << m_contKey.key());
28  return StatusCode::SUCCESS;
29  }
30 
31  NTuple::Item<float> corr;
32 
33  StatusCode sc=m_nt->addItem("hvcorr",corr,-1000.,2.);
34  if (sc!=StatusCode::SUCCESS)
35  {ATH_MSG_ERROR( "addItem 'corr' failed" );
36  return StatusCode::FAILURE;
37  }
38 
40  const LArOnOffIdMapping* cabling=*cablingHdl;
41  if(!cabling) {
42  ATH_MSG_WARNING( "Do not have cabling object LArOnOffIdMapping" );
43  return StatusCode::FAILURE;
44  }
45 
46  for (const HWIdentifier hwid: m_onlineId->channel_range()) {
47  if (cabling->isOnlineConnected(hwid)) {
48  float value=larHVScaleCorr->HVScaleCorr(hwid);
49  if (value > ILArHVScaleCorr::ERRORCODE) { // check for ERRORCODE
50  fillFromIdentifier(hwid);
51  corr=value;
52  sc=ntupleSvc()->writeRecord(m_nt);
53  if (sc!=StatusCode::SUCCESS) {
54  ATH_MSG_ERROR( "writeRecord failed" );
55  return StatusCode::FAILURE;
56  }
57  }// end if object exists
58  }//end if isConnected
59  }//end loop over online ID
60 
61  ATH_MSG_INFO( "LArHVScaleCorr2Ntuple has finished." );
62  return StatusCode::SUCCESS;
63 }// end finalize-method.
LArHVScaleCorr2Ntuple.h
LArHVScaleCorr2Ntuple::initialize
virtual StatusCode initialize()
Definition: LArHVScaleCorr2Ntuple.cxx:15
LArHVScaleCorr2Ntuple::m_contKey
SG::ReadCondHandleKey< ILArHVScaleCorr > m_contKey
Definition: LArHVScaleCorr2Ntuple.h:22
ILArHVScaleCorr
Definition: ILArHVScaleCorr.h:13
LArHVScaleCorr2Ntuple::LArHVScaleCorr2Ntuple
LArHVScaleCorr2Ntuple(const std::string &name, ISvcLocator *pSvcLocator)
Definition: LArHVScaleCorr2Ntuple.cxx:9
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LArHVScaleCorr2Ntuple::stop
virtual StatusCode stop()
Definition: LArHVScaleCorr2Ntuple.cxx:21
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
LArHVScaleCorr2Ntuple::m_ntuplePath
StringProperty m_ntuplePath
Definition: LArHVScaleCorr2Ntuple.h:23
athena.value
value
Definition: athena.py:122
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
HWIdentifier
Definition: HWIdentifier.h:13
LArCond2NtupleBase::initialize
StatusCode initialize()
Definition: LArCond2NtupleBase.cxx:33
LArCond2NtupleBase::cablingKey
const SG::ReadCondHandleKey< LArOnOffIdMapping > & cablingKey() const
Definition: LArCond2NtupleBase.cxx:449
LArCond2NtupleBase
Definition: LArCond2NtupleBase.h:32
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LArOnlineID_Base::channel_range
id_range channel_range() const
Definition: LArOnlineID_Base.cxx:1936
ILArHVScaleCorr.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LArCond2NtupleBase::m_ntpath
std::string m_ntpath
Definition: LArCond2NtupleBase.h:65
LArCond2NtupleBase::m_nt
NTuple::Tuple * m_nt
Definition: LArCond2NtupleBase.h:68
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
LArCond2NtupleBase::m_ntTitle
std::string m_ntTitle
Definition: LArCond2NtupleBase.h:65
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
LArCond2NtupleBase::m_onlineId
const LArOnlineID_Base * m_onlineId
Definition: LArCond2NtupleBase.h:85
LArCond2NtupleBase::fillFromIdentifier
bool fillFromIdentifier(const HWIdentifier &id)
Definition: LArCond2NtupleBase.cxx:288
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
ILArHVScaleCorr::HVScaleCorr
virtual const float & HVScaleCorr(const HWIdentifier &id) const =0
ILArHVScaleCorr::ERRORCODE
@ ERRORCODE
Definition: ILArHVScaleCorr.h:27
CaloGain.h
ntupleSvc
INTupleSvc * ntupleSvc()
Definition: ServiceAccessor.h:14
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20
SG::ReadCondHandle::cptr
const_pointer_type cptr()
Definition: ReadCondHandle.h:67