X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=RAW%2FAliRawCastorDB.cxx;h=9f81676af90608664ecacba40608b230d4ae92bc;hb=bcb585f3014bee5ee79f280be71f1221d017afe0;hp=68715e1dc25e81e77bbb1931be91f340ad8fef42;hpb=a109e73ef777d562e3b69ec4212d0c56f4dc8ccc;p=u%2Fmrichter%2FAliRoot.git diff --git a/RAW/AliRawCastorDB.cxx b/RAW/AliRawCastorDB.cxx index 68715e1dc25..9f81676af90 100644 --- a/RAW/AliRawCastorDB.cxx +++ b/RAW/AliRawCastorDB.cxx @@ -25,8 +25,6 @@ #include #include -#include "AliMDC.h" - #include "AliRawCastorDB.h" @@ -35,41 +33,26 @@ ClassImp(AliRawCastorDB) //______________________________________________________________________________ AliRawCastorDB::AliRawCastorDB(AliRawEvent *event, -#ifdef USE_HLT AliESD *esd, -#endif - Double_t maxsize, Int_t compress) - : AliRawDB(event, -#ifdef USE_HLT - esd, -#endif - maxsize, compress, kFALSE) + Int_t compress, + const char* fileName) + : AliRawDB(event, esd, compress, fileName) { // Create a new raw DB that will be accessed via CASTOR and rootd. -#ifndef USE_RDM 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; } -#endif - if (!Create()) - MakeZombie(); - else - fRawDB->UseCache(50, 0x200000); //0x100000 = 1MB) + if (fRawDB) fRawDB->UseCache(50, 0x200000); //0x100000 = 1MB) } //______________________________________________________________________________ @@ -82,8 +65,9 @@ const char *AliRawCastorDB::GetFileName() const static TString fname; - TString fs = AliMDC::CastorFS(); - TString fsr = AliMDC::RFIOFS(); + TString fs = fFS1; + TString fsr = fs; + fsr.ReplaceAll("castor:", "rfio:"); TDatime dt; // make a new subdirectory for each day @@ -98,8 +82,8 @@ const char *AliRawCastorDB::GetFileName() const // directory does not exist, create it if (gSystem->mkdir(fsr, kTRUE) == -1) { Error("GetFileName", "cannot create dir %s, using %s", fsr.Data(), - AliMDC::RFIOFS()); - fs = AliMDC::CastorFS(); + fFS1.Data()); + fs = fFS1; } } // FIXME: should check if fs is a directory @@ -119,25 +103,39 @@ const char *AliRawCastorDB::GetFileName() const } //______________________________________________________________________________ -void AliRawCastorDB::Close() +Int_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(); + 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(); - if (AliMDC::DeleteFiles()) { + Int_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; }