]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ZDC/AliZDCRawStream.cxx
Bug #92237 fixed as Barth suggested
[u/mrichter/AliRoot.git] / ZDC / AliZDCRawStream.cxx
index 9349d77a93875a250cf294ab56fd48772ec27117..19e396c22f3912ce7d7e2d5de801ef105926444f 100644 (file)
@@ -52,7 +52,7 @@ AliZDCRawStream::AliZDCRawStream(AliRawReader* rawReader) :
   fIsADCEOB(kFALSE),
   fSODReading(kFALSE),
   fIsMapRead(kFALSE),
-  fReadCDH(kTRUE),
+  fReadCDH(kFALSE),
   fDeadfaceOffset(-1),
   fDeadbeefOffset(-1),
   fDataOffset(0),
@@ -388,17 +388,14 @@ Bool_t AliZDCRawStream::Next()
   for(Int_t kl=0; kl<4; kl++) fCPTInput[kl] = 0;
 
   fEvType = fRawReader->GetType();
-  if(fPosition==0 && fReadCDH){
-    //if(fEvType==7 || fEvType ==8){ //Physics or calibration event
-      ReadCDHHeader();
-    //}
+  if(fPosition==0){
+    ReadCDHHeader();
+    // Needed to read simulated raw data (temporary solution?)
+    if(!fReadCDH) fReadOutCard=1;
     fCurrentCh=0; fCurrScCh=0;  fCurrTDCCh=0;fNChannelsOn=0;
     // Ch. debug
     //printf("\n  AliZDCRawStream::Next() - ev. type %d",fEvType);
   }
-  // Needed to read simulated raw data (temporary solution?)
-  else if(fPosition==0 && !fReadCDH && fReadOutCard==-1) fReadOutCard=1;
-  
   // Ch. debug
   //printf("\n  AliZDCRawStream::Next() - fBuffer[%d] = %x\n",fPosition, fBuffer);
   
@@ -677,9 +674,9 @@ Bool_t AliZDCRawStream::Next()
         if((fBuffer & 0x07000000) != 0x06000000){
           fRawReader->AddMajorErrorLog(kZDCDataError);
         }
-        else if((fBuffer & 0x07000000) == 0x06000001){ // Corrupted event!!!
-          fIsADCEventGood = kFALSE;
-        }
+        //else if((fBuffer & 0x07000000) == 0x06000001){ // Corrupted event!!!
+        //  fIsADCEventGood = kFALSE;
+        //}
       }
     
       // If the not valid datum isn't followed by the 1st ADC header
@@ -701,7 +698,8 @@ Bool_t AliZDCRawStream::Next()
     else fADCModule = (Int_t) ((fBuffer & 0xf8000000)>>27);
     
     // ************************************ ADC MODULES ************************************
