]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliRawRFIODB.cxx
Bug fix: AliHLTComponent::ConfigureFromArgumentString
[u/mrichter/AliRoot.git] / RAW / AliRawRFIODB.cxx
index a6b15b04ccaf2fc164f1d4f43b7081643cb4c476..3b73282c29090738429d484af9b3c32041b452aa 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,20 +32,14 @@ ClassImp(AliRawRFIODB)
 
 
 //______________________________________________________________________________
-AliRawRFIODB::AliRawRFIODB(AliRawEvent *event,
-#ifdef USE_HLT
-                          AliESD *esd,
-#endif
-                          Double_t maxsize, Int_t compress)
-   : AliRawDB(event,
-#ifdef USE_HLT
-             esd,
-#endif
-             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) {
@@ -64,12 +56,9 @@ AliRawRFIODB::AliRawRFIODB(AliRawEvent *event,
          Error("AliRawRFIODB", "STAGE_HOST not set");
       init = 1;
    }
+#if ROOT_VERSION_CODE < ROOT_VERSION(5,99,0)
+   if (fRawDB) fRawDB->UseCache(50, 0x200000);  //0x100000 = 1MB)
 #endif
-
-   if (!Create())
-      MakeZombie();
-   else
-      fRawDB->UseCache(50, 0x200000);  //0x100000 = 1MB)
 }
 
 //______________________________________________________________________________
@@ -82,7 +71,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
@@ -94,8 +83,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
@@ -115,25 +104,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;
 }