]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliRawRootdDB.cxx
generates TOF CDB reconstruction parameters (AliTOFRecoParam)
[u/mrichter/AliRoot.git] / RAW / AliRawRootdDB.cxx
index 7062e28f18b20d99c139f7838fadd1fa81593bf6..13d6d9753052992f2769ef4136d7f60a76e52253 100644 (file)
@@ -24,8 +24,6 @@
 
 #include <TSystem.h>
 
-#include "AliMDC.h"
-
 #include "AliRawRootdDB.h"
 
 
@@ -33,15 +31,15 @@ ClassImp(AliRawRootdDB)
 
 
 //______________________________________________________________________________
-AliRawRootdDB::AliRawRootdDB(AliRawEvent *event, Double_t maxsize, Int_t compress)
-   : AliRawDB(event, maxsize, compress, kFALSE)
+AliRawRootdDB::AliRawRootdDB(AliRawEvent *event,
+                            AliESDEvent *esd,
+                            Int_t compress,
+                            const char* fileName)
+   : AliRawDB(event, esd, compress, fileName)
 {
    // 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)
 }
 
 //______________________________________________________________________________
@@ -54,7 +52,7 @@ const char *AliRawRootdDB::GetFileName() const
 
    static TString fname;
 
-   TString fs = AliMDC::RootdFS();
+   TString fs = fFS1;
    TDatime dt;
 
 #if 0
@@ -67,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
@@ -89,26 +87,39 @@ const char *AliRawRootdDB::GetFileName() const
 }
 
 //______________________________________________________________________________
-void AliRawRootdDB::Close()
+Int_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->Write() == 0)
+     error = kTRUE;
+   if (fESDTree)
+     if (fESDTree->Write() == 0)
+       error = kTRUE;
 
    // Close DB, this also deletes the fTree
    fRawDB->Close();
 
+   Int_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;
 }