]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Macro to transfer OCDB data from one location to another, with possibility to
authoracolla <acolla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 31 May 2007 11:55:58 +0000 (11:55 +0000)
committeracolla <acolla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 31 May 2007 11:55:58 +0000 (11:55 +0000)
change run range, path etc.

STEER/CDBToGrid.C [new file with mode: 0644]

diff --git a/STEER/CDBToGrid.C b/STEER/CDBToGrid.C
new file mode 100644 (file)
index 0000000..74c73d7
--- /dev/null
@@ -0,0 +1,56 @@
+
+// This macro transfers OCDB data of one single ("detName") or all ALICE detectors from one location to another, 
+// It is possible to set new run range, path etc... 
+
+void CDBToGrid(const char *detName="", const char* fromUri="local://$ALICE_ROOT", 
+       const char* toUri="local://newOCDB"){
+
+AliCDBManager *man = AliCDBManager::Instance();
+
+man->SetDefaultStorage(fromUri);
+
+AliCDBStorage *dest = man->GetStorage(toUri);
+
+man->SetRun(0);
+
+if(detName == ""){
+// drain everything
+       TList *calib = man->GetAll("*/Calib/*");
+       TList *align = man->GetAll("*/Align/Data");
+} else {
+// drain calibration and aliignment for detector "detName"
+
+       TString calibPath = detName;
+       TString alignPath = calibPath;
+       calibPath+="/Calib/*";
+       alignPath+="/Align/Data";
+
+       TList *calib = man->GetAll(calibPath);
+       TList *align = man->GetAll(alignPath);
+}
+
+AliCDBEntry *entry;
+for(int i=0;i<calib->GetEntries();i++){
+
+       entry = (AliCDBEntry*) calib->At(i);
+       
+       // change run range
+       entry->GetId().SetRunRange(0,999999999);
+
+       TString path=entry->GetId().GetPath();
+       if (path == "ITS/Resp/RespSDD") entry->GetId().SetPath("ITS/Calib/RespSDD"); // bug in ITS/Resp/RespSDD
+
+       dest->Put(entry);
+}
+
+for(int i=0;i<align->GetEntries();i++){
+       entry = (AliCDBEntry*) align->At(i);
+       entry->GetId().SetRunRange(0,999999999);
+       dest->Put(entry);
+}
+
+
+man->Destroy();
+
+}