ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArCalibTools
src
LArPedestals2Ntuple.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/LArPedestals2Ntuple.h
"
6
#include "
LArRawConditions/LArPedestalComplete.h
"
7
#include "
CaloIdentifier/CaloGain.h
"
8
9
10
LArPedestals2Ntuple::LArPedestals2Ntuple
(
const
std::string& name, ISvcLocator* pSvcLocator):
11
LArCond2NtupleBase
(name, pSvcLocator),
12
m_pedKey
(
"Pedestal"
){
13
14
declareProperty
(
"ContainerKey"
,
m_pedKey
);
15
m_ntTitle
=
"Pedestals"
;
16
m_ntpath
=
"/NTUPLES/FILE1/PEDESTALS"
;
17
18
}
19
20
LArPedestals2Ntuple::~LArPedestals2Ntuple
()
21
=
default
;
22
23
StatusCode
LArPedestals2Ntuple::initialize
() {
24
ATH_CHECK
(
m_pedKey
.initialize());
25
return
LArCond2NtupleBase::initialize
();
26
}
27
28
StatusCode
LArPedestals2Ntuple::stop
()
29
{
30
// For compatibility with existing configurations, look in the detector
31
// store first, then in conditions.
32
const
ILArPedestal
* larPedestal =
33
detStore
()->tryConstRetrieve<
ILArPedestal
> (
m_pedKey
.key());
34
if
(!larPedestal) {
35
SG::ReadCondHandle<ILArPedestal>
pedHandle{
m_pedKey
};
36
larPedestal = *pedHandle;
37
}
38
39
if
(larPedestal==
nullptr
) {
40
ATH_MSG_ERROR
(
"Unable to retrieve ILArPedestal with key "
41
<<
m_pedKey
.key() <<
" from DetectorStore"
);
42
return
StatusCode::FAILURE;
43
}
44
45
NTuple::Item<long> cellIndex,gain;
46
NTuple::Item<double> ped;
47
NTuple::Item<double> rms;
48
49
50
StatusCode
sc
=
m_nt
->addItem(
"icell"
,cellIndex,0,200000);
51
if
(
sc
!=StatusCode::SUCCESS)
52
{
ATH_MSG_ERROR
(
"addItem 'Cell Index' failed"
);
53
return
StatusCode::FAILURE;
54
}
55
56
sc
=
m_nt
->addItem(
"gain"
,gain,0,3);
57
if
(
sc
!=StatusCode::SUCCESS) {
58
ATH_MSG_ERROR
(
"addItem 'gain' failed"
);
59
return
StatusCode::FAILURE;
60
}
61
62
63
sc
=
m_nt
->addItem(
"ped"
,ped,-1000.,5000.);
64
if
(
sc
!=StatusCode::SUCCESS) {
65
ATH_MSG_ERROR
(
"addItem 'ped' failed"
);
66
return
StatusCode::FAILURE;
67
}
68
69
sc
=
m_nt
->addItem(
"rms"
,rms,0.,1e12);
70
if
(
sc
!=StatusCode::SUCCESS) {
71
ATH_MSG_ERROR
(
"addItem 'rms' failed"
);
72
return
StatusCode::FAILURE;
73
}
74
75
76
unsigned
cellCounter=0;
77
unsigned
maxgain =
m_NGains
;
78
if
(
m_isSC
) maxgain=
CaloGain::LARMEDIUMGAIN
;
79
80
for
(
long
igain=
CaloGain::LARHIGHGAIN
; igain<maxgain; igain++) {
81
for
(
const
HWIdentifier
hwid:
m_onlineId
->channel_range()) {
82
if
(larPedestal->
pedestal
(hwid,igain)>
ILArPedestal::ERRORCODE
) {
83
fillFromIdentifier
(hwid);
84
cellIndex = cellCounter;
85
86
ped=larPedestal->
pedestal
(hwid,igain);
87
rms=larPedestal->
pedestalRMS
(hwid,igain);
88
gain=igain;
89
90
sc
=
ntupleSvc
()->writeRecord(
m_nt
);
91
if
(
sc
!=StatusCode::SUCCESS) {
92
ATH_MSG_ERROR
(
"writeRecord failed"
);
93
return
StatusCode::FAILURE;
94
}
95
}
// end if Pedestal exists for this channel
96
cellCounter++;
97
}
//end loop over gains
98
}
//end loop over online ID
99
100
ATH_MSG_INFO
(
"LArPedestals2Ntuple has finished."
);
101
return
StatusCode::SUCCESS;
102
}
// end finalize-method.
103
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
CaloGain.h
LArPedestalComplete.h
LArPedestals2Ntuple.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
ntupleSvc
INTupleSvc * ntupleSvc()
Definition
ServiceAccessor.h:14
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
HWIdentifier
Definition
HWIdentifier.h:13
ILArPedestal
Definition
ILArPedestal.h:12
ILArPedestal::ERRORCODE
@ ERRORCODE
Definition
ILArPedestal.h:47
ILArPedestal::pedestal
virtual float pedestal(const HWIdentifier &id, int gain) const =0
ILArPedestal::pedestalRMS
virtual float pedestalRMS(const HWIdentifier &id, int gain) const =0
access to RMS of Pedestal index by Identifier, and gain setting
LArCond2NtupleBase::initialize
StatusCode initialize()
Definition
LArCond2NtupleBase.cxx:33
LArCond2NtupleBase::m_isSC
Gaudi::Property< bool > m_isSC
Definition
LArCond2NtupleBase.h:57
LArCond2NtupleBase::m_ntTitle
std::string m_ntTitle
Definition
LArCond2NtupleBase.h:68
LArCond2NtupleBase::m_NGains
Gaudi::Property< int > m_NGains
Definition
LArCond2NtupleBase.h:64
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
LArPedestals2Ntuple::initialize
StatusCode initialize()
Definition
LArPedestals2Ntuple.cxx:23
LArPedestals2Ntuple::LArPedestals2Ntuple
LArPedestals2Ntuple(const std::string &name, ISvcLocator *pSvcLocator)
Definition
LArPedestals2Ntuple.cxx:10
LArPedestals2Ntuple::stop
virtual StatusCode stop()
Definition
LArPedestals2Ntuple.cxx:28
LArPedestals2Ntuple::~LArPedestals2Ntuple
~LArPedestals2Ntuple()
LArPedestals2Ntuple::m_pedKey
SG::ReadCondHandleKey< ILArPedestal > m_pedKey
Definition
LArPedestals2Ntuple.h:38
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
CaloGain::LARMEDIUMGAIN
@ LARMEDIUMGAIN
Definition
CaloGain.h:18
CaloGain::LARHIGHGAIN
@ LARHIGHGAIN
Definition
CaloGain.h:18
Generated on
for ATLAS Offline Software by
1.17.0