ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
TestBeam
TBCnv
src
ReadTBLArCalibDigits.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TBCnv/ReadTBLArCalibDigits.h
"
6
#include "
LArIdentifier/LArOnlineID.h
"
7
#include <vector>
8
9
ReadTBLArCalibDigits::ReadTBLArCalibDigits
(
const
std::string& name, ISvcLocator* pSvcLocator)
10
:
AthAlgorithm
(name, pSvcLocator),
11
m_count
(0),
12
m_onlineHelper
(0)
13
{
14
declareProperty
(
"ContainerKey"
,
m_containerKey
=
""
);
15
declareProperty
(
"DumpFile"
,
m_dumpFile
=
""
);
16
}
17
18
ReadTBLArCalibDigits::~ReadTBLArCalibDigits
()
19
{
20
}
21
22
StatusCode
ReadTBLArCalibDigits::initialize
()
23
{
24
MsgStream log(msgSvc(), name());
25
log << MSG::INFO <<
"Initialize"
<<
endmsg
;
26
27
StatusCode
sc
=
detStore
()->retrieve(
m_onlineHelper
,
"LArOnlineID"
);
28
if
(
sc
.isFailure()) {
29
log << MSG::ERROR <<
"Could not get LArOnlineID helper"
<<
endmsg
;
30
return
StatusCode::FAILURE;
31
}
32
33
if
(
m_dumpFile
.size()>0)
34
m_outfile
.open(
m_dumpFile
.c_str(),std::ios::out);
35
36
m_count
=0;
37
38
log << MSG::INFO <<
"======== ReadTBLArCalibDigits initialize successfully ========"
<<
endmsg
;
39
return
StatusCode::SUCCESS;
40
}
41
42
43
StatusCode
ReadTBLArCalibDigits::execute
(
const
EventContext&
/*ctx*/
) {
44
MsgStream log(msgSvc(), name());
45
46
m_count
++;
47
48
int
cellCounter = 0;
49
50
StatusCode
sc
;
51
52
log << MSG::DEBUG <<
"======== executing event "
<<
m_count
<<
" ========"
<<
endmsg
;
53
log << MSG::DEBUG <<
"Retrieving TBLArCalibDigitContainer. Key= "
<<
m_containerKey
<<
endmsg
;
54
TBLArCalibDigitContainer
* larCalibDigitCont;
55
sc
=
evtStore
()->retrieve(larCalibDigitCont ,
m_containerKey
);
56
57
if
(
sc
.isFailure()) {
58
log << MSG::FATAL <<
" Cannot read TBLArCalibDigitContainer from StoreGate! key="
<<
m_containerKey
<<
endmsg
;
59
return
StatusCode::FAILURE;
60
}
61
62
log << MSG::VERBOSE <<
"Now loop over container "
<<
endmsg
;
63
64
for
(
const
LArCalibDigit
* digit : *larCalibDigitCont) {
65
66
log << MSG::VERBOSE <<
" Get hardware ID "
<<
endmsg
;
67
68
HWIdentifier
chid=digit->hardwareID();
69
70
log << MSG::VERBOSE <<
" chid = "
<< chid <<
endmsg
;
71
72
const
std::vector<short>& vSamples=digit->samples();
73
int
nSamples=vSamples.size();
74
75
log << MSG::VERBOSE <<
" nSamples = "
<< nSamples <<
endmsg
;
76
77
if
(
m_outfile
.is_open()) {
78
m_outfile
<<
"Evt="
<<
m_count
<<
" "
;
79
m_outfile
<<
"FebId= 0x"
<< std::hex <<
m_onlineHelper
->feb_Id(chid).get_compact()
80
<< std::dec <<
" Ch= "
<<
m_onlineHelper
->channel(chid) <<
" "
;
81
for
(
int
i=0; i<nSamples; i++) {
82
m_outfile
<<
" "
<< vSamples[i];
83
}
84
m_outfile
<<
" G="
<< digit->gain() << std::endl;
85
}
86
87
cellCounter++;
88
89
log << MSG::VERBOSE <<
" cellCounter = "
<< cellCounter <<
endmsg
;
90
91
}
92
93
log << MSG::DEBUG <<
"Event "
<<
m_count
<<
" contains "
<< cellCounter <<
" channels"
<<
endmsg
;
94
95
return
StatusCode::SUCCESS;
96
97
}
98
99
StatusCode
ReadTBLArCalibDigits::finalize
()
100
{
101
MsgStream log(msgSvc(), name());
102
if
(
m_outfile
.is_open())
103
m_outfile
.close();
104
log << MSG::INFO <<
"finalize ReadTBLArCalibDigits"
<<
endmsg
;
105
return
StatusCode::SUCCESS;
106
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
LArOnlineID.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
ReadTBLArCalibDigits.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
HWIdentifier
Definition
HWIdentifier.h:13
LArCalibDigit
Base class for LArDigits taken during calibration runs.
Definition
LArCalibDigit.h:29
ReadTBLArCalibDigits::m_count
int m_count
Definition
ReadTBLArCalibDigits.h:29
ReadTBLArCalibDigits::~ReadTBLArCalibDigits
~ReadTBLArCalibDigits()
Definition
ReadTBLArCalibDigits.cxx:18
ReadTBLArCalibDigits::m_containerKey
std::string m_containerKey
Definition
ReadTBLArCalibDigits.h:32
ReadTBLArCalibDigits::m_onlineHelper
const LArOnlineID * m_onlineHelper
Definition
ReadTBLArCalibDigits.h:30
ReadTBLArCalibDigits::m_dumpFile
std::string m_dumpFile
Definition
ReadTBLArCalibDigits.h:33
ReadTBLArCalibDigits::initialize
StatusCode initialize()
Definition
ReadTBLArCalibDigits.cxx:22
ReadTBLArCalibDigits::execute
StatusCode execute(const EventContext &ctx)
Execute method.
Definition
ReadTBLArCalibDigits.cxx:43
ReadTBLArCalibDigits::m_outfile
std::ofstream m_outfile
Definition
ReadTBLArCalibDigits.h:31
ReadTBLArCalibDigits::finalize
StatusCode finalize()
Definition
ReadTBLArCalibDigits.cxx:99
ReadTBLArCalibDigits::ReadTBLArCalibDigits
ReadTBLArCalibDigits(const std::string &name, ISvcLocator *pSvcLocator)
Definition
ReadTBLArCalibDigits.cxx:9
TBLArCalibDigitContainer
Liquid Argon Calibration Digit Container .
Definition
TBLArCalibDigitContainer.h:26
Generated on
for ATLAS Offline Software by
1.17.0