ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArCalibTools
src
LArfSampl2Ntuple.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/LArfSampl2Ntuple.h
"
6
#include "
LArRawConditions/LArfSamplMC.h
"
7
#include "
CaloIdentifier/CaloGain.h
"
8
9
10
LArfSampl2Ntuple::LArfSampl2Ntuple
(
const
std::string& name, ISvcLocator* pSvcLocator):
11
LArCond2NtupleBase
(name, pSvcLocator) {
12
m_ntTitle
=
"fSampl"
;
13
m_ntpath
=
"/NTUPLES/FILE1/FSAMPL"
;
14
15
}
16
17
LArfSampl2Ntuple::~LArfSampl2Ntuple
()
18
=
default
;
19
20
StatusCode
LArfSampl2Ntuple::initialize
(){
21
ATH_CHECK
(
m_contKey
.initialize());
22
return
LArCond2NtupleBase::initialize
();
23
}
24
25
StatusCode
LArfSampl2Ntuple::stop
() {
26
27
// For compatibility with existing configurations, look in the detector
28
// store first, then in conditions store
29
const
ILArfSampl
* larfSampl =
detStore
()->tryConstRetrieve<
ILArfSampl
>(
m_contKey
.key());
30
if
(!larfSampl){
31
SG::ReadCondHandle<ILArfSampl>
fsamplHdl(
m_contKey
);
32
larfSampl=*fsamplHdl;
33
}
34
35
StatusCode
sc
;
36
37
NTuple::Item<long> cellIndex;
38
NTuple::Item<float> fsampl;
39
40
sc
=
m_nt
->addItem(
"icell"
,cellIndex,0,2000);
41
if
(
sc
!=StatusCode::SUCCESS)
42
{
ATH_MSG_ERROR
(
"addItem 'Cell Index' failed"
);
43
return
StatusCode::FAILURE;
44
}
45
46
sc
=
m_nt
->addItem(
"fsampl"
,fsampl);
47
if
(
sc
!=StatusCode::SUCCESS)
48
{
ATH_MSG_ERROR
(
"addItem 'fsampl' failed"
);
49
return
StatusCode::FAILURE;
50
}
51
52
SG::ReadCondHandle<LArOnOffIdMapping>
cablingHdl{
m_cablingKey
};
53
const
LArOnOffIdMapping
* cabling=*cablingHdl;
54
if
(!cabling) {
55
ATH_MSG_WARNING
(
"Do not have cabling object LArOnOffIdMapping"
);
56
return
StatusCode::FAILURE;
57
}
58
59
unsigned
cellCounter=0;
60
for
(
const
HWIdentifier
hwid:
m_onlineId
->channel_range()) {
61
if
( cabling->isOnlineConnected(hwid)) {
62
fillFromIdentifier
(hwid);
63
cellIndex = cellCounter;
64
fsampl = larfSampl->
FSAMPL
(hwid);
65
sc
=
ntupleSvc
()->writeRecord(
m_nt
);
66
if
(
sc
!=StatusCode::SUCCESS) {
67
ATH_MSG_ERROR
(
"writeRecord failed"
);
68
return
StatusCode::FAILURE;
69
}
70
}
//end if isConnected
71
cellCounter++;
72
}
//end loop over online ID
73
74
ATH_MSG_INFO
(
"LArfSampl2Ntuple has finished."
);
75
return
StatusCode::SUCCESS;
76
}
// end finalize-method.
77
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
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
LArfSampl2Ntuple.h
LArfSamplMC.h
ntupleSvc
INTupleSvc * ntupleSvc()
Definition
ServiceAccessor.h:14
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
HWIdentifier
Definition
HWIdentifier.h:13
ILArfSampl
Definition
ILArfSampl.h:14
ILArfSampl::FSAMPL
virtual const float & FSAMPL(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::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
LArOnOffIdMapping
Definition
LArOnOffIdMapping.h:20
LArfSampl2Ntuple::initialize
StatusCode initialize()
Definition
LArfSampl2Ntuple.cxx:20
LArfSampl2Ntuple::stop
virtual StatusCode stop()
Definition
LArfSampl2Ntuple.cxx:25
LArfSampl2Ntuple::~LArfSampl2Ntuple
~LArfSampl2Ntuple()
LArfSampl2Ntuple::m_contKey
SG::ReadCondHandleKey< ILArfSampl > m_contKey
Definition
LArfSampl2Ntuple.h:22
LArfSampl2Ntuple::LArfSampl2Ntuple
LArfSampl2Ntuple(const std::string &name, ISvcLocator *pSvcLocator)
Definition
LArfSampl2Ntuple.cxx:10
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
Generated on
for ATLAS Offline Software by
1.17.0