-
// 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",
+// draining "align" objects is in general to be avoided, since those present in the repository might not be updated
+// some paths might be missing hereafter: this can be checked in advance by means of "listCdbEntries.sh" run on the
+// starting OCDB folder
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include "AliCDBManager.h"
+#include "AliCDBStorage.h"
+#include "AliCDBEntry.h"
+#include "AliCDBId.h"
+#include <TString.h>
+#include <TList.h>
+#endif
+
+void CDBToGrid(const char *detName="", const char* fromUri="local://$ALICE_ROOT/OCDB",
const char* toUri="local://newOCDB")
{
-AliCDBManager *man = AliCDBManager::Instance();
-
-man->SetDefaultStorage(fromUri);
+ AliCDBManager *man = AliCDBManager::Instance();
+ man->SetDefaultStorage(fromUri);
+ AliCDBStorage *dest = man->GetStorage(toUri);
+ man->SetRun(0);
-AliCDBStorage *dest = man->GetStorage(toUri);
+ TList* calib=0;
+ TList* align=0;
+ TList* config=0;
-man->SetRun(0);
+ if(detName == "")
+ {
+ // drain by cdb-path
+ calib = man->GetAll("*/Calib/*");
+ //align = man->GetAll("*/Align/Data");
+ config = man->GetAll("*/Config/*");
-TList* calib=0;
-TList* align=0;
-TList* recpar=0;
-TList* config=0;
+ // drain everything, really!
+ //calib = man->GetAll("*");
-if(detName == ""){
-// drain everything
- //calib = man->GetAll("*/Calib/*");
- //align = man->GetAll("*/Align/Data");
- //recpar = man->GetAll("*/RecParam/*");
- //config = man->GetAll("*/Config/*");
-
-// drain everything, really!
- calib = man->GetAll("*");
+ } else {
+ // drain calibration and alignment for detector "detName"
-} else {
-// drain calibration and alignment for detector "detName"
+ TString calibPath = detName;
+ TString alignPath = calibPath;
+ calibPath+="/Calib/*";
+ alignPath+="/Align/Data";
- TString calibPath = detName;
- TString alignPath = calibPath;
- calibPath+="/Calib/*";
- alignPath+="/Align/Data";
+ //calib = man->GetAll(calibPath);
+ //align = man->GetAll(alignPath);
- //calib = man->GetAll(calibPath);
- //align = man->GetAll(alignPath);
-
-// drain everything, really!
- calib = man->GetAll(Form("%s/*",detName.Data()));
-}
-
-AliCDBEntry *entry;
-
-Int_t ok=0; TString failed="";
-if(calib){
- ok=0; failed="";
- for(int i=0;i<calib->GetEntries();i++){
-
- entry = (AliCDBEntry*) calib->At(i);
- entry->GetId().SetRunRange(0,999999999);
-
- TString path=entry->GetId().GetPath();
-
- cout << path.Data() << endl;
-
- if (path == "ITS/Resp/RespSDD") entry->GetId().SetPath("ITS/Calib/RespSDD"); // bug in ITS/Resp/RespSDD
-
- if(path == "TOF/Calib/Par" || path == "TOF/Calib/SimPar" || path.Contains("TOF/CDB")) continue;
-
- if (dest->Put(entry)) {
- ok++;
- } else {
- failed += path.Data(); failed += " ";
- }
- }
- printf("\n************ CALIB *********** \n");
- printf("************ Stored %d objects over %d *********** \n", ok, calib->GetEntries());
- if(failed != ""){
- printf("***** List of failed objects: %s \n", failed.Data());
+ // drain everything, really!
+ calib = man->GetAll(Form("%s/*",detName));
}
-}
+ AliCDBEntry *entry;
-if(align){
-ok=0; failed="";
-for(int i=0;i<align->GetEntries();i++){
+ Int_t ok=0; TString failed="";
+ if(calib){
+ ok=0; failed="";
+ for(int i=0;i<calib->GetEntries();i++){
- entry = (AliCDBEntry*) align->At(i);
- entry->GetId().SetRunRange(0,999999999);
- TString path=entry->GetId().GetPath();
+ entry = (AliCDBEntry*) calib->At(i);
+ entry->GetId().SetRunRange(0,AliCDBRunRange::Infinity());
- if (dest->Put(entry)) {
- ok++;
- } else {
- failed += path.Data(); failed += " ";
- }
- }
- printf("\n************ ALIGN *********** \n");
- printf("************ Stored %d objects over %d *********** \n", ok, align->GetEntries());
- if(failed != ""){
- printf("***** List of failed objects: %s \n", failed.Data());
- }
-}
+ TString path=entry->GetId().GetPath();
-if(recpar){
- ok=0; failed="";
- for(int i=0;i<recpar->GetEntries();i++){
+ printf("%s\n",path.Data());
- entry = (AliCDBEntry*) recpar->At(i);
- 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
- if (dest->Put(entry)) {
- ok++;
- } else {
- failed += path.Data(); failed += " ";
- }
- }
- printf("\n************ RECPAR *********** \n");
- printf("************ Stored %d objects over %d *********** \n", ok, recpar->GetEntries());
- if(failed != ""){
- printf("***** List of failed objects: %s \n", failed.Data());
- }
-}
+ if(path == "TOF/Calib/Par" || path == "TOF/Calib/SimPar" || path.Contains("TOF/CDB")) continue;
-if(config){
- ok=0; failed = "";
- for(int i=0;i<config->GetEntries();i++){
+ if (dest->Put(entry)) {
+ ok++;
+ } else {
+ failed += path.Data(); failed += " ";
+ }
+ }
+ printf("\n************ CALIB *********** \n");
+ printf("************ Stored %d objects over %d *********** \n", ok, calib->GetEntries());
+ if(failed != ""){
+ printf("***** List of failed objects: %s \n", failed.Data());
+ }
+ }
- entry = (AliCDBEntry*) config->At(i);
- entry->GetId().SetRunRange(0,999999999);
- TString path=entry->GetId().GetPath();
- if (dest->Put(entry)) {
- ok++;
- } else {
- failed += path.Data(); failed += " ";
- }
+ if(align){
+ ok=0; failed="";
+ for(int i=0;i<align->GetEntries();i++){
+
+ entry = (AliCDBEntry*) align->At(i);
+ entry->GetId().SetRunRange(0,AliCDBRunRange::Infinity());
+ TString path=entry->GetId().GetPath();
+
+ if (dest->Put(entry)) {
+ ok++;
+ } else {
+ failed += path.Data(); failed += " ";
+ }
+ }
+ printf("\n************ ALIGN *********** \n");
+ printf("************ Stored %d objects over %d *********** \n", ok, align->GetEntries());
+ if(failed != ""){
+ printf("***** List of failed objects: %s \n", failed.Data());
+ }
}
- printf("\n************ CONFIG *********** \n");
- printf("************ Stored %d objects over %d *********** \n", ok, config->GetEntries());
- if(failed != ""){
- printf("***** List of failed objects: %s \n", failed.Data());
+
+ if(config){
+ ok=0; failed = "";
+ for(int i=0;i<config->GetEntries();i++){
+
+ entry = (AliCDBEntry*) config->At(i);
+ entry->GetId().SetRunRange(0,AliCDBRunRange::Infinity());
+ TString path=entry->GetId().GetPath();
+
+ if (dest->Put(entry)) {
+ ok++;
+ } else {
+ failed += path.Data(); failed += " ";
+ }
+ }
+ printf("\n************ CONFIG *********** \n");
+ printf("************ Stored %d objects over %d *********** \n", ok, config->GetEntries());
+ if(failed != ""){
+ printf("***** List of failed objects: %s \n", failed.Data());
+ }
}
-}
-man->Destroy();
+ man->Destroy();
}