-    if(fADCModule>=kFirstADCGeo && fADCModule<=kLastADCGeo){
+    if(fADCModule>=kFirstADCGeo && fADCModule<=kLastADCGeo && 
+       !fIsTriggerHistory && !fIsScHeaderRead && !fIsTriggerScaler){
       // *** ADC header
       if((fBuffer & 0x07000000) == 0x02000000){
         fIsADCHeader = kTRUE;
@@ -716,7 +714,7 @@ Bool_t AliZDCRawStream::Next()
         fADCValue = (fBuffer & 0xfff);  
        //
        //printf("  AliZDCRawStream -> ADC DATUM: mod. %d ch. %d gain %d value %d\n",
-       //  fADCModule,fADCChannel,fADCGain,fADCValue);
+         //fADCModule,fADCChannel,fADCGain,fADCValue);
        
        // Checking if the channel map for the ADCs has been provided/read
        if(fMapADC[0][0]==-1){
@@ -739,13 +737,13 @@ Bool_t AliZDCRawStream::Next()
             break;
           } 
        }
-       if(foundMapEntry==kFALSE){
+       if(foundMapEntry==kFALSE && fEvType==7){
          AliWarning(Form(" No valid entry in ADC mapping for raw data %d ADCmod. %d ch. %d\n",
              fPosition,fADCModule,fADCChannel));
        }
 
        // Final checks
-       if(foundMapEntry==kTRUE){
+       if(foundMapEntry==kTRUE && fEvType==7){
          if(fSector[0]<1 || fSector[0]>5){
             AliWarning(Form(" No valid detector assignment: %d",fSector[0]));
             fRawReader->AddMajorErrorLog(kInvalidSector);
@@ -770,7 +768,7 @@ Bool_t AliZDCRawStream::Next()
       // *** ADC EOB
       else if((fBuffer & 0x07000000) == 0x04000000){
         fIsADCEOB = kTRUE;
-       printf("  AliZDCRawStream -> EOB --------------------------\n");
+       //printf("  AliZDCRawStream -> ADC EOB --------------------------\n");
       }
     }//ADC module
     // ********************************* ADD ADC *********************************
@@ -794,7 +792,7 @@ Bool_t AliZDCRawStream::Next()
       // *** ADC EOB
       else if((fBuffer & 0x07000000) == 0x04000000){
         fIsADCEOB = kTRUE;
-       //printf("  AliZDCRawStream -> EOB --------------------------\n");
+       //printf("  AliZDCRawStream -> ADD ADC EOB --------------------------\n");
       }
     }
     // ********************************* TDC *********************************
@@ -807,7 +805,7 @@ Bool_t AliZDCRawStream::Next()
       if(fADCModule==kZDCTDCGeo){ // *** ZDC TDC
         fIsZDCTDCHeader = kTRUE;
         //Ch. debug
-        //printf("  AliZDCRawStream -> ZDC TDC: mod.%d\n",fADCModule);
+        //printf("  AliZDCRawStream -> ZDC TDC header: mod.%d\n",fADCModule);
       }
       else if(fADCModule==kADDTDCGeo){ // *** ADD TDC
         fIsADDTDCHeader = kTRUE;
@@ -828,9 +826,10 @@ Bool_t AliZDCRawStream::Next()
         //printf("  AliZDCRawStream -> VME SCALER HEADER: geo %d Nwords %d TrigSource %d TrigNo. %d\n",
         //   fScGeo,fScNWords,fScTriggerSource,fScTriggerNumber);
       } 
-      else if(!(fBuffer & 0x04000000)){
-        fIsScEventGood = kFALSE;
-      }
+      // Commented by C.O. & M.G. (23/09/2011)
+      //else if(!(fBuffer & 0x04000000) && fIsScHeaderRead==kFALSE){
+      //  fIsScEventGood = kFALSE;
+      //}
     }
     // *********************************** PATTERN UNIT ***********************************
     else if(fADCModule == kPUGeo){
@@ -864,12 +863,14 @@ Bool_t AliZDCRawStream::Next()
     // ********************************** VME SCALER DATA **********************************
     //  Reading VME scaler data 
     if(fIsScHeaderRead && fPosition>=fScStartCounter+1){ // *** Scaler word
-      fADCModule=kScalerGeo; fIsADCDataWord=kFALSE; fIsScalerWord=kTRUE;
+      fADCModule=kScalerGeo; 
+      fIsADCDataWord=kFALSE; 
+      fIsScalerWord=kTRUE;
       fScEvCounter = fBuffer;
       Int_t nWords = (Int_t) (fScNWords);
       if(fPosition == fScStartCounter+nWords) fIsScHeaderRead = kFALSE;
       //Ch. debug
-      //printf("  AliZDCRawStream -> scaler datum %d", fScEvCounter);
+      //printf("  AliZDCRawStream -> scaler datum %x \n", fScEvCounter);
     }
     // ********************************** ZDC TDC DATA **********************************
     //  ZDC TDC data
@@ -968,7 +969,7 @@ Bool_t AliZDCRawStream::Next()
           }
         }       
         // Ch. debug
-        //printf("  AliZDCRawStream -> Trigger history word %d\n", fPosition-fTrigHistStart);
+        //printf("  AliZDCRawStream -> Trigger history word[%d] %x\n", fPosition, fBuffer);
     }
     
   }