AliSimulation will store used CDB map/path in the galice.root
authorshahoian <ruben.shahoyan@cern.ch>
Mon, 10 Mar 2014 15:23:39 +0000 (16:23 +0100)
committershahoian <ruben.shahoyan@cern.ch>
Mon, 10 Mar 2014 15:34:39 +0000 (16:34 +0100)
STEER/STEER/AliSimulation.cxx
STEER/STEER/AliSimulation.h

index e7158c9..2fbf987 100644 (file)
@@ -2106,7 +2106,9 @@ void AliSimulation::FinishRun()
   AliRunLoader::Instance()->CdGAFile();
   gAlice->Write(0,TObject::kOverwrite);//write AliRun
   AliRunLoader::Instance()->Write(0,TObject::kOverwrite);//write RunLoader itself
-  
+  //
+  StoreUsedCDBMaps();
+  //  
   if(gAlice->GetMCApp()) gAlice->GetMCApp()->FinishRun();  
   AliRunLoader::Instance()->Synchronize();
 }
@@ -2513,3 +2515,46 @@ time_t AliSimulation::GenerateTimeStamp() const
   else
     return 0;
 }
+
+//_____________________________________________________________________________
+void AliSimulation::StoreUsedCDBMaps() const
+{
+  // write in galice.root maps with used CDB paths
+  //
+  const TMap *cdbMap = AliCDBManager::Instance()->GetStorageMap();      
+  const TList *cdbList = AliCDBManager::Instance()->GetRetrievedIds();  
+  //
+  TMap *cdbMapCopy = new TMap(cdbMap->GetEntries());    
+  cdbMapCopy->SetOwner(1);      
+  //  cdbMapCopy->SetName("cdbMap");    
+  TIter iter(cdbMap->GetTable());       
+  //    
+  TPair* pair = 0;      
+  while((pair = dynamic_cast<TPair*> (iter.Next()))){   
+    TObjString* keyStr = dynamic_cast<TObjString*> (pair->Key());       
+    TObjString* valStr = dynamic_cast<TObjString*> (pair->Value());
+    if (keyStr && valStr)
+      cdbMapCopy->Add(new TObjString(keyStr->GetName()), new TObjString(valStr->GetName()));    
+  }     
+  //    
+  TList *cdbListCopy = new TList();     
+  cdbListCopy->SetOwner(1);     
+  //  cdbListCopy->SetName("cdbList");  
+  //
+  TIter iter2(cdbList);         
+  
+  AliCDBId* id=0;
+  while((id = dynamic_cast<AliCDBId*> (iter2.Next()))){         
+    cdbListCopy->Add(new TObjString(id->ToString().Data()));    
+  }     
+  //
+  AliRunLoader::Instance()->CdGAFile();
+  gDirectory->WriteObject(cdbMapCopy,"cdbMap","kSingleKey");
+  gDirectory->WriteObject(cdbListCopy,"cdbList","kSingleKey");  
+  //
+  AliInfo(Form("Stored used OCDB entries as TMap %s and TList %s in %s",
+              cdbMapCopy->GetName(),
+              cdbListCopy->GetName(),
+              fGAliceFileName.Data()));
+  //
+}
index 4d7e1ce..9cf13ff 100644 (file)
@@ -122,6 +122,8 @@ public:
   virtual  Bool_t IsLegoRun() const {return (fLego!=0);}
   AliLego* Lego() const {return fLego;}
   virtual  void  FinishRun();
+  //
+  void StoreUsedCDBMaps() const; 
 
   //Quality Assurance
   Int_t       GetDetIndex(const char * detector);