ATLAS Offline Software
Loading...
Searching...
No Matches
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
7#include <vector>
8
9ReadTBLArCalibDigits::ReadTBLArCalibDigits(const std::string& name, ISvcLocator* pSvcLocator)
10 : AthAlgorithm(name, pSvcLocator),
11 m_count(0),
13{
14 declareProperty("ContainerKey",m_containerKey="");
15 declareProperty("DumpFile",m_dumpFile="");
16}
17
21
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
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
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}
#define endmsg
static Double_t sc
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
Base class for LArDigits taken during calibration runs.
const LArOnlineID * m_onlineHelper
ReadTBLArCalibDigits(const std::string &name, ISvcLocator *pSvcLocator)
Liquid Argon Calibration Digit Container