///////////////////////////////////////////////////////////////////////////////
#include <TObject.h>
-#include <TRandom.h>
#include "AliHMPIDParam.h"
#include <AliBitPacking.h>
#include <AliFstream.h>
void InitVars(Int_t n);
void DelVars();
- Int_t GetDDLNumber() const { return fDDLNumber; } // Provide current DDL number
- static inline Int_t GetPad(Int_t ddl,Int_t row,Int_t dil,Int_t pad); //
- Int_t GetNPads() const { return fNPads;}
- Int_t* GetPadArray() const { return fPad;}
- Int_t* GetChargeArray() const { return fCharge;}
+ static inline Int_t GetPad(Int_t ddl,Int_t row,Int_t dil,Int_t pad); //get absolute pad number
+ static Int_t GetNDDL() { return kNDDL;} //return the number of max # of DDLs
+ static Int_t GetNErrors() { return kSumErr;} //return the number of max # of Error Types
+
+ Int_t GetNPads() const { return fNPads;} //Get number of pads present in the stream
+ Int_t* GetPadArray() const { return fPad;} //Get pad array from stream decoded
+ Int_t* GetChargeArray() const { return fCharge;} //Get the charge of the pads from dedcoded stream
+ Int_t* GetnDDLInStream() const { return fnDDLInStream;} //Get the DDL input check array
+ Int_t* GetnDDLOutStream() const { return fnDDLOutStream;} //Get the DDL output check array
Int_t Pc ( Int_t ddl,Int_t row,Int_t dil,Int_t pad ) {return AliHMPIDParam::A2P(GetPad(ddl,row,dil,pad));} //PC position number
Int_t PadPcX ( Int_t ddl,Int_t row,Int_t dil,Int_t pad ) {return AliHMPIDParam::A2X(GetPad(ddl,row,dil,pad));} //pad pc x # 0..79
Int_t PadPcY ( Int_t ddl,Int_t row,Int_t dil,Int_t pad ) {return AliHMPIDParam::A2Y(GetPad(ddl,row,dil,pad));} //pad pc y # 0..47
-
- inline Bool_t SetZeroSup (Bool_t isSup);
- inline Bool_t GetZeroSup();
- inline Int_t GetErrors(Int_t ddl,Int_t eType); //Get errors and occurance
-
+
+ static inline Char_t* GetErrName(Int_t eType);
+ inline Bool_t SetZeroSup (Bool_t isSup);
+ inline Bool_t GetZeroSup()const;
+ inline Int_t GetErrors(Int_t ddl,Int_t eType)const; //Get errors and occurance
+ Int_t GetDDLNumber() const{ return fDDLNumber;} //return the number of DDL actually being decoded
+ UInt_t GetLDCNumber() const{ return fLDCNumber;} //return the number of LDC actually being decoded
+ UInt_t GetTimeStamp() const{ return fTimeStamp;} //return the time stamp of the event actually being decoded
+
+ void SetTurbo(Bool_t isTurbo){fTurbo=isTurbo;} // Enable/Disable Turbo
+ Bool_t GetTurbo(){ return fTurbo;} // Enable Turbo
+ Bool_t Turbo(); // Read HMPID Raw data without error checks
Bool_t ReadHMPIDRawData(); // Read HMPID Raw data
Bool_t ReadSegment(Int_t &cntSegment); // Read Segment
Bool_t ReadRow(Int_t &cntRow); // Read Row
kbit17,kbit18,kbit19,kbit20,kbit21,kbit22,kbit23,kbit24,
kbit25,kbit26,kbit27,kbit28,kbit29,kbit30,kbit31,kbit32};
- enum EHMPIDRawStreamError {
- kRawDataSizeErr = 1,
- kRowMarkerErr = 2,
- kWrongRowErr = 3,
- kWrongDilogicErr = 4,
- kWrongPadErr = 5,
- kEoEFlagErr = 6,
- kEoESizeErr = 7,
- kEoEDILOGICErr = 8,
- kEoERowErr = 9,
- kBadSegWordErr = 10,
- kWrongSegErr = 11,
- kRowMarkerSizeErr = 12,
- kSumErr = 13 //This is always the last one, to retreive the number of errors
- };
-
- enum {
+ enum EHMPIDRawStreamError { kRawDataSizeErr = 0, kRowMarkerErr = 1, kWrongRowErr = 2, kWrongDilogicErr = 3,
+ kWrongPadErr = 4, kEoEFlagErr = 5, kEoESizeErr = 6, kEoEDILOGICErr = 7,
+ kEoERowErr = 8, kBadSegWordErr = 9, kWrongSegErr = 10, kRowMarkerSizeErr = 11,
+ kPedQZero =12, kSumErr = 13 //This is always the last one, to retreive the number of errors
+ }; //Always check the updated list of names in the .cxx file for print-out!
+
+ enum {
kNRows = 24, // Number of rows (starting from 1 !)//was25
kNDILOGICAdd = 10, // Number of DILOGIC addresses in a row (starting from 1 !) //was11
kNPadAdd = 48, // Number of pad row
kNRowsPerSegment = 8, // Number of rows per segment
kNDDL = 14
};
- enum EHMPIDRawError {
+ enum EHMPIDRawError {
kInvalidRawDataWord = 1
};
AliHMPIDRawStream& operator = (const AliHMPIDRawStream& stream);
AliHMPIDRawStream(const AliHMPIDRawStream& stream);
- UInt_t GetWord(Int_t n=1,EDirection dir=kFwd); // Get n-th word
+ Bool_t GetWord(Int_t n=1,EDirection dir=kFwd); // Get n-th word
UInt_t GetNextWord(); // Get next word
Int_t fNPads; // counter of pads in one DDL
Int_t *fCharge; // Array for charge values for all channels in one DDL
Int_t *fPad; // Array for abs pad values for all channels in one DDL
Int_t fDDLNumber; // index of current DDL number
+ Int_t *fnDDLInStream; // if the DDL is in the raw data
+ Int_t *fnDDLOutStream; // if the DDL is in the raw data
+ UInt_t fLDCNumber; // index of current LDC number
+ UInt_t fTimeStamp; // TimeStamp
AliRawReader *fRawReader; // object for reading the raw data
UChar_t *fData; // raw data
Int_t **fNumOfErr; // Store the numner of errors for a given error type and a given DDL
UInt_t fWord; // current position in fData
Bool_t fZeroSup; // set if zero suppression is applied
Int_t *fPos; // for debug purposes
- Int_t iPos; // counter for debug
-
+ Int_t fiPos; // counter for debug
+ Bool_t fTurbo; // kTRUE = Turbo decoding is called. DEFAULT: kFALSE = normal decoding is called
ClassDef(AliHMPIDRawStream, 2) // base class for reading HMPID raw digits
};
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// in case the charge from the channels
// has not been read or invalid arguments
- assert(0<=ddl&&ddl<=13);
- assert(1<=row&&row<=24);
- assert(1<=dil&&dil<=10);
- assert(0<=pad&&pad<=47);
-
+ //assert(0<=ddl&&ddl<=13); assert(1<=row&&row<=24); assert(1<=dil&&dil<=10); assert(0<=pad&&pad<=47);
+ /* clm */ //corrupted data from ddl aborts the pedestal run at the assert
+ if(ddl<0 || ddl >13 || row<1 || row >25 || dil<1 || dil >10 || pad<0 || pad >47 ) return -1;
+ /* clm */
Int_t a2y[6]={3,2,4,1,5,0}; //pady for a given padress (for single DILOGIC chip)
- Int_t ch=ddl/2;
- Int_t tmp=(row-1)/8; Int_t pc=(ddl%2)? 5-2*tmp:2*tmp;
- Int_t px=(dil-1)*8+pad/6;
- tmp=(ddl%2)?(24-row):row-1;
- Int_t py=6*(tmp%8)+a2y[pad%6];
-
+ Int_t ch=ddl/2;
+ Int_t tmp=(24-row)/8;
+ Int_t pc=(ddl%2)?5-2*tmp:2*tmp;
+ Int_t px=(kNDILOGICAdd+1 - dil)*8-pad/6-1; //flip according to Paolo (2-9-2008)
+
+ tmp=(ddl%2)?row-1:(24-row);
+ Int_t py=6*(tmp%8)+a2y[pad%6];
+
return AliHMPIDParam::Abs(ch,pc,px,py);
}//GetPad()
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
return fZeroSup;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Bool_t AliHMPIDRawStream::GetZeroSup()
+Bool_t AliHMPIDRawStream::GetZeroSup()const
{
if(fZeroSup==kTRUE) return kTRUE;
else return kFALSE;
for(Int_t iDig=0;iDig<pDigCh->GetEntriesFast();iDig++){//digits loop
AliHMPIDDigit *pDig1=(AliHMPIDDigit*)pDigCh->At(iDig);
- pDig1->Raw(w32,ddl,r,d,a);
+ pDig1->Raw(w32,ddl,r,d,a); //??????????
isDigThere[ddl][r][d][a]=iDig;
}
AliHMPIDDigit *pDig=(AliHMPIDDigit*)pDigCh->At(isDigThere[iddl][row][dil][pad]);
pDig->Raw(w32,ddl,r,d,a);
if(pDig->Q() < 0 ) continue; //We can turn of the zero sup for pedestal simulation
- //Printf("::::::::::::::: ddl from Digit : %d",ddl);
- if(ddl%2){ //write raw digit selecting on DDL
+ if(ddl%2){ //write raw digit selecting on DDL
ddlL->WriteBuffer((char*)&w32,sizeof(w32)); cntL++; cntLpad++; cntLrow++; cntLdig++; cntwInLseg++;//Printf(" WL: %x isDig: %d",w32,isDigThere[iddl][row][dil][pad]);
}else{
ddlR->WriteBuffer((char*)&w32,sizeof(w32)); cntR++; cntRpad++; cntRrow++; cntRdig++;cntwInRseg++;//Printf(" WR: %x isDig: %d",w32,isDigThere[iddl][row][dil][pad]);
}//chambers loop
}//WriteRaw()
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Int_t AliHMPIDRawStream::GetErrors(Int_t ddl,Int_t eType)
+Int_t AliHMPIDRawStream::GetErrors(Int_t ddl,Int_t eType)const
{
// Return the number of errors for a given error tye during raw data reading
// Arguments: errorType
-// Returns: error or -999 if error Type does not exist
+// Returns: error or -999 if error Type does not exist
- if(eType < 1 || eType> kSumErr-1 ) return -999;
- else if( ddl < 0 || ddl > kNDDL-1 ) return -999;
- else
- return fNumOfErr[ddl][eType];
+ if(eType < 0 || eType> kSumErr || ddl < 0 || ddl > kNDDL-1 ) return -999;
+ else return fNumOfErr[ddl][eType];
} //GetErrors()
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
+Char_t* AliHMPIDRawStream::GetErrName(Int_t eType)
+{
+ // Return the name of the error for a given error tye during raw data reading
+ // Arguments: errorType
+ // Returns: error or -999 if error Type does not exist
+ Char_t *eName[]={ "kRawDataSizeErr", "kRowMarkerErr" , "kWrongRowErr" , "kWrongDilogicErr",
+ "kWrongPadErr" , "kEoEFlagErr" , "kEoESizeErr" , "kEoEDILOGICErr",
+ "kEoERowErr" , "kBadSegWordErr", "kWrongSegErr" , "kRowMarkerSizeErr",
+ "kPedQZero" , "kSumErr" };
+ Char_t *eNoErr="NotDefinedErrorType";
+ if(eType<0 || eType>kSumErr) return eNoErr;
+ else return eName[eType];
+}//GetErrName()
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+
+
#endif