27 {23,44}, {29,47}, {31,48}, {21,43},
28 { 5,35}, {15,40}, { 7,36}, {13,39},
29 { 1,33}, {11,38}, { 3,34}, { 9,37},
30 { 6, 3}, {16, 8}, { 8, 4}, {14, 7},
32 {17,41}, {19,42}, {27,46}, {25,45},
33 {32,16}, {22,11}, {24,12}, {30,15},
34 {12, 6}, { 2, 1}, { 4, 2}, {10, 5},
35 {28,14}, {18, 9}, {20,10}, {26,13},
37 {54,27}, {56,28}, {64,32}, {62,31},
38 {49,57}, {59,62}, {51,58}, {57,61},
39 {53,59}, {63,64}, {55,60}, {61,63},
40 {45,55}, {39,52}, {37,51}, {47,56},
42 {34,17}, {42,21}, {44,22}, {36,18},
43 {50,25}, {60,30}, {58,29}, {52,26},
44 {38,19}, {40,20}, {48,24}, {46,23},
45 {41,53}, {35,50}, {33,49}, {43,54}
49 {31,48}, {29,47}, {23,44}, {21,43},
50 { 5,35}, { 7,36}, {15,40}, {13,39},
51 { 1,33}, { 3,34}, {11,38}, { 9,37},
52 { 6, 3}, { 8, 4}, {16, 8}, {14, 7},
54 {17,41}, {27,46}, {19,42}, {25,45},
55 {24,12}, {22,11}, {32,16}, {30,15},
56 { 4, 2}, { 2, 1}, {12, 6}, {10, 5},
57 {20,10}, {18, 9}, {28,14}, {26,13},
59 {54,27}, {64,32}, {56,28}, {62,31},
60 {49,57}, {51,58}, {59,62}, {57,61},
61 {53,59}, {55,60}, {63,64}, {61,63},
62 {45,55}, {47,56}, {37,51}, {39,52},
64 {34,17}, {42,21}, {36,18}, {44,22},
65 {50,25}, {52,26}, {58,29}, {60,30},
66 {38,19}, {48,24}, {40,20}, {46,23},
67 {41,53}, {43,54}, {33,49}, {35,50}
86 const unsigned long *
buffer = (
reinterpret_cast<const unsigned long*
>( fedData.
data()));
87 int fedLenght = fedData.
size();
90 if (fedLenght != (nWordsPerEvent *4) )
92 edm::LogError(
"CamacTBDataFormatter") <<
"CamacTBData has size " << fedLenght
93 <<
" Bytes as opposed to expected " 94 << (nWordsPerEvent *4)
105 for (
int wordNumber=0; wordNumber<nWordsPerEvent; wordNumber++)
106 { statusWords[wordNumber ] =
true;}
126 a = buffer[wordCounter];wordCounter++;
127 LogDebug(
"CamacTBDataFormatter") <<
"\n\nword:\t" <<
a;
131 LogDebug(
"CamacTBDataFormatter") <<
"format ver:\t" <<
b;
135 LogDebug(
"CamacTBDataFormatter") <<
"major:\t" <<
b;
139 LogDebug(
"CamacTBDataFormatter") <<
"minor:\t" <<
b;
141 LogDebug(
"CamacTBDataFormatter") <<
"\n\n word:\t" <<
a;
142 LogDebug(
"CamacTBDataFormatter") <<
"time stamp secs: "<<
a;
144 LogDebug(
"CamacTBDataFormatter") <<
"\n\n word:\t" <<
a;
145 LogDebug(
"CamacTBDataFormatter") <<
"time stamp musecs: " <<
a;
148 a = buffer[wordCounter];wordCounter++;
149 LogDebug(
"CamacTBDataFormatter") <<
"\n\n word:\t" <<
a;
151 LogDebug(
"CamacTBDataFormatter") <<
"LV1A: "<<
b;
154 a = buffer[wordCounter];wordCounter++;
155 LogDebug(
"CamacTBDataFormatter") <<
"\n\n word:\t" <<
a;
158 LogDebug(
"CamacTBDataFormatter") <<
"run number: "<<
b;
161 LogDebug(
"CamacTBDataFormatter") <<
"spill number: "<<
b;
164 a = buffer[wordCounter];wordCounter++;
166 LogDebug(
"CamacTBDataFormatter") <<
"event number in spill: "<<
b;
168 a = buffer[wordCounter];wordCounter++;
170 LogDebug(
"CamacTBDataFormatter") <<
"internal event number: "<<
b;
172 a = buffer[wordCounter];wordCounter++;
173 LogDebug(
"CamacTBDataFormatter") <<
"\n\n word:\t" <<
a;
176 LogDebug(
"CamacTBDataFormatter") <<
"vme errors: "<<
b;
178 LogDebug(
"CamacTBDataFormatter") <<
"camac errors: "<<
b;
180 a = buffer[wordCounter];wordCounter++;
181 LogDebug(
"CamacTBDataFormatter") <<
"\n\n word:\t" <<
a;
183 LogDebug(
"CamacTBDataFormatter") <<
"extended (32 bits) run number: "<<
b;
193 unsigned long bufferHodo[16];
194 bool hodoAreGood =
true;
195 for (
int hodo=0; hodo<16; hodo++)
197 hodoAreGood = hodoAreGood && checkStatus(buffer[wordCounter], wordCounter);
199 a = buffer[wordCounter];
200 bufferHodo[hodo] = buffer[wordCounter];
203 LogDebug(
"CamacTBDataFormatter") <<
"hodo: " << hodo <<
"\t: " <<
b;
209 for (
int iplane=0; iplane<nHodoPlanes; iplane++)
213 for (
int fiber=0; fiber<nHodoFibers; fiber++) { hodoHits[iplane][fiber] = 0; }
218 for(
int j=0; j<hodoRawLen; j++)
220 int word= bufferHodo[ j+iplane*hodoRawLen ] &0xffff;
221 for(
int i=1;
i<0x10000;
i<<=1)
226 hodoHits[iplane][ hodoFiberMap[detType][ch].
nfiber - 1]++;
235 hodoRaw.
setPlanes((
unsigned int)nHodoPlanes);
236 for (
int ipl = 0; ipl < nHodoPlanes; ipl++)
239 theHodoPlane.
setChannels((
unsigned int)nHodoFibers);
240 for (
int fib = 0; fib < nHodoFibers; fib++){ theHodoPlane.
setHit((
unsigned int)fib, (
bool)hodoHits[ipl][fib]); }
241 hodoRaw.
setPlane((
unsigned int)ipl, theHodoPlane);
246 edm::LogWarning(
"CamacTBDataFormatter") <<
"hodoscope block has hardware problems or is partly unused at LV1: " 247 << lv1 <<
" spill: " << spill
249 <<
". Skipping digi.";
263 scalers_.reserve(36);
265 bool scalersAreGood =
true;
266 for (
int scaler=0; scaler<72; scaler++)
268 scalersAreGood = scalersAreGood && checkStatus(buffer[wordCounter], wordCounter);
270 a = buffer[wordCounter]; wordCounter++;
272 LogDebug(
"CamacTBDataFormatter") <<
"scaler: " << scaler <<
"\t: " <<
b;
275 if ( (scaler%2)==0 ) scalers_.push_back(b);
282 edm::LogWarning(
"CamacTBDataFormatter") <<
"scalers block has hardware problems or is partly unused at LV1: " 283 << lv1 <<
" spill: " << spill
295 LogDebug(
"CamacTBDataFormatter") <<
"\n";
296 bool fingersAreGood =
true;
297 for (
int finger=0; finger<2; finger++)
299 fingersAreGood = fingersAreGood && checkStatus(buffer[wordCounter], wordCounter);
301 a = buffer[wordCounter]; wordCounter++;
303 LogDebug(
"CamacTBDataFormatter") <<
"finger: " << finger <<
"\t: " <<
b;
309 edm::LogWarning(
"CamacTBDataFormatter") <<
"fingers block has hardware problems or is partly unused at LV1: " 310 << lv1 <<
" spill: " << spill
321 a = buffer[wordCounter]; wordCounter++;
322 LogDebug(
"CamacTBDataFormatter") <<
"\n\n word:\t" <<
a;
324 LogDebug(
"CamacTBDataFormatter") <<
"number of words used in multi stop TDC words: "<<
b;
326 int numberTDCwords = 16;
327 bool multiStopTDCIsGood =
true;
328 for (
int tdc=0; tdc< numberTDCwords ; tdc++)
330 multiStopTDCIsGood = multiStopTDCIsGood && checkStatus(buffer[wordCounter], wordCounter);
332 a = buffer[wordCounter]; wordCounter++;
334 LogDebug(
"CamacTBDataFormatter") <<
"tdc: " << tdc <<
"\t: " <<
b;
336 if ( multiStopTDCIsGood ){
340 edm::LogWarning(
"CamacTBDataFormatter") <<
"multi stop TDC block has hardware problems or is partly unused at LV1: " 341 << lv1 <<
" spill: " << spill
346 wordCounter += (16 - numberTDCwords);
354 a = buffer[wordCounter]; wordCounter++;
355 b = (a & 0x00000001);
358 LogDebug(
"CamacTBDataFormatter") <<
" table is in position.";
359 tableIsMoving =
false;
363 LogDebug(
"CamacTBDataFormatter") <<
" table is moving.";
364 tableIsMoving =
true;
378 bool ADCIsGood =
true;
379 a = buffer[wordCounter]; wordCounter++;
381 LogDebug(
"CamacTBDataFormatter") <<
"ADC word1: " << a <<
"\t ADC2: " << b <<
" word is: " << (wordCounter-1);
384 ADCIsGood = checkStatus(buffer[wordCounter], wordCounter);
385 a = buffer[wordCounter]; wordCounter++;
387 LogDebug(
"CamacTBDataFormatter") <<
"ADC word2, adc channel 11, ampli S6: " << a <<
"\t ADC2: " <<
b;
388 if (ADCIsGood) tbEventHeader.
setS6ADC ( b ) ;
389 else tbEventHeader.
setS6ADC ( -1 ) ;
397 ADCIsGood && checkStatus(buffer[wordCounter], wordCounter);
398 a = buffer[wordCounter]; wordCounter++;
400 LogDebug(
"CamacTBDataFormatter") <<
"TDC word1: " << a <<
"\t TDC2: " <<
b;
401 ADCIsGood && checkStatus(buffer[wordCounter], wordCounter);
402 a = buffer[wordCounter]; wordCounter++;
404 LogDebug(
"CamacTBDataFormatter") <<
"TDC word2: (ext_val_trig - LHC_clock) " 405 << a <<
"\t (ext_val_trig - LHC_clock): " 414 a = buffer[wordCounter]; wordCounter++;
415 LogDebug(
"CamacTBDataFormatter") <<
"\n\n word:\t" <<
a;
417 LogDebug(
"CamacTBDataFormatter") <<
"last word of event: "<<
b;
434 if ( wordNumber < 1 || wordNumber > nWordsPerEvent)
436 edm::LogWarning(
"CamacTBDataFormatter::checkStatus") <<
"checking word number: " 437 << wordNumber <<
" which is out of allowed range (" 438 << nWordsPerEvent <<
")";
444 if (word & 0x80000000)
446 edm::LogWarning(
"CamacTBDataFormatter::checkStatus") <<
"daq item not used at word: "<< wordNumber;
447 statusWords[wordNumber -1] =
false;
451 if (word & 0x40000000)
453 edm::LogWarning(
"CamacTBDataFormatter::checkStatus") <<
"vme error on word: "<< wordNumber;
454 statusWords[wordNumber -1] =
false;
458 if (word & 0x20000000)
460 edm::LogWarning(
"CamacTBDataFormatter::checkStatus") <<
"vme status error at word: "<< wordNumber;
461 statusWords[wordNumber -1] =
false;
465 if (word & 0x10000000)
467 edm::LogWarning(
"CamacTBDataFormatter::checkStatus") <<
"camac error (no X) at word: "<< wordNumber;
468 statusWords[wordNumber -1] =
false;
472 if (word & 0x08000000)
474 edm::LogWarning(
"CamacTBDataFormatter::checkStatus") <<
"camac error (no Q) at word: "<< wordNumber;
475 statusWords[wordNumber -1] =
false;
void setHit(unsigned int i, bool status)
void setPlane(unsigned int i, const EcalTBHodoscopePlaneRawHits &planeHit)
size_t size() const
Lenght of the data buffer in bytes.
void setChannels(unsigned int size)
Set methods.
void setSample(unsigned int i, const EcalTBTDCSample &sam)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
void setSize(unsigned int size)
Set methods.
void setPlanes(unsigned int size)
Set methods.