#include <RawVaDigit.h>
Inheritance diagram for RawVaDigit:

Public Types | |
| enum | EVaErrorCode { kAdcNegative = BIT(0), kNonStdData = BIT(1), kWarningState = BIT(2), kParityErr0 = BIT(3), kParityErr1 = BIT(4), kWordBitErr0 = BIT(5), kWordBitErr1 = BIT(6) } |
Public Member Functions | |
| RawVaDigit () | |
| RawVaDigit (const Int_t *&p, const RawDigitCrateStatus *cstat) | |
| virtual | ~RawVaDigit () |
Static Public Member Functions | |
| const Char_t * | AsString (EVaErrorCode errcode) |
|
|
Definition at line 25 of file RawVaDigit.h. 00025 {
00026 // intrepretation of ErrorCode bits
00027 kAdcNegative = BIT(0),
00028 kNonStdData = BIT(1), // either CalInject or Pedestal data
00029 kWarningState = BIT(2), // for normal data: FIFO almost full
00030 // for CalInject: no dynode trigger received
00031 kParityErr0 = BIT(3), // parity error on lower word
00032 kParityErr1 = BIT(4), // parity error on upper word
00033 kWordBitErr0 = BIT(5), // bit 31 of lower word wasn't 0
00034 kWordBitErr1 = BIT(6)
00035 };
|
|
|
Definition at line 45 of file RawVaDigit.h. 00045 : RawDigit() { ; }
|
|
||||||||||||
|
Definition at line 20 of file RawVaDigit.cxx. 00021 {
00022 // this is where the sub-block is actually unpacked
00023 // to fill the fields
00024 //
00025 // 3 2 1 0
00026 // 10987654321098765432109876543210
00027 // U: 1PWccccccccccccNsaaaaaaaaaaaaaa X=common mode,c=chan, s=sign a=adc
00028 // L: 0Pttttttttttttttttttttttttttttt P=parity, t=tdc
00029 // X: PlexStripEndId::fEncoded
00030 // W = fifo or calinject warning condition (0=okay)
00031 // N = 1 for normal data taking (0=calinject or pedestal data)
00032
00033 const int chaddmask = 0x1fff;
00034 const int chaddshift = 16;
00035 const int adcmask = 0x00003fff;
00036 const int tdcmask = 0x3fffffff;
00037
00038 const int adcsignbit = 0x00004000;
00039 const int adcsignext = 0xffffc000;
00040 // const int adcsignshft = 14;
00041
00042 Int_t chadd = ( p[0] >> chaddshift) & chaddmask;
00043 BuildRawChannelId(cstat,chadd);
00044
00045 // fErrorCode:
00046 // bit
00047 // 7 unused
00048 // 6 0 if bit 31 of upper word was indeed 1
00049 // 5 0 if bit 31 of lower word was indeed 0
00050 // 4 0 if bit 30 of upper word did correctly match computed parity
00051 // 3 0 if bit 30 of lower word did correctly match computed parity
00052 // 2 bit 29 of upper word
00053 // if bit 1 = 0: 0=FIFO OK, 1=FIFO almost full
00054 // if bit 1 = 1: 0=CalInject OK, 1=no dynode trig from CalInject
00055 // 1 0 if bit 15 of upper word was 1 (normal data mode)
00056 // value of 1 here indicates either CalInject or Pedestal
00057 // 0 bit 14 of upper word = sign of ADC
00058
00059 const int wordbit = 0x80000000;
00060 // const int parityb = 0x40000000;
00061 const int warnb = 0x20000000;
00062 const int stddatab = 0x00008000;
00063
00064 fErrorCode = 0;
00065 if ( p[0] & adcsignbit) fErrorCode |= kAdcNegative;
00066 if (!(p[0] & stddatab) ) fErrorCode |= kNonStdData;
00067 if ( p[0] & warnb ) fErrorCode |= kWarningState;
00068
00069 // compute & test parity bits ... sum of bits should be even
00070 int sum1 = 0;
00071 int sum0 = 0;
00072 int v1 = p[0]; // upper word
00073 int v0 = p[1]; // lower word
00074 for (int j=0; j<32; j++) {
00075 sum1 += (v1&1);
00076 sum0 += (v0&1);
00077 v1 = v1 >> 1;
00078 v0 = v0 >> 1;
00079 }
00080 if (sum1&1 != 0) fErrorCode |= kParityErr1;
00081 if (sum0&1 != 0) fErrorCode |= kParityErr0;
00082
00083 if (!(p[0] & wordbit) == wordbit ) fErrorCode |= kWordBitErr1;
00084 if (!(p[1] & wordbit) == 0 ) fErrorCode |= kWordBitErr0;
00085
00086 fAdc = p[0] & adcmask;
00087 // bit 14 (lower bit of "hdr") tells whether ADC is negative
00088 // if so sign extend the existing 14 bit 2's complement value
00089 if (p[0] & adcsignbit) fAdc |= adcsignext;
00090
00091 fTdc = p[1] & tdcmask;
00092
00093 #ifdef RWHDEBUG
00094 printf("RawVaDigit::(Unpack from chunk) RCId %s\n ADC %5d TDC %6d\n",
00095 fRawChannelId.AsString(""),
00096 fAdc,fTdc);
00097 cout << "RawVaDigit started with p= " << p << endl;
00098 #endif
00099
00100 // processing eat up 2 words
00101 p += 2;
00102 }
|
|
|
Definition at line 46 of file RawVaDigit.h. 00046 { ; }
|
|
|
Definition at line 105 of file RawVaDigit.cxx. References kAdcNegative, kNonStdData, kParityErr0, kParityErr1, kWarningState, kWordBitErr0, and kWordBitErr1. 00106 {
00107 switch (errcode) {
00108 case kAdcNegative: return "Adc Negative"; break;
00109 case kNonStdData: return "Non-Standard Data"; break;
00110 case kWarningState: return "Warning State"; break;
00111 case kParityErr0: return "Parity Error 0"; break;
00112 case kParityErr1: return "Parity Error 1"; break;
00113 case kWordBitErr0: return "Word Bit Error 0"; break;
00114 case kWordBitErr1: return "Word Bit Error 1"; break;
00115 default: return "Unknown VA Error Code"; break;
00116 }
00117 }
|
1.3.9.1