]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Update to profit from record-by-record reading capabilites of the AliLHCReader
authorshahoian <shahoian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 10 Apr 2010 22:25:34 +0000 (22:25 +0000)
committershahoian <shahoian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 10 Apr 2010 22:25:34 +0000 (22:25 +0000)
STEER/AliGRPPreprocessor.cxx
STEER/AliLHCDipValT.h
STEER/AliLHCReader.cxx

index b5a658e6cce389bc7e8dcc75649326b0b2f4c49b..8bc128b09a710a5a162c93e4f1b6236c1e05dbe3 100644 (file)
@@ -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;
                }
        }
        
index e9cf810363b35ae963cbed0cf37a163ba72c6cb7..60289fe0def59e25a5a094cafa101922d3a1768a 100755 (executable)
@@ -46,7 +46,7 @@ template<class Element> 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 Element> 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<Element>& AliLHCDipValT<Element>::operator=(const AliLHCDipValT<El
 
 //__________________________________________________________________________
 template<class Element>
-Char_t* AliLHCDipValT<Element>::TimeAsString(double t)
+Char_t* AliLHCDipValT<Element>::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<Element>::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<Element>::Print(const Option_t *opt) const
     if (sz>1) printf("\n");
     Bool_t eolOK = kFALSE;
     for (int i=0;i<sz;i++) {
-      if      (tp == typeid(Int_t*).name()    || tp == typeid(UInt_t*).name() ) printf(" %6d |" ,(Int_t)fArray[i]);
+      if      (tp == typeid(Int_t*).name()    || tp == typeid(UInt_t*).name() ) {
+       if (!str.Contains("bit")) printf(" %6d |" ,(Int_t)fArray[i]);
+       else {
+         printf(" ");
+         int val = (int)fArray[i];
+         for (int j=sizeof(int)*8;j--;) printf("%d",(val>>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;
index 66019fdb519f5cbc0e5c46e6c3d1cf4b5a2f1b99..287b61b40c9458af6ff7d3571a2e8842f06ce23a 100644 (file)
@@ -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;