From: masera Date: Fri, 14 Nov 2008 09:07:33 +0000 (+0000) Subject: Changes to be able to access reference data files via Alien, in a similar way as... X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=6ddf3d66323e8e24129ff2de65b7e1c2ec19e424 Changes to be able to access reference data files via Alien, in a similar way as previously with locally stored files (H. Tydesjo) --- diff --git a/ITS/AliITSOnlineSPDphys.cxx b/ITS/AliITSOnlineSPDphys.cxx index 11e8af7ca5f..64e833ec042 100644 --- a/ITS/AliITSOnlineSPDphys.cxx +++ b/ITS/AliITSOnlineSPDphys.cxx @@ -9,13 +9,12 @@ //////////////////////////////////////////////////////////// #include - #include #include "AliITSOnlineSPDphys.h" #include "AliITSOnlineSPDphysInfo.h" #include "AliITSOnlineSPDHitArray.h" -AliITSOnlineSPDphys::AliITSOnlineSPDphys(const Char_t *fileName) : +AliITSOnlineSPDphys::AliITSOnlineSPDphys(const Char_t *fileName, Bool_t readFromGridFile) : fFile(NULL), fWrite(kFALSE), fModified(kFALSE), @@ -26,21 +25,43 @@ AliITSOnlineSPDphys::AliITSOnlineSPDphys(const Char_t *fileName) : // constructor, open file for reading or writing // look for a previously saved info object // (if file not found create a new one and return, else read) - FILE* fp0 = fopen(fFileName.Data(), "r"); - if (fp0 == NULL) { + + Bool_t bRead = readFromGridFile; + + if (!bRead) { + FILE* fp0 = fopen(fFileName.Data(), "r"); + if (fp0 != NULL) { + bRead=kTRUE; + fclose(fp0); + } + } + + if (bRead) { // open file for reading + fFile = TFile::Open(fFileName.Data(), "READ"); + if (fFile==NULL) { // grid file not found, create new local default file + printf("ERROR: AliITSOnlineSPDphys: File %s not found! Creating 'test999.root' file instead\n",fFileName.Data()); + // create default empty file: + fFileName = "test999.root"; + fPhysInfo = new AliITSOnlineSPDphysInfo(); + fInfoModified=kTRUE; + fFile = new TFile(fFileName.Data(), "RECREATE"); + fWrite=kTRUE; + InitHitmap(); + } + else { // read from file (grid or local) + fWrite=kFALSE; + fFile->GetObject("AliITSOnlineSPDphysInfo", fPhysInfo); + ReadHitmap(); + } + } + else { // create new local file fPhysInfo = new AliITSOnlineSPDphysInfo(); fInfoModified=kTRUE; fFile = new TFile(fFileName.Data(), "RECREATE"); fWrite=kTRUE; InitHitmap(); } - else { - fclose(fp0); - fFile = new TFile(fFileName.Data(), "READ"); - fWrite=kFALSE; - fFile->GetObject("AliITSOnlineSPDphysInfo", fPhysInfo); - ReadHitmap(); - } + } AliITSOnlineSPDphys::AliITSOnlineSPDphys(const AliITSOnlineSPDphys& /*phys*/) : diff --git a/ITS/AliITSOnlineSPDphys.h b/ITS/AliITSOnlineSPDphys.h index bc7befed2a7..bcf6fb956d7 100644 --- a/ITS/AliITSOnlineSPDphys.h +++ b/ITS/AliITSOnlineSPDphys.h @@ -22,7 +22,7 @@ class AliITSOnlineSPDphys { public: AliITSOnlineSPDphys():fFile(NULL),fWrite(kFALSE),fModified(kFALSE),fInfoModified(kFALSE),fPhysInfo(NULL),fFileName("."){} - AliITSOnlineSPDphys(const Char_t *fileName); + AliITSOnlineSPDphys(const Char_t *fileName, Bool_t readFromGridFile=kFALSE); AliITSOnlineSPDphys(const AliITSOnlineSPDphys& phys); virtual ~AliITSOnlineSPDphys(); AliITSOnlineSPDphys& operator=(const AliITSOnlineSPDphys& phys); diff --git a/ITS/AliITSOnlineSPDphysAnalyzer.cxx b/ITS/AliITSOnlineSPDphysAnalyzer.cxx index f12f08da778..234343e4a1a 100644 --- a/ITS/AliITSOnlineSPDphysAnalyzer.cxx +++ b/ITS/AliITSOnlineSPDphysAnalyzer.cxx @@ -34,7 +34,7 @@ #include #include -AliITSOnlineSPDphysAnalyzer::AliITSOnlineSPDphysAnalyzer(const Char_t *fileName, AliITSOnlineCalibrationSPDhandler* handler) : +AliITSOnlineSPDphysAnalyzer::AliITSOnlineSPDphysAnalyzer(const Char_t *fileName, AliITSOnlineCalibrationSPDhandler* handler, Bool_t readFromGridFile) : fFileName(fileName),fPhysObj(NULL),fHandler(handler), fNrEnoughStatChips(0),fNrDeadChips(0),fNrInefficientChips(0), fNrEqHits(0),fbDeadProcessed(kFALSE), @@ -44,7 +44,7 @@ AliITSOnlineSPDphysAnalyzer::AliITSOnlineSPDphysAnalyzer(const Char_t *fileName, fMinNrEqHitsForDeadChips(60000),fRatioToMeanForInefficientChip(0.1) { // constructor - Init(); + Init(readFromGridFile); } AliITSOnlineSPDphysAnalyzer::AliITSOnlineSPDphysAnalyzer(AliITSOnlineSPDphys* physObj, AliITSOnlineCalibrationSPDhandler* handler) : @@ -114,16 +114,18 @@ AliITSOnlineSPDphysAnalyzer& AliITSOnlineSPDphysAnalyzer::operator=(const AliITS return *this; } -void AliITSOnlineSPDphysAnalyzer::Init() { +void AliITSOnlineSPDphysAnalyzer::Init(Bool_t readFromGridFile) { // initialize container obj - FILE* fp0 = fopen(fFileName.Data(), "r"); - if (fp0 == NULL) { - return; - } - else { - fclose(fp0); + if (!readFromGridFile) { + FILE* fp0 = fopen(fFileName.Data(), "r"); + if (fp0 == NULL) { + return; + } + else { + fclose(fp0); + } } - fPhysObj = new AliITSOnlineSPDphys(fFileName.Data()); + fPhysObj = new AliITSOnlineSPDphys(fFileName.Data(), readFromGridFile); } void AliITSOnlineSPDphysAnalyzer::SetParam(const Char_t *pname, const Char_t *pval) { diff --git a/ITS/AliITSOnlineSPDphysAnalyzer.h b/ITS/AliITSOnlineSPDphysAnalyzer.h index a7e6575e441..d83ab5b1cba 100644 --- a/ITS/AliITSOnlineSPDphysAnalyzer.h +++ b/ITS/AliITSOnlineSPDphysAnalyzer.h @@ -20,7 +20,7 @@ class TH2F; class AliITSOnlineSPDphysAnalyzer { public: - AliITSOnlineSPDphysAnalyzer(const Char_t *fileName, AliITSOnlineCalibrationSPDhandler* handler); + AliITSOnlineSPDphysAnalyzer(const Char_t *fileName, AliITSOnlineCalibrationSPDhandler* handler, Bool_t readFromGridFile=kFALSE); AliITSOnlineSPDphysAnalyzer(AliITSOnlineSPDphys* physObj, AliITSOnlineCalibrationSPDhandler* handler); AliITSOnlineSPDphysAnalyzer(const AliITSOnlineSPDphysAnalyzer& handle); ~AliITSOnlineSPDphysAnalyzer(); @@ -51,7 +51,7 @@ class AliITSOnlineSPDphysAnalyzer { enum calibvals{kMINTH,kMEANTH,kDAC,kUNIMA,kNOISE,kDELAY}; // calib types AliITSOnlineSPDphys *fPhysObj; // container obj AliITSOnlineCalibrationSPDhandler *fHandler; // calib helper obj - void Init(); // initialization + void Init(Bool_t readFromGridFile=kFALSE); // initialization void Exponent(Double_t &val, Int_t &valExp) const; UInt_t fNrEnoughStatChips; // nr of enough stat chips diff --git a/ITS/AliITSOnlineSPDscan.cxx b/ITS/AliITSOnlineSPDscan.cxx index e432eb850cb..8542593be14 100644 --- a/ITS/AliITSOnlineSPDscan.cxx +++ b/ITS/AliITSOnlineSPDscan.cxx @@ -21,7 +21,7 @@ #include "AliITSOnlineSPDHitArray.h" #include "AliITSOnlineSPDHitEvent.h" -AliITSOnlineSPDscan::AliITSOnlineSPDscan(const Char_t *fileName) : +AliITSOnlineSPDscan::AliITSOnlineSPDscan(const Char_t *fileName, Bool_t readFromGridFile) : fFile(NULL), fWrite(kFALSE), fCurrentStep(-1), @@ -33,18 +33,40 @@ AliITSOnlineSPDscan::AliITSOnlineSPDscan(const Char_t *fileName) : // constructor, open file for reading or writing // look for a previously saved info object // (if file not found create a new one and return, else read) - FILE* fp0 = fopen(fFileName.Data(), "r"); - if (fp0 == NULL) { + + Bool_t bRead = readFromGridFile; + + if (!bRead) { + FILE* fp0 = fopen(fFileName.Data(), "r"); + if (fp0 != NULL) { + bRead=kTRUE; + fclose(fp0); + } + } + + if (bRead) { // open file for reading + fFile = TFile::Open(fFileName.Data(), "READ"); + if (fFile==NULL) { // grid file not found, create new local default file + printf("ERROR: AliITSOnlineSPDscan: File %s not found! Creating 'test999.root' file instead\n",fFileName.Data()); + // create default empty file: + fFileName = "test999.root"; + fScanInfo = new AliITSOnlineSPDscanInfo(); + fInfoModified=kTRUE; + fFile = new TFile(fFileName.Data(), "RECREATE"); + fWrite=kTRUE; + } + else { // read from file (grid or local) + fWrite=kFALSE; + fFile->GetObject("AliITSOnlineSPDscanInfo", fScanInfo); + } + } + else { // create new local file fScanInfo = new AliITSOnlineSPDscanInfo(); + fInfoModified=kTRUE; fFile = new TFile(fFileName.Data(), "RECREATE"); fWrite=kTRUE; } - else { - fclose(fp0); - fFile = new TFile(fFileName.Data(), "READ"); - fWrite=kFALSE; - fFile->GetObject("AliITSOnlineSPDscanInfo", fScanInfo); - } + Init(); } diff --git a/ITS/AliITSOnlineSPDscan.h b/ITS/AliITSOnlineSPDscan.h index 759fc9e9431..35c5779b3ef 100644 --- a/ITS/AliITSOnlineSPDscan.h +++ b/ITS/AliITSOnlineSPDscan.h @@ -23,7 +23,7 @@ class AliITSOnlineSPDscan { public: AliITSOnlineSPDscan():fFile(NULL),fWrite(kFALSE),fCurrentStep(-1),fModified(kFALSE),fInfoModified(kFALSE),fScanInfo(NULL),fFileName("./test.root"){} - AliITSOnlineSPDscan(const Char_t *fileName); + AliITSOnlineSPDscan(const Char_t *fileName, Bool_t readFromGridFile=kFALSE); AliITSOnlineSPDscan(const AliITSOnlineSPDscan& scan); virtual ~AliITSOnlineSPDscan(); AliITSOnlineSPDscan& operator=(const AliITSOnlineSPDscan& scan); diff --git a/ITS/AliITSOnlineSPDscanAnalyzer.cxx b/ITS/AliITSOnlineSPDscanAnalyzer.cxx index 7da36f9f38f..3c8574a41c2 100644 --- a/ITS/AliITSOnlineSPDscanAnalyzer.cxx +++ b/ITS/AliITSOnlineSPDscanAnalyzer.cxx @@ -49,7 +49,7 @@ Double_t itsSpdErrorf(Double_t *x, Double_t *par){ //} -AliITSOnlineSPDscanAnalyzer::AliITSOnlineSPDscanAnalyzer(const Char_t *fileName, AliITSOnlineCalibrationSPDhandler *handler) : +AliITSOnlineSPDscanAnalyzer::AliITSOnlineSPDscanAnalyzer(const Char_t *fileName, AliITSOnlineCalibrationSPDhandler *handler, Bool_t readFromGridFile) : fType(99),fDacId(99),fFileName(fileName),fScanObj(NULL),fHandler(handler),fTriggers(NULL), fOverWrite(kFALSE),fNoiseThreshold(0.01),fNoiseMinimumEvents(100), fMinNrStepsBeforeIncrease(5),fMinIncreaseFromBaseLine(2),fStepDownDacSafe(5),fMaxBaseLineLevel(10) @@ -65,7 +65,7 @@ AliITSOnlineSPDscanAnalyzer::AliITSOnlineSPDscanAnalyzer(const Char_t *fileName, fbModuleScanned[mod]=kFALSE; } - Init(); + Init(readFromGridFile); } AliITSOnlineSPDscanAnalyzer::AliITSOnlineSPDscanAnalyzer(const AliITSOnlineSPDscanAnalyzer& handle) : @@ -158,16 +158,19 @@ AliITSOnlineSPDscanAnalyzer& AliITSOnlineSPDscanAnalyzer::operator=(const AliITS return *this; } -void AliITSOnlineSPDscanAnalyzer::Init() { +void AliITSOnlineSPDscanAnalyzer::Init(Bool_t readFromGridFile) { // first checks type of container and then initializes container obj - FILE* fp0 = fopen(fFileName.Data(), "r"); - if (fp0 == NULL) { - return; - } - else { - fclose(fp0); + if (!readFromGridFile) { + FILE* fp0 = fopen(fFileName.Data(), "r"); + if (fp0 == NULL) { + return; + } + else { + fclose(fp0); + } } - fScanObj = new AliITSOnlineSPDscan(fFileName.Data()); + + fScanObj = new AliITSOnlineSPDscan(fFileName.Data(),readFromGridFile); fType = fScanObj->GetType(); delete fScanObj; @@ -175,16 +178,16 @@ void AliITSOnlineSPDscanAnalyzer::Init() { switch(fType) { case kUNIMA: case kNOISE: - fScanObj = new AliITSOnlineSPDscanSingle(fFileName.Data()); + fScanObj = new AliITSOnlineSPDscanSingle(fFileName.Data(),readFromGridFile); break; case kMINTH: case kDAC: case kDELAY: - fScanObj = new AliITSOnlineSPDscanMultiple(fFileName.Data()); + fScanObj = new AliITSOnlineSPDscanMultiple(fFileName.Data(),readFromGridFile); fDacId = ((AliITSOnlineSPDscanMultiple*)fScanObj)->GetDacId(); break; case kMEANTH: - fScanObj = new AliITSOnlineSPDscanMeanTh(fFileName.Data()); + fScanObj = new AliITSOnlineSPDscanMeanTh(fFileName.Data(),readFromGridFile); fDacId = ((AliITSOnlineSPDscanMeanTh*)fScanObj)->GetDacId(); break; default: diff --git a/ITS/AliITSOnlineSPDscanAnalyzer.h b/ITS/AliITSOnlineSPDscanAnalyzer.h index 58cd76420ce..ff2b0efe3f4 100644 --- a/ITS/AliITSOnlineSPDscanAnalyzer.h +++ b/ITS/AliITSOnlineSPDscanAnalyzer.h @@ -23,7 +23,7 @@ class TH2F; class AliITSOnlineSPDscanAnalyzer { public: - AliITSOnlineSPDscanAnalyzer(const Char_t *fileName, AliITSOnlineCalibrationSPDhandler *handler); + AliITSOnlineSPDscanAnalyzer(const Char_t *fileName, AliITSOnlineCalibrationSPDhandler *handler, Bool_t readFromGridFile=kFALSE); AliITSOnlineSPDscanAnalyzer(const AliITSOnlineSPDscanAnalyzer& handle); ~AliITSOnlineSPDscanAnalyzer(); @@ -73,7 +73,7 @@ class AliITSOnlineSPDscanAnalyzer { TGraph* fHitEventEfficiency[6][11]; // hit event graphs TGraph* fTriggers; // trigger graph - void Init(); // init + void Init(Bool_t readFromGridFile=kFALSE); // init Bool_t ProcessMeanMultiplicity(); // process mean mult Bool_t ProcessHitEventEfficiency();// process hit event eff diff --git a/ITS/AliITSOnlineSPDscanMeanTh.cxx b/ITS/AliITSOnlineSPDscanMeanTh.cxx index bcf6fee7c61..939b4027efc 100644 --- a/ITS/AliITSOnlineSPDscanMeanTh.cxx +++ b/ITS/AliITSOnlineSPDscanMeanTh.cxx @@ -8,23 +8,47 @@ #include "AliITSOnlineSPDscanMeanTh.h" #include "AliITSOnlineSPDscanInfoMeanTh.h" -AliITSOnlineSPDscanMeanTh::AliITSOnlineSPDscanMeanTh(const Char_t *fileName) { +AliITSOnlineSPDscanMeanTh::AliITSOnlineSPDscanMeanTh(const Char_t *fileName, Bool_t readFromGridFile) { // constructor fFileName=fileName; + fModified=kFALSE; + fInfoModified=kFALSE; // look for a previously saved info object // (if file not found create a new one and return, else read) - FILE* fp0 = fopen(fFileName.Data(), "r"); - if (fp0 == NULL) { + + Bool_t bRead = readFromGridFile; + + if (!bRead) { + FILE* fp0 = fopen(fFileName.Data(), "r"); + if (fp0 != NULL) { + bRead=kTRUE; + fclose(fp0); + } + } + + if (bRead) { // open file for reading + fFile = TFile::Open(fFileName.Data(), "READ"); + if (fFile==NULL) { // grid file not found, create new local default file + printf("ERROR: AliITSOnlineSPDscan: File %s not found! Creating 'test999.root' file instead\n",fFileName.Data()); + // create default empty file: + fFileName = "test999.root"; + fScanInfo = new AliITSOnlineSPDscanInfoMeanTh(); + fInfoModified=kTRUE; + fFile = new TFile(fFileName.Data(), "RECREATE"); + fWrite=kTRUE; + } + else { // read from file (grid or local) + fWrite=kFALSE; + fFile->GetObject("AliITSOnlineSPDscanInfo", fScanInfo); + } + } + else { // create new local file fScanInfo = new AliITSOnlineSPDscanInfoMeanTh(); + fInfoModified=kTRUE; fFile = new TFile(fFileName.Data(), "RECREATE"); fWrite=kTRUE; } - else { - fclose(fp0); - fFile = new TFile(fFileName.Data(), "READ"); - fWrite=kFALSE; - fFile->GetObject("AliITSOnlineSPDscanInfo", fScanInfo); - } + Init(); } diff --git a/ITS/AliITSOnlineSPDscanMeanTh.h b/ITS/AliITSOnlineSPDscanMeanTh.h index 09db7b57927..dc472e60e0c 100644 --- a/ITS/AliITSOnlineSPDscanMeanTh.h +++ b/ITS/AliITSOnlineSPDscanMeanTh.h @@ -13,7 +13,7 @@ class AliITSOnlineSPDscanMeanTh : public AliITSOnlineSPDscanMultiple { public: AliITSOnlineSPDscanMeanTh(){} - AliITSOnlineSPDscanMeanTh(const Char_t *fileName); + AliITSOnlineSPDscanMeanTh(const Char_t *fileName, Bool_t readFromGridFile=kFALSE); AliITSOnlineSPDscanMeanTh(const AliITSOnlineSPDscanMeanTh& scan); virtual ~AliITSOnlineSPDscanMeanTh(); AliITSOnlineSPDscanMeanTh& operator=(const AliITSOnlineSPDscanMeanTh& scan); diff --git a/ITS/AliITSOnlineSPDscanMultiple.cxx b/ITS/AliITSOnlineSPDscanMultiple.cxx index a9ecb944e6f..cb271407793 100644 --- a/ITS/AliITSOnlineSPDscanMultiple.cxx +++ b/ITS/AliITSOnlineSPDscanMultiple.cxx @@ -11,23 +11,47 @@ AliITSOnlineSPDscanMultiple::AliITSOnlineSPDscanMultiple():AliITSOnlineSPDscan(){ // Default constructor } -AliITSOnlineSPDscanMultiple::AliITSOnlineSPDscanMultiple(const Char_t *fileName) { +AliITSOnlineSPDscanMultiple::AliITSOnlineSPDscanMultiple(const Char_t *fileName, Bool_t readFromGridFile) { // constructor fFileName=fileName; + fModified=kFALSE; + fInfoModified=kFALSE; // look for a previously saved info object // (if file not found create a new one and return, else read) - FILE* fp0 = fopen(fFileName.Data(), "r"); - if (fp0 == NULL) { + + Bool_t bRead = readFromGridFile; + + if (!bRead) { + FILE* fp0 = fopen(fFileName.Data(), "r"); + if (fp0 != NULL) { + bRead=kTRUE; + fclose(fp0); + } + } + + if (bRead) { // open file for reading + fFile = TFile::Open(fFileName.Data(), "READ"); + if (fFile==NULL) { // grid file not found, create new local default file + printf("ERROR: AliITSOnlineSPDscan: File %s not found! Creating 'test999.root' file instead\n",fFileName.Data()); + // create default empty file: + fFileName = "test999.root"; + fScanInfo = new AliITSOnlineSPDscanInfoMultiple(); + fInfoModified=kTRUE; + fFile = new TFile(fFileName.Data(), "RECREATE"); + fWrite=kTRUE; + } + else { // read from file (grid or local) + fWrite=kFALSE; + fFile->GetObject("AliITSOnlineSPDscanInfo", fScanInfo); + } + } + else { // create new local file fScanInfo = new AliITSOnlineSPDscanInfoMultiple(); + fInfoModified=kTRUE; fFile = new TFile(fFileName.Data(), "RECREATE"); fWrite=kTRUE; } - else { - fclose(fp0); - fFile = new TFile(fFileName.Data(), "READ"); - fWrite=kFALSE; - fFile->GetObject("AliITSOnlineSPDscanInfo", fScanInfo); - } + Init(); } diff --git a/ITS/AliITSOnlineSPDscanMultiple.h b/ITS/AliITSOnlineSPDscanMultiple.h index 235948c7000..c461a27f2b2 100644 --- a/ITS/AliITSOnlineSPDscanMultiple.h +++ b/ITS/AliITSOnlineSPDscanMultiple.h @@ -13,7 +13,7 @@ class AliITSOnlineSPDscanMultiple : public AliITSOnlineSPDscan { public: AliITSOnlineSPDscanMultiple(); - AliITSOnlineSPDscanMultiple(const Char_t *fileName); + AliITSOnlineSPDscanMultiple(const Char_t *fileName, Bool_t readFromGridFile=kFALSE); AliITSOnlineSPDscanMultiple(const AliITSOnlineSPDscanMultiple& scan); virtual ~AliITSOnlineSPDscanMultiple(); AliITSOnlineSPDscanMultiple& operator=(const AliITSOnlineSPDscanMultiple& scan); diff --git a/ITS/AliITSOnlineSPDscanSingle.cxx b/ITS/AliITSOnlineSPDscanSingle.cxx index 0fadffadbe7..ffcd197d313 100644 --- a/ITS/AliITSOnlineSPDscanSingle.cxx +++ b/ITS/AliITSOnlineSPDscanSingle.cxx @@ -26,23 +26,47 @@ #include "AliITSOnlineSPDscanSingle.h" #include "AliITSOnlineSPDscanInfo.h" -AliITSOnlineSPDscanSingle::AliITSOnlineSPDscanSingle(const Char_t *fileName) { +AliITSOnlineSPDscanSingle::AliITSOnlineSPDscanSingle(const Char_t *fileName, Bool_t readFromGridFile) { // constructor fFileName=fileName; + fModified=kFALSE; + fInfoModified=kFALSE; // look for a previously saved info object // (if file not found create a new one and return, else read) - FILE* fp0 = fopen(fFileName.Data(), "r"); - if (fp0 == NULL) { + + Bool_t bRead = readFromGridFile; + + if (!bRead) { + FILE* fp0 = fopen(fFileName.Data(), "r"); + if (fp0 != NULL) { + bRead=kTRUE; + fclose(fp0); + } + } + + if (bRead) { // open file for reading + fFile = TFile::Open(fFileName.Data(), "READ"); + if (fFile==NULL) { // grid file not found, create new local default file + printf("ERROR: AliITSOnlineSPDscan: File %s not found! Creating 'test999.root' file instead\n",fFileName.Data()); + // create default empty file: + fFileName = "test999.root"; + fScanInfo = new AliITSOnlineSPDscanInfo(); + fInfoModified=kTRUE; + fFile = new TFile(fFileName.Data(), "RECREATE"); + fWrite=kTRUE; + } + else { // read from file (grid or local) + fWrite=kFALSE; + fFile->GetObject("AliITSOnlineSPDscanInfo", fScanInfo); + } + } + else { // create new local file fScanInfo = new AliITSOnlineSPDscanInfo(); + fInfoModified=kTRUE; fFile = new TFile(fFileName.Data(), "RECREATE"); fWrite=kTRUE; } - else { - fclose(fp0); - fFile = new TFile(fFileName.Data(), "READ"); - fWrite=kFALSE; - fFile->GetObject("AliITSOnlineSPDscanInfo", fScanInfo); - } + Init(); } AliITSOnlineSPDscanSingle::~AliITSOnlineSPDscanSingle() {} diff --git a/ITS/AliITSOnlineSPDscanSingle.h b/ITS/AliITSOnlineSPDscanSingle.h index 7a9629a638d..3a4ad01d3e6 100644 --- a/ITS/AliITSOnlineSPDscanSingle.h +++ b/ITS/AliITSOnlineSPDscanSingle.h @@ -17,7 +17,7 @@ class AliITSOnlineSPDscanSingle : public AliITSOnlineSPDscan { public: AliITSOnlineSPDscanSingle() {} - AliITSOnlineSPDscanSingle(const Char_t *fileName); + AliITSOnlineSPDscanSingle(const Char_t *fileName, Bool_t readFromGridFile=kFALSE); virtual ~AliITSOnlineSPDscanSingle(); // SET METHODS ***********************************