-// @(#)alimdc:$Name$:$Id$
+// @(#) $Id$
// Author: Fons Rademakers 26/11/99
/**************************************************************************
#include <TSystem.h>
#include <TUrl.h>
-#include "AliMDC.h"
-
#include "AliRawRFIODB.h"
//______________________________________________________________________________
-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) {
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)
}
//______________________________________________________________________________
static TString fname;
- TString fs = AliMDC::RFIOFS();
+ TString fs = fFS1;
TDatime dt;
// make a new subdirectory for each day
// 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
}
//______________________________________________________________________________
-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;
}