ATLAS Offline Software
Loading...
Searching...
No Matches
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
9LArHVScaleCorr2Ntuple::LArHVScaleCorr2Ntuple(const std::string& name, ISvcLocator* pSvcLocator):
10 LArCond2NtupleBase(name, pSvcLocator)
11{
12 m_ntTitle="HV Scale Correction";
13}
14
20
22
23 const EventContext& ctx = Gaudi::Hive::currentContext();
24
25
27 const ILArHVScaleCorr* larHVScaleCorr = hvHdl.cptr();
28 if(!larHVScaleCorr) {
29 ATH_MSG_WARNING("Could not retrieve the ILArHVScaleCorr from CondStore with key: " << m_contKey.key());
30 return StatusCode::SUCCESS;
31 }
32
33 NTuple::Item<float> corr;
34
35 StatusCode sc=m_nt->addItem("hvcorr",corr,-1000.,2.);
36 if (sc!=StatusCode::SUCCESS)
37 {ATH_MSG_ERROR( "addItem 'corr' failed" );
38 return StatusCode::FAILURE;
39 }
40
42 const LArOnOffIdMapping* cabling=*cablingHdl;
43 if(!cabling) {
44 ATH_MSG_WARNING( "Do not have cabling object LArOnOffIdMapping" );
45 return StatusCode::FAILURE;
46 }
47
48 for (const HWIdentifier hwid: m_onlineId->channel_range()) {
49 if (cabling->isOnlineConnected(hwid)) {
50 float value=larHVScaleCorr->HVScaleCorr(hwid);
51 if (value > ILArHVScaleCorr::ERRORCODE) { // check for ERRORCODE
52 fillFromIdentifier(hwid);
53 corr=value;
54 sc=ntupleSvc()->writeRecord(m_nt);
55 if (sc!=StatusCode::SUCCESS) {
56 ATH_MSG_ERROR( "writeRecord failed" );
57 return StatusCode::FAILURE;
58 }
59 }// end if object exists
60 }//end if isConnected
61 }//end loop over online ID
62
63 ATH_MSG_INFO( "LArHVScaleCorr2Ntuple has finished." );
64 return StatusCode::SUCCESS;
65}// end finalize-method.
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
static Double_t sc
INTupleSvc * ntupleSvc()
virtual const float & HVScaleCorr(const HWIdentifier &id) const =0
const SG::ReadCondHandleKey< LArOnOffIdMapping > & cablingKey() const
const LArOnlineID_Base * m_onlineId
bool fillFromIdentifier(const HWIdentifier &id)
LArCond2NtupleBase(const std::string &name, ISvcLocator *pSvcLocator)
LArHVScaleCorr2Ntuple(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadCondHandleKey< ILArHVScaleCorr > m_contKey
virtual StatusCode initialize()
const_pointer_type cptr()