]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - T0/AliT0RawReader.cxx
Updated misalignemt macros (Tomasz)
[u/mrichter/AliRoot.git] / T0 / AliT0RawReader.cxx
index f146111ef6353eeb4f7ea9c0be2fa45923157834..618324151fcf236a98c81c3f73bab80b54a26222 100644 (file)
 //                                                                          
 // T0 
 // Class for reading T0 RAW data in TOF data format
-// Alla.Maevskaya@cern.ch
 //
-//____________________________________________________________________
-
 #include "AliT0RawReader.h"
 #include "AliT0Parameters.h"
 #include "AliBitPacking.h"
 #include "TBits.h"
 
-//#include <Riostream.h>
+#include <Riostream.h>
+#include "TMath.h"
+#include "TH1F.h"
+#include "TArrayI.h"
 #include "AliLog.h"
  
 ClassImp(AliT0RawReader)
@@ -58,6 +58,15 @@ ClassImp(AliT0RawReader)
 {
   // 
 }
+/*
+AliT0RawReader::AliT0RawReader(const AliT0RawReader& o): TTask(o),
+     fRawReader(rawReader),
+       fData(NULL),
+       fPosition(0)
+{
+  //
+}
+*/
 
 
 Bool_t  AliT0RawReader::Next()
@@ -94,10 +103,10 @@ Bool_t  AliT0RawReader::Next()
   Int_t numberOfWordsInTRM=0, iTRM=0;
   Int_t tdcTime, koef,hit=0;
   Int_t koefhits[110];
-  Int_t trmChainHeader =  0x00000000;
-  Int_t  trmChainTrailer =  0x10000000;
+  Int_t trm_chain_header =  0x00000000;
+  Int_t  trm_chain_trailer =  0x10000000;
   
-  Int_t  filler =  0x70000000;
+  UInt_t  filler =  0x70000000;
   Bool_t correct=kTRUE;
   Int_t header;
 
@@ -113,12 +122,11 @@ Bool_t  AliT0RawReader::Next()
     } while (fRawReader->GetDataSize() == 0);
     
     fPosition = 0;
-    //    cout.setf( ios_base::hex, ios_base::basefield );
+     cout.setf( ios_base::hex, ios_base::basefield );
     
     //DRM header
     for (Int_t i=0; i<6; i++) {
       word = GetNextWord();
-      if(i==0 &&  AliBitPacking::UnpackWord(word,4,20) ==7) fNTRM=0;
       //      cout<<" DRM header "<<word<<endl;
       header = AliBitPacking::UnpackWord(word,28,31);
       if( header !=4 )
@@ -128,14 +136,13 @@ Bool_t  AliT0RawReader::Next()
          break;
        }
     }
-    // cout<<" nTRMs "<<fNTRM<<endl;
-      for (Int_t ntrm=0; ntrm< fNTRM; ntrm++)
+    //    cout<<"   fNTRM "<<fNTRM<<endl;
+    for (Int_t ntrm=0; ntrm< fNTRM; ntrm++)
       {
        //TRMheader  
        word = GetNextWord();
        header = AliBitPacking::UnpackWord(word,28,31);
-       Int_t event = AliBitPacking::UnpackWord(word,4,15);
-       //      cout<<" TRM header "<<word<<" event "<<event<<endl;
+       //      cout<<" TRM header "<<word<<endl;
        if ( header != 4 )
          {
            AliWarning(Form(" !!!! wrong TRM header  %x!!!!", word));
@@ -143,25 +150,27 @@ Bool_t  AliT0RawReader::Next()
            break;
          }
        numberOfWordsInTRM=AliBitPacking::UnpackWord(word,4,16);
-       //cout<<" numberOfWordsInTRM "<<numberOfWordsInTRM<<endl;
+       //      cout<<" numberOfWordsInTRM "<<numberOfWordsInTRM<<endl;
        iTRM=AliBitPacking::UnpackWord(word,0,3);
        for( Int_t ichain=0; ichain<2; ichain++)
          {
            //chain header
            word = GetNextWord();
-           //  cout<<" chain header "<<word<<endl;
-           uu = word & trmChainHeader;
-           if(uu != trmChainHeader) 
+           //      cout<<" chain header "<<word<<endl;
+           uu = word & trm_chain_header;
+           if(uu != trm_chain_header) 
              {
                AliWarning(Form(" !!!! wrong CHAIN  0  header %x!!!!", word));
                fRawReader->AddMajorErrorLog(kWrongChain0Header,Form("w=%x",word));
                break;
              }
            word = GetNextWord();
-           // cout<<" next "<<word<<endl;
+//         cout<<" next "<<word<<endl;
            tdcTime =  AliBitPacking::UnpackWord(word,31,31);   
+           //      for (; tdcTime==1; tdcTime) 
            while(tdcTime==1)
              {
+               correct = kTRUE;
                //                      cout<<" packed "<<word<<endl;
                itdc=AliBitPacking::UnpackWord(word,24,27);
                ichannel=AliBitPacking::UnpackWord(word,21,23);
@@ -180,8 +189,8 @@ Bool_t  AliT0RawReader::Next()
                if(correct){
                  hit=koefhits[koef];
                  if(hit>5) {  
-                   AliWarning(Form("Too many hits for %i channel  ! ",koef)); 
-                   break; 
+                   AliWarning(Form("Too many hits for %i channel - %i ! ",koef,koefhits[koef] )); 
+                   hit=5;
                  }
                  fAllData[koef][hit]=time; 
                  koefhits[koef]++;
@@ -192,9 +201,9 @@ Bool_t  AliT0RawReader::Next()
                
              }
            
-           // cout<<" chain trailer "<<word<<endl;
-           uu = word&trmChainTrailer;
-           if(uu != trmChainTrailer )
+           //      cout<<" chain trailer "<<word<<endl;
+           uu = word&trm_chain_trailer;
+           if(uu != trm_chain_trailer )
              {
                AliWarning(Form(" !!!! wrong CHAIN 0 trailer %x !!!!", word));
                fRawReader->AddMajorErrorLog(kWrongChain0Trailer,Form("w=%x",word));
@@ -213,7 +222,7 @@ Bool_t  AliT0RawReader::Next()
          }
       } //TRM loop
     word = GetNextWord(); //
-    // cout<<" after TRM trailer "<<word<<endl;
+    //    cout<<" after TRM trailer "<<word<<endl;
     if (word == filler )  word = GetNextWord(); 
      header = AliBitPacking::UnpackWord(word,28,31);
      if( header !=5 )
@@ -221,8 +230,8 @@ Bool_t  AliT0RawReader::Next()
         AliWarning(Form(" !!!! wrong DRM GLOBAL trailer  %x!!!!", word));
         fRawReader->AddFatalErrorLog(kWrongDRMTrailer,Form("w=%x",word));
       }
-     // cout.setf( ios_base::dec, ios_base::basefield );
-         
+     cout.setf( ios_base::dec, ios_base::basefield );
+    
      return kTRUE;
 }
 //_____________________________________________________________________________