]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliRawRFIODB.cxx
changes and additions for the response maker task. fix visualisation (M. Verweij)
[u/mrichter/AliRoot.git] / RAW / AliRawRFIODB.cxx
index 0936f9dd08feb3cab6a7d55293a98550c17258a4..5a1c4718c1e7a140460c541be12645c9feb5c90b 100644 (file)
@@ -1,4 +1,4 @@
-// @(#)alimdc:$Name$:$Id$
+// @(#) $Id$
 // Author: Fons Rademakers  26/11/99
 
 /**************************************************************************
@@ -25,8 +25,6 @@
 #include <TSystem.h>
 #include <TUrl.h>
 
-#include "AliMDC.h"
-
 #include "AliRawRFIODB.h"
 
 
@@ -34,12 +32,14 @@ ClassImp(AliRawRFIODB)
 
 
 //______________________________________________________________________________
-AliRawRFIODB::AliRawRFIODB(AliRawEvent *event, Double_t maxsize, Int_t compress)
-   : AliRawDB(event, maxsize, compress, kFALSE)
+AliRawRFIODB::AliRawRFIODB(AliRawEventV2 *event,
+                          AliESDEvent *esd,
+                          Int_t compress,
+                          const char* fileName,Int_t basketsize)
+   : AliRawDB(event, esd, compress, fileName, basketsize)
 {
    // Create a new raw DB that will be accessed via RFIO.
 
-#ifndef USE_RDM
    static int init = 0;
    // Set STAGE_POOL environment variable to current host
    if (!init) {
@@ -56,12 +56,8 @@ AliRawRFIODB::AliRawRFIODB(AliRawEvent *event, Double_t maxsize, Int_t compress)
          Error("AliRawRFIODB", "STAGE_HOST not set");
       init = 1;
    }
-#endif
 
-   if (!Create())
-      MakeZombie();
-   else
-      fRawDB->UseCache(50, 0x200000);  //0x100000 = 1MB)
+   if (fRawDB) fRawDB->UseCache(50, 0x200000);  //0x100000 = 1MB)
 }
 
 //______________________________________________________________________________
@@ -74,7 +70,7 @@ const char *AliRawRFIODB::GetFileName() const
 
    static TString fname;
 
-   TString fs = AliMDC::RFIOFS();
+   TString fs = fFS1;
    TDatime dt;
 
    // make a new subdirectory for each day
@@ -86,8 +82,8 @@ const char *AliRawRFIODB::GetFileName() const
       // directory does not exist, create it
       if (gSystem->mkdir(fs, kTRUE) == -1) {
          Error("GetFileName", "cannot create dir %s, using %s", fs.Data(),
-               AliMDC::RFIOFS());
-         fs = AliMDC::RFIOFS();
+               fFS1.Data());
+         fs = fFS1;
       }
    }
    // FIXME: should check if fs is a directory
@@ -107,25 +103,42 @@ const char *AliRawRFIODB::GetFileName() const
 }
 
 //______________________________________________________________________________
-void AliRawRFIODB::Close()
+Long64_t AliRawRFIODB::Close()
 {
    // Close raw RFIO DB.
 
-   if (!fRawDB) return;
+   if (!fRawDB) return 0;
+
+   if (!fRawDB->IsOpen()) return 0;
 
    fRawDB->cd();
 
    // Write the tree.
-   fTree->Write();
+   Bool_t error = kFALSE;
+   if (fTree)
+     if (fTree->Write() == 0)
+       error = kTRUE;
+   if (fESDTree)
+     if (fESDTree->Write() == 0)
+       error = kTRUE;
 
    // Close DB, this also deletes the fTree
    fRawDB->Close();
 
-   if (AliMDC::DeleteFiles()) {
+   fTree = NULL;
+
+   Long64_t filesize = fRawDB->GetEND();
+
+   if (fDeleteFiles) {
       TUrl u(fRawDB->GetName());
       gSystem->Exec(Form("rfrm %s", u.GetFile()));
    }
 
    delete fRawDB;
    fRawDB = 0;
+
+   if(!error)
+     return filesize;
+   else
+     return -1;
 }