From 63bd40f44a30da5d72bf70e33a90c0d9439e237c Mon Sep 17 00:00:00 2001 From: shahoian Date: Sat, 10 Apr 2010 22:25:34 +0000 Subject: [PATCH] Update to profit from record-by-record reading capabilites of the AliLHCReader --- STEER/AliGRPPreprocessor.cxx | 37 ++++++++++++------------------------ STEER/AliLHCDipValT.h | 22 +++++++++++++++------ STEER/AliLHCReader.cxx | 12 ++++++++++-- 3 files changed, 38 insertions(+), 33 deletions(-) diff --git a/STEER/AliGRPPreprocessor.cxx b/STEER/AliGRPPreprocessor.cxx index b5a658e6cce..8bc128b09a7 100644 --- a/STEER/AliGRPPreprocessor.cxx +++ b/STEER/AliGRPPreprocessor.cxx @@ -831,31 +831,18 @@ UInt_t AliGRPPreprocessor::ProcessLHCData(AliGRPObject *grpobj) } // Processing data to go to AliLHCData object - - TMap* lhcMap = (TMap*)lhcReader.ReadLHCDP(fileName.Data()); - if (lhcMap) { - Log(Form("LHCData map entries = %d",lhcMap->GetEntries())); - - AliLHCData* dt = new AliLHCData(lhcMap,timeStart,timeEnd); - - // storing AliLHCData in OCDB - if (dt){ - AliCDBMetaData md; - md.SetResponsible("Ruben Shahoyan"); - md.SetComment("LHC data from the GRP preprocessor."); - - Bool_t result = kTRUE; - result = Store("GRP", "LHCData", dt, &md); - delete dt; - if (result) return 0; - else return 3; - } - else return 4; - delete lhcMap; - } - else { - AliError("Cannot read correctly LHCData file"); - return 2; + AliLHCData* dt = new AliLHCData(fileName.Data(),timeStart,timeEnd); + // storing AliLHCData in OCDB + if (dt){ + AliInfo(Form("Filled %d records to AliLHCData object",dt->GetData().GetEntriesFast())); + AliCDBMetaData md; + md.SetResponsible("Ruben Shahoyan"); + md.SetComment("LHC data from the GRP preprocessor."); + Bool_t result = kTRUE; + result = Store("GRP", "LHCData", dt, &md); + delete dt; + if (result) return 0; + else return 3; } } diff --git a/STEER/AliLHCDipValT.h b/STEER/AliLHCDipValT.h index e9cf810363b..60289fe0def 100755 --- a/STEER/AliLHCDipValT.h +++ b/STEER/AliLHCDipValT.h @@ -46,7 +46,7 @@ template class AliLHCDipValT : public TObject Element GetValue(Int_t i=0) const; Element* GetValues() const {return (Element*)fArray;} Double_t GetTimeStamp() const {return fTimeStamp;} - Char_t* GetTimeAsString() const {return TimeAsString(fTimeStamp);} + Char_t* GetTimeAsString(Bool_t utc=kTRUE) const {return TimeAsString(fTimeStamp,utc);} // void SetProcessed1(Bool_t v=kTRUE) {SetBit(kProcessed1,v);} void SetLastSpecial(Bool_t v=kTRUE) {SetBit(kLastSpecial,v);} @@ -60,7 +60,7 @@ template class AliLHCDipValT : public TObject virtual void Clear(const Option_t *opt=""); virtual void Print(const Option_t *opt="") const; // - static Char_t* TimeAsString(double t); + static Char_t* TimeAsString(double t,Bool_t utc=kTRUE); // protected: // @@ -112,10 +112,11 @@ AliLHCDipValT& AliLHCDipValT::operator=(const AliLHCDipValT -Char_t* AliLHCDipValT::TimeAsString(double t) +Char_t* AliLHCDipValT::TimeAsString(double t, Bool_t utc) { + // time as string in UTC or local format time_t tt = (time_t) t; - char* st = ctime(&tt); + char* st = utc ? asctime(gmtime(&tt)) : ctime(&tt); *(strchr(st,'\n')) = 0; return st; } @@ -206,7 +207,7 @@ void AliLHCDipValT::Print(const Option_t *opt) const TString str = opt; str.ToLower(); if (str.Contains("raw")) printf("%.1f ",GetTimeStamp()); - else printf("[%s] ",GetTimeAsString()); + else printf("[%s] ",GetTimeAsString(!str.Contains("loc"))); // TString tp = typeid(fArray).name(); if ( tp==typeid(Char_t*).name() ) printf(": %s\n",(Char_t*)fArray); @@ -215,7 +216,16 @@ void AliLHCDipValT::Print(const Option_t *opt) const if (sz>1) printf("\n"); Bool_t eolOK = kFALSE; for (int i=0;i>j)&0x1); + printf(" |"); + } + + } else if (tp == typeid(Double_t*).name() || tp == typeid(Float_t*).name()) printf(" %+.3e |",(Float_t)fArray[i]); else printf(" "); eolOK = kFALSE; diff --git a/STEER/AliLHCReader.cxx b/STEER/AliLHCReader.cxx index 66019fdb519..287b61b40c9 100644 --- a/STEER/AliLHCReader.cxx +++ b/STEER/AliLHCReader.cxx @@ -60,7 +60,7 @@ TMap* AliLHCReader::ReadLHCDP(TString filename) // // reading the file with the inputs // - + gSystem->ExpandPathName(filename); if( gSystem->AccessPathName( filename.Data() ) ) { AliError(Form( "file (%s) not found", filename.Data() ) ); return NULL; @@ -92,6 +92,14 @@ TMap* AliLHCReader::ReadLHCDP(TString filename) } TObjArray* tokens = strLine.Tokenize("\t"); Int_t ntokens = tokens->GetEntriesFast(); + // + if ( strLine.Contains("LHC_ENTRIES ") ) { + // RS: special treatment for "LHC_ENTRIES N" record, which is space (and not tab) separated) + delete tokens; + tokens = strLine.Tokenize(" "); + ntokens = tokens->GetEntriesFast(); + } + // AliDebug(3,Form("Number of tokens = %d",ntokens)); if (ntokens == 2 && !(((TObjString*)tokens->At(0))->String()).CompareTo("LHC_ENTRIES")){ lhcEntries = (((TObjString*)tokens->At(1))->String()).Atoi(); @@ -220,7 +228,7 @@ TObjArray* AliLHCReader::ReadSingleLHCDP(TString filename, TString alias) // reading the file with the inputs for the selected alias // returning the TObjArray containing the information only for the current alias // - + gSystem->ExpandPathName(filename); if( gSystem->AccessPathName( filename.Data() ) ) { AliError(Form( "file (%s) not found", filename.Data() ) ); return NULL; -- 2.43.0