/*
$Log$
+Revision 1.18 2007/05/08 11:53:29 arcelli
+Improved class flexibility for further use (R.Preghenella)
+
+Revision 1.17 2007/05/03 08:53:50 decaro
+Coding convention: RS3 violation -> suppression
+
+Revision 1.16 2007/05/03 08:22:22 decaro
+Coding convention: RN17 violation -> suppression
+
+Revision 1.15 2007/04/30 15:22:06 arcelli
+Change TOF digit Time, Tot etc to int type
+
Revision 1.14 2007/04/27 11:11:53 arcelli
updates for the new decoder
+Revision 1.13 2007/03/16 11:46:35 decaro
+Coding convention: RN17 rule violation -> suppression
+
Revision 1.12 2007/02/22 09:43:45 decaro
Added AliTOFRawStream::GetIndex method for online calibration (C.Zampolli)
//
for (Int_t i=0;i<AliDAQ::NumberOfDdls("TOF");i++){
- fDataBuffer[i]=new AliTOFHitDataBuffer(DATA_BUFFER_SIZE);
- fPackedDataBuffer[i]=new AliTOFHitDataBuffer(DATA_BUFFER_SIZE);
+ fDataBuffer[i]=new AliTOFHitDataBuffer();
+ fPackedDataBuffer[i]=new AliTOFHitDataBuffer();
}
fTOFrawData = new TClonesArray("AliTOFrawData",1000);
// default ctr
//
for (Int_t i=0;i<AliDAQ::NumberOfDdls("TOF");i++){
- fDataBuffer[i]=new AliTOFHitDataBuffer(DATA_BUFFER_SIZE);
- fPackedDataBuffer[i]=new AliTOFHitDataBuffer(DATA_BUFFER_SIZE);
+ fDataBuffer[i]=new AliTOFHitDataBuffer();
+ fPackedDataBuffer[i]=new AliTOFHitDataBuffer();
}
fTOFrawData = new TClonesArray("AliTOFrawData",1000);
iPadAlongTheStrip = iTDClocal*AliTOFGeometry::NCh() + iCHlocal;
if (((iDDL==1 || iDDL==2) && iPadAlongTheStrip< AliTOFGeometry::NpadX()) ||
- ((iDDL==0 || iDDL==3) && iPadAlongTheStrip>=AliTOFGeometry::NpadX()))
- AliError("Problems with the padX number!");
-
+ ((iDDL==0 || iDDL==3) && iPadAlongTheStrip>=AliTOFGeometry::NpadX())) {
+ fRawReader->AddMajorErrorLog(kPadXError);
+ AliWarning("Problems with the padX number!");
+ }
return iPadAlongTheStrip;
}
Int_t iSector = GetSectorNumber(nDDL);
Int_t iPlate = Equip2VolNplate(iDDL, nTRM, nTDC);
- if (iPlate==-1) AliError("Problems with the plate number!");
+ if (iPlate==-1) {
+ fRawReader->AddMajorErrorLog(kPlateError,"plate = -1");
+ AliWarning("Problems with the plate number!");
+ }
Int_t iStrip = Equip2VolNstrip(iDDL, nTRM, nTDC);
- if (iStrip==-1) AliError("Problems with the strip number!");
+ if (iStrip==-1) {
+ fRawReader->AddMajorErrorLog(kStripError,"strip = -1");
+ AliWarning("Problems with the strip number!");
+ }
Int_t iPadAlongTheStrip = Equip2VolNpad(iDDL, iChain, nTDC, iCH);
- if (iPadAlongTheStrip==-1)
- AliError("Problems with the pad number along the strip!");
+ if (iPadAlongTheStrip==-1){
+ fRawReader->AddMajorErrorLog(kPadAlongStripError,"pad = -1");
+ AliWarning("Problems with the pad number along the strip!");
+ }
Int_t iPadX = (Int_t)(iPadAlongTheStrip/(Float_t(AliTOFGeometry::NpadZ())));
Int_t iPadZ = iPadAlongTheStrip%AliTOFGeometry::NpadZ();
Int_t AliTOFRawStream::GetIndex(Int_t *detId)
{
//Retrieve calibration channel index
- const Int_t nSectors = fTOFGeometry->NSectors();
- const Int_t nPlates = fTOFGeometry->NPlates();
- const Int_t nStripA = fTOFGeometry->NStripA();
- const Int_t nStripB = fTOFGeometry->NStripB();
- const Int_t nStripC = fTOFGeometry->NStripC();
- const Int_t nPadX = fTOFGeometry->NpadX();
- const Int_t nPadZ = fTOFGeometry->NpadZ();
+ const Int_t kSectors = fTOFGeometry->NSectors();
+ const Int_t kPlates = fTOFGeometry->NPlates();
+ const Int_t kStripA = fTOFGeometry->NStripA();
+ const Int_t kStripB = fTOFGeometry->NStripB();
+ const Int_t kStripC = fTOFGeometry->NStripC();
+ const Int_t kPadX = fTOFGeometry->NpadX();
+ const Int_t kPadZ = fTOFGeometry->NpadZ();
Int_t isector = detId[0];
- if (isector >= nSectors)
- AliError(Form("Wrong sector number in TOF (%d) !",isector));
+ if (isector >= kSectors){
+ fRawReader->AddMajorErrorLog(kSectorError, Form("sector = %i",isector));
+ AliWarning(Form("Wrong sector number in TOF (%d) !",isector));
+ }
Int_t iplate = detId[1];
- if (iplate >= nPlates)
- AliError(Form("Wrong plate number in TOF (%d) !",iplate));
+ if (iplate >= kPlates){
+ fRawReader->AddMajorErrorLog(kPlateError, Form("plate = %i",iplate));
+ AliWarning(Form("Wrong plate number in TOF (%d) !",iplate));
+ }
Int_t istrip = detId[2];
Int_t ipadz = detId[3];
Int_t ipadx = detId[4];
stripOffset = 0;
break;
case 1:
- stripOffset = nStripC;
+ stripOffset = kStripC;
break;
case 2:
- stripOffset = nStripC+nStripB;
+ stripOffset = kStripC+kStripB;
break;
case 3:
- stripOffset = nStripC+nStripB+nStripA;
+ stripOffset = kStripC+kStripB+kStripA;
break;
case 4:
- stripOffset = nStripC+nStripB+nStripA+nStripB;
+ stripOffset = kStripC+kStripB+kStripA+kStripB;
break;
default:
- AliError(Form("Wrong plate number in TOF (%d) !",iplate));
+ fRawReader->AddMajorErrorLog(kPlateError, Form("plate = %i",iplate));
+ AliWarning(Form("Wrong plate number in TOF (%d) !",iplate));
break;
};
- Int_t idet = ((2*(nStripC+nStripB)+nStripA)*nPadZ*nPadX)*isector +
- (stripOffset*nPadZ*nPadX)+
- (nPadZ*nPadX)*istrip+
- (nPadX)*ipadz+
+ Int_t idet = ((2*(kStripC+kStripB)+kStripA)*kPadZ*kPadX)*isector +
+ (stripOffset*kPadZ*kPadX)+
+ (kPadZ*kPadX)*istrip+
+ (kPadX)*ipadz+
ipadx;
return idet;
}
//-----------------------------------------------------------------------------
-Bool_t AliTOFRawStream::DecodeDDL(Int_t DDLMin, Int_t DDLMax, Int_t verbose = 0){
- Int_t currentEquipment;
- Int_t currentDDL;
+Bool_t AliTOFRawStream::DecodeDDL(Int_t nDDLMin, Int_t nDDLMax, Int_t verbose = 0) {
+ //
+ // To decode raw data for DDL number in [nDDLmin; nDDLmax]
+ //
- //pointers
- UChar_t *data = 0x0;
-
//check and fix valid DDL range
- if (DDLMin < 0){
- DDLMin = 0;
- AliError("Wrong DDL range: setting first DDL ID to 0");
+ if (nDDLMin < 0){
+ nDDLMin = 0;
+ fRawReader->AddMinorErrorLog(kDDLMinError);
+ AliWarning("Wrong DDL range: setting first DDL ID to 0");
}
- if (DDLMax > 71){
- DDLMax = 71;
- AliError("Wrong DDL range: setting last DDL ID to 71");
+ if (nDDLMax > 71){
+ nDDLMax = 71;
+ fRawReader->AddMinorErrorLog(kDDLMaxError);
+ AliWarning("Wrong DDL range: setting last DDL ID to 71");
}
//select required DDLs
- fRawReader->Select("TOF", DDLMin, DDLMax);
+ fRawReader->Select("TOF", nDDLMin, nDDLMax);
if (verbose)
- AliInfo(Form("Selected TOF DDL range: %d-%d", DDLMin, DDLMax));
+ AliInfo(Form("Selected TOF DDL range: %d-%d", nDDLMin, nDDLMax));
+ return(Decode(verbose));
+}
+//-----------------------------------------------------------------------------
+Bool_t AliTOFRawStream::Decode(Int_t verbose = 0) {
+ //
+ // New decoder method
+ //
+
+ Int_t currentEquipment;
+ Int_t currentDDL;
+
+ //pointers
+ UChar_t *data = 0x0;
+
//loop and read DDL headers
while(fRawReader->ReadHeader()){
//read equipment payload
if (!fRawReader->ReadNext(data, kDataSize))
{
+ fRawReader->AddMajorErrorLog(kDDLdataReading);
if (verbose)
- AliError("Error while reading DDL data. Go to next equipment");
+ AliWarning("Error while reading DDL data. Go to next equipment");
delete [] data;
data = 0x0;
continue;
fDecoder->SetPackedDataBuffer(fPackedDataBuffer[currentDDL]);
//start decoding
- if (fDecoder->Decode((UInt_t *)data, kDataWords) == kTRUE)
- AliError(Form("Error while decoding DDL # %d: decoder returned with errors", currentDDL));
+ if (fDecoder->Decode((UInt_t *)data, kDataWords) == kTRUE) {
+ fRawReader->AddMajorErrorLog(kDDLDecoder,Form("DDL # = %d",currentDDL));
+ AliWarning(Form("Error while decoding DDL # %d: decoder returned with errors", currentDDL));
+ }
delete [] data;
data = 0x0;
void
AliTOFRawStream::ResetBuffers()
{
+ //
+ // To reset the buffers
+ //
+
for (Int_t iDDL = 0; iDDL < AliDAQ::NumberOfDdls("TOF"); iDDL++){
ResetDataBuffer(iDDL);
ResetPackedDataBuffer(iDDL);
Bool_t
AliTOFRawStream::LoadRawDataBuffers(Int_t indexDDL, Int_t verbose)
{
+ //
+ // To load the buffers
+ //
+
fTOFrawData->Clear();
fPackedDigits = 0;
AliInfo(Form("Decoding raw data for DDL # %d ...", indexDDL));
if (DecodeDDL(indexDDL, indexDDL, verbose) != 0){ //decode DDL
- AliError(Form("Error while decoding DDL # %d", indexDDL));
+ fRawReader->AddMajorErrorLog(kDDLDecoder,Form("DDL # = %d",indexDDL));
+ AliWarning(Form("Error while decoding DDL # %d", indexDDL));
return kTRUE;
}