- { 0, 1, 4, 5, 80, 81, 84, 85, 88, 89, 92, 93},
- { 8, 9,12,13, 96, 97,100,101,104,105,108,109},
- {16,17,20,21,112,113,116,117,120,121,124,125},
- {24,25,28,29,128,129,132,133,136,137,140,141},
- {32,33,36,37,144,145,148,149,152,153,156,157},
- {40,41,44,45,160,161,164,165,168,169,172,173},
- {48,49,52,53,176,177,180,181,184,185,188,189},
- {56,57,60,61,192,193,196,197,200,201,204,205},
- {64,65,68,69,208,209,212,213,216,217,220,221},
- {72,73,76,77,224,225,228,229,232,233,236,237},
- { 2, 3, 6, 7, 82, 83, 86, 87, 90, 91, 94, 95},
- {10,11,14,15, 98, 99,102,103,106,107,110,111},
- {18,19,22,23,114,115,118,119,122,123,126,127},
- {26,27,30,31,130,131,134,135,138,139,142,143},
- {34,35,38,39,146,147,150,151,154,155,158,159},
- {42,43,46,47,162,163,166,167,170,171,174,175},
- {50,51,54,55,178,179,182,183,186,187,190,191},
- {58,59,62,63,194,195,198,199,202,203,206,207},
- {66,67,70,71,210,211,214,215,218,219,222,223},
- {74,75,78,79,226,227,230,231,234,235,238,239}
+ { 4, 5, 0, 1, 80, 81, 84, 85, 88, 89, 92, 93},
+ {12,13, 8, 9, 96, 97,100,101,104,105,108,109},
+ {20,21,16,17,112,113,116,117,120,121,124,125},
+ {28,29,24,25,128,129,132,133,136,137,140,141},
+ {36,37,32,33,144,145,148,149,152,153,156,157},
+ {44,45,40,41,160,161,164,165,168,169,172,173},
+ {52,53,48,49,176,177,180,181,184,185,188,189},
+ {60,61,56,57,192,193,196,197,200,201,204,205},
+ {68,69,64,65,208,209,212,213,216,217,220,221},
+ {76,77,72,73,224,225,228,229,232,233,236,237},
+ { 7, 6, 3, 2, 83, 82, 87, 86, 91, 90, 95, 94},
+ {15,14,11,10, 99, 98,103,102,107,106,111,110},
+ {23,22,19,18,115,114,119,118,123,122,127,126},
+ {31,30,27,26,131,130,135,134,139,138,143,142},
+ {39,38,35,34,147,146,151,150,155,154,159,158},
+ {47,46,43,42,163,162,167,166,171,170,175,174},
+ {55,54,51,50,179,178,183,182,187,186,191,190},
+ {63,62,59,58,195,194,199,198,203,202,207,206},
+ {71,70,67,66,211,210,215,214,219,218,223,222},
+ {79,78,75,74,227,226,231,230,235,234,239,238}
+//__________________________________________________________________________
+void AliITSRawStreamSPD::CheckHeaderAndTrailerCount(Int_t ddlID) {
+ // Checks that the number of header and trailers found for the ddl are as expected
+ if (fEqPLChipHeadersRead != fExpectedHeaderTrailerCount) {
+ TString errMess = Form("Chip header count inconsistent %d != %d (expected) for ddl %d",
+ fEqPLChipHeadersRead,fExpectedHeaderTrailerCount,ddlID);
+ AliError(errMess.Data());
+ fRawReader->AddMajorErrorLog(kHeaderCountErr,errMess.Data());
+ if (fAdvancedErrorLog) fAdvLogger->ProcessError(kHeaderCountErr,ddlID,fEqPLBytesRead,fEqPLChipHeadersRead,errMess.Data());
+ }
+ if (fEqPLChipTrailersRead != fExpectedHeaderTrailerCount) {
+ TString errMess = Form("Chip trailer count inconsistent %d != %d (expected) for ddl %d",
+ fEqPLChipTrailersRead,fExpectedHeaderTrailerCount,ddlID);
+ AliError(errMess.Data());
+ fRawReader->AddMajorErrorLog(kHeaderCountErr,errMess.Data());
+ if (fAdvancedErrorLog) fAdvLogger->ProcessError(kHeaderCountErr,ddlID,fEqPLBytesRead,fEqPLChipHeadersRead,errMess.Data());
+ }
+}
+//__________________________________________________________________________
+void AliITSRawStreamSPD::ActivateAdvancedErrorLog(Bool_t activate, AliITSRawStreamSPDErrorLog* advLogger) {
+ // Activate the advanced error logging.
+ // Logger object has to be created elsewhere and a pointer sent here.
+ fAdvancedErrorLog=activate;
+ if (activate && advLogger!=NULL) {
+ fAdvLogger = advLogger;
+ }
+ if (fAdvLogger==NULL) {
+ fAdvancedErrorLog=kFALSE;
+ }
+}
+//__________________________________________________________________________
+const Char_t* AliITSRawStreamSPD::GetErrorName(UInt_t errorCode) {
+ // Returns a string for each error code
+ if (errorCode==kTotal) return "All Errors";
+ else if (errorCode==kHeaderMissingErr) return "Header Missing";
+ else if (errorCode==kTrailerMissingErr) return "Trailer Missing";
+ else if (errorCode==kTrailerWithoutHeaderErr) return "Trailer Unexpected";
+ else if (errorCode==kHeaderCountErr) return "Header Count Wrong";
+ else if (errorCode==kTrailerCountErr) return "Trailer Count Wrong";
+ else if (errorCode==kFillUnexpectErr) return "Fill Unexpected";
+ else if (errorCode==kFillMissingErr) return "Fill Missing";
+ else if (errorCode==kWrongFillWordErr) return "Fill Word Wrong";
+ else if (errorCode==kNumberHitsErr) return "Hit Count Wrong";
+ else if (errorCode==kEventCounterErr) return "Event Counter Error";
+ else if (errorCode==kDDLNumberErr) return "DDL Number Error";
+ else if (errorCode==kHSNumberErr) return "HS Number Error";
+ else if (errorCode==kChipAddrErr) return "Chip Address Error";
+ else if (errorCode==kCalHeaderLengthErr) return "Calib Header Length Error";
+ else if (errorCode==kAdvEventCounterErr) return "Event Counter Error (Adv)";
+ else if (errorCode==kAdvEventCounterOrderErr) return "Event Counter Jump Error (Adv)";
+ else if (errorCode==kTrailerErrorBitErr) return "Trailer Error Bit Set";
+ else if (errorCode==kLinkRxDetectorFatalErr) return "LinkRx/Detector Fatal Error Bit Set";
+ else if (errorCode==kTSMtriggerErr) return "TSM Trigger Error Bit Set";
+ else if (errorCode==kHighMultiplicityFlag) return "High Multiplicity Event Flag Set";
+ else return "";
+}
+//__________________________________________________________________________
+Bool_t AliITSRawStreamSPD::GetFastOrSignal(UInt_t eq, UInt_t hs, UInt_t chip) {
+ // returns if there was a fastor signal from this chip
+ if (eq>=20 || hs>=6 || chip>=10) {
+ TString errMess = Form("eq,hs,chip = %d,%d,%d out of bounds. Return kFALSE.",eq,hs,chip);
+ AliError(errMess.Data());
+ return kFALSE;
+ }
+ return fFastOrSignal[eq][hs][chip];
+}
+//__________________________________________________________________________
+Bool_t AliITSRawStreamSPD::IsActiveEq(UInt_t eq) const {
+ // returns if the eq is active (seen in data)
+ if (eq>=20) {
+ TString errMess = Form("eq = %d out of bounds. Return kFALSE.",eq);
+ AliError(errMess.Data());
+ return kFALSE;
+ }
+ return fActiveEq[eq];
+}
+//__________________________________________________________________________
+Bool_t AliITSRawStreamSPD::IsActiveHS(UInt_t eq, UInt_t hs) const {
+ // returns if the hs is active (info from block attr)
+ if (eq>=20 || hs>=6) {
+ TString errMess = Form("eq,hs = %d,%d out of bounds. Return kFALSE.",eq,hs);
+ AliError(errMess.Data());
+ return kFALSE;
+ }
+ return fActiveHS[eq][hs];
+}
+//__________________________________________________________________________
+Bool_t AliITSRawStreamSPD::IsActiveChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
+ // returns if the chip is active (seen in data)
+ if (eq>=20 || hs>=6 || chip>=10) {
+ TString errMess = Form("eq,hs,chip = %d,%d,%d out of bounds. Return kFALSE.",eq,hs,chip);
+ AliError(errMess.Data());
+ return kFALSE;
+ }
+ return fActiveChip[eq][hs][chip];
+}
+//__________________________________________________________________________
+//__________________________________________________________________________
+Bool_t AliITSRawStreamSPD::IsEventCounterFullConsistent() const {
+ // checks if the event counter values are consistent within the event
+ Short_t reference = -1;
+ for (UInt_t eq=0; eq<20; eq++) {
+ if (IsActiveEq(eq)) {
+ for (UInt_t hs=0; hs<6; hs++) {
+ if (IsActiveHS(eq,hs)) {
+ for (UInt_t chip=0; chip<10; chip++) {
+ if (fEventCounterFull[eq][hs][chip]!=-1) {
+ if (reference==-1) reference = fEventCounterFull[eq][hs][chip];
+ if (fEventCounterFull[eq][hs][chip] != reference) return kFALSE;
+ }
+ }
+ }
+ }
+ }
+ }
+ return kTRUE;
+}
+//__________________________________________________________________________
+Short_t AliITSRawStreamSPD::GetEventCounterFullEq(UInt_t eq) const {
+ // if the eq is active; returns the event counter value
+ if (eq>=20) {
+ TString errMess = Form("eq (%d) out of bounds",eq);
+ AliError(errMess.Data());
+ return -1;
+ }
+ if (IsActiveEq(eq)) {
+ for (UInt_t hs=0; hs<6; hs++) {
+ if (IsActiveHS(eq,hs)) {
+ for (UInt_t chip=0; chip<10; chip++) {
+ if (fEventCounterFull[eq][hs][chip]!=-1) {
+ return fEventCounterFull[eq][hs][chip];
+ }
+ }
+ }
+ }
+ }
+ return -1;
+}
+//__________________________________________________________________________
+Short_t AliITSRawStreamSPD::GetEventCounterFullHS(UInt_t eq, UInt_t hs) const {
+ // if the eq,hs is active; returns the event counter value
+ if (eq>=20 || hs>=6) {
+ TString errMess = Form("eq,hs (%d,%d) out of bounds",eq,hs);
+ AliError(errMess.Data());
+ return -1;
+ }
+ if (IsActiveEq(eq)) {
+ if (IsActiveHS(eq,hs)) {
+ for (UInt_t chip=0; chip<10; chip++) {
+ if (fEventCounterFull[eq][hs][chip]!=-1) {
+ return fEventCounterFull[eq][hs][chip];
+ }
+ }
+ }
+ }
+ return -1;
+}
+//__________________________________________________________________________
+Short_t AliITSRawStreamSPD::GetEventCounterFullChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
+ // if the eq,hs,chip is active; returns the event counter value
+ if (eq>=20 || hs>=6 || chip>=10) {
+ TString errMess = Form("eq,hs,chip (%d,%d,%d) out of bounds",eq,hs,chip);
+ AliError(errMess.Data());
+ return -1;
+ }
+ if (IsActiveEq(eq)) {
+ if (IsActiveHS(eq,hs)) {
+ if (IsActiveChip(eq,hs,chip)) {
+ return fEventCounterFull[eq][hs][chip];
+ }
+ }
+ }
+ return -1;
+}
+//__________________________________________________________________________
+Int_t AliITSRawStreamSPD::GetHword(UInt_t index) {
+ if (index<kCalHeadLenMax) return fCalHeadWord[index];
+ else return 0;
+}