o fix problems in ITS pid when using probabilities (combined pid) - Benjamin, Stefano
[u/mrichter/AliRoot.git] / STEER / macros / CDBToGrid.C
CommitLineData
ac9339b3 1// This macro transfers OCDB data of one single ("detName") or all ALICE detectors from one location to another,
2// It is possible to set new run range, path etc...
4cf9c7e8 3// draining "align" objects is in general to be avoided, since those present in the repository might not be updated
4// some paths might be missing hereafter: this can be checked in advance by means of "listCdbEntries.sh" run on the
5// starting OCDB folder
6#if !defined(__CINT__) || defined(__MAKECINT__)
7#include "AliCDBManager.h"
8#include "AliCDBStorage.h"
9#include "AliCDBEntry.h"
10#include "AliCDBId.h"
11#include <TString.h>
12#include <TList.h>
13#endif
ac9339b3 14
162637e4 15void CDBToGrid(const char *detName="", const char* fromUri="local://$ALICE_ROOT/OCDB",
81fadc01 16 const char* toUri="local://newOCDB")
17{
ac9339b3 18
4cf9c7e8 19 AliCDBManager *man = AliCDBManager::Instance();
20 man->SetDefaultStorage(fromUri);
21 AliCDBStorage *dest = man->GetStorage(toUri);
22 man->SetRun(0);
ac9339b3 23
4cf9c7e8 24 TList* calib=0;
25 TList* align=0;
26 TList* config=0;
81fadc01 27
4cf9c7e8 28 if(detName == "")
29 {
30 // drain by cdb-path
31 calib = man->GetAll("*/Calib/*");
32 //align = man->GetAll("*/Align/Data");
33 config = man->GetAll("*/Config/*");
81fadc01 34
4cf9c7e8 35 // drain everything, really!
36 //calib = man->GetAll("*");
ac9339b3 37
4cf9c7e8 38 } else {
39 // drain calibration and alignment for detector "detName"
ac9339b3 40
4cf9c7e8 41 TString calibPath = detName;
42 TString alignPath = calibPath;
43 calibPath+="/Calib/*";
44 alignPath+="/Align/Data";
81fadc01 45
4cf9c7e8 46 //calib = man->GetAll(calibPath);
47 //align = man->GetAll(alignPath);
ac9339b3 48
4cf9c7e8 49 // drain everything, really!
50 calib = man->GetAll(Form("%s/*",detName));
81fadc01 51 }
81fadc01 52
4cf9c7e8 53 AliCDBEntry *entry;
ac9339b3 54
4cf9c7e8 55 Int_t ok=0; TString failed="";
56 if(calib){
57 ok=0; failed="";
58 for(int i=0;i<calib->GetEntries();i++){
ac9339b3 59
4cf9c7e8 60 entry = (AliCDBEntry*) calib->At(i);
61 entry->GetId().SetRunRange(0,AliCDBRunRange::Infinity());
81fadc01 62
4cf9c7e8 63 TString path=entry->GetId().GetPath();
ac9339b3 64
4cf9c7e8 65 printf("%s\n",path.Data());
81fadc01 66
4cf9c7e8 67 if (path == "ITS/Resp/RespSDD") entry->GetId().SetPath("ITS/Calib/RespSDD"); // bug in ITS/Resp/RespSDD
81fadc01 68
4cf9c7e8 69 if(path == "TOF/Calib/Par" || path == "TOF/Calib/SimPar" || path.Contains("TOF/CDB")) continue;
ac9339b3 70
4cf9c7e8 71 if (dest->Put(entry)) {
72 ok++;
73 } else {
74 failed += path.Data(); failed += " ";
75 }
76 }
77 printf("\n************ CALIB *********** \n");
78 printf("************ Stored %d objects over %d *********** \n", ok, calib->GetEntries());
79 if(failed != ""){
80 printf("***** List of failed objects: %s \n", failed.Data());
81 }
82 }
81fadc01 83
81fadc01 84
4cf9c7e8 85 if(align){
86 ok=0; failed="";
87 for(int i=0;i<align->GetEntries();i++){
88
89 entry = (AliCDBEntry*) align->At(i);
90 entry->GetId().SetRunRange(0,AliCDBRunRange::Infinity());
91 TString path=entry->GetId().GetPath();
92
93 if (dest->Put(entry)) {
94 ok++;
95 } else {
96 failed += path.Data(); failed += " ";
97 }
98 }
99 printf("\n************ ALIGN *********** \n");
100 printf("************ Stored %d objects over %d *********** \n", ok, align->GetEntries());
101 if(failed != ""){
102 printf("***** List of failed objects: %s \n", failed.Data());
103 }
81fadc01 104 }
4cf9c7e8 105
106 if(config){
107 ok=0; failed = "";
108 for(int i=0;i<config->GetEntries();i++){
109
110 entry = (AliCDBEntry*) config->At(i);
111 entry->GetId().SetRunRange(0,AliCDBRunRange::Infinity());
112 TString path=entry->GetId().GetPath();
113
114 if (dest->Put(entry)) {
115 ok++;
116 } else {
117 failed += path.Data(); failed += " ";
118 }
119 }
120 printf("\n************ CONFIG *********** \n");
121 printf("************ Stored %d objects over %d *********** \n", ok, config->GetEntries());
122 if(failed != ""){
123 printf("***** List of failed objects: %s \n", failed.Data());
124 }
81fadc01 125 }
ac9339b3 126
4cf9c7e8 127 man->Destroy();
ac9339b3 128
129}