9 static const InterfaceID IID_ILArABBADecoder(
"LArABBADecoder", 1, 0);
18 declareInterface< LArABBADecoder >(
this );
23 {
return IID_ILArABBADecoder; }
31 return StatusCode::SUCCESS;
35 return StatusCode::SUCCESS;
47 ATH_MSG_WARNING(
"Exception while checking eformat fragment validity: " << ex.what() );
52 return StatusCode::FAILURE;
56 std::map<eformat::SubDetectorGroup, std::vector<const uint32_t*> > robIndex;
57 eformat::helper::build_toc(*
re, robIndex );
58 for (
auto mapit : robIndex) std::cout <<
"Rob Index subdetgroup is " << std::hex << mapit.first << std::endl;
59 std::map<eformat::SubDetectorGroup, std::vector<const uint32_t*> >::const_iterator robIt = robIndex.find(
eformat::LAR);
60 if (robIt!=robIndex.end()) {
61 const std::vector<const uint32_t*>&
robs = robIt->second;
69 ATH_MSG_WARNING (
" exception thrown by ROBFragment, badly corrupted event. Abort decoding " );
75 return StatusCode::SUCCESS;
85 uint32_t nData = robFrag->rod_ndata();
89 <<
"Empty ROD block (less than 3 words) for source ID " << robFrag->rod_source_id() );
94 robFrag->rod_source_id();
97 unsigned int n = robFrag->payload_size_word();
100 std::vector<std::string> string;
104 for(
unsigned int s=1;
s<
n-13;
s+=6) {
107 for (
unsigned int k=0;
k<6;++
k){
110 std::ostringstream oss;
111 oss << std::hex <<
x;
112 if (oss.str().size() == 7){
122 string.push_back(
ss);
128 constexpr
int nFibers = 20;
129 constexpr
int nchannels = 8;
130 constexpr
int Nabbachannels = nFibers * nchannels;
132 constexpr
int fiberSeq[16] = {0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1};
133 constexpr
int adcSeq[16] = {1,0,1,0,3,2,3,2,5,4,5,4,7,6,7,6};
135 std::vector< std::vector< std::vector<int> > > abbasamples;
136 abbasamples.resize(nFibers);
138 std::vector<std::vector<short>> abba_channel_samples;
139 abba_channel_samples.resize(Nabbachannels);
141 for (
int fib=0;fib < nFibers; ++fib){
142 abbasamples[fib].resize(nchannels);
143 for (
int ch = 0;
ch < nchannels; ++
ch){
145 int Nchannel = fib*8 +
ch;
146 abba_channel_samples[Nchannel].resize(
nsamples);
152 for (
int fib=0;fib < nFibers; fib+=2){
153 for (
int sam=0; sam <
nsamples; sam++){
155 const std::string &wx =
string[zx];
157 for (
int m = 0;
m < 16; ++
m){
158 int fiber_number = fiberSeq[
m];
159 int adc_number = adcSeq[
m];
161 std::stringstream
ss;
164 for (
int j =
idx; j <
idx+3; ++j){
172 ss >> std::hex >> mysample_int;
173 int fb = fiber_number+fib;
175 int abbachannel = fb*8+
ch;
182 abbasamples[fb][
ch][sam] = mysample_int;
183 abba_channel_samples[abbachannel][sam] = mysample_int;
191 std::map<int, HWIdentifier> abba_mapping;
195 switch (robFrag->rod_source_id())
214 msg(MSG::ERROR) <<
"ROD_source_id not found" <<
endmsg;
284 for (std::size_t index_abba_channel_samples = 0; index_abba_channel_samples < abba_channel_samples.size(); ++index_abba_channel_samples) {
285 auto abba_mapping_search = abba_mapping.find(index_abba_channel_samples);
286 if (abba_mapping_search == abba_mapping.end()) {
287 msg(MSG::WARNING) <<
"No mapping for index_abba_channel_samples: "<<std::dec<<index_abba_channel_samples <<
endmsg;
291 HWIdentifier channelID = (*abba_mapping_search).second;
293 std::vector<short> adcValues = abba_channel_samples[index_abba_channel_samples];
295 scDigit=
new LArDigit(channelID,dummyGain,std::move(adcValues));