AliCDBId's in the list of retrieved OCDB parameters in the ESD's user info
authoracolla <acolla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 23 Nov 2007 20:33:48 +0000 (20:33 +0000)
committeracolla <acolla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 23 Nov 2007 20:33:48 +0000 (20:33 +0000)
replaced with TObjString's (the output of AliCDBId::ToString()), to remove
dependency on CDB in the ESDs.

In AliCDBId: added static function

AliCDBID* MakeFromString(const TString& str)

that returns the AliCDBId built from a string having the format of
AliCDBId::ToString()

STEER/AliCDBId.cxx
STEER/AliCDBId.h
STEER/AliReconstruction.cxx

index 10e0510..85bd288 100644 (file)
@@ -23,6 +23,8 @@
 
 #include "AliCDBId.h"
 #include <Riostream.h>
+#include <TObjArray.h>
+#include <TObjString.h>
 
 ClassImp(AliCDBId)
 
@@ -78,6 +80,50 @@ fLastStorage("new")
 }
 
 //_____________________________________________________________________________
+AliCDBId* AliCDBId::MakeFromString(const TString& idString)
+{
+// constructor from string 
+// string has the format as the output of AliCDBId::ToString:
+// path: "TRD/Calib/PIDLQ"; run range: [0,999999999]; version: v0_s0
+
+       AliCDBId* id = new AliCDBId("a/b/c",-1,-1,-1,-1);
+       
+       TObjArray* arr1 = idString.Tokenize(';');
+       TIter iter1(arr1);
+       TObjString *objStr1 = 0;
+       while((objStr1 = dynamic_cast<TObjString*>(iter1.Next()))) {
+               TString buff(objStr1->GetName());
+               
+               if(buff.Contains("path:")) {
+                       TString path(buff(buff.First('\"')+1, buff.Length()-buff.First('\"')-2));
+                       id->SetPath(path.Data());
+               
+               } else if (buff.Contains("run range:")) {
+                       TString firstRunStr(buff(buff.Index('[')+1, buff.Index(',')-buff.Index('[')-1));
+                       TString lastRunStr(buff(buff.Index(',')+1, buff.Index(']')-buff.Index(',')-1));
+                       id->SetRunRange(firstRunStr.Atoi(), lastRunStr.Atoi());
+               
+               } else if (buff.Contains("version:")) { 
+                       if (buff.Contains("_s")) {
+                               TString versStr(buff(buff.Last('v')+1, buff.Index('_')-buff.Last('v')-1));
+                               TString subVersStr(buff(buff.Last('s')+1, buff.Length()-buff.Last('s')-1));
+                               id->SetVersion(versStr.Atoi());
+                               id->SetSubVersion(subVersStr.Atoi());
+                       } else {
+                               TString versStr(buff(buff.Last('v')+1, buff.Length()-buff.Last('v')-1));
+                               id->SetVersion(versStr.Atoi());
+                       }
+               }
+       
+       }
+       
+       delete arr1;
+       
+       return id;
+
+}
+
+//_____________________________________________________________________________
 AliCDBId::~AliCDBId() {
 //destructor
 
index 549bd52..511519f 100644 (file)
@@ -32,6 +32,8 @@ public:
                Int_t firstRun , Int_t lastRun , Int_t verison = -1, 
                Int_t subVersion = -1); 
 
+       static AliCDBId* MakeFromString(const TString& idString);               
+               
        virtual ~AliCDBId();
 
        const AliCDBPath&       GetAliCDBPath() const {return fPath;}
index a827242..210b93c 100644 (file)
@@ -966,7 +966,7 @@ Bool_t AliReconstruction::Run(const char* input)
         
    AliCDBId* id=0;      
    while((id = dynamic_cast<AliCDBId*> (iter2.Next()))){        
-         cdbListCopy->Add(id->Clone());         
+         cdbListCopy->Add(new TObjString(id->ToString().Data()));       
    }    
         
    tree->GetUserInfo()->Add(cdbMapCopy);