]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDrawData.cxx
inconsistency corrected, version introduced
[u/mrichter/AliRoot.git] / TRD / AliTRDrawData.cxx
index 70367642040933569cf24201cf92669fbb2b4c00..1cb00bf26c8cd94bc0eaa488e653cf57e98e03cb 100644 (file)
@@ -35,8 +35,8 @@
 #include "AliTRDdataArrayI.h"
 #include "AliTRDRawStream.h"
 
-#include "AliTRDCommonParam.h"
 #include "AliTRDcalibDB.h"
+#include "AliFstream.h"
 
 ClassImp(AliTRDrawData)
 
@@ -44,8 +44,6 @@ ClassImp(AliTRDrawData)
 AliTRDrawData::AliTRDrawData()
   :TObject()
   ,fRawVersion(2)    // Default Raw Data version set here
-  ,fCommonParam(0)
-  ,fCalibration(0)
   ,fGeo(0)
   ,fNumberOfDDLs(0)
 {
@@ -59,8 +57,6 @@ AliTRDrawData::AliTRDrawData()
 AliTRDrawData::AliTRDrawData(const AliTRDrawData &r)
   :TObject(r)
   ,fRawVersion(2)    // Default Raw Data version set here
-  ,fCommonParam(0)
-  ,fCalibration(0)
   ,fGeo(0)
   ,fNumberOfDDLs(0)
 {
@@ -123,16 +119,7 @@ Bool_t AliTRDrawData::Digits2Raw(TTree *digitsTree, TTree *tracks )
 
   fGeo = new AliTRDgeometry();
 
-  fCommonParam = AliTRDCommonParam::Instance();
-  if (!fCommonParam) {
-    AliError("Could not get common params");
-    delete fGeo;
-    delete digitsManager;
-    return kFALSE;
-  }
-
-  fCalibration = AliTRDcalibDB::Instance();
-  if (!fCalibration) {
+  if (!AliTRDcalibDB::Instance()) {
     AliError("Could not get calibration object");
     delete fGeo;
     delete digitsManager;
@@ -175,16 +162,12 @@ Bool_t AliTRDrawData::Digits2Raw(AliTRDdigitsManager *digitsManager)
     char name[1024];
     sprintf(name,"TRD_%d.ddl",sect + AliTRDRawStream::kDDLOffset);
 
-#ifndef __DECCXX
-    ofstream *of = new ofstream(name, ios::binary);
-#else
-    ofstream *of = new ofstream(name);
-#endif
+    AliFstream* of = new AliFstream(name);
 
     // Write a dummy data header
     AliRawDataHeader  header;  // the event header
-    UInt_t hpos = of->tellp();
-    of->write((char *) (& header), sizeof(header));
+    UInt_t hpos = of->Tellp();
+    of->WriteBuffer((char *) (& header), sizeof(header));
 
     // Reset payload byte size (payload does not include header).
     Int_t npayloadbyte = 0;
@@ -196,10 +179,10 @@ Bool_t AliTRDrawData::Digits2Raw(AliTRDdigitsManager *digitsManager)
        Int_t iDet = fGeo->GetDetector(plan, cham, sect);
        // If chamber status is ok, we assume that the optical link is also OK.
         // This is shown in the GTU link mask.
-       if ( fCalibration->GetChamberStatus(iDet) )
+       if ( AliTRDcalibDB::Instance()->GetChamberStatus(iDet) )
          GtuCdh = GtuCdh | (3 << (2*plan));
       }
-      of->write((char *) (& GtuCdh), sizeof(GtuCdh));
+      of->WriteBuffer((char *) (& GtuCdh), sizeof(GtuCdh));
       npayloadbyte += 4;
     }
 
@@ -217,25 +200,23 @@ Bool_t AliTRDrawData::Digits2Raw(AliTRDdigitsManager *digitsManager)
 
         // Process A side of the chamber
        if ( fRawVersion >= 1 && fRawVersion <= 2 ) hcwords = ProduceHcDataV1andV2(digits,0,iDet,hc_buffer,kMaxHcWords);
-        of->write((char *) hc_buffer, hcwords*4);
+        of->WriteBuffer((char *) hc_buffer, hcwords*4);
         npayloadbyte += hcwords*4;
 
         // Process B side of the chamber
        if ( fRawVersion >= 1 && fRawVersion <= 2 ) hcwords = ProduceHcDataV1andV2(digits,1,iDet,hc_buffer,kMaxHcWords);
-        of->write((char *) hc_buffer, hcwords*4);
+        of->WriteBuffer((char *) hc_buffer, hcwords*4);
         npayloadbyte += hcwords*4;
 
       }
     }
 
     // Complete header
-    header.fSize = UInt_t(of->tellp()) - hpos;
+    header.fSize = UInt_t(of->Tellp()) - hpos;
     header.SetAttribute(0);  // Valid data
-    of->seekp(hpos);         // Rewind to header position
-    of->write((char *) (& header), sizeof(header));
-    of->close();
+    of->Seekp(hpos);         // Rewind to header position
+    of->WriteBuffer((char *) (& header), sizeof(header));
     delete of;
-
   }
 
   delete hc_buffer;
@@ -271,9 +252,9 @@ Int_t AliTRDrawData::ProduceHcDataV1andV2(AliTRDdataArrayI *digits, Int_t side
   Int_t        plan = fGeo->GetPlane( det );   // Plane
   Int_t        cham = fGeo->GetChamber( det ); // Chamber
   Int_t        sect = fGeo->GetSector( det );  // Sector (=iDDL)
-  Int_t        nRow = fCommonParam->GetRowMax( plan, cham, sect );
-  Int_t        nCol = fCommonParam->GetColMax( plan );
-  const Int_t nTBin = fCalibration->GetNumberOfTimeBins();
+  Int_t        nRow = fGeo->GetRowMax( plan, cham, sect );
+  Int_t        nCol = fGeo->GetColMax( plan );
+  const Int_t nTBin = AliTRDcalibDB::Instance()->GetNumberOfTimeBins();
   Int_t      kCtype = 0;                       // Chamber type (0:C0, 1:C1)
   Int_t         iEv = 0xA;                     // Event ID. Now fixed to 10, how do I get event id?
   UInt_t          x = 0;                       // General used number