ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArCalibTools
src
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
5
#include "
LArCalibTools/LArHVScaleCorr2Ntuple.h
"
6
#include "
LArElecCalib/ILArHVScaleCorr.h
"
7
#include "
CaloIdentifier/CaloGain.h
"
8
9
LArHVScaleCorr2Ntuple::LArHVScaleCorr2Ntuple
(
const
std::string& name, ISvcLocator* pSvcLocator):
10
LArCond2NtupleBase
(name, pSvcLocator)
11
{
12
m_ntTitle
=
"HV Scale Correction"
;
13
}
14
15
StatusCode
LArHVScaleCorr2Ntuple::initialize
() {
16
ATH_CHECK
(
m_contKey
.initialize());
17
m_ntpath
=
m_ntuplePath
;
18
return
LArCond2NtupleBase::initialize
();
19
}
20
21
StatusCode
LArHVScaleCorr2Ntuple::stop
() {
22
23
const
EventContext& ctx = Gaudi::Hive::currentContext();
24
25
26
SG::ReadCondHandle<ILArHVScaleCorr>
hvHdl(
m_contKey
, ctx);
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
41
SG::ReadCondHandle<LArOnOffIdMapping>
cablingHdl{
cablingKey
()};
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.
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
CaloGain.h
ILArHVScaleCorr.h
LArHVScaleCorr2Ntuple.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
ntupleSvc
INTupleSvc * ntupleSvc()
Definition
ServiceAccessor.h:14
HWIdentifier
Definition
HWIdentifier.h:13
ILArHVScaleCorr
Definition
ILArHVScaleCorr.h:13
ILArHVScaleCorr::ERRORCODE
@ ERRORCODE
Definition
ILArHVScaleCorr.h:27
ILArHVScaleCorr::HVScaleCorr
virtual const float & HVScaleCorr(const HWIdentifier &id) const =0
LArCond2NtupleBase::initialize
StatusCode initialize()
Definition
LArCond2NtupleBase.cxx:33
LArCond2NtupleBase::m_ntTitle
std::string m_ntTitle
Definition
LArCond2NtupleBase.h:68
LArCond2NtupleBase::cablingKey
const SG::ReadCondHandleKey< LArOnOffIdMapping > & cablingKey() const
Definition
LArCond2NtupleBase.cxx:458
LArCond2NtupleBase::m_nt
NTuple::Tuple * m_nt
Definition
LArCond2NtupleBase.h:71
LArCond2NtupleBase::m_onlineId
const LArOnlineID_Base * m_onlineId
Definition
LArCond2NtupleBase.h:88
LArCond2NtupleBase::m_ntpath
std::string m_ntpath
Definition
LArCond2NtupleBase.h:68
LArCond2NtupleBase::fillFromIdentifier
bool fillFromIdentifier(const HWIdentifier &id)
Definition
LArCond2NtupleBase.cxx:290
LArCond2NtupleBase::LArCond2NtupleBase
LArCond2NtupleBase(const std::string &name, ISvcLocator *pSvcLocator)
Definition
LArCond2NtupleBase.cxx:15
LArHVScaleCorr2Ntuple::LArHVScaleCorr2Ntuple
LArHVScaleCorr2Ntuple(const std::string &name, ISvcLocator *pSvcLocator)
Definition
LArHVScaleCorr2Ntuple.cxx:9
LArHVScaleCorr2Ntuple::stop
virtual StatusCode stop()
Definition
LArHVScaleCorr2Ntuple.cxx:21
LArHVScaleCorr2Ntuple::m_ntuplePath
StringProperty m_ntuplePath
Definition
LArHVScaleCorr2Ntuple.h:23
LArHVScaleCorr2Ntuple::m_contKey
SG::ReadCondHandleKey< ILArHVScaleCorr > m_contKey
Definition
LArHVScaleCorr2Ntuple.h:22
LArHVScaleCorr2Ntuple::initialize
virtual StatusCode initialize()
Definition
LArHVScaleCorr2Ntuple.cxx:15
LArOnOffIdMapping
Definition
LArOnOffIdMapping.h:20
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::cptr
const_pointer_type cptr()
Definition
ReadCondHandle.h:67
Generated on
for ATLAS Offline Software by
1.17.0