-// @(#)alimdc:$Name$:$Id$
+// @(#) $Id$
// Author: Fons Rademakers 26/11/99
/**************************************************************************
//______________________________________________________________________________
-AliRawCastorDB::AliRawCastorDB(AliRawEvent *event,
- AliESD *esd,
+AliRawCastorDB::AliRawCastorDB(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 CASTOR and rootd.
static int init = 0;
- // Set STAGE_POOL environment variable to current host
if (!init) {
- // THESE ENVIRONMENT SYMBOLS ARE NOW DEFINED BY THE ALICE DATE SETUP
- // THEREFORE WE SHALL NOT USE ANY HARDCODED VALUES BUT RATHER USE
- // WHATEVER HAS BEEN SET IN THE DATE SITE
- //gSystem->Setenv("STAGE_POOL", "lcg00");
- //gSystem->Setenv("STAGE_HOST", "stage013");
-
- // however for sanity we check if they are really set
- if (!gSystem->Getenv("STAGE_POOL"))
- Error("AliRawRFIODB", "STAGE_POOL not set");
- if (!gSystem->Getenv("STAGE_HOST"))
- Error("AliRawRFIODB", "STAGE_HOST not set");
+ // THESE ENVIRONMENT VARIABLES ARE IN PRINCIPLE HARDCODED IN
+ // THE CASTOR CLIENT LIBRARY
+ // however for sanity we check if they are set by the user
+ if (!gSystem->Getenv("RH_HOST"))
+ Error("AliRawRFIODB", "RH_HOST not set");
+ if (!gSystem->Getenv("SVCCLASS"))
+ Error("AliRawRFIODB", "SVCCLASS not set");
init = 1;
}
}
//______________________________________________________________________________
-void AliRawCastorDB::Close()
+Long64_t AliRawCastorDB::Close()
{
// Close raw CASTOR/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 (fDeleteFiles) {
TUrl u(fRawDB->GetName());
gSystem->Exec(Form("rfrm %s", u.GetFile()));
delete fRawDB;
fRawDB = 0;
+
+ if(!error)
+ return filesize;
+ else
+ return -1;
}