ATLAS Offline Software
LArRodBlockPhysicsV6.cxx
Go to the documentation of this file.
1 //Dear emacs, this is -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // Implementation of a LArRODBlockStructure class
8 // This version contains LArDigits in fixed gain.
9 // See .h file for more details.
10 
11 #include "GaudiKernel/MsgStream.h"
13 //#include <cstdio>
14 #include "LArRawEvent/LArDigit.h"
16 #include "StoreGate/StoreGateSvc.h"
17 #include "GaudiKernel/Bootstrap.h"
18 #include "GaudiKernel/ISvcLocator.h"
19 #include <iostream>
20 
21 //#define LARBSDBGOUTPUT
22 #ifdef LARBSDBGOUTPUT
23 #define MYLEVEL (MSG::FATAL)
24 #define LARBSDBG(text) logstr<<MYLEVEL<<text<<endmsg
25 #else
26 #define LARBSDBG(text)
27 #endif
28 
29 //int mycheck_tot=0;
30 //int mycheck_err=0;
31 
32 namespace {
33 union ShortLong {
34  uint16_t s[2];
35  uint32_t l;
36 };
37 }
38 
41  m_onlineHelper(nullptr)
42 {
43  m_iHeadBlockSize=endtag/2; // The implicit cast rounds down to the right size
49  m_OffTimeCut=0; //FIXME: Nowhere set to a sensible value ???
51  // retrieve onlineHelper
52  SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service("DetectorStore")};
53  if (!detStore) {
54  std::cout << "Unable to locate DetectorStore" << std::endl;
55  std::abort();
56  }
57  StatusCode sc = detStore->retrieve(m_onlineHelper, "LArOnlineID");
58  if (sc.isFailure()) {
59  std::cout << "Could not get LArOnlineID helper !" << std::endl;
60  std::abort();
61  }
62 }
63 
64 
66 {
67  m_EnergyIndex=0;
69  m_DigitsIndex=0;
72 
73  m_GainPointer=0;
76  m_RaddPointer=0;
78  m_SumPointer=0;
83 }
84 
86 {
88  {
89  int off = -8;
90  int ns = getHeader16(NSamples) & 0xff;
91  if (m_requiredNSamples > 0 && m_requiredNSamples != ns) return false;
92  int radd = (ns+1)/2;
93  int dim1 = getHeader16(ResultsDim1);
94  int off1 = getHeader16(ResultsOff1);
95  int off2 = getHeader16(ResultsOff2);
96  int dim2 = getHeader16(ResultsDim2);
97  int off3 = getHeader16(RawDataBlkOff);
98  int dim3 = getHeader16(RawDataBlkDim);
99  if ( !(ns&0x1) ) radd++;
100 
101  if (off1 && dim1+off1+off<m_FebBlockSize) {
102  off1 += off;
103  if (dim1>=8)
104  m_GainPointer=(const uint32_t*)(m_FebBlock+off1);
105  if (dim1>=12)
107  if (dim1>=16)
108  m_MaskDigitsPointer=(const uint32_t*)(m_FebBlock+off1+12);
109  if (dim1>=16+radd)
110  m_RaddPointer=(const uint16_t*)(m_FebBlock+off1+16);
111  if (dim1>=80+radd)
112  m_EnergyPointer=(const uint16_t*) (m_FebBlock+off1+16+radd);
113  if (dim1>=84+radd)
114  m_SumPointer=(const int32_t*)(m_FebBlock+off1+80+radd);
115  if (dim1>84+radd)
116  m_TimeQualityPointer=(const uint16_t*)(m_FebBlock+off1+84+radd);
117  off1 -= off;
118  }
119  if (off2 && dim2+off2+off<m_FebBlockSize) {
120  m_DigitsPointer=(const uint16_t*)(m_FebBlock+off2+off);
121  }
122  if (off3 && dim3+off3+off<m_FebBlockSize) {
123  m_RawDataPointer=(const uint16_t*)(m_FebBlock+off3+off);
124  }
125 
126  // Check for offsets problems
127  uint32_t problem = 0;
128  int n1, n2;
129  int n1_tmp, n2_tmp;
130  int off1_tmp, dim1_tmp;
131  int off2_tmp, dim2_tmp;
132  int off3_tmp, dim3_tmp;
133  if(off1==0) {
134  n1 = n2 = 0;
135  n1_tmp = n2_tmp =0;
136  off1_tmp = dim1_tmp = 0;
137  off2_tmp = dim2_tmp = 0;
138  off3_tmp = dim3_tmp = 0;
139  }
140  else {
141  m_RaddPointer=(const uint16_t*)(m_FebBlock+26);
144  n1 = getNbSweetCells1();
145  n2 = getNbSweetCells2();
146  n1_tmp = getNbSweetCells1FromMask();
147  n2_tmp = getNbSweetCells2FromMask();
148  off1_tmp = 10-off;
149  dim1_tmp = 84+(ns+1)/2+n1;
150  if ( !(ns&0x1) ) dim1_tmp++;
151  if ( m_requiredNSamples > 0 ){
152  dim1_tmp = 84 +(m_requiredNSamples+1)/2+n1;
153  if ( !(m_requiredNSamples&0x1) ) dim1_tmp++;
154  }
155  off2_tmp = off1_tmp+dim1_tmp;
156  dim2_tmp = (n2*ns+1)/2;
157  off3_tmp = off2_tmp+dim2_tmp;
158  dim3_tmp = getNumberOfWords()-3-off3_tmp-off;
159  if(dim2_tmp==0) off2_tmp = 0;
160  if(dim3_tmp==0) off3_tmp = 0;
161  }
162 
163  if(off1 != off1_tmp) problem=1;
164  if(dim1 != dim1_tmp) problem=2;
165  if(off2 != off2_tmp) problem=3;
166  if(dim2 != dim2_tmp) problem=4;
167  if(off3 != off3_tmp) problem=5;
168  if(dim3 != dim3_tmp) problem=6;
169  if(n1 != n1_tmp) problem=7;
170  if(n2 != n2_tmp) problem=8;
171  if (m_requiredNSamples > 0 &&
172  getHeader32(NGains) != (uint32_t)0x10000 + m_requiredNSamples) problem=9;
173  //if(getHeader32(NGains)!=0x10000 + (unsigned int)ns) problem=9;
174  //if(getHeader32(InFPGAFormat)!=1) problem=10;
175  //if(m_FebBlock[getNumberOfWords()-2]!=0x12345678) problem=11;
176 
177  if(problem) { // Try to recompute offsets
178  std::cout << "LArByteStreamProblem " << problem << std::endl;
179  std::cout << "NSamples = " << std::dec << ns << std::endl;
180  std::cout << "getHeader32(NGains) = " << std::hex << getHeader32(NGains) << std::endl;
181  std::cout << "NWTot: " << std::hex << getNumberOfWords() << " n1=" << n1 << " (" << n1_tmp << ") n2=" << n2 << " (" << n2_tmp << ")" << std::endl;
182  std::cout << "Found 1: " << off1 << " " << dim1 << std::endl;
183  std::cout << "Found 2: " << off2 << " " << dim2 << std::endl;
184  std::cout << "Found 3: " << off3 << " " << dim3 << std::dec << std::endl;
185 
186  if(n1==n1_tmp && n2==n2_tmp) { // Check consistency of cells above threshold
187  off1 = off1_tmp;
188  dim1 = dim1_tmp;
189  off2 = off2_tmp;
190  dim2 = dim2_tmp;
191  off3 = off3_tmp;
192  dim3 = dim3_tmp;
193  std::cout << "Recomputed 1: " << std::hex << off1 << " " << dim1 << std::endl;
194  std::cout << "Recomputed 2: " << off2 << " " << dim2 << std::endl;
195  std::cout << "Recomputed 3: " << off3 << " " << dim3 << std::dec << std::endl;
196 
197  if (off1 && dim1+off1+off<m_FebBlockSize) {
198  off1 += off;
199  if (dim1>=8)
200  m_GainPointer=(const uint32_t*)(m_FebBlock+off1);
201  if (dim1>=12)
203  if (dim1>=16)
204  m_MaskDigitsPointer=(const uint32_t*)(m_FebBlock+off1+12);
205  if (dim1>=16+radd)
206  m_RaddPointer=(const uint16_t*)(m_FebBlock+off1+16);
207  if (dim1>=80+radd)
208  m_EnergyPointer=(const uint16_t*) (m_FebBlock+off1+16+radd);
209  if (dim1>=84+radd)
210  m_SumPointer=(const int32_t*)(m_FebBlock+off1+80+radd);
211  if (dim1>84+radd)
212  m_TimeQualityPointer=(const uint16_t*)(m_FebBlock+off1+84+radd);
213  }
214  if (off2 && dim2+off2+off<m_FebBlockSize) {
215  m_DigitsPointer=(const uint16_t*)(m_FebBlock+off2+off);
216  }
217  if (off3 && dim3+off3+off<m_FebBlockSize) {
218  m_RawDataPointer=(const uint16_t*)(m_FebBlock+off3+off);
219  }
220  }
221  }
222 
223  problem=0;
224  // Recheck offsets
225  if(off1< off2 && off1 + dim1 > off2) problem = 1;
226  if(off1< off3 && off1 + dim1 > off3) problem = 2;
227  if(off2< off1 && off2 + dim2 > off1) problem = 3;
228  if(off2< off3 && off2 + dim2 > off3) problem = 4;
229  if(off3< off1 && off3 + dim3 > off1) problem = 5;
230  if(off3< off2 && off3 + dim3 > off2) problem = 6;
231 
232  if(problem) {
233  resetPointers();
234  std::cout << "LArByteStreamProblem " << problem << std::endl;
235  std::cout << "Unrecoverable problem" << std::endl;
236  }
237 
238  //uint32_t febId = getHeader32(FEBID);
239  //uint32_t onCheck = onlineCheckSum();
240  //uint32_t offCheck = offlineCheckSum();
241  //
242  //mycheck_tot++;
243  //if(onCheck!=offCheck)
244  //{
245  // mycheck_err++;
246  // std::cout << "FebID checksum " << std::hex << febId << std::endl;
247  // std::cout << "Online checksum " << std::hex << onCheck << " Offline checksum " << offCheck << std::dec << std::endl;
248  // std::cout << "Diff1 checksum " << std::hex << onCheck-offCheck << " Diff2 checksum " << offCheck-onCheck << std::dec << std::endl;
249  // double x=mycheck_err/((double) mycheck_tot)*100.0;
250  // std::cout << "Number of FEB in error: " << mycheck_err << " / " << mycheck_tot << " = " << x << " %" << std::endl;
251  //}
252 
253  //
254  //if(febId==0x3b1b8000 || febId==0x398b0000 || febId==0x3a988000) {
255  //if(onCheck!=offCheck) {
256  // std::cout << "***********************************************************************"<< std::endl;
257  // std::cout << "Problem :" << problem << std::endl;
258  // std::cout << "Header values :"<< std::endl;
259  // std::cout << "************************************************************************"<< std::endl;
260  // std::cout << "FebBlockSize = " << m_FebBlockSize << std::endl;
261  // std::cout << "EnergyIndex = " << m_EnergyIndex << std::endl;
262  // std::cout << "TimeQualityIndex = " << m_TimeQualityIndex << std::endl;
263  // std::cout << "DigitsIndex = " << m_DigitsIndex << std::endl;
264  // std::cout << "DigitsChannel = " << m_DigitsChannel << std::endl;
265  // std::cout << "RawDataIndex = " << m_RawDataIndex << std::endl;
266  // std::cout << "GainPointer = " << m_GainPointer << std::endl;
267  // std::cout << "MaskTimeQualityPointer = " << m_MaskTimeQualityPointer << std::endl;
268  // std::cout << "MaskDigitsPointer = " << m_MaskDigitsPointer << std::endl;
269  // std::cout << "RaddPointer = " << m_RaddPointer << std::endl;
270  // std::cout << "EnergyPointer = " << m_EnergyPointer << std::endl;
271  // std::cout << "SumPointer = " << m_SumPointer << std::endl;
272  // std::cout << "TimeQualityPointer = " << m_TimeQualityPointer << std::endl;
273  // std::cout << "DigitsPointer = " << m_DigitsPointer << std::endl;
274  // std::cout << "RawDataPointer = " << m_RawDataPointer << std::endl;
275  // std::cout << "numberHotCell = " << std::dec << getNbSweetCells1() << " " << getNbSweetCells2() << std::endl;
276  // std::cout << "Fragment @ = 0x" << std::hex << m_FebBlock << std::endl;
277  // std::cout << "NWTot = " << std::dec << getNumberOfWords() << std::endl;
278  // std::cout << "FebID = 0x" << std::hex << getHeader32(FEBID) << std::endl;
279  // std::cout << "FebSN = 0x" << std::hex << getHeader32(FEB_SN) << std::endl;
280  // std::cout << "ResultsOff1 = 0x" << std::hex << getHeader16(ResultsOff1) << std::endl;
281  // std::cout << "ResultsDim1 = 0x" << std::hex << getHeader16(ResultsDim1) << std::endl;
282  // std::cout << "ResultsOff2 = 0x" << std::hex << getHeader16(ResultsOff2) << std::endl;
283  // std::cout << "ResultsDim2 = 0x" << std::hex << getHeader16(ResultsDim2) << std::endl;
284  // std::cout << "RawDataBlkOff = 0x" << std::hex << getHeader16(RawDataBlkOff) << std::endl;
285  // std::cout << "RawDataBlkDim = 0x" << std::hex << getHeader16(RawDataBlkDim) << std::endl;
286  // std::cout << "Event status = 0x" << std::hex << getStatus() << std::dec << std::endl;
287  // std::cout << "************************************************************************"<< std::dec << std::endl;
288  // int size = getNumberOfWords();
289  // for(int i=0;i<size;i++) {
290  // std::cout << std::hex << i << " : " << std::hex << m_FebBlock+i << " : " << std::hex << m_FebBlock[i] << std::endl;
291  // }
292  //}
293 
294  }
295 
296  return true;
297 }
298 
299 int LArRodBlockPhysicsV6::getNextRawData(int& channelNumber, std::vector<short>& samples, uint32_t& gain)
300 {
301 #ifdef LARBSDBGOUTPUT
302  MsgStream logstr(Athena::getMessageSvc(), BlockType());
303  //Debug output
304  logstr << MYLEVEL << "Let s go in getNextRawData..." << endmsg;
305  logstr << MYLEVEL << "GetNextRawData for FEB 0x" << MSG::hex << (uint32_t)getHeader32(FEBID) << MSG::dec << endmsg;
306  logstr << MYLEVEL << "m_RawDataPointer=" << m_RawDataPointer << " m_RawDataIndex="<< m_RawDataIndex
307  << " m_channelsPerFEB=" << m_channelsPerFEB << endmsg;
308 #endif
309 
310  if (m_RawDataIndex>=m_channelsPerFEB) { //Already beyond maximal number of channels
311 #ifdef LARBSDBGOUTPUT
312  logstr << MYLEVEL << "Maximum number of channels reached" << endmsg;
313 #endif
314  return 0;
315  }
316  //const uint16_t block = getHeader16(m_RawDataOff);//Position of the raw FEB data block
317  if (!m_RawDataPointer) { //Block does not exist
318  // Try to get samples and gain from getNextDigits
319  return getNextDigits(channelNumber,samples,gain);
320  }
321 
322  // Get next channel
323  unsigned rodChannelNumber=m_RawDataIndex; // Index of Channel in ROD-Block
324  channelNumber=((rodChannelNumber&0xe)<<2) + ((rodChannelNumber&0x1)<<6) + (rodChannelNumber>>4); //channel number of the FEB
325  //channelNumber=(rodChannelNumber>>4) + ((rodChannelNumber&0xf)<<3); //channel number of the FEB
326  uint32_t febgain;
327  const unsigned int nsamples = getHeader16(NSamples) & 0xff;
328  const unsigned int ngains = getHeader16(NGains);
329 
330 #ifdef LARBSDBGOUTPUT
331  logstr << MYLEVEL << "This FEB has " << nsamples << " samples" << endmsg;
332  logstr << MYLEVEL << "This FEB has " << ngains << " gains" << endmsg;
333 #endif
334 
335  if(ngains==0 || nsamples==0) return 0;
336  int s_size = nsamples+1;
337  int offset = (10+nsamples)&0xfffc;
338  int index;
339  index = s_size*m_RawDataIndex + offset;
340  uint16_t s[2];
341  //for(unsigned int i=0;i<nsamples+1;i++) {
342  // if(m_RawDataPointer[index+i]>>14) {
343  // std::cout << "Trying to decode strange raw data value: " << std::hex << m_RawDataPointer[index+i] << std::dec << std::endl;
344  // }
345  //}
346  if((nsamples+1)&0x7) {
347  s[0] = m_RawDataPointer[index++]>>2;
348  febgain = m_RawDataPointer[index++];
349  samples.push_back(s[0]);
350  for(unsigned int i=0;i<nsamples/2;i++) {
351  s[1] = m_RawDataPointer[index++]>>2;
352  s[0] = m_RawDataPointer[index++]>>2;
353  samples.push_back(s[0]);
354  samples.push_back(s[1]);
355  }
356  } // End of check for 5 samples
357  else {
358  if (!(m_RawDataIndex%2)) {
359  s[0] = m_RawDataPointer[index++]>>2;
360  febgain = m_RawDataPointer[index++];
361  samples.push_back(s[0]);
362  for(unsigned int i=0;i<nsamples/2;i++) {
363  s[1] = m_RawDataPointer[index++]>>2;
364  s[0] = m_RawDataPointer[index++]>>2;
365  samples.push_back(s[0]);
366  samples.push_back(s[1]);
367  }
368  } else {
369  for(unsigned int i=0;i<nsamples/2;i++) {
370  s[1] = m_RawDataPointer[index++]>>2;
371  s[0] = m_RawDataPointer[index++]>>2;
372  samples.push_back(s[0]);
373  samples.push_back(s[1]);
374  }
375  febgain = m_RawDataPointer[index++];
376  s[0] = m_RawDataPointer[index++]>>2;
377  samples.push_back(s[0]);
378  }
379  } // End of >5 check
380  gain=RawToOfflineGain(febgain);
381 
382 #ifdef LARBSDBGOUTPUT
383  logstr << MYLEVEL << " ===> ROD Channel = " << m_RawDataIndex << endmsg;
384  logstr << MYLEVEL << " ===> FEB Channel = " << channelNumber << endmsg;
385  logstr << MYLEVEL << " ===> Gain = " << gain << endmsg;
386  for(int i=0;i<nsamples;i++)
387  logstr << MYLEVEL << " ===> sample " << i << " = " << samples[i] << endmsg;
388  int n = m_RawDataIndex;
389  int32_t e,t,q;
390  uint32_t g;
392 #endif
393  //std::cout << "Gain= " << gain << " Febgain=" << febgain << std::endl;
394  ++m_RawDataIndex;
395  unsigned rearrangeFirstSample=0;
397  rearrangeFirstSample=m_rearrangeFirstSample; //Overwrite by jobOptions
398  else
399  rearrangeFirstSample=getFirstSampleIndex();
400  //std::cout << "FebConfig: "<< getFebConfig() << " FirstSampleIndex " << rearrangeFirstSample <<std::endl;
401  if (rearrangeFirstSample && rearrangeFirstSample<samples.size()) //FIXME: Very ugly hack! See explanation in LArRodDecoder.h file
402  {//Change e.g. 3 0 1 2 4 to 0 1 2 3 4
403  short movedSample=samples[0];
404  for (unsigned i=1;i<=rearrangeFirstSample;i++)
405  samples[i-1]=samples[i];
406  samples[rearrangeFirstSample]=movedSample;
407  }
408 #ifdef LARBSDBGOUTPUT
409  logstr << MYLEVEL << "GetNextRawData for FEB finished 0x" << MSG::hex << (uint32_t)getHeader32(FEBID) << MSG::dec << endmsg;
410 #endif
411  return 1;
412 }
413 
414 int LArRodBlockPhysicsV6::getNextDigits(int& channelNumber, std::vector<short>& samples, uint32_t& gain)
415 {
416  //std::cout << " I am here !!!!!!!!!!!!!!!!!!!!!! " << std::endl;
417 #ifdef LARBSDBGOUTPUT
418  MsgStream logstr(Athena::getMessageSvc(), BlockType());
419  //Debug output
420  logstr << MYLEVEL << "Let s go in getNextDigits..." << endmsg;
421  logstr << MYLEVEL << "GetNextDigits for FEB 0x" << MSG::hex << (uint32_t)getHeader32(FEBID) << MSG::dec << endmsg;
422  logstr << MYLEVEL << "m_DigitsPointer=" << m_DigitsPointer << " m_DigitsIndex="<< m_DigitsIndex
423  << " m_DigitsChannel="<< m_DigitsChannel
424  << " m_channelsPerFEB=" << m_channelsPerFEB << endmsg;
425 #endif
426 
427  if (m_DigitsChannel>=m_channelsPerFEB) { //Already beyond maximal number of channels
428 #ifdef LARBSDBGOUTPUT
429  logstr << MYLEVEL << "Maximum number of channels reached" << endmsg;
430 #endif
431  return 0;
432  }
433  //const uint16_t block = getHeader16(m_DigitsOff);//Position of the raw FEB data block
434  if (!m_DigitsPointer) { //Block does not exist
435 #ifdef LARBSDBGOUTPUT
436  logstr << MYLEVEL << "No Digits Block in this FEB" << endmsg;
437 #endif
438  return 0;
439  }
440  if (!m_MaskDigitsPointer) { //Block does not exist
441 #ifdef LARBSDBGOUTPUT
442  logstr << MYLEVEL << "No Mask Digits Block in this FEB" << endmsg;
443 #endif
444  return 0;
445  }
446 
447  // Get Digits if the information is present according to summary block
448  uint32_t hasDigits;
449 
450  hasDigits = (uint32_t) ((m_MaskDigitsPointer[m_DigitsChannel>>5] >> (m_DigitsChannel&0x1f)) &0x1);
451  // Increment channel number until digits are found
452  while(hasDigits==0) {
453  m_DigitsChannel++;
454  if (m_DigitsChannel>=m_channelsPerFEB) { //Already beyond maximal number of channels
455 #ifdef LARBSDBGOUTPUT
456  logstr << MYLEVEL << "Maximum number of channels reached" << endmsg;
457 #endif
458  return 0;
459  }
460  hasDigits = (uint32_t) ((m_MaskDigitsPointer[m_DigitsChannel>>5] >> (m_DigitsChannel&0x1f)) &0x1);
461  }
462 
463  // Get next channel
464  unsigned rodChannelNumber=m_DigitsChannel; // Index of Channel in ROD-Block
465  channelNumber=((rodChannelNumber&0xe)<<2) + ((rodChannelNumber&0x1)<<6) + (rodChannelNumber>>4); //channel number of the FEB
466  //channelNumber=(rodChannelNumber>>4) + ((rodChannelNumber&0xf)<<3); //channel number of the FEB
467  const unsigned int nsamples = getHeader16(NSamples) & 0xff;
468 
469  // gain in 2 bits of a 32 bits word
470  if(m_GainPointer) {
471  gain = (uint32_t) ((m_GainPointer[m_DigitsChannel>>4] >> (m_DigitsChannel&0xf)*2) & 0x3);
473  } else gain=0xffffffff;
474 
475 #ifdef LARBSDBGOUTPUT
476  logstr << MYLEVEL << "This FEB has " << nsamples << " samples" << endmsg;
477 #endif
478 
479  if(nsamples==0) return 0;
480  int s_size = nsamples;
481  int index;
482  index = s_size*m_DigitsIndex;
483  //uint16_t s;
484  //for(unsigned int i=0;i<nsamples;i++) {
485  // s = m_DigitsPointer[index++]>>2;
486  // samples.push_back(s);
487  //}
488  //int ok=1;
489  //for(unsigned int i=0;i<nsamples;i++) {
490  // if(m_DigitsPointer[index+i]>>14 && m_DigitsIndex<getNbSweetCells2()-1) {
491  // std::cout << "Trying to decode strange digits value: " << std::hex << m_DigitsPointer[index+i] << std::dec << std::endl;
492  // ok=0;
493  // }
494  //}
495  if( nsamples&0x1){
496  if(m_DigitsIndex&0x1) {
497  samples.push_back(m_DigitsPointer[index-1]>>2);
498  samples.push_back(m_DigitsPointer[index+2]>>2);
499  samples.push_back(m_DigitsPointer[index+1]>>2);
500  samples.push_back(m_DigitsPointer[index+4]>>2);
501  samples.push_back(m_DigitsPointer[index+3]>>2);
502  if(nsamples==7) {
503  samples.push_back(m_DigitsPointer[index+6]>>2);
504  samples.push_back(m_DigitsPointer[index+5]>>2);
505  }
506  } else {
507  samples.push_back(m_DigitsPointer[index+1]>>2);
508  samples.push_back(m_DigitsPointer[index+0]>>2);
509  samples.push_back(m_DigitsPointer[index+3]>>2);
510  samples.push_back(m_DigitsPointer[index+2]>>2);
511  samples.push_back(m_DigitsPointer[index+5]>>2);
512  if(nsamples==7) {
513  samples.push_back(m_DigitsPointer[index+4]>>2);
514  samples.push_back(m_DigitsPointer[index+7]>>2);
515  }
516  }
517  } else {
518  samples.push_back(m_DigitsPointer[index+1]>>2);
519  samples.push_back(m_DigitsPointer[index+0]>>2);
520  samples.push_back(m_DigitsPointer[index+3]>>2);
521  samples.push_back(m_DigitsPointer[index+2]>>2);
522  }
523 
524 #ifdef LARBSDBGOUTPUT
525  logstr << MYLEVEL << " ===> ROD Channel = " << m_DigitsChannel << endmsg;
526  logstr << MYLEVEL << " ===> FEB Channel = " << channelNumber << endmsg;
527  logstr << MYLEVEL << " ===> Gain = " << gain << endmsg;
528  for(int i=0;i<nsamples;i++)
529  logstr << MYLEVEL << " ===> sample " << i << " = " << samples[i] << endmsg;
530 #endif
531  //std::cout << "Gain= " << gain << " Febgain=" << febgain << std::endl;
532  m_DigitsIndex++;
533  m_DigitsChannel++;
534  unsigned rearrangeFirstSample=0;
536  rearrangeFirstSample=m_rearrangeFirstSample; //Overwrite by jobOptions
537  else
538  rearrangeFirstSample=getFirstSampleIndex();
539  //std::cout << "FebConfig: "<< getFebConfig() << " FirstSampleIndex " << getFirstSampleIndex() <<std::endl;
540  if (rearrangeFirstSample && rearrangeFirstSample<samples.size()) //FIXME: Very ugly hack! See explanation in LArRodDecoder.h file
541  {//Change e.g. 3 0 1 2 4 to 0 1 2 3 4
542  short movedSample=samples[0];
543  for (unsigned i=1;i<=rearrangeFirstSample;i++)
544  samples[i-1]=samples[i];
545  samples[rearrangeFirstSample]=movedSample;
546  }
547 #ifdef LARBSDBGOUTPUT
548  logstr << MYLEVEL << "GetNextDigits for FEB finished 0x" << MSG::hex << (uint32_t)getHeader32(FEBID) << MSG::dec << endmsg;
549 #endif
550  return 1;
551 }
552 
554 {
555  if(!m_RaddPointer) return 0;
556  return m_RaddPointer[1]>>8;
557 }
558 
560 {
561  if(!m_RaddPointer) return 0;
562  return m_RaddPointer[1] & 0xff;
563 }
564 
566 {
567  if(!m_MaskTimeQualityPointer) return 0;
568  int n=0;
569  for(int i=0;i<4;i++)
570  for(int j=0;j<32;j++)
571  if((m_MaskTimeQualityPointer[i] >> j) &0x1) n++;
572  return n;
573 }
574 
576 {
577  if(!m_MaskDigitsPointer) return 0;
578  int n=0;
579  for(int i=0;i<4;i++)
580  for(int j=0;j<32;j++)
581  if((m_MaskDigitsPointer[i] >> j) &0x1) n++;
582  return n;
583 }
584 
586 {
587  return getHeader16(NSamples);
588 }
589 
591 {
592  return getHeader16(NGains);
593 }
594 
596 {
597  return getHeader16(ResultsDim1);
598 }
599 
601 {
602  return getHeader16(ResultsDim2);
603 }
604 
606 {
607  return getHeader16(RawDataBlkDim);
608 }
609 
611 {
612  if(!m_RawDataPointer) {
613  if(!m_RaddPointer) return 0;
614  if(sample%2) sample+=2;
615  return m_RaddPointer[sample];
616  }
617  int index;
618  if(sample==0) index=6;
619  else if(sample & 0x1) index=7+sample-1;
620  else index=7+sample+1;
622  if(adc>=8) return x>>8;
623  return x&0xff;
624 }
625 
627 {
628  if(!m_RawDataPointer) return 0;
629  int index=5;
631  return x;
632 }
633 
635 {
636  if(!m_RawDataPointer) return 0;
637  int index=4;
639  return x;
640 }
641 
643 {
644  if(!m_RawDataPointer) return 0;
645  int index=7;
647  return x;
648 }
649 
651 {
652  if(getNumberOfWords()<EventStatus/2) return 0;
654  return x;
655 }
656 
657 /*
658 uint32_t LArRodBlockPhysicsV6::onlineCheckSum() const
659 {
660  //int size = getNumberOfWords();
661  int index = getNumberOfWords()-1;
662  if(index<m_iHeadBlockSize) return 0;
663  uint32_t sum = m_FebBlock[index];
664  //for(int i=size-10;i<size;i++) {
665  // std::cout << i << " : " << std::hex << m_FebBlock+i << " : " << m_FebBlock[i] << std::endl;
666  //}
667  return sum;
668 }
669 
670 uint32_t LArRodBlockPhysicsV6::offlineCheckSum() const
671 {
672  int end = getNumberOfWords()-3;
673  //int start = 0; //m_iHeadBlockSize;
674  uint32_t sum = 0;
675  for(int i=0;i<end;i++) {
676  sum += m_FebBlock[i];
677  //std::cout << i << " : " << std::hex << sum << " : " << m_FebBlock[i] << std::endl;
678  }
679  return sum & 0x7fffffff;
680 }
681 */
682 
683 // start of encoding methods
684 void LArRodBlockPhysicsV6::initializeFragment(std::vector<uint32_t>& fragment ){
685  m_pRODblock=&fragment; //remember pointer to fragment
686  if (fragment.size()>m_iHeadBlockSize) { //Got filled fragment
687  unsigned int sizeRead=0;
688  //Store existing data in the FEB-Map
689  while (sizeRead<fragment.size()) {
691  FebIter=fragment.begin()+sizeRead; //Store pointer to current Feb-Header
692  m_FebBlock=&(*FebIter); //Set m_FebBlock in order to use getHeader-functions.
693  uint32_t currFEBid=getHeader32(FEBID); //Get this FEB-ID
694  uint16_t currFebSize=getNumberOfWords(); //Size of this FEB-Block
695  if (FebIter+currFebSize>fragment.end()) {
696  fragment.clear(); //Clear existing vector
697  //*m_logstr << MSG::ERROR << "Got inconsistent ROD-Fragment!" << endmsg;
698  return;
699  }
700  m_mFebBlocks[currFEBid].assign(FebIter,FebIter+currFebSize); //Copy data from ROD-fragment into FEB-Block
701  sizeRead+=currFebSize+m_MiddleHeaderSize; //6 is the middle header size
702  //LARBSDBG("Found FEB-id " << currFEBid << " in existing ROD-Fragment");
703  } // end while
704  }
705  fragment.clear(); //Clear existing vector
706  return;
707 
708 }
709 
710 //For writing: Initalizes a single FEB-Block
712 {
714  if (m_vFragment->size()<m_iHeadBlockSize) //Got empty or spoiled fragment
715  {
716  m_vFragment->resize(m_iHeadBlockSize,0); //Initialize FEB-Header
717  setHeader32(FEBID,id); //Set Feb ID
718  // At least 10 (head) + 16 (gain/sumblks) + 64 (energies)
719  m_vFragment->reserve(90);
720  }
721 
722  m_SumBlkBlockE1.resize(4);
723  for(unsigned int i=0;i<4;i++) m_SumBlkBlockE1[i]=0x0;
724  m_SumBlkBlockE2.resize(4);
725  for(unsigned int i=0;i<4;i++) m_SumBlkBlockE2[i]=0x0;
726  m_GainBlock.resize(8);
727  for(unsigned int i=0;i<8;i++) m_GainBlock[i]=0x0;
728 // m_RawDataBlock.resize(0);
729  m_TimeQualityBlock.resize(8);
730  for(unsigned int i=0;i<8;i++) m_TimeQualityBlock[i]=0x0;
731  m_EnergyBlockEncode.resize(128);
732  for(unsigned int i=0;i<128;i++) m_EnergyBlockEncode[i]=0x0;
733  m_DigitsEncode.clear();
734 
735  resetPointers();
736 
737 }
738 
739 void LArRodBlockPhysicsV6::setNextEnergy(const int channel, const int32_t energy,
740  const int32_t time, const int32_t quality, const uint32_t gain)
741 {
742  //LARBSDBG("setNextEnergy-------------------->>>>>********************** format V4 ***********");
743  //LARBSDBG("Channel=" << channel << " energy =" << energy);
744  int rcNb=FebToRodChannel(channel);
745  //int rcNb=(channel);
746  //rcNb ist supposed to equal or bigger than m_EIndex.
747  //In the latter case, we fill up the missing channels with zero
748  if (rcNb<m_EnergyIndex) {
749  //*m_logstr << MSG::ERROR << "LArRODBlockStructure Error: Internal error. Channels not ordered correctly. rcNb=" << rcNb
750  // << " m_EnergyIndex=" << m_EnergyIndex << endmsg;
751  return;
752  }
753 
754  //Fill up missing channels with zeros:
755  while (m_EnergyIndex<rcNb)
756  setNextEnergy((int16_t)0,(int16_t)32767,(int16_t)-32767,(uint32_t)0);
757 
758  // transform 32 bits data into 16 bits data
759 
760  uint16_t theenergy;
761  uint32_t abse,EncodedE;
762  int16_t thetime,thequality;
763  int32_t sign;
764 
765  //Time is in 10 ps in ByteStream, hence the factor 10 to convert from ps
766  thetime = (int16_t) time/10;
767  thequality = (int16_t) quality;
768 
769  sign=(energy>=0?1:-1); // get sign of energy
770  abse=(uint32_t)abs(energy);
771 
772  EncodedE=abse; // range 0
773 
774  if ((abse>8192)&&(abse<65536))
775  {
776  EncodedE=((abse>>3)|0x4000); // range 1 : drop last 3 bits and put range bits (bits 14 and 13 = 01)
777  }
778  else if ((abse>65535)&&(abse<524288))
779  {
780  EncodedE=((abse>>6)|0x8000); // range 2 : drop last 6 bits and put range bits (bits 14 and 13 = 10)
781  }
782  else if ((abse>524288))
783  {
784  EncodedE=((abse>>9)|0xc000); // range 3 : drop last 9 bits and put range bits (bits 14 and 13 = 11)
785  }
786 
787  // treat sign now :
788 
789  if (sign<0) EncodedE |= 0x2000;
790  theenergy = (uint16_t) EncodedE;
791 
792 
793  // Add data...
794 
795  //LARBSDBG("setNextEnergy-------------------->>>>> Energy = "<< energy << " Encoded Energy =" << theenergy);
796 
797  if (abse> m_EnergyThreshold1)
798  {
799  setNextEnergy(theenergy,thetime,thequality,gain);
800  }
801  else
802  {
803  setNextEnergy(theenergy,(int16_t)32767,(int16_t)-32767,gain);
804  }
805  return;
806 }
807 
808 //Private function, expects channel number is rod-style ordering
810 {
811  if (m_EnergyIndex>=m_channelsPerFEB) //Use m_EIndex to count total number of channels
812  {//*m_logstr << MSG::ERROR << "LArRodBlockStructure Error: Attempt to write Energy for channel "
813  // << m_EnergyIndex << " channels into a FEB!" <<endmsg;
814  return;
815  }
816  //LARBSDBG("LArRodBlockStructure: Setting Energy for channel " << m_EnergyIndex << ". E=" << energy);
817 
818  //LARBSDBG("In setNextEnergy-------------------->>>>> time = " << time << " quality=" << quality);
819 
820  // Energy
821  int endianindex;
822  if (m_EnergyIndex & 0x1) endianindex = m_EnergyIndex-1;
823  else endianindex = m_EnergyIndex+1;
824  m_EnergyBlockEncode[endianindex] = energy;
825 
826  // Find correct position
827 
828  //LARBSDBG("Writing Raw data to E block. E=" << energy);
829 
830  // update summary block
831  // Gain is composed of two bits per cell
832  uint16_t gain_idx=m_EnergyIndex>>4;
833  uint16_t gain_bit=(m_EnergyIndex&0xf)*2;
835  m_GainBlock[gain_idx] |= (gain1 << gain_bit);
836 
837  // write Time and Chi2 for cells above HighEnergyCellCut threshold
838 
839  if (quality!=-32767) // Do write Time and Chi2 information
840  {
841  // count the number of hot cells
842  m_numberHotCell++;
843  // count the number of cells offtime
845  uint16_t mask_idx=m_EnergyIndex>>5;
846  uint16_t mask_bit=(m_EnergyIndex&0x1f);
847  m_SumBlkBlockE1[mask_idx] |= (0x1 << mask_bit);
848 
849  m_TimeQualityBlock.push_back(*((uint16_t*)&time));
850  m_TimeQualityBlock.push_back(*((uint16_t*)&quality));
851  }
852  m_EnergyIndex++; //Use m_EIndex to count the channels put in the Energy block
853 
854 }
855 
856 void LArRodBlockPhysicsV6::setRawData(const int chIdx, const std::vector<short>& samples , const uint32_t /* gain_not_used */ ){
857 
858  // First of all, set the bits
859  int cchIdx = FebToRodChannel(chIdx);
860  uint16_t mask_idx=cchIdx>>5;
861  uint16_t mask_bit=(cchIdx&0x1f);
862  m_SumBlkBlockE2[mask_idx] |= (0x1 << mask_bit);
863  for(std::vector<short>::const_iterator i=samples.begin();i!=samples.end();++i){
864  m_DigitsEncode.push_back((*i)<<2);
865  }
866 
867 }
868 
870 {
871 //Complete non-complete Energy block
873  setNextEnergy((uint16_t)0,(int16_t)32767,(int32_t)-32767,(uint32_t)0);//E=0,t=32767,q=-32767,G=0
874 
875 uint16_t n;
876 //uint16_t BlockOffset;
878 // checkSum value
879 uint32_t sum=0;
880 
881 // Will Hardcode here for the moment FIXME. Minimal 1 sample
884 // These will never be used form MC. Nice to put in here thought
885 setHeader16(FEB_SN,0xfefe);
886 setHeader16(FEB_SN_h,0xdede);
889 
890 // Gain block...
891 n = m_GainBlock.size();
892 //BlockOffset=0;
893 //LARBSDBG("Checking Gain Block n=" << n << "BlockOffset=" << BlockOffset);
894 //Check if Gain-Block exists and is not yet part of the fragment
895 if (n)
896  {
897  //LARBSDBG(MSG::DEBUG << "In finalyseFEB-------------------->>>>> " << "Checking for Gain Block : length= " << n << " BlockOffset=" << BlockOffset);
898  for(unsigned int i=0;i<n;i++){
899  m_vFragment->push_back(m_GainBlock[i]);
900  sum+=m_GainBlock[i];
901  }
902  }
903 
904  // Cells above energy threshold E1
905  n = m_SumBlkBlockE1.size();
906  //Check if Summary Block exists and is not yet part of the fragment
907  if (n)
908  {
909  //LARBSDBG("In finalizeFEB-------------------->>>>> " << "Checking for Summary Block : length= " << n << " BlockOffset=" << BlockOffset);
910  for (unsigned i=0;i<n;i++){
911  m_vFragment->push_back(m_SumBlkBlockE1[i]);
913  }
914  }
915 
916  // Cells above energy threshold E2 (not included so far)
917  n = m_SumBlkBlockE2.size();
918  //Check if Summary Block exists and is not yet part of the fragment
919  //LARBSDBG("Checking for Summary Block n=" << n << "BlockOffset=" << BlockOffset);
920  if (n)
921  {
922  //LARBSDBG("In finalizeFEB-------------------->>>>> " << "Checking for Summary Block : length= " << n << " BlockOffset=" << BlockOffset);
923  for (unsigned i=0;i<n;i++){
924  m_vFragment->push_back(m_SumBlkBlockE2[i]);
926  }
927  }
928 
929  // fill info from counters
930  // for moment just include 1 fake words (32 bits) to put radd
931  uint32_t radd_nANC=0x0;
932  // Second threshold missing (FIXME)
933  radd_nANC = ((m_numberHotCell<<8))+(m_DigitsEncode.size()/nsamples);
934  radd_nANC = (radd_nANC<<16);
935  m_vFragment->push_back(radd_nANC);
936  sum+=radd_nANC;
937  // Need to include radd nsamples-1
938  // No need to include in sum's for now
939  for( int i=0; i < (nsamples-1)/2; i++)
940  m_vFragment->push_back(0x0);
941 
942 
943  // Energy block...
944  n = 128 ; // Fixed size m_EnergyBlock.size();
945  // BlockOffset=getVectorHeader16(ResultsOff1); xxx
946  // Block also include time, whenever necessary
947  int size_of_block=80+(nsamples+1)/2+(m_TimeQualityBlock.size())/2;
948  //LARBSDBG("Checking Energy Block n=" << n << "BlockOffset=" << BlockOffset);
949  //Check if Energy-Block exists and is not yet part of the fragment
950  if (n)
951  {
953  setHeader16(ResultsDim1,size_of_block);
954  //LARBSDBG("In finalyseFEB-------------------->>>>> " << "Checking for Energy Block : length= " << n << " BlockOffset=" << BlockOffset);
955  for(unsigned int i=0;i<n/2;i++) {
956  // WARNING witch one should be >>16 2*i or 2*i+1? To be tested
957  uint32_t Encode = m_EnergyBlockEncode[2*i]+(m_EnergyBlockEncode[2*i+1]<<16);
958  m_vFragment->push_back(Encode);
959  sum+=Encode;
960  }
961  }
962 
963  // Magic numbers (4 or 8) for Ex, Ey and Ez
964  n = m_TimeQualityBlock.size();
965  //LARBSDBG("Checking Time and Quality Block n=" << n << "BlockOffset=" << BlockOffset);
966  //Check if Time and Quality Block exists and is not yet part of the fragment
967  if (n)
968  {
969  unsigned int imax = n/2;
970  for(unsigned int i=0;i<imax;i++){
971  ShortLong to_push{};
972  to_push.s[0] = m_TimeQualityBlock[i*2];
973  to_push.s[1] = m_TimeQualityBlock[i*2+1];
974  m_vFragment->push_back(to_push.l);
975  sum+=to_push.l;
976  }
977  }
978  // Now include digits
979  n = m_DigitsEncode.size();
980  if ( n ) {
981  // First make sure it is not and odd number to store
982  if ( m_DigitsEncode.size() & 0x1 ) m_DigitsEncode.push_back(0x0);
983  unsigned int imax=m_DigitsEncode.size()/2;
984  for(unsigned int i=0;i<imax;i++){
985  // Better by-swap
986  ShortLong to_push{};
987  to_push.s[1]=m_DigitsEncode[i*2];
988  to_push.s[0]=m_DigitsEncode[i*2+1];
989  m_vFragment->push_back(to_push.l);
990  sum+=to_push.l;
991  }
993  setHeader16(ResultsOff2,18+size_of_block);
994  } // End of check for format
995 
996  // Need to add header to check sum
997  for(size_t ii=0;ii<endtag/2;ii++){
998  sum+=((*m_vFragment)[ii]);
999  }
1000  // Three final magic words
1001  m_vFragment->push_back(0x0); // For the moment
1002  m_vFragment->push_back(0x12345678); // For the moment
1003  //sum+=0x12345678;
1004  sum+=m_vFragment->size()+1;
1005  m_vFragment->push_back(sum& 0x7fffffff);
1006 
1007  setHeader32(NWTot,m_vFragment->size());
1008  return;
1009 
1010 }
1011 
1012 
1014 {
1015  FEBMAPTYPE::const_iterator feb_it_b=m_mFebBlocks.begin();
1016  FEBMAPTYPE::const_iterator feb_it_e=m_mFebBlocks.end();
1017  FEBMAPTYPE::const_iterator feb_it;
1018  for (feb_it=feb_it_b;feb_it!=feb_it_e;++feb_it) {
1019  if (feb_it!=feb_it_b) //Not first Feb
1020  m_pRODblock->resize( m_pRODblock->size()+m_MiddleHeaderSize);
1021 
1022  //Add feb data to rod data block
1023  m_pRODblock->insert (m_pRODblock->end(),
1024  feb_it->second.begin(), feb_it->second.end());
1025  } //end for feb_it
1026 
1027  m_mFebBlocks.clear();
1028  return;
1029 }
1030 
1031 //Sort functions & ordering relation:
1032 template<class RAWDATA>
1033 bool LArRodBlockPhysicsV6::operator ()
1034  (const RAWDATA* ch1, const RAWDATA* ch2) const
1035 {
1036  HWIdentifier id1 = ch1->channelID();
1037  HWIdentifier id2 = ch2->channelID();
1038 
1039  HWIdentifier febId1= m_onlineHelper->feb_Id(id1);
1040  HWIdentifier febId2= m_onlineHelper->feb_Id(id2);
1041 
1042  if(febId1 == febId2 ){
1043  int cId1 = m_onlineHelper->channel(id1);
1044  int cId2 = m_onlineHelper->channel(id2);
1045  return FebToRodChannel(cId1) < FebToRodChannel(cId2);
1046  }
1047 
1048  return febId1 < febId2 ;
1049 }
1050 
1051 
1052 #ifdef LARBSDBGOUTPUT
1053 #undef LARBSDBGOUTPUT
1054 #endif
1055 #undef LARBSDBG
LArRodBlockStructure
Definition: LArRodBlockStructure.h:48
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
febId2
HWIdentifier febId2
Definition: LArRodBlockPhysicsV0.cxx:565
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
LArRodBlockPhysicsV6::getNbSweetCells2FromMask
uint16_t getNbSweetCells2FromMask() const
Definition: LArRodBlockPhysicsV6.cxx:575
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
LArRodBlockStructure::m_vFragment
std::vector< uint32_t > * m_vFragment
Definition: LArRodBlockStructure.h:231
LArRodBlockPhysicsV6::getNbSweetCells1
virtual uint16_t getNbSweetCells1() const
Definition: LArRodBlockPhysicsV6.cxx:553
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
LArRodBlockPhysicsV6::NWTot
@ NWTot
Definition: LArRodBlockPhysicsV6.h:36
LArRodBlockPhysicsV6::InFPGAFormat_h
@ InFPGAFormat_h
Definition: LArRodBlockPhysicsV6.h:55
LArRodBlockPhysicsV6::m_numberHotCell
uint16_t m_numberHotCell
Definition: LArRodBlockPhysicsV6.h:165
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LArRodBlockStructure::getNumberOfWords
uint32_t getNumberOfWords() const
Definition: LArRodBlockStructure.h:428
LArRodBlockPhysicsV6::getNextEnergy
virtual int getNextEnergy(int &channelNumber, int32_t &energy, int32_t &time, int32_t &quality, uint32_t &gain)
Definition: LArRodBlockPhysicsV6.h:195
LArRodBlockPhysicsV6::m_RawDataIndex
int m_RawDataIndex
Definition: LArRodBlockPhysicsV6.h:150
index
Definition: index.py:1
LArRodBlockStructure::m_FebBlockSize
int32_t m_FebBlockSize
Definition: LArRodBlockStructure.h:229
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:218
LArRodBlockPhysicsV6::getFirstSampleIndex
uint16_t getFirstSampleIndex() const
Definition: LArRodBlockPhysicsV6.h:190
LArRodBlockPhysicsV6::ResultsOff1
@ ResultsOff1
Definition: LArRodBlockPhysicsV6.h:42
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
LArRodBlockPhysicsV6::m_EnergyPointer
const uint16_t * m_EnergyPointer
Definition: LArRodBlockPhysicsV6.h:155
LArRodBlockPhysicsV6::getResults1Size
virtual uint16_t getResults1Size() const
Definition: LArRodBlockPhysicsV6.cxx:595
LArRodBlockPhysicsV6::ResultsDim2
@ ResultsDim2
Definition: LArRodBlockPhysicsV6.h:45
LArRodBlockPhysicsV6::setPointers
virtual bool setPointers()
Definition: LArRodBlockPhysicsV6.cxx:85
LArRodBlockPhysicsV6::FEBID
@ FEBID
Definition: LArRodBlockPhysicsV6.h:38
LArRodBlockPhysicsV6::getCtrl2
virtual uint16_t getCtrl2(uint32_t adc) const
Definition: LArRodBlockPhysicsV6.cxx:634
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
LArRodBlockStructure::m_FebBlock
const uint32_t * m_FebBlock
Definition: LArRodBlockStructure.h:227
LArRodBlockStructure::setHeader16
void setHeader16(const unsigned n, const uint16_t w)
Definition: LArRodBlockStructure.h:380
LArRodBlockPhysicsV6::m_TimeQualityBlock
std::vector< uint16_t > m_TimeQualityBlock
Definition: LArRodBlockPhysicsV6.h:141
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
LArRodBlockPhysicsV6::getCtrl3
virtual uint16_t getCtrl3(uint32_t adc) const
Definition: LArRodBlockPhysicsV6.cxx:642
LArRodBlockPhysicsV6::m_onlineHelper
const LArOnlineID * m_onlineHelper
Definition: LArRodBlockPhysicsV6.h:173
LArRodBlockPhysicsV6::m_DigitsIndex
int m_DigitsIndex
Definition: LArRodBlockPhysicsV6.h:148
LArRodBlockPhysicsV6::resetPointers
virtual void resetPointers()
Definition: LArRodBlockPhysicsV6.cxx:65
HWIdentifier
Definition: HWIdentifier.h:13
CaloGain::LARNGAIN
@ LARNGAIN
Definition: CaloGain.h:19
x
#define x
LArRodBlockPhysicsV6::m_SumPointer
const int32_t * m_SumPointer
Definition: LArRodBlockPhysicsV6.h:156
xAOD::int16_t
setScaleOne setStatusOne setSaturated int16_t
Definition: gFexGlobalRoI_v1.cxx:55
LArRodBlockStructure::m_pRODblock
std::vector< uint32_t > * m_pRODblock
Definition: LArRodBlockStructure.h:232
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
LArRodBlockStructure::OfflineToRawGain
uint32_t OfflineToRawGain(const uint32_t gain) const
Definition: LArRodBlockStructure.h:352
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
LArRodBlockPhysicsV6::FEB_SN_h
@ FEB_SN_h
Definition: LArRodBlockPhysicsV6.h:41
LArRodBlockPhysicsV6::m_MaskTimeQualityPointer
const uint32_t * m_MaskTimeQualityPointer
Definition: LArRodBlockPhysicsV6.h:152
LArRodBlockPhysicsV6::getRawDataSize
virtual uint16_t getRawDataSize() const
Definition: LArRodBlockPhysicsV6.cxx:605
LArRodBlockPhysicsV6::finalizeFEB
void finalizeFEB()
Definition: LArRodBlockPhysicsV6.cxx:869
LArRodBlockPhysicsV6::setNextEnergy
void setNextEnergy(const int channel, const int32_t energy, const int32_t time, const int32_t quality, const uint32_t gain)
Definition: LArRodBlockPhysicsV6.cxx:739
LArRodBlockPhysicsV6::m_SumBlkBlockE2
std::vector< uint32_t > m_SumBlkBlockE2
Definition: LArRodBlockPhysicsV6.h:138
LArRodBlockPhysicsV6::getNbSweetCells2
virtual uint16_t getNbSweetCells2() const
Definition: LArRodBlockPhysicsV6.cxx:559
LArRodBlockPhysicsV6::getResults2Size
virtual uint16_t getResults2Size() const
Definition: LArRodBlockPhysicsV6.cxx:600
LArRodBlockStructure::m_iHeadBlockSize
unsigned short m_iHeadBlockSize
Definition: LArRodBlockStructure.h:221
LArRodBlockStructure::m_rearrangeFirstSample
unsigned int m_rearrangeFirstSample
Definition: LArRodBlockStructure.h:241
LArRodBlockPhysicsV6::ResultsOff2
@ ResultsOff2
Definition: LArRodBlockPhysicsV6.h:44
LArRodBlockPhysicsV6.h
LArRodBlockStructure::getHeader32
uint32_t getHeader32(const unsigned n) const
Definition: LArRodBlockStructure.h:365
LArRodBlockPhysicsV6::InFPGAFormat
@ InFPGAFormat
Definition: LArRodBlockPhysicsV6.h:54
LArRodBlockPhysicsV6::m_numberHotCellOffTime
uint16_t m_numberHotCellOffTime
Definition: LArRodBlockPhysicsV6.h:166
LArDigit.h
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
LArRodBlockPhysicsV6::m_DigitsChannel
int m_DigitsChannel
Definition: LArRodBlockPhysicsV6.h:149
id2
HWIdentifier id2
Definition: LArRodBlockPhysicsV0.cxx:562
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
LArRodBlockStructure::RawToOfflineGain
uint32_t RawToOfflineGain(const uint32_t gain) const
Definition: LArRodBlockStructure.h:349
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:113
LArRodBlockPhysicsV6::FEB_SN
@ FEB_SN
Definition: LArRodBlockPhysicsV6.h:40
lumiFormat.i
int i
Definition: lumiFormat.py:85
LArRodBlockPhysicsV6::m_RawDataPointer
const uint16_t * m_RawDataPointer
Definition: LArRodBlockPhysicsV6.h:159
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
beamspotman.n
n
Definition: beamspotman.py:731
LArRodBlockPhysicsV6::NGains
@ NGains
Definition: LArRodBlockPhysicsV6.h:50
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LArRodBlockPhysicsV6::m_EnergyThreshold2
uint16_t m_EnergyThreshold2
Definition: LArRodBlockPhysicsV6.h:169
LArRodBlockPhysicsV6::m_GainPointer
const uint32_t * m_GainPointer
Definition: LArRodBlockPhysicsV6.h:151
LArRodBlockPhysicsV6::getCtrl1
virtual uint16_t getCtrl1(uint32_t adc) const
Definition: LArRodBlockPhysicsV6.cxx:626
LArRodBlockPhysicsV6::m_SumBlkBlockE1
std::vector< uint32_t > m_SumBlkBlockE1
Definition: LArRodBlockPhysicsV6.h:137
LArRodBlockPhysicsV6::concatinateFEBs
void concatinateFEBs()
Definition: LArRodBlockPhysicsV6.cxx:1013
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
LArRodBlockPhysicsV6::m_OffTimeCut
int16_t m_OffTimeCut
Definition: LArRodBlockPhysicsV6.h:170
CaloCellPos2Ntuple.x7fffffff
x7fffffff
Definition: CaloCellPos2Ntuple.py:24
MYLEVEL
#define MYLEVEL
Definition: LArRodBlockPhysicsV3.h:47
LArRodBlockPhysicsV6::NSamples
@ NSamples
Definition: LArRodBlockPhysicsV6.h:51
imax
int imax(int i, int j)
Definition: TileLaserTimingTool.cxx:33
LArRodBlockPhysicsV6::m_DigitsPointer
const uint16_t * m_DigitsPointer
Definition: LArRodBlockPhysicsV6.h:158
CaloTime_fillDB.gain1
gain1
Definition: CaloTime_fillDB.py:356
LArRodBlockPhysicsV6::getNextRawData
virtual int getNextRawData(int &channelNumber, std::vector< short > &samples, uint32_t &gain)
Definition: LArRodBlockPhysicsV6.cxx:299
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
LArRodBlockPhysicsV6::m_DigitsEncode
std::vector< uint16_t > m_DigitsEncode
Definition: LArRodBlockPhysicsV6.h:144
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
LArRodBlockPhysicsV6::m_fixedGain
int m_fixedGain
Definition: LArRodBlockPhysicsV6.h:162
LArRodBlockPhysicsV6::m_GainBlock
std::vector< uint32_t > m_GainBlock
Definition: LArRodBlockPhysicsV6.h:139
LArRodBlockPhysicsV6::getNbSweetCells1FromMask
uint16_t getNbSweetCells1FromMask() const
Definition: LArRodBlockPhysicsV6.cxx:565
LArRodBlockPhysicsV6::m_EnergyIndex
int m_EnergyIndex
Definition: LArRodBlockPhysicsV6.h:146
LArRodBlockPhysicsV6::EventStatus
@ EventStatus
Definition: LArRodBlockPhysicsV6.h:48
Rtt_histogram.n1
n1
Definition: Rtt_histogram.py:21
ReadOfcFromCool.nsamples
nsamples
Definition: ReadOfcFromCool.py:115
LArRodBlockStructure::m_MiddleHeaderSize
int32_t m_MiddleHeaderSize
Definition: LArRodBlockStructure.h:239
LArRodBlockPhysicsV6::m_MaskDigitsPointer
const uint32_t * m_MaskDigitsPointer
Definition: LArRodBlockPhysicsV6.h:153
LArRodBlockPhysicsV6::m_EnergyThreshold1
uint16_t m_EnergyThreshold1
Definition: LArRodBlockPhysicsV6.h:168
DeMoScan.index
string index
Definition: DeMoScan.py:364
LArRodBlockPhysicsV6::ResultsDim1
@ ResultsDim1
Definition: LArRodBlockPhysicsV6.h:43
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
ReadFloatFromCool.adc
adc
Definition: ReadFloatFromCool.py:48
LArRodBlockPhysicsV6::getNumberOfGains
virtual uint32_t getNumberOfGains() const
Definition: LArRodBlockPhysicsV6.cxx:590
LArRodBlockPhysicsV6::setRawData
void setRawData(const int, const std::vector< short > &, const uint32_t)
Definition: LArRodBlockPhysicsV6.cxx:856
LArRodBlockPhysicsV6::getNextDigits
int getNextDigits(int &channelNumber, std::vector< short > &samples, uint32_t &gain)
Definition: LArRodBlockPhysicsV6.cxx:414
LArRodBlockPhysicsV6::m_TimeQualityPointer
const uint16_t * m_TimeQualityPointer
Definition: LArRodBlockPhysicsV6.h:157
LArRodBlockPhysicsV6::m_EnergyBlockEncode
std::vector< uint16_t > m_EnergyBlockEncode
Definition: LArRodBlockPhysicsV6.h:143
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
LArRodBlockPhysicsV6::BlockType
std::string BlockType()
Definition: LArRodBlockPhysicsV6.h:62
LArRodBlockPhysicsV6::getNumberOfSamples
virtual uint32_t getNumberOfSamples() const
Definition: LArRodBlockPhysicsV6.cxx:585
extractSporadic.q
list q
Definition: extractSporadic.py:98
LArRodBlockPhysicsV6::FebToRodChannel
virtual int FebToRodChannel(int ch) const
Definition: LArRodBlockPhysicsV6.h:379
LArRodBlockPhysicsV6::m_TimeQualityIndex
int m_TimeQualityIndex
Definition: LArRodBlockPhysicsV6.h:147
python.SystemOfUnits.ns
int ns
Definition: SystemOfUnits.py:130
LArRodBlockPhysicsV6::RawDataBlkDim
@ RawDataBlkDim
Definition: LArRodBlockPhysicsV6.h:47
LArRodBlockPhysicsV6::getRadd
virtual uint32_t getRadd(uint32_t adc, uint32_t sample) const
Definition: LArRodBlockPhysicsV6.cxx:610
febId1
HWIdentifier febId1
Definition: LArRodBlockPhysicsV0.cxx:564
LArRodBlockPhysicsV6::endtag
@ endtag
Definition: LArRodBlockPhysicsV6.h:56
LArRodBlockPhysicsV6::m_requiredNSamples
unsigned short m_requiredNSamples
Definition: LArRodBlockPhysicsV6.h:172
LArRodBlockStructure::m_channelsPerFEB
int m_channelsPerFEB
Definition: LArRodBlockStructure.h:225
LArRodBlockPhysicsV6::initializeFEB
void initializeFEB(const uint32_t id)
Definition: LArRodBlockPhysicsV6.cxx:711
LArRodBlockPhysicsV6::getStatus
virtual uint32_t getStatus() const
Definition: LArRodBlockPhysicsV6.cxx:650
StoreGateSvc.h
LArRodBlockStructure::getHeader16
uint16_t getHeader16(const unsigned n) const
Definition: LArRodBlockStructure.h:355
LArRodBlockPhysicsV6::m_RaddPointer
const uint16_t * m_RaddPointer
Definition: LArRodBlockPhysicsV6.h:154
LArRodBlockPhysicsV6::initializeFragment
void initializeFragment(std::vector< uint32_t > &fragment)
Definition: LArRodBlockPhysicsV6.cxx:684
LArRodBlockStructure::m_mFebBlocks
FEBMAPTYPE m_mFebBlocks
Definition: LArRodBlockStructure.h:234
LArRodBlockStructure::setHeader32
void setHeader32(const unsigned n, const uint32_t w)
Definition: LArRodBlockStructure.h:394
LArRodBlockPhysicsV6::RawDataBlkOff
@ RawDataBlkOff
Definition: LArRodBlockPhysicsV6.h:46
LArRodBlockPhysicsV6::LArRodBlockPhysicsV6
LArRodBlockPhysicsV6()
Definition: LArRodBlockPhysicsV6.cxx:39