]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/CDBToGrid.C
introducing SDD, SSD layer misal (Andrea Dainese)
[u/mrichter/AliRoot.git] / STEER / CDBToGrid.C
CommitLineData
ac9339b3 1
2// This macro transfers OCDB data of one single ("detName") or all ALICE detectors from one location to another,
3// It is possible to set new run range, path etc...
4
5void CDBToGrid(const char *detName="", const char* fromUri="local://$ALICE_ROOT",
81fadc01 6 const char* toUri="local://newOCDB")
7{
ac9339b3 8
9AliCDBManager *man = AliCDBManager::Instance();
10
11man->SetDefaultStorage(fromUri);
12
13AliCDBStorage *dest = man->GetStorage(toUri);
14
15man->SetRun(0);
16
81fadc01 17TList* calib=0;
18TList* align=0;
19TList* recpar=0;
20TList* config=0;
21
ac9339b3 22if(detName == ""){
23// drain everything
81fadc01 24 //calib = man->GetAll("*/Calib/*");
25 //align = man->GetAll("*/Align/Data");
26 //recpar = man->GetAll("*/RecParam/*");
27 //config = man->GetAll("*/Config/*");
28
29// drain everything, really!
30 calib = man->GetAll("*");
31
ac9339b3 32} else {
81fadc01 33// drain calibration and alignment for detector "detName"
ac9339b3 34
35 TString calibPath = detName;
36 TString alignPath = calibPath;
81fadc01 37 calibPath+="/Calib/*";
ac9339b3 38 alignPath+="/Align/Data";
39
81fadc01 40 //calib = man->GetAll(calibPath);
41 //align = man->GetAll(alignPath);
42
43// drain everything, really!
44 calib = man->GetAll(Form("%s/*",detName.Data()));
ac9339b3 45}
46
47AliCDBEntry *entry;
ac9339b3 48
81fadc01 49Int_t ok=0; TString failed="";
50if(calib){
51 ok=0; failed="";
52 for(int i=0;i<calib->GetEntries();i++){
53
54 entry = (AliCDBEntry*) calib->At(i);
55 entry->GetId().SetRunRange(0,999999999);
56
57 TString path=entry->GetId().GetPath();
58
59 cout << path.Data() << endl;
60
61 if (path == "ITS/Resp/RespSDD") entry->GetId().SetPath("ITS/Calib/RespSDD"); // bug in ITS/Resp/RespSDD
ac9339b3 62
81fadc01 63 if(path == "TOF/Calib/Par" || path == "TOF/Calib/SimPar" || path.Contains("TOF/CDB")) continue;
64
65 if (dest->Put(entry)) {
66 ok++;
67 } else {
68 failed += path.Data(); failed += " ";
69 }
70 }
71 printf("\n************ CALIB *********** \n");
72 printf("************ Stored %d objects over %d *********** \n", ok, calib->GetEntries());
73 if(failed != ""){
74 printf("***** List of failed objects: %s \n", failed.Data());
75 }
76}
77
ac9339b3 78
81fadc01 79if(align){
80ok=0; failed="";
81for(int i=0;i<align->GetEntries();i++){
ac9339b3 82
81fadc01 83 entry = (AliCDBEntry*) align->At(i);
84 entry->GetId().SetRunRange(0,999999999);
85 TString path=entry->GetId().GetPath();
86
87 if (dest->Put(entry)) {
88 ok++;
89 } else {
90 failed += path.Data(); failed += " ";
91 }
92 }
93 printf("\n************ ALIGN *********** \n");
94 printf("************ Stored %d objects over %d *********** \n", ok, align->GetEntries());
95 if(failed != ""){
96 printf("***** List of failed objects: %s \n", failed.Data());
97 }
ac9339b3 98}
99
81fadc01 100if(recpar){
101 ok=0; failed="";
102 for(int i=0;i<recpar->GetEntries();i++){
103
104 entry = (AliCDBEntry*) recpar->At(i);
105 entry->GetId().SetRunRange(0,999999999);
106 TString path=entry->GetId().GetPath();
107
108 if (dest->Put(entry)) {
109 ok++;
110 } else {
111 failed += path.Data(); failed += " ";
112 }
113 }
114 printf("\n************ RECPAR *********** \n");
115 printf("************ Stored %d objects over %d *********** \n", ok, recpar->GetEntries());
116 if(failed != ""){
117 printf("***** List of failed objects: %s \n", failed.Data());
118 }
ac9339b3 119}
120
81fadc01 121if(config){
122 ok=0; failed = "";
123 for(int i=0;i<config->GetEntries();i++){
124
125 entry = (AliCDBEntry*) config->At(i);
126 entry->GetId().SetRunRange(0,999999999);
127 TString path=entry->GetId().GetPath();
128
129 if (dest->Put(entry)) {
130 ok++;
131 } else {
132 failed += path.Data(); failed += " ";
133 }
134 }
135 printf("\n************ CONFIG *********** \n");
136 printf("************ Stored %d objects over %d *********** \n", ok, config->GetEntries());
137 if(failed != ""){
138 printf("***** List of failed objects: %s \n", failed.Data());
139 }
140}
ac9339b3 141
142man->Destroy();
143
144}