]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFRawStream.cxx
warning suppression
[u/mrichter/AliRoot.git] / TOF / AliTOFRawStream.cxx
index cc2bb978084e770e5dea194d78b1d567a89f8206..bd45a08ac372bc97739974420f7582da2fca0c97 100644 (file)
 
 /*
 $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
 
@@ -84,7 +96,6 @@ Revision 0.01  2005/07/22 A. De Caro
 #include "AliRawReader.h"
 
 #include "AliTOFGeometry.h"
-#include "AliTOFGeometryV5.h"
 #include "AliTOFrawData.h"
 #include "AliTOFRawMap.h"
 #include "AliTOFRawStream.h"
@@ -114,7 +125,6 @@ AliTOFRawStream::AliTOFRawStream(AliRawReader* rawReader):
   fStrip(-1),
   fPadX(-1),
   fPadZ(-1),
-  fTOFGeometry(new AliTOFGeometryV5()),
   fPackedDigits(0),
   fWordType(-1),
   fSlotID(-1),
@@ -132,8 +142,8 @@ AliTOFRawStream::AliTOFRawStream(AliRawReader* rawReader):
   //
 
   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);
@@ -164,7 +174,6 @@ AliTOFRawStream::AliTOFRawStream():
   fStrip(-1),
   fPadX(-1),
   fPadZ(-1),
-  fTOFGeometry(new AliTOFGeometryV5()),
   fPackedDigits(0),
   fWordType(-1),
   fSlotID(-1),
@@ -181,8 +190,8 @@ AliTOFRawStream::AliTOFRawStream():
   // 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);
@@ -211,7 +220,6 @@ AliTOFRawStream::AliTOFRawStream(const AliTOFRawStream& stream) :
   fStrip(-1),
   fPadX(-1),
   fPadZ(-1),
-  fTOFGeometry(new AliTOFGeometryV5()),
   fPackedDigits(0),
   fWordType(-1),
   fSlotID(-1),
@@ -250,8 +258,6 @@ AliTOFRawStream::AliTOFRawStream(const AliTOFRawStream& stream) :
   fPadX = stream.fPadX;
   fPadZ = stream.fPadZ;
 
-  fTOFGeometry = stream.fTOFGeometry;
-
   fPackedDigits = stream.fPackedDigits;
 
   fWordType = stream.fWordType;
@@ -302,8 +308,6 @@ AliTOFRawStream& AliTOFRawStream::operator = (const AliTOFRawStream& stream)
   fPadX = stream.fPadX;
   fPadZ = stream.fPadZ;
 
-  fTOFGeometry = stream.fTOFGeometry;
-
   fPackedDigits = stream.fPackedDigits;
 
   fWordType = stream.fWordType;
@@ -335,8 +339,6 @@ AliTOFRawStream::~AliTOFRawStream()
 
   fPackedDigits = 0;
 
-  delete fTOFGeometry;
   for (Int_t i=0;i<72;i++){ 
     delete fDataBuffer[i];
     delete fPackedDataBuffer[i];
@@ -1028,9 +1030,10 @@ Int_t AliTOFRawStream::Equip2VolNpad(Int_t iDDL, Int_t iChain, Int_t nTDC,
   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;
 
 }
@@ -1093,14 +1096,22 @@ void AliTOFRawStream::EquipmentId2VolumeId(Int_t nDDL, Int_t nTRM, Int_t iChain,
   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();
@@ -1112,82 +1123,44 @@ void AliTOFRawStream::EquipmentId2VolumeId(Int_t nDDL, Int_t nTRM, Int_t iChain,
   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()){
 
@@ -1211,8 +1184,9 @@ Bool_t AliTOFRawStream::DecodeDDL(Int_t DDLMin, Int_t DDLMax, Int_t verbose = 0)
     //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;
@@ -1228,8 +1202,10 @@ Bool_t AliTOFRawStream::DecodeDDL(Int_t DDLMin, Int_t DDLMax, Int_t verbose = 0)
     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;
@@ -1248,6 +1224,10 @@ Bool_t AliTOFRawStream::DecodeDDL(Int_t DDLMin, Int_t DDLMax, Int_t verbose = 0)
 void
 AliTOFRawStream::ResetBuffers()
 {
+  //
+  // To reset the buffers
+  //
+
   for (Int_t iDDL = 0; iDDL < AliDAQ::NumberOfDdls("TOF"); iDDL++){
     ResetDataBuffer(iDDL);
     ResetPackedDataBuffer(iDDL);
@@ -1258,6 +1238,10 @@ AliTOFRawStream::ResetBuffers()
 Bool_t
 AliTOFRawStream::LoadRawDataBuffers(Int_t indexDDL, Int_t verbose)
 {
+  //
+  // To load the buffers
+  //
+
   fTOFrawData->Clear();
   fPackedDigits = 0;
   
@@ -1265,7 +1249,8 @@ AliTOFRawStream::LoadRawDataBuffers(Int_t indexDDL, Int_t verbose)
     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;
   }