]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFRawStream.cxx
Adding set of AliESDEvent in the track for TOF matching
[u/mrichter/AliRoot.git] / TOF / AliTOFRawStream.cxx
index 37be5961b0c7c2fc706653ce7244dcb8caaeaa02..b46291de47047b98093c66336c7844e39ebed0a9 100644 (file)
@@ -504,12 +504,13 @@ AliTOFRawStream::~AliTOFRawStream()
   // destructor
 
   fPackedDigits = 0;
-
   delete fDecoder;
   delete fDecoderV2;
   
-  fTOFrawData->Clear();
-  delete fTOFrawData;
+  if (fTOFrawData) {
+    fTOFrawData->Clear("C");
+    delete fTOFrawData;
+  }
 
   //delete fCableLengthMap;
 
@@ -630,6 +631,11 @@ Bool_t AliTOFRawStream::Next()
   }
 
   fDDL  = fRawReader->GetDDLID();
+  if (fDDL==-1) {
+    fRawReader->AddMajorErrorLog(kDDLdataReading);
+    AliWarning("Error when load DDL. Go to next DDL");
+    return kFALSE;
+  }
 
   fWordType = GetField(data,WORD_TYPE_MASK,WORD_TYPE_POSITION);
 
@@ -1438,10 +1444,6 @@ Bool_t AliTOFRawStream::Decode(Int_t verbose = 0) {
   //loop and read DDL headers 
   while(fRawReader->ReadHeader()){
 
-    //memory leak prevention (actually data should be always 0x0 here)
-    if (data != 0x0)
-      delete [] data;
-
     //get equipment infos
     currentEquipment = fRawReader->GetEquipmentId();
 
@@ -1487,7 +1489,7 @@ Bool_t AliTOFRawStream::Decode(Int_t verbose = 0) {
     //start decoding
     if (fDecoder->Decode((UInt_t *)data, kDataWords, currentCDH) == kTRUE) {
       fRawReader->AddMajorErrorLog(kDDLDecoder,Form("DDL # = %d",currentDDL));
-      AliWarning(Form("Error while decoding DDL # %d: decoder returned with errors", currentDDL));
+      if (verbose) AliWarning(Form("Error while decoding DDL # %d: decoder returned with errors", currentDDL));
       ResetDataBuffer(currentDDL);
       ResetPackedDataBuffer(currentDDL);
     }
@@ -1556,7 +1558,7 @@ Bool_t AliTOFRawStream::DecodeV2(Int_t verbose = 0) {
   //start decoding
   if (fDecoderV2->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));
+    if (verbose) AliWarning(Form("Error while decoding DDL # %d: decoder returned with errors", currentDDL));
   }
   
   delete [] data;
@@ -1735,12 +1737,12 @@ AliTOFRawStream::LoadRawDataBuffersV2(Int_t indexDDL, Int_t verbose)
 
   /* check error detected/recovered */
   if (decodersd->GetErrorDetected()) {
-    AliWarning(Form("Error detected while decoding DDL %d (errorSlotID mask = %04x)", indexDDL, decodersd->GetErrorSlotID()));
+      AliDebug(2, Form("Error detected while decoding DDL %d (errorSlotID mask = %04x)", indexDDL, decodersd->GetErrorSlotID()));
     if (decodersd->GetRecoveringError()) {
-      AliWarning("Couldn't recover from error");
+      AliDebug(2, "Couldn't recover from error");
     }
     else {
-      AliWarning("Error recovered, anyway something is probably lost");
+      AliDebug(2, "Error recovered, anyway something is probably lost");
     }
   }
   /* check DRM header/trailer */
@@ -1751,10 +1753,10 @@ AliTOFRawStream::LoadRawDataBuffersV2(Int_t indexDDL, Int_t verbose)
   }
   /* check partecipating mask */
   if (drmsd->GetPartecipatingSlotID() != drmsd->GetDecoderSlotEnableMask()) {
-    AliWarning(Form("DRM slot enable mask differs from decoder slot enable mask (%08x != %08x) in DDL %d", drmsd->GetSlotEnableMask(), drmsd->GetDecoderSlotEnableMask(), indexDDL));
+      AliDebug(2, Form("DRM slot enable mask differs from decoder slot enable mask (%08x != %08x) in DDL %d", drmsd->GetSlotEnableMask(), drmsd->GetDecoderSlotEnableMask(), indexDDL));
     for (Int_t ibit = 0; ibit < 11; ibit++)
       if ((drmsd->GetPartecipatingSlotID() & (0x1 << ibit)) && !(drmsd->GetDecoderSlotEnableMask() & (0x1 << ibit)))
-       AliWarning(Form("readout slot %d data is missing in decoder", ibit + 2));
+        AliDebug(2, Form("readout slot %d data is missing in decoder", ibit + 2));
   }
   
   /* get DRM data */
@@ -1774,6 +1776,7 @@ AliTOFRawStream::LoadRawDataBuffersV2(Int_t indexDDL, Int_t verbose)
     /* skip if bad TRM event counter detected */
     if (trmsd->GetEventCounter() != drmsd->GetLocalEventCounter()) continue;
     /* skip if bad TRM CRC detected */
+    AliDebug(2,Form("~~~~~~ %02d %02d --- TRM CRC: as written in raw data =%d and as computed =%d ~~~~~~",indexDDL,itrm,trmsd->GetEventCRC(), trmsd->GetDecoderCRC()));
     if (trmsd->GetEventCRC() != trmsd->GetDecoderCRC()) continue;
 
     /* loop over chains */