]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliRawRootdDB.cxx
set LookUp table
[u/mrichter/AliRoot.git] / RAW / AliRawRootdDB.cxx
index 1de0c9a30bd5db16cc57526b4b3de7c877949a66..89c86e2d78c0fe20d3375ecab4477622c24d1291 100644 (file)
@@ -1,4 +1,4 @@
-// @(#)alimdc:$Name$:$Id$
+// @(#) $Id$
 // Author: Fons Rademakers  26/11/99
 
 /**************************************************************************
@@ -31,15 +31,17 @@ ClassImp(AliRawRootdDB)
 
 
 //______________________________________________________________________________
-AliRawRootdDB::AliRawRootdDB(AliRawEvent *event,
-                            AliESD *esd,
+AliRawRootdDB::AliRawRootdDB(AliRawEventV2 *event,
+                            AliESDEvent *esd,
                             Int_t compress,
-                            const char* fileName)
-   : AliRawDB(event, esd, compress, fileName)
+                            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 ROOT_VERSION_CODE < ROOT_VERSION(5,99,0)
    if (fRawDB) fRawDB->UseCache(50, 0x200000);  //0x100000 = 1MB)
+#endif
 }
 
 //______________________________________________________________________________
@@ -87,21 +89,32 @@ 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();
-   if (fESDTree) fESDTree->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 (fDeleteFiles)
@@ -110,4 +123,8 @@ void AliRawRootdDB::Close()
 
    delete fRawDB;
    fRawDB = 0;
+   if(!error)
+     return filesize;
+   else
+     return -1;
 }