/*
$Log$
+Revision 1.19 2007/05/18 13:07:53 decaro
+Error messages stored in the global raw-reader error log (Cvetan, Chiara)
+
+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
#include "AliRawReader.h"
#include "AliTOFGeometry.h"
-#include "AliTOFGeometryV5.h"
#include "AliTOFrawData.h"
#include "AliTOFRawMap.h"
#include "AliTOFRawStream.h"
fStrip(-1),
fPadX(-1),
fPadZ(-1),
- fTOFGeometry(new AliTOFGeometryV5()),
fPackedDigits(0),
fWordType(-1),
fSlotID(-1),
//
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);
fStrip(-1),
fPadX(-1),
fPadZ(-1),
- fTOFGeometry(new AliTOFGeometryV5()),
fPackedDigits(0),
fWordType(-1),
fSlotID(-1),
// 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);
fStrip(-1),
fPadX(-1),
fPadZ(-1),
- fTOFGeometry(new AliTOFGeometryV5()),
fPackedDigits(0),
fWordType(-1),
fSlotID(-1),
fPadX = stream.fPadX;
fPadZ = stream.fPadZ;
- fTOFGeometry = stream.fTOFGeometry;
-
fPackedDigits = stream.fPackedDigits;
fWordType = stream.fWordType;
fPadX = stream.fPadX;
fPadZ = stream.fPadZ;
- fTOFGeometry = stream.fTOFGeometry;
-
fPackedDigits = stream.fPackedDigits;
fWordType = stream.fWordType;
fPackedDigits = 0;
- delete fTOFGeometry;
-
for (Int_t i=0;i<72;i++){
delete fDataBuffer[i];
delete fPackedDataBuffer[i];
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();
volume[4] = iPadZ;
}
-//_____________________________________________________________________________
-
-Int_t AliTOFRawStream::GetIndex(Int_t *detId)
-{
- //Retrieve calibration channel index
- 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 >= kSectors)
- AliError(Form("Wrong sector number in TOF (%d) !",isector));
- Int_t iplate = detId[1];
- if (iplate >= kPlates)
- AliError(Form("Wrong plate number in TOF (%d) !",iplate));
- Int_t istrip = detId[2];
- Int_t ipadz = detId[3];
- Int_t ipadx = detId[4];
- Int_t stripOffset = 0;
- switch (iplate) {
- case 0:
- stripOffset = 0;
- break;
- case 1:
- stripOffset = kStripC;
- break;
- case 2:
- stripOffset = kStripC+kStripB;
- break;
- case 3:
- stripOffset = kStripC+kStripB+kStripA;
- break;
- case 4:
- stripOffset = kStripC+kStripB+kStripA+kStripB;
- break;
- default:
- AliError(Form("Wrong plate number in TOF (%d) !",iplate));
- break;
- };
-
- 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;
}