7#include "GaudiKernel/MsgStream.h"
80 for (
int k=0;k<23;k++)
82 for (
int i=0;i<64;i++)
91 if (
sc.isFailure()) {
msg (MSG::FATAL) <<
" Could not open mapping " <<
endmsg;
return sc; }
92 else msg (MSG::DEBUG) <<
" mapping is fine " <<
endmsg;
169 return StatusCode::SUCCESS;
184 if ( sc_read != StatusCode::SUCCESS ) {
185 msg(MSG::ERROR) <<
"ALFA_Raw2Digit: Could not find container" <<
endmsg;
186 return StatusCode::SUCCESS;
189 else if ( sc_read == StatusCode::SUCCESS ) {
190 msg(MSG::DEBUG) <<
"ALFA_Raw2Digit: Raw data container retrieved" <<
endmsg;
193 msg(MSG::DEBUG) <<
"MD record_collection()" <<
endmsg;
196 if (
sc.isFailure()) {
197 msg(MSG::WARNING) <<
"ALFA_Raw2Digit: recordCollection failed" <<
endmsg;
198 return StatusCode::SUCCESS;
201 msg(MSG::DEBUG) <<
"OD record_collection()" <<
endmsg;
204 if (
sc.isFailure()) {
205 msg(MSG::WARNING) <<
"ALFA_Raw2Digit, recordODCollection failed" <<
endmsg;
206 return StatusCode::SUCCESS;
210 for (
unsigned int i=0;i<8;i++) {
212 for (
unsigned int j=0;j<20;j++) {
214 for (
unsigned int k=0;k<64;k++) {
218 for (
unsigned int k=0;k<16;k++) {
235 for(;RawData_Collection_Beg!=RawData_Collection_End; ++RawData_Collection_Beg)
237 m_mbID = ((*RawData_Collection_Beg)->GetMBId_POT());
253 for (
unsigned int i=0;i<16;i++) {
262 for(;p_RawData_Beg!=p_RawData_End; ++p_RawData_Beg)
266 if ((*p_RawData_Beg)->GetPMFId_PMF()>0 && ((*p_RawData_Beg)->GetWordId_PMF())<24)
268 m_pmfID= (*p_RawData_Beg)->GetPMFId_PMF();
274 msg(MSG::DEBUG) <<
" pmfId = " << (*p_RawData_Beg)->GetPMFId_PMF() <<
", MBId = " << (*p_RawData_Beg)->GetMBId_PMF() <<
endmsg;
279 for (
unsigned int i=0;i<16;i++)
281 if ((*p_RawData_Beg)->Get_Chan(i)!=100)
283 msg(MSG::DEBUG) <<
"ALFA_Raw2Digit, maroc chanel # = " << (*p_RawData_Beg)->Get_Chan(i)<<
endmsg;
285 m_fibID = (*p_RawData_Beg)->Get_Chan(i);
322 msg(MSG::DEBUG) <<
"ALFA_Raw2Digit: new digit (softsim numbering-starting from 0) in the collection, pot = " <<
m_pot <<
", plate = " <<
m_plate <<
", fiber = " <<
m_fiber <<
endmsg;
359 msg(MSG::DEBUG) <<
"ALFA_Raw2Digit: new OD digit (softsim numbering-starting from 0) in the collection, pot = " <<
m_ODpot <<
", side = " <<
m_ODside <<
", plate = " <<
m_ODplate <<
", fiber = " <<
m_ODfiber <<
endmsg;
367 msg(MSG::DEBUG) <<
"ALFA_Raw2Digit: More than n Raw Data " <<
endmsg;
372 msg(MSG::DEBUG) <<
"ALFA_Raw2Digit: finish loop over raw data " <<
endmsg;
375 msg(MSG::DEBUG) <<
"ALFA_Raw2Digit: finish loop over collection " <<
endmsg;
379 return StatusCode::SUCCESS;
476 return StatusCode::SUCCESS;
482 msg(MSG::DEBUG) <<
" ALFA_Digitization::recordCollection " <<
endmsg;
487 if (
sc.isFailure()) {
msg (MSG::FATAL) <<
" MD - Could not record the empty digit collection in StoreGate " <<
endmsg;
return sc; }
488 else msg (MSG::DEBUG) <<
" MD - Digit collection is recorded in StoreGate " <<
endmsg;
495 msg(MSG::DEBUG) <<
" ALFA_Digitization::recordODCollection " <<
endmsg;
500 if (
sc.isFailure()) {
msg (MSG::FATAL) <<
" OD - Could not record the empty digit collection in StoreGate " <<
endmsg;
return sc; }
501 else msg (MSG::DEBUG) <<
" OD - Digit collection is recorded in StoreGate " <<
endmsg;
520 int OD_MaPmtChan = 0;
538 for (
unsigned int j=0; j<8; j++)
546 m_mapname =
"ALFA_Raw2Digit/MAROC_MAPMT_FIBER_NEW_MD_";
555 if(filePath.length() == 0)
557 msg(MSG::FATAL) <<
" the mapping file MD maroc-mapmt \"" <<
m_mapname.c_str() <<
"\" not found in Datapath." <<
endmsg;
558 throw std::runtime_error(
"FATAL: mapping MD maroc-mapmt not found in Datapath.");
562 msg(MSG::DEBUG) <<
"DEBUG: the mapping file MD maroc-mapmt \"" <<
m_mapname.c_str() <<
"\" found in Datapath." <<
endmsg;
563 msg(MSG::DEBUG) <<
"DEBUG: filePath = " << filePath.c_str() <<
endmsg;
573 for (
unsigned int i=0;i<1280;i++){
575 m_inChan >> iLayer >> MarChan >> MapChan >> FibChan;
577 msg(MSG::DEBUG) << i <<
" maroc_mapmt_fiber, layer = " << iLayer <<
", maroc = " << MarChan <<
", map = "<< MapChan <<
", fib = " << FibChan <<
endmsg;
579 if ((MarChan < 0) || (MarChan > 63))
581 std::string s1(
"MarChan out of range; file corrupted");
582 throw std::runtime_error(s1);
585 if ((MapChan < 0) || (MapChan > 63))
587 std::string s2(
"MapChan out of range; file corrupted");
588 throw std::runtime_error(s2);
591 if ((iLayer < 0) || (iLayer > 19))
593 std::string s2(
"Layer out of range; file corrupted");
594 throw std::runtime_error(s2);
609 return StatusCode::FAILURE;
613 m_mapname =
"ALFA_Raw2Digit/PMF_LAYER_MD";
620 if(filePath.length() == 0)
622 msg(MSG::FATAL) <<
" the mapping file PMF_LAYER_MD \"" <<
m_mapname.c_str() <<
"\" not found in Datapath." <<
endmsg;
623 throw std::runtime_error(
"FATAL: mapping PMF_LAYER_MD not found in Datapath.");
627 msg(MSG::DEBUG) <<
"DEBUG: the mapping file PMF_LAYER_MD \"" <<
m_mapname.c_str() <<
"\" found in Datapath." <<
endmsg;
628 msg(MSG::DEBUG) <<
"DEBUG: filePath = " << filePath.c_str() <<
endmsg;
632 m_inPMF.open(filePath.c_str());
635 for (
unsigned int i=0;i<20;i++)
638 msg(MSG::DEBUG) << i <<
" pmf2layer, pmf = " << PMFNum <<
", layer = "<< LAYNum <<
endmsg;
640 if ((PMFNum < 0) || ( PMFNum > 22))
642 std::string s3(
"PMFNum out of range; file corrupted");
643 throw std::runtime_error(s3);
655 return StatusCode::FAILURE;
666 if(filePath.length() == 0)
668 msg(MSG::FATAL) <<
" the mapping file OD_MAP \"" <<
m_mapname.c_str() <<
"\" not found in Datapath." <<
endmsg;
669 throw std::runtime_error(
"FATAL: mapping OD_MAP not found in Datapath.");
673 msg(MSG::DEBUG) <<
"DEBUG: the mapping file OD_MAP \"" <<
m_mapname.c_str() <<
"\" found in Datapath." <<
endmsg;
674 msg(MSG::DEBUG) <<
"DEBUG: filePath = " << filePath.c_str() <<
endmsg;
678 m_inOD.open(filePath.c_str());
681 for(
unsigned int jlay=0; jlay<3; jlay++)
683 for(
unsigned int jside=0; jside<2; jside++)
685 for(
unsigned int jch=0; jch<32; jch++)
687 m_inOD >> OD_PMFNum >> OD_Dieter >> OD_LAYNum >> OD_Side >> OD_MaPmtChan >> OD_FibChan;
688 msg(MSG::DEBUG) <<
" pmf2layer, OD_PMFNum = " << OD_PMFNum <<
", OD_Dieter = "<< OD_Dieter <<
", OD_LAYNum = " << OD_LAYNum <<
", OD_Side = " << OD_Side <<
", OD_MaPmtChan = " << OD_MaPmtChan <<
", OD_FibChan = " << OD_FibChan <<
endmsg;
690 if ((OD_PMFNum < 2) || ( OD_PMFNum > 4))
692 std::string s4(
"OD_PMFNum out of range; file corrupted");
693 throw std::runtime_error(s4);
696 if ((OD_MaPmtChan < 1) || ( OD_MaPmtChan > 64))
698 std::string s5(
"OD_MaPmtChan out of range; file corrupted");
699 throw std::runtime_error(s5);
709 if ((OD_LAYNum > 0) && ( OD_LAYNum < 4))
716 msg(MSG::DEBUG) <<
"OD_LAYNum out of bounds" <<
endmsg;
730 return StatusCode::FAILURE;
734 return StatusCode::SUCCESS;
743 if (
int(fmod(
double(
m_maroc2mapmt[pot_n][iLayer][MarChan]+1),
double(8)))>0)
748 chan_j=9-int(fmod(
double(
m_maroc2mapmt[pot_n][iLayer][MarChan]+1),
double(8)));
758 return StatusCode::SUCCESS;
std::string PathResolverFindDataFile(const std::string &logical_file_name)
bool m_fiber_b[8][20][64]
StatusCode recordODCollection()
int m_OD_pmf_maroc2fiber[8][4][64]
int m_mapmt2maroc[8][20][64]
uint32_t m_lumi_block_old
std::string m_ALFA_RawDataCollectionKey
bool m_trigger_pattern_b[8][16]
ALFA_Digit * m_digitObject
ALFA_DigitCollection * m_digitCollection
ALFA_ODDigit * m_ODdigitObject
ALFA_Raw2Digit(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode recordCollection()
ALFA_ODDigitCollection * m_ODdigitCollection
TH2D * m_All_Trigger_norm
std::string m_key_ODDigitCollection
std::string m_key_DigitCollection
int m_OD_pmf_maroc2side[8][4][64]
Int_t m_pmf_chan_hit_counter[8][23][64]
int m_maroc2fiber[8][20][64]
int m_maroc2mapmt[8][20][64]
StatusCode ChanPlot(uint32_t pot_n, uint32_t iLayer, uint32_t MarChan, uint32_t &chan_i, uint32_t &chan_j)
Int_t m_n_hits_lay[8][20]
std::string m_strMeasuredDataType
This container provides acces to the PMF RDOs.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
DataModel_detail::const_iterator< DataVector > const_iterator