]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ACORDE/AliACORDERawStream.cxx
end-of-line normalization
[u/mrichter/AliRoot.git] / ACORDE / AliACORDERawStream.cxx
index dbee66ae53ae7dea3b4847e7a4567f0a51d9fc84..80de666393bccbf10dee4ef9ee2d335855158296 100644 (file)
@@ -23,6 +23,7 @@
 #include "AliRawReader.h"
 #include "AliLog.h"
 #include "AliDAQ.h"
+#include "AliRawReaderRoot.h"
 
 ClassImp(AliACORDERawStream)
 
@@ -39,6 +40,8 @@ AliACORDERawStream::AliACORDERawStream(AliRawReader* rawReader) :
   // Created:      04 Feb 2008  Mario Sitta
   //
 
+  fWord[0] = fWord[1] = fWord[2] = fWord[3] = 0;
+
   // Select the raw data corresponding to the ACORDE detector id
 //  fRawReader->Reset();
   AliDebug(1,Form("Selecting raw data for detector %d",AliDAQ::DetectorID("ACORDE")));
@@ -46,12 +49,32 @@ AliACORDERawStream::AliACORDERawStream(AliRawReader* rawReader) :
 
 }
 
+//_____________________________________________________________________________
+AliACORDERawStream::AliACORDERawStream(const AliACORDERawStream &r) :
+  TObject(),
+  fRawReader(r.fRawReader),
+  fPosition(-1),
+  fData(NULL),
+  fDataSize(0)
+{
+  // Simple copy constructor
+  ((AliACORDERawStream &) r).Copy(*this);
+}
+
 //_____________________________________________________________________________
 AliACORDERawStream::~AliACORDERawStream()
 {
   // Default destructor
 }
 
+//_____________________________________________________________________________
+AliACORDERawStream &AliACORDERawStream::operator=(const AliACORDERawStream &r)
+{
+  // Simple operator=
+  if (this != &r)  ((AliACORDERawStream &) r).Copy(*this);
+  return *this;
+}
+
 //_____________________________________________________________________________
 void AliACORDERawStream::Reset()
 {
@@ -92,8 +115,8 @@ Bool_t AliACORDERawStream::Next()
 
   fDataSize = fRawReader->GetDataSize();
   if (fDataSize != 16) {
-    fRawReader->AddFatalErrorLog(kRawDataSizeErr,Form("size %d != 5488",fDataSize));
-    AliWarning(Form("Wrong ACORDE raw data size: %d, expected 5488 bytes!",fDataSize));
+    fRawReader->AddFatalErrorLog(kRawDataSizeErr,Form("size %d != 16",fDataSize));
+    AliWarning(Form("Wrong ACORDE raw data size: %d, expected 16 bytes!",fDataSize));
     return kFALSE;
   }
 
@@ -156,26 +179,26 @@ UInt_t AliACORDERawStream::GetNextWord()
 }
 
 //_____________________________________________________________________________
-UShort_t AliACORDERawStream::GetNextShort()
-{
-  //
-  // Returns the next 16 bit word inside the raw data payload.
-  // The method is supposed to be endian (platform) independent.
-  //
-  // Input:
-  //
-  // Output:
-  //         word : a 16 bit word containing the data
-  //
-  // Created:      04 Feb 2008  Mario Sitta
-  //
-
-  if (!fData || fPosition < 0) AliFatal("Raw data payload buffer is not yet initialized !");
 
-  UShort_t word = 0;
-  word |= fData[fPosition++];
-  word |= fData[fPosition++] << 8;
-
-  return word;
+Int_t AliACORDERawStream::GetNEvents(char* fileName) 
+{
+       // Returns the Total Number of Events recorded by ACORDE 
+       // Note: it may be a better way to do it !!
+       // Input: fileName to Analyze
+       // Output: Number of Total Events (fNEvents) in fileName
+       // Created: 25 March 2008
+       // Author: Mario Rodriguez Cahuantzi <mrodrigu@mail.cern.ch>
+       
+       AliRawReader* rCount = new AliRawReaderRoot(fileName);
+       Int_t DyM=0;
+       Int_t fNEvents=0;
+       while(DyM==0)
+       {
+       if (!rCount->NextEvent()) DyM=1;
+       else fNEvents++;
+       }
+       delete rCount;
+       return fNEvents;
 }
 
+//____________________________________________________________________________