8#include "GaudiKernel/IToolSvc.h"
27{ MsgStream log(msgSvc(), name());
28 log << MSG::INFO <<
"Initialize" <<
endmsg;
43 NTupleFilePtr file1(
ntupleSvc(),
"/NTUPLES/FILE1");
45 {log << MSG::ERROR <<
"Booking of NTuple failed" <<
endmsg;
46 return StatusCode::FAILURE;
48 NTuplePtr nt(
ntupleSvc(),
"/NTUPLES/FILE1/LARDIGITS");
50 nt=
ntupleSvc()->book(
"/NTUPLES/FILE1/LARDIGITS",CLID_ColumnWiseTuple,
"LArDigits");
53 {log << MSG::ERROR <<
"Booking of NTuple failed" <<
endmsg;
54 return StatusCode::FAILURE;
74 log << MSG::INFO <<
"======== ReadTBLArDigits initialize successfully ========" <<
endmsg;
75 return StatusCode::SUCCESS;
82 MsgStream log(msgSvc(), name());
85 log << MSG::DEBUG <<
"======== executing event "<<
m_count <<
" ========" <<
endmsg;
86 log << MSG::DEBUG <<
"Retrieving TBLArDigitContainer. Key= " <<
m_containerKey.value() <<
endmsg;
93 {log << MSG::FATAL <<
" Cannot read TBLArDigitContainer from StoreGate! key=" <<
m_containerKey.value() <<
endmsg;
94 return StatusCode::FAILURE;
99 log << MSG::DEBUG <<
"Sorting digits" <<
endmsg;
106 log << MSG::DEBUG <<
"Finished sorting" <<
endmsg;
107 unsigned cellCounter=0;
108 if (larDigitCont->
size()>0)
112 log << MSG::DEBUG <<
"Now loop over digits" <<
endmsg;
113 for (
const LArDigit* digit : *larDigitCont) {
115 log << MSG::DEBUG <<
"Get offline ID" <<
endmsg;
116 const Identifier id=cabling->cnvToIdentifier(chid);
117 const std::vector<short>& vSamples=digit->samples();
119 log << MSG::DEBUG <<
"Now find eta/phi (EM only right now)" <<
endmsg;
120 if (
m_emId->is_lar_em(
id)) {
124 }
else if (
m_fcalId->is_lar_fcal(
id)) {
128 }
else if (
m_hecId->is_lar_hec(
id)) {
137 log << MSG::DEBUG <<
"Store identifier arrays" <<
endmsg;
145 log << MSG::DEBUG <<
"Loop over samples" <<
endmsg;
146 int nSamples=vSamples.size();
147 for (
int i=0;i<nSamples && i<32;i++)
158 for (
int i=0;i<nSamples;i++) {
166 if (
sc!=StatusCode::SUCCESS) {
167 log << MSG::ERROR <<
"writeRecord failed" <<
endmsg;
168 return StatusCode::FAILURE;
172 log << MSG::INFO <<
"Event " <<
m_count <<
" contains " << cellCounter <<
" channels\n";
173 return StatusCode::SUCCESS;
177{ MsgStream log(msgSvc(), name());
180 log << MSG::INFO <<
"finalize ReadTBLArDigits" <<
endmsg;
181 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
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
Gaudi::Property< std::string > m_dumpFile
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
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
NTuple::Array< long > m_eta
Gaudi::Property< bool > m_printFebChan
NTuple::Item< long > m_cellIndex
NTuple::Item< long > m_Nsamples
Gaudi::Property< bool > m_printCellLoc
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)
Gaudi::Property< std::string > m_containerKey
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.