ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArCalibTools
src
LArOFCBin2Ntuple.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
LArCalibTools/LArOFCBin2Ntuple.h
"
6
#include "
LArRawConditions/LArRinjComplete.h
"
7
8
#include "
LArIdentifier/LArOnlineID.h
"
9
10
11
LArOFCBin2Ntuple::LArOFCBin2Ntuple
(
const
std::string& name, ISvcLocator* pSvcLocator):
12
LArCond2NtupleBase
(name, pSvcLocator) {
13
m_ntTitle
=
"OFCBIN"
;
14
m_ntpath
=
"/NTUPLES/FILE1/OFCBIN"
;
15
16
}
17
18
StatusCode
LArOFCBin2Ntuple::initialize
()
19
{
20
ATH_CHECK
(
m_binKey
.initialize() );
21
ATH_CHECK
(
m_cablingKey
.initialize(!
m_isSC
) );
22
ATH_CHECK
(
m_cablingSCKey
.initialize(
m_isSC
) );
23
24
ATH_CHECK
(
LArCond2NtupleBase::initialize
() );
25
return
StatusCode::SUCCESS;
26
}
27
28
StatusCode
LArOFCBin2Ntuple::stop
() {
29
30
const
EventContext& ctx = Gaudi::Hive::currentContext();
31
32
NTuple::Item<long> cellIndex;
33
NTuple::Item<int> ofcbin;
34
35
StatusCode
sc
=
m_nt
->addItem(
"icell"
,cellIndex,0,2000);
36
if
(
sc
!=StatusCode::SUCCESS)
37
{
ATH_MSG_ERROR
(
"addItem 'Cell Index' failed"
);
38
return
StatusCode::FAILURE;
39
}
40
41
42
sc
=
m_nt
->addItem(
"OFCBin"
,ofcbin,0,50);
43
if
(
sc
!=StatusCode::SUCCESS) {
44
ATH_MSG_ERROR
(
"addItem 'OFCBin' failed"
);
45
return
StatusCode::FAILURE;
46
}
47
48
const
LArOnOffIdMapping
*cabling=
nullptr
;
49
if
(
m_isSC
) {
50
ATH_MSG_DEBUG
(
"LArOFC2Ntuple: using SC cabling"
);
51
SG::ReadCondHandle<LArOnOffIdMapping>
cablingHdl{
m_cablingSCKey
, ctx};
52
cabling=*cablingHdl;
53
}
else
{
54
SG::ReadCondHandle<LArOnOffIdMapping>
cablingHdl{
m_cablingKey
, ctx};
55
cabling=*cablingHdl;
56
}
57
58
59
if
(!cabling) {
60
ATH_MSG_WARNING
(
"Do not have cabling object LArOnOffIdMapping"
);
61
return
StatusCode::FAILURE;
62
}
63
64
const
ILArOFCBin
* LArbin =
nullptr
;
65
SG::ReadCondHandle<ILArOFCBin>
ofcbinHdl(
m_binKey
, ctx);
66
LArbin = ofcbinHdl.
cptr
();
67
if
(!LArbin) {
68
ATH_MSG_ERROR
(
"Unable to retrieve ILArOFCBin with key "
69
<<
m_binKey
<<
" from ConditionsStore"
);
70
return
StatusCode::FAILURE;
71
}
72
73
unsigned
cellCounter=0;
74
for
(
HWIdentifier
hwid :
m_onlineId
->channel_range()){
75
if
( cabling->isOnlineConnected(hwid)) {
76
fillFromIdentifier
(hwid);
77
cellIndex = cellCounter;
78
ofcbin = LArbin->
bin
(hwid,0);
79
sc
=
ntupleSvc
()->writeRecord(
m_nt
);
80
if
(
sc
!=StatusCode::SUCCESS) {
81
ATH_MSG_ERROR
(
"writeRecord failed"
);
82
return
StatusCode::FAILURE;
83
}
84
cellCounter++;
85
}
//end if isConnected
86
}
//end loop over online ID
87
ATH_MSG_INFO
(
"LArOFCBin2Ntuple: filled "
<<cellCounter);
88
ATH_MSG_INFO
(
"LArOFCBin2Ntuple has finished."
);
89
return
StatusCode::SUCCESS;
90
}
// end finalize-method.
91
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
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
LArOFCBin2Ntuple.h
LArOnlineID.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
LArRinjComplete.h
ntupleSvc
INTupleSvc * ntupleSvc()
Definition
ServiceAccessor.h:14
HWIdentifier
Definition
HWIdentifier.h:13
ILArOFCBin
Definition
ILArOFCBin.h:12
ILArOFCBin::bin
virtual const int & bin(const HWIdentifier &id, const int &gain) const =0
LArCond2NtupleBase::initialize
StatusCode initialize()
Definition
LArCond2NtupleBase.cxx:33
LArCond2NtupleBase::m_isSC
Gaudi::Property< bool > m_isSC
Definition
LArCond2NtupleBase.h:57
LArCond2NtupleBase::m_cablingSCKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingSCKey
Definition
LArCond2NtupleBase.h:93
LArCond2NtupleBase::m_ntTitle
std::string m_ntTitle
Definition
LArCond2NtupleBase.h:68
LArCond2NtupleBase::m_nt
NTuple::Tuple * m_nt
Definition
LArCond2NtupleBase.h:71
LArCond2NtupleBase::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition
LArCond2NtupleBase.h:92
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
LArOFCBin2Ntuple::LArOFCBin2Ntuple
LArOFCBin2Ntuple(const std::string &name, ISvcLocator *pSvcLocator)
Definition
LArOFCBin2Ntuple.cxx:11
LArOFCBin2Ntuple::m_binKey
SG::ReadCondHandleKey< ILArOFCBin > m_binKey
Definition
LArOFCBin2Ntuple.h:27
LArOFCBin2Ntuple::stop
virtual StatusCode stop() override
Definition
LArOFCBin2Ntuple.cxx:28
LArOFCBin2Ntuple::initialize
virtual StatusCode initialize() override
Definition
LArOFCBin2Ntuple.cxx:18
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