]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Introduction of raw stream base class
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Jan 2008 15:35:04 +0000 (15:35 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Jan 2008 15:35:04 +0000 (15:35 +0000)
13 files changed:
TRD/AliTRDRawStream.cxx
TRD/AliTRDRawStream.h
TRD/AliTRDRawStreamV2.cxx
TRD/AliTRDRawStreamV2.h
TRD/AliTRDclusterizer.cxx
TRD/AliTRDrawData.cxx
TRD/AliTRDrawData.h
TRD/AliTRDrawStreamBase.cxx [new file with mode: 0644]
TRD/AliTRDrawStreamBase.h [new file with mode: 0644]
TRD/AliTRDrawStreamTB.cxx
TRD/AliTRDrawStreamTB.h
TRD/TRDbaseLinkDef.h
TRD/libTRDbase.pkg

index 3e1b495feb2279f248f61172db8b7b3ae334a3b2..5ea06d4cdb6f917b69966bb6ca29dabd5602c460 100644 (file)
@@ -45,7 +45,8 @@ ClassImp(AliTRDRawStream)
 
 //_____________________________________________________________________________
 AliTRDRawStream::AliTRDRawStream() 
-  :TObject()
+  :AliTRDrawStreamBase()
+//  :TObject()
   ,fGeo(NULL) 
   ,fSig()
   ,fADC(0)
@@ -124,7 +125,8 @@ AliTRDRawStream::AliTRDRawStream()
 
 //_____________________________________________________________________________
 AliTRDRawStream::AliTRDRawStream(AliRawReader *rawReader) 
-  :TObject()
+  :AliTRDrawStreamBase(rawReader)
+//  :TObject()
   ,fGeo(NULL) 
   ,fSig()
   ,fADC(0)
@@ -205,7 +207,8 @@ AliTRDRawStream::AliTRDRawStream(AliRawReader *rawReader)
 
 //_____________________________________________________________________________
 AliTRDRawStream::AliTRDRawStream(const AliTRDRawStream& stream)
-  :TObject(stream)
+  :AliTRDrawStreamBase(stream)
+//  :TObject()
   ,fGeo(NULL)
   ,fSig()
   ,fADC(-1)
@@ -337,7 +340,7 @@ Bool_t AliTRDRawStream::SetRawVersion(Int_t rv)
 }
 
 //____________________________________________________________________________
