]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliRawRootdDB.cxx
Changes for #92834: Implement trigger aliases in AliRoot, RAW data reconstruction
[u/mrichter/AliRoot.git] / RAW / AliRawRootdDB.cxx
index 58af4b90a8df6d54a0e50dd3c97175f4fe768182..74102545bd9fd6eab5cb48edffb1a62ddc21837a 100644 (file)
@@ -1,4 +1,4 @@
-// @(#)alimdc:$Name$:$Id$
+// @(#) $Id$
 // Author: Fons Rademakers  26/11/99
 
 /**************************************************************************
@@ -24,8 +24,6 @@
 
 #include <TSystem.h>
 
-#include "AliMDC.h"
-
 #include "AliRawRootdDB.h"
 
 
@@ -33,23 +31,15 @@ ClassImp(AliRawRootdDB)
 
 
 //______________________________________________________________________________
-AliRawRootdDB::AliRawRootdDB(AliRawEvent *event,
-#ifdef USE_HLT
-                            AliESD *esd,
-#endif
-                            Double_t maxsize, Int_t compress)
-   : AliRawDB(event,
-#ifdef USE_HLT
-             esd,
-#endif
-             maxsize, compress, kFALSE)
+AliRawRootdDB::AliRawRootdDB(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 rootd daemon.
 
-   if (!Create())
-      MakeZombie();
-   else
-      fRawDB->UseCache(50, 0x200000);  //0x100000 = 1MB)
+   if (fRawDB) fRawDB->UseCache(50, 0x200000);  //0x100000 = 1MB)
 }
 
 //______________________________________________________________________________
@@ -62,7 +52,7 @@ const char *AliRawRootdDB::GetFileName() const
 
    static TString fname;
 
-   TString fs = AliMDC::RootdFS();
+   TString fs = fFS1;
    TDatime dt;
 
 #if 0
@@ -75,8 +65,8 @@ const char *AliRawRootdDB::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::RootdFS());
-         fs = AliMDC::RootdFS();
+               fFS1.Data());
+         fs = fFS1;
       }
    }
    // FIXME: should check if fs is a directory
@@ -97,26 +87,42 @@ const char *AliRawRootdDB::GetFileName() const
 }
 
 //______________________________________________________________________________
-void AliRawRootdDB::Close()
+Long64_t AliRawRootdDB::Close()
 {
    // Close raw rootd 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();
 
+   fTree = NULL;
+
+   Long64_t filesize = fRawDB->GetEND();
+
 #if 0
    // can use services of TFTP
-   if (AliMDC::DeleteFiles())
+   if (fDeleteFiles)
       gSystem->Exec(Form("rfrm %s", fRawDB->GetName()));
 #endif
 
    delete fRawDB;
    fRawDB = 0;
+   if(!error)
+     return filesize;
+   else
+     return -1;
 }