8#include "GaudiKernel/IToolSvc.h"
38{ MsgStream log(msgSvc(), name());
39 log << MSG::INFO <<
"Initialize" <<
endmsg;
54 NTupleFilePtr file1(
ntupleSvc(),
"/NTUPLES/FILE1");
56 {log << MSG::ERROR <<
"Booking of NTuple failed" <<
endmsg;
57 return StatusCode::FAILURE;
59 NTuplePtr nt(
ntupleSvc(),
"/NTUPLES/FILE1/LARDIGITS");
61 nt=
ntupleSvc()->book(
"/NTUPLES/FILE1/LARDIGITS",CLID_ColumnWiseTuple,
"LArDigits");
64 {log << MSG::ERROR <<
"Booking of NTuple failed" <<
endmsg;
65 return StatusCode::FAILURE;
85 log << MSG::INFO <<
"======== ReadTBLArDigits initialize successfully ========" <<
endmsg;
86 return StatusCode::SUCCESS;
93 MsgStream log(msgSvc(), name());
96 log << MSG::DEBUG <<
"======== executing event "<<
m_count <<
" ========" <<
endmsg;
104 {log << MSG::FATAL <<
" Cannot read TBLArDigitContainer from StoreGate! key=" <<
m_containerKey <<
endmsg;
105 return StatusCode::FAILURE;
110 log << MSG::DEBUG <<
"Sorting digits" <<
endmsg;
117 log << MSG::DEBUG <<
"Finished sorting" <<
endmsg;
118 unsigned cellCounter=0;
119 if (larDigitCont->
size()>0)
123 log << MSG::DEBUG <<
"Now loop over digits" <<
endmsg;
124 for (
const LArDigit* digit : *larDigitCont) {
126 log << MSG::DEBUG <<
"Get offline ID" <<
endmsg;
127 const Identifier id=cabling->cnvToIdentifier(chid);
128 const std::vector<short>& vSamples=digit->samples();
130 log << MSG::DEBUG <<
"Now find eta/phi (EM only right now)" <<
endmsg;
131 if (
m_emId->is_lar_em(
id)) {
135 }
else if (
m_fcalId->is_lar_fcal(
id)) {
139 }
else if (
m_hecId->is_lar_hec(
id)) {
148 log << MSG::DEBUG <<
"Store identifier arrays" <<
endmsg;
156 log << MSG::DEBUG <<
"Loop over samples" <<
endmsg;
157 int nSamples=vSamples.size();
158 for (
int i=0;i<nSamples && i<32;i++)
169 for (
int i=0;i<nSamples;i++) {
177 if (
sc!=StatusCode::SUCCESS) {
178 log << MSG::ERROR <<
"writeRecord failed" <<
endmsg;
179 return StatusCode::FAILURE;
183 log << MSG::INFO <<
"Event " <<
m_count <<
" contains " << cellCounter <<
" channels\n";
184 return StatusCode::SUCCESS;
188{ MsgStream log(msgSvc(), name());
191 log << MSG::INFO <<
"finalize ReadTBLArDigits" <<
endmsg;
192 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
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
const LArHEC_ID * m_hecId
std::string m_containerKey
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
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.