-Int_t AliTRDRawStream::Init()
+Bool_t AliTRDRawStream::Init()
 {
   //
   // Initialization
@@ -345,7 +348,7 @@ Int_t AliTRDRawStream::Init()
 
   if (!AliTRDcalibDB::Instance()) {
     AliError("Could not get calibration object");
-    return 0;
+    return kFALSE;
   }
 
   if (!fGeo) {
index 83e9356d3216ccd505f42b8592f193d5cdcccf7a..9d0164c77f882c5876e577caaede9e7c34a76a28 100644 (file)
@@ -12,6 +12,7 @@
 ////////////////////////////////////////////////////////////////////////////
 
 #include <TObject.h>
+#include "AliTRDrawStreamBase.h"
 
 class AliRawReader;
 
@@ -23,7 +24,8 @@ const UInt_t kEndoftrackletmarker = 0xAAAAAAAA; /*This marks the end of tracklet
 const UInt_t kEndofrawdatamarker  = 0x00000000; /*This marks the end of half-chamber-data*/
 const UInt_t kSizeWord            = sizeof(UInt_t);
 
-class AliTRDRawStream: public TObject {
+//class AliTRDRawStream: public TObject {
+class AliTRDRawStream: public AliTRDrawStreamBase {
 
   public :
 
@@ -33,7 +35,7 @@ class AliTRDRawStream: public TObject {
 
     virtual Bool_t       Next();                                // Read the next data
     virtual Int_t        NextChamber(AliTRDdigitsManager *man); // Read next chamber data
-    virtual Int_t        Init();                                // Init for the fRawVersion > 1
+    virtual Bool_t        Init();                                // Init for the fRawVersion > 1
 
     enum { kDDLOffset = 0x400 };                                // Offset for DDL numbers
 
@@ -57,7 +59,7 @@ class AliTRDRawStream: public TObject {
     Bool_t               IsGTULinkActive(Int_t sm, Int_t la, Int_t sta, Int_t side)
       { return ( ((fGTUlinkMask[sm][sta]) >> (2*la+side)) & 0x1 ); };
 
-    Int_t *GetSignals()                { return fSig;     } // Signals in the three time bins from Data Word
+    Int_t *GetSignals() const          { return (Int_t*)fSig;     } // Signals in the three time bins from Data Word
     Int_t  GetADC() const              { return fADC;     } // MCM ADC channel and Time Bin of word 1
     Int_t  GetTimeBin() const          { return fTB - 3;  } // MCM ADC channel and Time Bin of word 1
     Int_t  GetEventNumber() const      { return fEv;      } // MCM Event number and position of current MCM
index c4274ab0596c303bf8f00d913b84d8d01eb37220..e1621e439c4554555940424894aeb1802dace1f6 100644 (file)
@@ -44,7 +44,8 @@ ClassImp(AliTRDRawStreamV2)
 
 //_____________________________________________________________________________
 AliTRDRawStreamV2::AliTRDRawStreamV2() 
-  :TObject()
+  :AliTRDrawStreamBase()
+//  :TObject()
   ,fGeo(NULL) 
   ,fSig()
   ,fADC(0)
@@ -131,7 +132,8 @@ AliTRDRawStreamV2::AliTRDRawStreamV2()
 
 //_____________________________________________________________________________
 AliTRDRawStreamV2::AliTRDRawStreamV2(AliRawReader *rawReader) 
-  :TObject()
+  :AliTRDrawStreamBase(rawReader)
+//  :TObject()
   ,fGeo(NULL) 
   ,fADC(0)
   ,fTB(0)
@@ -219,7 +221,8 @@ AliTRDRawStreamV2::AliTRDRawStreamV2(AliRawReader *rawReader)
 
 //_____________________________________________________________________________
 AliTRDRawStreamV2::AliTRDRawStreamV2(const AliTRDRawStreamV2& stream)
-  :TObject(stream)
+  :AliTRDrawStreamBase(stream)
+//  :TObject()
   ,fGeo(NULL)
   ,fSig()
   ,fADC(-1)
@@ -358,7 +361,7 @@ Bool_t AliTRDRawStreamV2::SetRawVersion(Int_t rv)
 }
 
 //____________________________________________________________________________
-Int_t AliTRDRawStreamV2::Init()
+Bool_t AliTRDRawStreamV2::Init()
 {
   //
   // Initialization
@@ -366,7 +369,7 @@ Int_t AliTRDRawStreamV2::Init()
 
   if (!AliTRDcalibDB::Instance()) {
     AliError("Could not get calibration object");
-    return 0;
+    return kFALSE;
   }
 
   if (!fGeo) {
index 5c9ec027a65160246680457d21e2d9aed091c443..1f67e3d3c69c3ac18bd0c372100595ba16f88fca 100644 (file)
 ///////////////////////////////////////////////////////////////////////////////
 
 #include <TObject.h>
+#include "AliTRDrawStreamBase.h"
 
 class AliTRDgeometry;
 class AliRawReader;
 class AliTRDdigitsManager;
 
-class AliTRDRawStreamV2: public TObject {
+//class AliTRDRawStreamV2: public TObject {
+class AliTRDRawStreamV2 : public AliTRDrawStreamBase {
 
   public :
 
@@ -27,7 +29,7 @@ class AliTRDRawStreamV2: public TObject {
 
     virtual Bool_t       Next();                                //  Read the next data
     virtual Int_t        NextChamber(AliTRDdigitsManager *man); //  Read next chamber data
-    virtual Int_t        Init();                                //  Init for the fRawVersion > 1
+    virtual Bool_t        Init();                                //  Init for the fRawVersion > 1
 
     enum { kDDLOffset = 0x400 };                                //  Offset for DDL numbers
 
@@ -51,7 +53,7 @@ class AliTRDRawStreamV2: public TObject {
     Bool_t               IsGTULinkActive(Int_t sm, Int_t la, Int_t sta, Int_t side)
       { return ( ((fGTUlinkMask[sm][sta]) >> (2*la+side)) & 0x1 ); };
 
-    Int_t *GetSignals()          { return fSig;     } //  Signals in the three time bins from Data Word
+    Int_t *GetSignals() const    { return (Int_t*)fSig;     } //  Signals in the three time bins from Data Word
     Int_t GetADC() const         { return fADC;     } //  MCM ADC channel and Time Bin of word 1
     Int_t GetTimeBin() const     { return fTB - 3;  } //  MCM ADC channel and Time Bin of word 1
     Int_t GetEventNumber() const { return fEv;      } //  MCM Event number and position of current MCM on TRD chamber
index 8c517eb1e94cabf4221333f6cc94612517e0467e..c9744aa04ffd2ee1bbeec57fdd62edb3d604b4cb 100644 (file)
@@ -48,8 +48,9 @@
 #include "AliTRDCommonParam.h"
 #include "AliTRDtransform.h"
 #include "AliTRDSignalIndex.h"
-#include "AliTRDRawStream.h"
-#include "AliTRDRawStreamV2.h"
+#include "AliTRDrawStreamBase.h"
+// #include "AliTRDRawStream.h"
+// #include "AliTRDRawStreamV2.h"
 #include "AliTRDfeeParam.h"
 
 #include "Cal/AliTRDCalROC.h"
@@ -68,7 +69,7 @@ AliTRDclusterizer::AliTRDclusterizer()
   ,fRawVersion(2)
   ,fIndexesOut(NULL)
   ,fIndexesMaxima(NULL)
-  ,fTransform(NULL)
+  ,fTransform(new AliTRDtransform(0))
 {
   //
   // AliTRDclusterizer default constructor
@@ -509,136 +510,138 @@ Bool_t AliTRDclusterizer::Raw2Clusters(AliRawReader *rawReader)
   // Creates clusters from raw data
   //
 
-  AliTRDdataArrayS *digits = 0;
-  AliTRDdataArrayI *track0 = 0;
-  AliTRDdataArrayI *track1 = 0;
-  AliTRDdataArrayI *track2 = 0; 
+//   AliTRDdataArrayS *digits = 0;
+//   AliTRDdataArrayI *track0 = 0;
+//   AliTRDdataArrayI *track1 = 0;
+//   AliTRDdataArrayI *track2 = 0; 
 
-  AliTRDSignalIndex *indexes = 0;
+//   AliTRDSignalIndex *indexes = 0;
 
-  // Create the digits manager
-  if (!fDigitsManager)
-    {
-      fDigitsManager = new AliTRDdigitsManager();
-      fDigitsManager->CreateArrays();
-    }
+//   // Create the digits manager
+//   if (!fDigitsManager)
+//     {
+//       fDigitsManager = new AliTRDdigitsManager();
+//       fDigitsManager->CreateArrays();
+//     }
 
-  AliTRDRawStreamV2 input(rawReader);
-  input.SetRawVersion( fRawVersion );
-  input.Init();
+// //   AliTRDRawStreamV2 input(rawReader);
+// //   input.SetRawVersion( fRawVersion );
+// //   input.Init();
+//   AliTRDrawStreamBase &input = *AliTRDrawStreamBase::GetRawStream(rawReader);
 
-  AliInfo(Form("Stream version: %s", input.IsA()->GetName()));
+//   AliInfo(Form("Stream version: %s", input.IsA()->GetName()));
 
-  // Loop through the digits
-  Int_t lastdet = -1;
-  Int_t det     =  0;
-  Int_t it      =  0;
-  while (input.Next()) 
-    {
+//   // Loop through the digits
+//   Int_t lastdet = -1;
+//   Int_t det     =  0;
+//   Int_t it      =  0;
+//   while (input.Next()) 
+//     {
 
-      det = input.GetDet();
+//       det = input.GetDet();
 
-      if (det != lastdet) 
-       {
+//       if (det != lastdet) 
+//     {
        
-         if (lastdet != -1)
-           {
-             digits = (AliTRDdataArrayS *) fDigitsManager->GetDigits(lastdet);
-             Bool_t iclusterBranch = kFALSE;
-             if (indexes->HasEntry())
-               iclusterBranch = MakeClusters(lastdet);
-             if (iclusterBranch == kFALSE)
-               {
-                 WriteClusters(lastdet);
-                 ResetRecPoints();
-               }
-           }
-
-         if (digits)
-           {
-             fDigitsManager->RemoveDigits(lastdet);
-             fDigitsManager->RemoveDictionaries(lastdet);
-             fDigitsManager->ClearIndexes(lastdet);
-           }
-
-         lastdet = det;
-
-         // Add a container for the digits of this detector
-         digits = (AliTRDdataArrayS *) fDigitsManager->GetDigits(det);
-         track0 = (AliTRDdataArrayI *) fDigitsManager->GetDictionary(det,0);
-         track1 = (AliTRDdataArrayI *) fDigitsManager->GetDictionary(det,1);
-         track2 = (AliTRDdataArrayI *) fDigitsManager->GetDictionary(det,2);
-
-         // Allocate memory space for the digits buffer
-         if (!digits->HasData()) 
-           {
-             //AliDebug(5, Form("Alloc digits for det %d", det));
-             digits->Allocate(input.GetMaxRow(),input.GetMaxCol(), input.GetNumberOfTimeBins());
-             track0->Allocate(input.GetMaxRow(),input.GetMaxCol(), input.GetNumberOfTimeBins());
-             track1->Allocate(input.GetMaxRow(),input.GetMaxCol(), input.GetNumberOfTimeBins());
-             track2->Allocate(input.GetMaxRow(),input.GetMaxCol(), input.GetNumberOfTimeBins());
-           }
+//       if (lastdet != -1)
+//         {
+//           digits = (AliTRDdataArrayS *) fDigitsManager->GetDigits(lastdet);
+//           Bool_t iclusterBranch = kFALSE;
+//           if (indexes->HasEntry())
+//             iclusterBranch = MakeClusters(lastdet);
+//           if (iclusterBranch == kFALSE)
+//             {
+//               WriteClusters(lastdet);
+//               ResetRecPoints();
+//             }
+//         }
+
+//       if (digits)
+//         {
+//           fDigitsManager->RemoveDigits(lastdet);
+//           fDigitsManager->RemoveDictionaries(lastdet);
+//           fDigitsManager->ClearIndexes(lastdet);
+//         }
+
+//       lastdet = det;
+
+//       // Add a container for the digits of this detector
+//       digits = (AliTRDdataArrayS *) fDigitsManager->GetDigits(det);
+//       track0 = (AliTRDdataArrayI *) fDigitsManager->GetDictionary(det,0);
+//       track1 = (AliTRDdataArrayI *) fDigitsManager->GetDictionary(det,1);
+//       track2 = (AliTRDdataArrayI *) fDigitsManager->GetDictionary(det,2);
+
+//       // Allocate memory space for the digits buffer
+//       if (!digits->HasData()) 
+//         {
+//           //AliDebug(5, Form("Alloc digits for det %d", det));
+//           digits->Allocate(input.GetMaxRow(),input.GetMaxCol(), input.GetNumberOfTimeBins());
+//           track0->Allocate(input.GetMaxRow(),input.GetMaxCol(), input.GetNumberOfTimeBins());
+//           track1->Allocate(input.GetMaxRow(),input.GetMaxCol(), input.GetNumberOfTimeBins());
+//           track2->Allocate(input.GetMaxRow(),input.GetMaxCol(), input.GetNumberOfTimeBins());
+//         }
          
-         indexes = fDigitsManager->GetIndexes(det);
-         indexes->SetSM(input.GetSM());
-         indexes->SetStack(input.GetStack());
-         indexes->SetLayer(input.GetLayer());
-         indexes->SetDetNumber(det);
-         if (indexes->IsAllocated() == kFALSE)
-           {
-             indexes->Allocate(input.GetMaxRow(), input.GetMaxCol(), input.GetNumberOfTimeBins());
-           }
-
-       }
+//       indexes = fDigitsManager->GetIndexes(det);
+//       indexes->SetSM(input.GetSM());
+//       indexes->SetStack(input.GetStack());
+//       indexes->SetLayer(input.GetLayer());
+//       indexes->SetDetNumber(det);
+//       if (indexes->IsAllocated() == kFALSE)
+//         {
+//           indexes->Allocate(input.GetMaxRow(), input.GetMaxCol(), input.GetNumberOfTimeBins());
+//         }
+
+//     }
       
-      for (it = 0; it < 3; it++)
-       {
-         if ( input.GetTimeBin() + it < input.GetNumberOfTimeBins() )
-           {
-             if (input.GetSignals()[it] > 0)
-               {
-                 digits->SetDataUnchecked(input.GetRow(), input.GetCol(),
-                                          input.GetTimeBin() + it, input.GetSignals()[it]);
-
-                 indexes->AddIndexTBin(input.GetRow(), input.GetCol(),
-                                       input.GetTimeBin() + it);
-                 track0->SetDataUnchecked(input.GetRow(), input.GetCol(),
-                                          input.GetTimeBin() + it, 0);
-                 track1->SetDataUnchecked(input.GetRow(), input.GetCol(),
-                                          input.GetTimeBin() + it, 0);
-                 track2->SetDataUnchecked(input.GetRow(), input.GetCol(),
-                                          input.GetTimeBin() + it, 0);
-               }
-           }
-       }
-
-    }
-
-  if (lastdet != -1)
-    {
-      Bool_t iclusterBranch = kFALSE;
-      if (indexes->HasEntry()) 
-        {
-         iclusterBranch = MakeClusters(lastdet);
-        }
-      if (iclusterBranch == kFALSE)
-       {
-         WriteClusters(lastdet);
-         ResetRecPoints();
-       }
-      //MakeClusters(lastdet);
-      if (digits)
-       {
-         fDigitsManager->RemoveDigits(lastdet);
-         fDigitsManager->RemoveDictionaries(lastdet);
-         fDigitsManager->ClearIndexes(lastdet);
-       }
-    }
-
-  delete fDigitsManager;
-  fDigitsManager = NULL;
-  return kTRUE;
-
+//       for (it = 0; it < 3; it++)
+//     {
+//       if ( input.GetTimeBin() + it < input.GetNumberOfTimeBins() )
+//         {
+//           if (input.GetSignals()[it] > 0)
+//             {
+//               digits->SetDataUnchecked(input.GetRow(), input.GetCol(),
+//                                        input.GetTimeBin() + it, input.GetSignals()[it]);
+
+//               indexes->AddIndexTBin(input.GetRow(), input.GetCol(),
+//                                     input.GetTimeBin() + it);
+//               track0->SetDataUnchecked(input.GetRow(), input.GetCol(),
+//                                        input.GetTimeBin() + it, 0);
+//               track1->SetDataUnchecked(input.GetRow(), input.GetCol(),
+//                                        input.GetTimeBin() + it, 0);
+//               track2->SetDataUnchecked(input.GetRow(), input.GetCol(),
+//                                        input.GetTimeBin() + it, 0);
+//             }
+//         }
+//     }
+
+//     }
+
+//   if (lastdet != -1)
+//     {
+//       Bool_t iclusterBranch = kFALSE;
+//       if (indexes->HasEntry()) 
+//         {
+//       iclusterBranch = MakeClusters(lastdet);
+//         }
+//       if (iclusterBranch == kFALSE)
+//     {
+//       WriteClusters(lastdet);
+//       ResetRecPoints();
+//     }
+//       //MakeClusters(lastdet);
+//       if (digits)
+//     {
+//       fDigitsManager->RemoveDigits(lastdet);
+//       fDigitsManager->RemoveDictionaries(lastdet);
+//       fDigitsManager->ClearIndexes(lastdet);
+//     }
+//     }
+
+//   delete fDigitsManager;
+//   fDigitsManager = NULL;
+//   return kTRUE;
+
+return Raw2ClustersChamber(rawReader);
 }
 
 //_____________________________________________________________________________
@@ -657,9 +660,11 @@ Bool_t AliTRDclusterizer::Raw2ClustersChamber(AliRawReader *rawReader)
 
   fDigitsManager->SetUseDictionaries(fAddLabels);
 
-  AliTRDRawStreamV2 input(rawReader);
-  input.SetRawVersion( fRawVersion );
-  input.Init();
+//   AliTRDRawStreamV2 input(rawReader);
+//   input.SetRawVersion( fRawVersion );
+//   input.Init();
+  AliTRDrawStreamBase *pinput = AliTRDrawStreamBase::GetRawStream(rawReader);
+  AliTRDrawStreamBase &input = *pinput;
 
   AliInfo(Form("Stream version: %s", input.IsA()->GetName()));
   
@@ -683,6 +688,9 @@ Bool_t AliTRDclusterizer::Raw2ClustersChamber(AliRawReader *rawReader)
 
   delete fDigitsManager;
   fDigitsManager = NULL;
+
+  delete pinput;
+  pinput = NULL;
   return kTRUE;
 
 }
index ebed36f421b6c29432a9c4cd58aedb46ba3c9c50..16e1a7b6d5b5d1096deb6332caf34058ba73f997 100644 (file)
@@ -35,6 +35,7 @@
 #include "AliTRDgeometry.h"
 #include "AliTRDdataArrayI.h"
 #include "AliTRDdataArrayS.h"
+#include "AliTRDrawStreamBase.h"
 #include "AliTRDRawStream.h"
 #include "AliTRDRawStreamV2.h"
 #include "AliTRDcalibDB.h"
@@ -575,6 +576,60 @@ AliTRDdigitsManager *AliTRDrawData::Raw2Digits(AliRawReader *rawReader)
   AliTRDdataArrayI *track1 = 0;
   AliTRDdataArrayI *track2 = 0; 
 
+  //AliTRDSignalIndex *indexes = 0;
+  // Create the digits manager
+  AliTRDdigitsManager* digitsManager = new AliTRDdigitsManager();
+  digitsManager->CreateArrays();
+
+  //AliTRDRawStream input(rawReader);
+  //   AliTRDRawStreamV2 input(rawReader);
+  //   input.SetRawVersion( fFee->GetRAWversion() );
+  //   input.Init();
+
+  AliTRDrawStreamBase *pinput = AliTRDrawStreamBase::GetRawStream(rawReader);
+  AliTRDrawStreamBase &input = *pinput;
+
+  AliInfo(Form("Stream version: %s", input.IsA()->GetName()));
+
+  // Loop through the digits
+  Int_t det    = 0;
+
+  while (det >= 0)
+    {
+      det = input.NextChamber(digitsManager);
+      if (det >= 0)
+       {
+         // get...
+         digits = (AliTRDdataArrayS *) digitsManager->GetDigits(det);
+         track0 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,0);
+         track1 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,1);
+         track2 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,2);
+         // and compress
+         if (digits) digits->Compress(1,0);
+         if (track0) track0->Compress(1,0);
+         if (track1) track1->Compress(1,0);
+         if (track2) track2->Compress(1,0);
+       }
+    }
+
+  delete pinput;
+  pinput = NULL;
+
+  return digitsManager;
+}
+
+//_____________________________________________________________________________
+AliTRDdigitsManager *AliTRDrawData::Raw2DigitsOLD(AliRawReader *rawReader)
+{
+  //
+  // Vx of the raw data reading
+  //
+
+  AliTRDdataArrayS *digits = 0;
+  AliTRDdataArrayI *track0 = 0;
+  AliTRDdataArrayI *track1 = 0;
+  AliTRDdataArrayI *track2 = 0; 
+
   AliTRDSignalIndex *indexes = 0;
   // Create the digits manager
   AliTRDdigitsManager* digitsManager = new AliTRDdigitsManager();
index bb5f843db65d5ef21f8fb5a16062e093303bace2..f91004b2af66471fb1cb2e59669ea9b3ecc20fb0 100644 (file)
@@ -35,6 +35,7 @@ class AliTRDrawData : public TObject {
   virtual Bool_t       Digits2Raw(TTree *digits, TTree *tracks = NULL);
 
   virtual AliTRDdigitsManager *Raw2Digits(AliRawReader *rawReader);
+  virtual AliTRDdigitsManager *Raw2DigitsOLD(AliRawReader *rawReader);
 
  protected:
 
diff --git a/TRD/AliTRDrawStreamBase.cxx b/TRD/AliTRDrawStreamBase.cxx
new file mode 100644 (file)
index 0000000..835f27d
--- /dev/null
@@ -0,0 +1,161 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id: AliTRDrawStreamBase.cxx 23387 2008-01-17 17:25:16Z cblume $ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+// This class defines access to TRD digits in raw data.                      //
+//                                                                           //
+// It loops over all TRD digits in the raw data given by the AliRawReader.   //
+// The Next method goes to the next digit. If there are no digits left       //
+// it returns kFALSE.                                                        //
+// Several getters provide information about the current digit.              //
+//                                                                           //
+// Author: M. Ploskon (ploskon@ikf.uni-frankfurt.de)                         //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliRawReader.h"
+
+#include "AliTRDRawStream.h"
+#include "AliTRDRawStreamV2.h"
+#include "AliTRDrawStreamTB.h"
+
+#include "AliTRDrawStreamBase.h"
+
+//--------------------------------------------------------
+ClassImp(AliTRDrawStreamBase)
+
+Int_t AliTRDrawStreamBase::fgRawStreamVersion = AliTRDrawStreamBase::kTRDsimStream;
+
+//_____________________________________________________________________________
+AliTRDrawStreamBase::AliTRDrawStreamBase()
+  : TObject()
+{
+  //
+  // this is just for API
+  //
+  ;
+}
+
+//_____________________________________________________________________________
+AliTRDrawStreamBase::AliTRDrawStreamBase(AliRawReader */*rawReader*/)
+  : TObject()
+{
+  //
+  // this is just for API
+  //
+  ;
+}
+
+//_____________________________________________________________________________
+AliTRDrawStreamBase::AliTRDrawStreamBase(const AliTRDrawStreamBase& /*st*/)
+  : TObject()
+{
+  //
+  // copy
+  //
+  TRD_NOIMP();
+  ;
+}
+
+//_____________________________________________________________________________
+AliTRDrawStreamBase::~AliTRDrawStreamBase()
+{
+  //
+  // destructor
+  //
+  ;
+}
+
+//_____________________________________________________________________________
+AliTRDrawStreamBase &
+AliTRDrawStreamBase::operator=(const AliTRDrawStreamBase &)
+{
+  //
+  // we are not using this functionality
+  //
+  TRD_NOIMP();
+  return *this;
+}
+
+//_____________________________________________________________________________
+AliTRDrawStreamBase *AliTRDrawStreamBase::GetRawStream()
+{
+  //
+  // Returns the selected raw stream implementation
+  //
+
+  if (fgRawStreamVersion == kTRDoldStream)
+    return new AliTRDRawStream();
+
+  if (fgRawStreamVersion == kTRDrealStream)
+    return new AliTRDrawStreamTB();
+
+  if (fgRawStreamVersion == kTRDsimStream)
+    {
+      AliTRDRawStreamV2 *rstream = new AliTRDRawStreamV2();
+      rstream->Init();
+      return rstream;
+    }
+  
+  return new AliTRDrawStreamBase;
+}
+
+//_____________________________________________________________________________
+AliTRDrawStreamBase *AliTRDrawStreamBase::GetRawStream(AliRawReader *reader)
+{
+  //
+  // Returns the selected raw stream implementation
+  //
+
+  if (fgRawStreamVersion == kTRDoldStream)
+    return new AliTRDRawStream(reader);
+
+  if (fgRawStreamVersion == kTRDrealStream)
+    return new AliTRDrawStreamTB(reader);
+
+  if (fgRawStreamVersion == kTRDsimStream)
+    {
+      AliTRDRawStreamV2 *rstream = new AliTRDRawStreamV2(reader);
+      rstream->Init();
+      return rstream;
+    }
+  return new AliTRDrawStreamBase;
+}
+
+//_____________________________________________________________________________
+void AliTRDrawStreamBase::SetRawStreamVersion(const char *opt) 
+{ 
+  //
+  // Sets the raw stream version
+  //
+
+  fgRawStreamVersion = 0; 
+
+  if (strstr(opt, "sim" ) != 0 || strstr(opt, "SIM") != 0) 
+    fgRawStreamVersion = kTRDsimStream; 
+
+  if (strstr(opt, "tb" ) != 0 || strstr(opt, "TB") != 0) 
+    fgRawStreamVersion = kTRDrealStream; 
+
+  if (strstr(opt, "real" ) != 0 || strstr(opt, "REAL") != 0) 
+    fgRawStreamVersion = kTRDrealStream; 
+
+  if (strstr(opt, "old" ) != 0 || strstr(opt, "OLD") != 0) 
+    fgRawStreamVersion = kTRDoldStream; 
+      
+}
diff --git a/TRD/AliTRDrawStreamBase.h b/TRD/AliTRDrawStreamBase.h
new file mode 100644 (file)
index 0000000..98dc656
--- /dev/null
@@ -0,0 +1,133 @@
+#ifndef ALITRDRAWSTREAMBASE_H
+#define ALITRDRAWSTREAMBASE_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: AliTRDrawStreamBase.h 23387 2008-01-17 17:25:16Z cblume $ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+// This base class defines access to TRD digits in raw data.                 //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "TObject.h"
+#include "TString.h"
+#include "AliLog.h"
+
+class AliRawReader;
+class AliTRDdigitsManager;
+
+#define TRD_MAX_TBINS 30
+#define TRD_MAX_ADC   21
+#define TRD_MAX_MCM   4 * 16
+
+/* // old raw stream */
+/* #define TRD_OLD_STREAM -1 */
+/* // read simulated data */
+/* #define TRD_SIM_STREAM 0 */
+/* // read real data - including test beam 2007 */
+/* #define TRD_REAL_STREAM 1 */
+
+#define TRD_NOIMP() AliFatal("Not Implemented for this class. Use inherited.");
+
+class AliTRDrawStreamBase : public TObject
+{ // class def begin
+
+ public:
+
+  AliTRDrawStreamBase();
+  AliTRDrawStreamBase(AliRawReader *rawReader);
+  virtual ~AliTRDrawStreamBase();
+
+  AliTRDrawStreamBase(const AliTRDrawStreamBase& st);
+  AliTRDrawStreamBase &operator=(const AliTRDrawStreamBase &);
+
+  //--------------------------------------------------------
+
+  enum STREAMTYPE
+    {
+      kTRDsimStream  =  0,
+      kTRDrealStream =  1,
+      kTRDoldStream  = 99
+    };
+
+  static   AliTRDrawStreamBase *GetRawStream();
+  static   AliTRDrawStreamBase *GetRawStream(AliRawReader *reader);
+
+  static  void      SetRawStreamVersion(Int_t iver) { fgRawStreamVersion = iver; }
+  static  void      SetRawStreamVersion(const char *opt);
+
+  virtual Bool_t    Next() {TRD_NOIMP(); return 0;}          
+  virtual Int_t     NextChamber(AliTRDdigitsManager */*man*/) {TRD_NOIMP(); return 0;} 
+  virtual Bool_t    Init() {TRD_NOIMP(); return -1;}     
+
+  virtual Bool_t    SetRawVersion(Int_t /*fraw*/) {TRD_NOIMP(); return 0;} 
+  
+  virtual Bool_t    IsCurrentPadShared() const {TRD_NOIMP(); return 0;}
+  virtual void      SetSharedPadReadout(Bool_t /*fv*/) {TRD_NOIMP();} 
+  virtual Bool_t    IsDataZeroSuppressed() const {TRD_NOIMP(); return 0;}
+  
+  virtual Bool_t    SetReader(AliRawReader */*reader*/) {TRD_NOIMP(); return 0;} 
+          
+  virtual Bool_t    IsTrackletEnableBitSet() const {TRD_NOIMP(); return 0;}
+  virtual Bool_t    IsStackActive(Int_t /*is*/) const {TRD_NOIMP(); return 0;}
+  virtual Int_t     GetNofActiveStacks() const {TRD_NOIMP(); return 0;}
+  virtual UInt_t   *GetSMstreamPosition() const {TRD_NOIMP(); return 0;}
+           
+  virtual Bool_t    IsSMbufferClean() const {TRD_NOIMP(); return 0;}
+    
+  virtual Bool_t    IsLinkActiveInStack(Int_t /*is*/, Int_t /*il*/) const {TRD_NOIMP(); return 0;}
+  virtual Int_t     GetActiveLinksInStack(Int_t /*is*/) const {TRD_NOIMP(); return 0;}
+           
+  virtual Int_t     GetSpecialRawVersion() const {TRD_NOIMP(); return 0;}
+  virtual Int_t     GetMajorRawVersion() const {TRD_NOIMP(); return 0;}  
+  virtual Int_t     GetRawVersion() const {TRD_NOIMP(); return 0;}       
+  virtual Int_t     GetMinorRawVersion() const {TRD_NOIMP(); return 0;}  
+
+  virtual Int_t     GetSM() const {TRD_NOIMP(); return 0;}   
+  virtual Int_t     GetLayer() const {TRD_NOIMP(); return 0;}
+  virtual Int_t     GetStack() const {TRD_NOIMP(); return 0;}
+  virtual Int_t     GetSide() const {TRD_NOIMP(); return 0;} 
+  virtual Int_t     GetDCS() const {TRD_NOIMP(); return 0;}  
+
+  virtual Int_t     GetROC() const {TRD_NOIMP(); return 0;}  
+  virtual Int_t     GetNumberOfTimeBins() const {TRD_NOIMP(); return 0;} 
+  virtual UInt_t    GetBunchCrossCounter() const {TRD_NOIMP(); return 0;}
+  virtual UInt_t    GetPreTriggerCounter() const {TRD_NOIMP(); return 0;}
+  virtual UInt_t    GetPreTriggerPhase() const {TRD_NOIMP(); return 0;}          
+
+  virtual Int_t     GetRow() const {TRD_NOIMP(); return 0;}   
+  virtual Int_t     GetCol() const {TRD_NOIMP(); return 0;}   
+  virtual Int_t     GetRowMax() const {TRD_NOIMP(); return 0;}
+  virtual Int_t     GetColMax() const {TRD_NOIMP(); return 0;}
+  // compatibility
+  virtual Int_t     GetMaxRow() const {TRD_NOIMP(); return 0;}
+  virtual Int_t     GetMaxCol() const {TRD_NOIMP(); return 0;}
+
+  virtual Int_t     GetDET() const {TRD_NOIMP(); return 0;}
+  virtual Int_t     GetDet() const {TRD_NOIMP(); return 0;}
+           
+  virtual Int_t     GetROB() const {TRD_NOIMP(); return 0;}
+  virtual Int_t     GetMCM() const {TRD_NOIMP(); return 0;}
+  virtual Int_t     GetEventNumber() const {TRD_NOIMP(); return 0;}
+  virtual Int_t     IsMCMcorrupted() const {TRD_NOIMP(); return 0;}
+
+  virtual Int_t    *GetSignals() const {TRD_NOIMP(); return 0;}
+  virtual Int_t     GetADC() const {TRD_NOIMP(); return 0;}
+  virtual Int_t     GetTimeBin() const {TRD_NOIMP(); return 0;}
+  
+  //----------------------------------------------------------
+ protected:
+
+ private:
+
+  static Int_t fgRawStreamVersion;           // Raw stream version number
+
+  ClassDef(AliTRDrawStreamBase, 0)           // TRD raw stream base class
+
+}; //clas def end
+
+#endif
index 0e0df4cc88fab69aca1a32864e1ca8e135017f63..4dcf93b4baaf8991061518489735d57a9b5cefd1 100644 (file)
@@ -122,7 +122,8 @@ Int_t AliTRDrawStreamTB::fgEmptySignals[] =
   };
 
 AliTRDrawStreamTB::AliTRDrawStreamTB()
-  : TObject()
+  : AliTRDrawStreamBase()
+//: TObject()
   , fSM()
   , fStack(0)
   , fHC(0)
@@ -162,7 +163,8 @@ AliTRDrawStreamTB::AliTRDrawStreamTB()
 
 //--------------------------------------------------------
 AliTRDrawStreamTB::AliTRDrawStreamTB(AliRawReader *rawReader)
-  : TObject()
+  : AliTRDrawStreamBase(rawReader)
+//: TObject()
   , fSM()
   , fStack(0)
   , fHC(0)
@@ -209,7 +211,8 @@ AliTRDrawStreamTB::AliTRDrawStreamTB(AliRawReader *rawReader)
 //------------------------------------------------------------
 
 AliTRDrawStreamTB::AliTRDrawStreamTB(const AliTRDrawStreamTB& /*st*/)
-  : TObject()
+  : AliTRDrawStreamBase()
+//: TObject()
   , fSM()
   , fStack(0)
   , fHC(0)
@@ -244,13 +247,14 @@ AliTRDrawStreamTB::AliTRDrawStreamTB(const AliTRDrawStreamTB& /*st*/)
 }
 
 //------------------------------------------------------------
-void AliTRDrawStreamTB::SetRawVersion(Int_t fraw)
+Bool_t AliTRDrawStreamTB::SetRawVersion(Int_t fraw)
 {
   //
   // function provided for backward compatibility
   //
   AliWarning("Raw data version is read from raw data stream! No point of setting it in here.");
   fraw = 0; // avoid warnings
+  return kFALSE;
 }
 
 //------------------------------------------------------------
index c13a274c3bf2f9360acaa0517d7bdba586a0e59b..ef25c0e5edfa840756e98c0b855371689d1f7215 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "TObject.h"
 #include "TString.h"
+#include "AliTRDrawStreamBase.h"
 
 class AliTRDgeometry;
 class AliRawReader;
@@ -21,11 +22,13 @@ class AliTRDdigitsManager;
 class TTreeSRedirector;
 class AliTRDfeeParam;
 
-#define TRD_MAX_TBINS 30
-#define TRD_MAX_ADC   21
-#define TRD_MAX_MCM   4 * 16
+// definitions in AliTRDrawStreamBase.h:
+/* #define TRD_MAX_TBINS 30 */
+/* #define TRD_MAX_ADC   21 */
+/* #define TRD_MAX_MCM   4 * 16 */
 
-class AliTRDrawStreamTB : public TObject
+//class AliTRDrawStreamTB : public TObject
+class AliTRDrawStreamTB : public AliTRDrawStreamBase
 { // class def begin
 
  public:
@@ -393,7 +396,7 @@ class AliTRDrawStreamTB : public TObject
   virtual Int_t NextChamber(AliTRDdigitsManager *man); // read next chamber data
   virtual Bool_t       Init();              // Init some internal variables
 
-  void     SetRawVersion(Int_t fraw); // set the raw version - used for backward compat.
+  Bool_t   SetRawVersion(Int_t fraw); // set the raw version - used for backward compat.
   
   Bool_t   IsCurrentPadShared() const {return fADC->fIsShared;}          // is current pad shared between mcms
   void     SetSharedPadReadout(Bool_t fv) {fSharedPadsOn = fv;}          //  set the flag on if the reader should return the shared pads
index 28bf9be2d4b89e6a8cb955d864ac74b5e03ffeaf..6ef92387c15464718b2e3175edaa8cdfe43701bd 100644 (file)
@@ -32,6 +32,7 @@
 #pragma link C++ class  AliTRDRawStreamV2+;
 
 #pragma link C++ class  AliTRDrawStreamTB+;
+#pragma link C++ class  AliTRDrawStreamBase+;
 #pragma link C++ class  AliTRDtestBeam+;
 
 #pragma link C++ class  AliTRDCommonParam+;
index 19e0566b961938b62c27a2f449076650e3366211..a9110b482f1ad1718c0be37be951ed78993f7f5b 100644 (file)
@@ -16,6 +16,7 @@ SRCS= AliTRDarrayI.cxx \
       AliTRDRawStream.cxx \
       AliTRDRawStreamV2.cxx \
       AliTRDrawStreamTB.cxx \
+      AliTRDrawStreamBase.cxx \
       AliTRDtestBeam.cxx \
       AliTRDCommonParam.cxx \
       AliTRDfeeParam.cxx \