// Initalize the containers
for(Int_t i = 0; i < kNChannels; i++) {
- fTime[i] = fWidth[i] = 0;
+ fTime[i] = fWidth[i] = 0.;
for(Int_t j = 0; j < kNEvOfInt; j++) {
- fADC[i][j] = 0;
+ fADC[i][j] = 0.;
fIsInt[i][j] = fIsBB[i][j] = fIsBG[i][j] = kFALSE;
}
fBBScalers[i] = fBGScalers[i] = 0;
// Reinitalize the containers
for(Int_t i = 0; i < kNChannels; i++) {
- fTime[i] = fWidth[i] = 0;
+ fTime[i] = fWidth[i] = 0.;
for(Int_t j = 0; j < kNEvOfInt; j++) {
- fADC[i][j] = 0;
+ fADC[i][j] = 0.;
fIsInt[i][j] = fIsBB[i][j] = fIsBG[i][j] = kFALSE;
}
fBBScalers[i] = fBGScalers[i] = 0;
for(Int_t iChannel = iChannel_Offset; iChannel < iChannel_Offset+4; iChannel++) {
for(Int_t iEvOfInt = 0; iEvOfInt < kNEvOfInt; iEvOfInt++) {
UShort_t data = GetNextShort();
- fADC[iChannel][iEvOfInt] = data & 0x3ff;
+ fADC[iChannel][iEvOfInt] = Float_t (data & 0x3ff);
fIsInt[iChannel][iEvOfInt] = (data >> 10) & 0x1;
}
}
for(Int_t iEvOfInt = 0; iEvOfInt < kNEvOfInt; iEvOfInt=iEvOfInt+2) {
UShort_t data = GetNextShort();
for(Int_t iChannel = iChannel_Offset; iChannel < iChannel_Offset+4; iChannel++) {
- fIsBB[iChannel][iEvOfInt] = (data >> 2*iChannel) & 0x1;
- fIsBG[iChannel][iEvOfInt] = (data >> 2*iChannel+1) & 0x1;
- fIsBB[iChannel][iEvOfInt+1] = (data >> (8+ 2*iChannel)) & 0x1;
- fIsBG[iChannel][iEvOfInt+1] = (data >> (8+ 2*iChannel+1)) & 0x1;
+ fIsBB[iChannel][iEvOfInt] = (data >> 2*(iChannel-iChannel_Offset)) & 0x1;
+ fIsBG[iChannel][iEvOfInt] = (data >> (2*(iChannel-iChannel_Offset)+1)) & 0x1;
+ if(iEvOfInt < (kNEvOfInt - 1)) {
+ fIsBB[iChannel][iEvOfInt+1] = (data >> (8+ 2*(iChannel-iChannel_Offset))) & 0x1;
+ fIsBG[iChannel][iEvOfInt+1] = (data >> (8+ 2*(iChannel-iChannel_Offset)+1)) & 0x1;
+ }
}
}
for(Int_t iBunch = 0; iBunch < kNBunches; iBunch=iBunch+2) {
UShort_t data = GetNextShort();
for(Int_t iChannel = iChannel_Offset; iChannel < iChannel_Offset+4; iChannel++) {
- fIsBBMB[iChannel][iBunch] = (data >> 2*iBunch) & 0x1;
- fIsBGMB[iChannel][iBunch] = (data >> 2*iBunch+1) & 0x1;
- fIsBBMB[iChannel][iBunch+1] = (data >> (8+2*iBunch)) & 0x1;
- fIsBGMB[iChannel][iBunch+1] = (data >> (8+2*iBunch+1)) & 0x1;
+ fIsBBMB[iChannel][iBunch] = (data >> 2*iBunch) & 0x1;
+ fIsBGMB[iChannel][iBunch] = (data >> (2*iBunch+1)) & 0x1;
+ if(iBunch < (kNBunches - 1)) {
+ fIsBBMB[iChannel][iBunch+1] = (data >> (8+2*iBunch)) & 0x1;
+ fIsBGMB[iChannel][iBunch+1] = (data >> (8+2*iBunch+1)) & 0x1;
+ }
}
}
}
- for(Int_t iChannel = iCIU*8; iChannel < (iCIU*8) + 8; iChannel++) {
- UInt_t time = GetNextWord();
- fTime[iChannel] = time & 0xfff;
- fWidth[iChannel] = (time >> 12) & 0x7f; // HPTDC used in pairing mode
+// for(Int_t iChannel = iCIU*8; iChannel < (iCIU*8) + 8; iChannel++) {
+// In fact times are stored the other way around in raw data...
+ for(Int_t iChannel = (iCIU*8) + 7; iChannel >= iCIU*8; iChannel--) {
+ UInt_t time = GetNextWord();
+ Float_t coarse1 = 25. * ((time >> 8) & 0xf );
+ Float_t coarse2 = 25. / 8. * ((time >> 5) & 0x7 );
+ Float_t fine = 25. / 256. * (time & 0x1f);
+ // fTime[iChannel] = time & 0xfff;
+ fTime[iChannel] = coarse1 + coarse2 + fine;
+ fWidth[iChannel] = 0.4 * ( (time >> 12) & 0x7f); // HPTDC used in pairing mode
}
// End of decoding of one CIU card