8#include "GaudiKernel/IToolSvc.h"
11#include "GaudiKernel/ThreadLocalContext.h"
39{ MsgStream log(msgSvc(), name());
40 log << MSG::INFO <<
"Initialize" <<
endmsg;
55 NTupleFilePtr file1(
ntupleSvc(),
"/NTUPLES/FILE1");
57 {log << MSG::ERROR <<
"Booking of NTuple failed" <<
endmsg;
58 return StatusCode::FAILURE;
60 NTuplePtr nt(
ntupleSvc(),
"/NTUPLES/FILE1/LARDIGITS");
62 nt=
ntupleSvc()->book(
"/NTUPLES/FILE1/LARDIGITS",CLID_ColumnWiseTuple,
"LArDigits");
65 {log << MSG::ERROR <<
"Booking of NTuple failed" <<
endmsg;
66 return StatusCode::FAILURE;
86 log << MSG::INFO <<
"======== ReadTBLArDigits initialize successfully ========" <<
endmsg;
87 return StatusCode::SUCCESS;
93 const EventContext& ctx = Gaudi::Hive::currentContext();
95 MsgStream log(msgSvc(), name());
98 log << MSG::DEBUG <<
"======== executing event "<<
m_count <<
" ========" <<
endmsg;
106 {log << MSG::FATAL <<
" Cannot read TBLArDigitContainer from StoreGate! key=" <<
m_containerKey <<
endmsg;
107 return StatusCode::FAILURE;
112 log << MSG::DEBUG <<
"Sorting digits" <<
endmsg;
119 log << MSG::DEBUG <<
"Finished sorting" <<
endmsg;
120 unsigned cellCounter=0;
121 if (larDigitCont->
size()>0)
125 log << MSG::DEBUG <<
"Now loop over digits" <<
endmsg;
126 for (
const LArDigit* digit : *larDigitCont) {
128 log << MSG::DEBUG <<
"Get offline ID" <<
endmsg;
129 const Identifier id=cabling->cnvToIdentifier(chid);
130 const std::vector<short>& vSamples=digit->samples();
132 log << MSG::DEBUG <<
"Now find eta/phi (EM only right now)" <<
endmsg;
133 if (
m_emId->is_lar_em(
id)) {
137 }
else if (
m_fcalId->is_lar_fcal(
id)) {
141 }
else if (
m_hecId->is_lar_hec(
id)) {
150 log << MSG::DEBUG <<
"Store identifier arrays" <<
endmsg;
158 log << MSG::DEBUG <<
"Loop over samples" <<
endmsg;
159 int nSamples=vSamples.size();
160 for (
int i=0;i<nSamples && i<32;i++)
171 for (
int i=0;i<nSamples;i++) {
179 if (
sc!=StatusCode::SUCCESS) {
180 log << MSG::ERROR <<
"writeRecord failed" <<
endmsg;
181 return StatusCode::FAILURE;
185 log << MSG::INFO <<
"Event " <<
m_count <<
" contains " << cellCounter <<
" channels\n";
186 return StatusCode::SUCCESS;
190{ MsgStream log(msgSvc(), name());
193 log << MSG::INFO <<
"finalize ReadTBLArDigits" <<
endmsg;
194 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
const ServiceHandle< StoreGateSvc > & detStore() const
Helper class for offline cell identifiers.
const LArFCAL_ID * fcal_idHelper() const
access to FCAL idHelper
const LArEM_ID * em_idHelper() const
access to EM idHelper
const LArHEC_ID * hec_idHelper() const
access to HEC idHelper
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
const T * front() const
Access the first element in the collection as an rvalue.
size_type size() const noexcept
Returns the number of elements in the collection.
Liquid Argon digit base class.
const std::vector< short > & samples() const
const LArOnlineID * m_onlineHelper
SortDigits(const LArOnlineID *onlineHelper)
NTuple::Array< long > m_phi
const LArFCAL_ID * m_fcalId
virtual StatusCode initialize() override
virtual StatusCode finalize() override
NTuple::Array< long > m_slot
NTuple::Array< long > m_pos_neg
virtual StatusCode execute() override
const LArHEC_ID * m_hecId
std::string m_containerKey
NTuple::Array< long > m_eta
NTuple::Item< long > m_cellIndex
NTuple::Item< long > m_Nsamples
NTuple::Array< long > m_barrel_ec
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
NTuple::Array< long > m_layer
NTuple::Array< long > m_gain
const LArOnlineID * m_onlineHelper
ReadTBLArDigits(const std::string &name, ISvcLocator *pSvcLocator)
NTuple::Tuple * m_ntuplePtr
NTuple::Matrix< long > m_samples
NTuple::Array< long > m_FT
NTuple::Array< long > m_channel
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.