AliRoot Core  edcc906 (edcc906)
AliOCDBtoolkit.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 /*
17 
18  Primary goal of the proposal was to provide functionality to browse and compare the content of the OCDB
19  specified by different means.
20 
21  a.) galice.root - as currently implemented by Ruben in MC (or any file with cdbMap, and cdbList)
22  b.) AliESDs.root - for the reconstructed data
23  c.) ocdb snapshot - as used for grid productions
24  d.) TMap(s) - as used internally in galice.root and AliESDs,root
25  e.) log file (if possible) - looks logs aways used similar syntax, tested and working
26  f.) C macro - custom macro
27 
28  Content comparison should be done:
29  a.) on the level of symbolic links
30  b.) on the level of content itself
31  - by by byte comparison dif
32  - data member by data member comparison
33 
34  Implementation assumption:
35  All input formats (a .. f) will be converted to the TMap storages and TList if AliCDBIds
36 
37 
38 
39 
40  //=============================================================================
41  // Functionality to dump content of objects in human readable format in root prompt
42  //=============================================================================
43  Use case examples:
44  1.) compare content of alignent OCDB files for different yers
45  2.) compare ClusterParam for different periods
46  =================================================================================================================
47  // 1.) Compare alignment example:
48  // Compare TPC alignemnt 2013 and 2010
49  AliOCDBtoolkit::DumpOCDBFile("/cvmfs/alice-ocdb.cern.ch/calibration/data/2013/OCDB/TPC/Align/Data/Run0_999999999_v1_s0.root","TPCalign2013.dump",1,"docdb");
50  AliOCDBtoolkit::DumpOCDBFile("/cvmfs/alice-ocdb.cern.ch/calibration/data/2010/OCDB/TPC/Align/Data/Run0_999999999_v1_s0.root","TPCalign2010.dump",1,"docdb");
51  diff TPCalign2013.dump TPCalign2010.dump > TPCalign2013_TPCalign2010.diff
52  =================================================================================================================
53  // 2.) Compare ClusterParam OCDB etry
54  AliOCDBtoolkit::DumpOCDBFile("/cvmfs/alice-ocdb.cern.ch/calibration/data/2010/OCDB/TPC/Calib/ClusterParam/Run131541_999999999_v2_s0.root","2010_TPC_Calib_ClusterParam_Run131541_999999999_v2_s0.dump",1,"docdb");
55  AliOCDBtoolkit::AliOCDBtoolkit::DumpOCDBFile("/cvmfs/alice-ocdb.cern.ch/calibration/data/2010/OCDB/TPC/Calib/ClusterParam/Run0_999999999_v1_s0.root","2010_TPC_Calib_ClusterParam_Run0_999999999_v1_s0.dump",1,"docdb");
56  AliOCDBtoolkit::DumpOCDBFile("/cvmfs/alice-ocdb.cern.ch/calibration/data/2013/OCDB/TPC/Calib/ClusterParam/Run0_999999999_v1_s0.root","2013_TPC_Calib_ClusterParam_Run0_999999999_v1_s0.dump",1,"docdb");
57  diff 2010_TPC_Calib_ClusterParam_Run131541_999999999_v2_s0.dump 2010_TPC_Calib_ClusterParam_Run0_999999999_v1_s0.dump
58 
59 
60  //=============================================================================
61  // Infovke OCDB toolkit functionality from prompt
62  //=============================================================================
63  More examples : AliOCDBtoolkit.sh in shell prompt (see examples in $ALICE_PHYSCS/PWGPP/CalibMacros/AliOCDBtoolkit.sh)
64  E.g:
65  1.) source AliOCDBtoolkit.sh
66  source $ALICE_PHYSICS/PWGPP/CalibMacros/AliOCDBtoolkit.sh
67  2.) make human readable OCDB tables, CDBids trees, OCDB obejct dumps .... specifying approprate input (ESD,galice.root, log files, snapshot)
68  (object dump only for selected items - configured by $ALICE_PHYSICS/PWGPP/CalibMacros/AliOCDBtoolkit.cfg
69  (Examples for logs and snapshots to be rechecked)
70 
71  ocdbMakeTable alien:///alice/data/2010/LHC10d/000126158/pass4/10000126158023.10/AliESDs.root ESD OCDBrec.list
72  ===> Output: OCDBrec.list, OCDBrec.list.root *.xml and *.print files for selected OCDB entries
73  ocdbMakeTable alien:///alice/sim/2016/LHC16d1/244983/301/galice.root MC OCDBsim.list
74  ===> Output: OCDBsim.list, OCDBsim.list.root and *.print files for selected OCDB entries
75  dumpObject $ALICE_ROOT/OCDB/TPC/Calib/PadNoise/Run0_999999999_v1_s0.root "object" "XML" TPC_Calib_PadNoise_Run0_999999999_v1_s0.xml
76 
77 
78 */
79 
80 
81 
82 // STD
83 #include <iostream>
84 #include <algorithm>
85 #include <sstream>
86 #include <stdexcept>
87 #include <functional>
88 #include "TRealData.h"
89 #include "TDataMember.h"
90 #include "TClass.h"
91 #include "TROOT.h"
92 #include <TVectorD.h>
93 #include <TObjArray.h>
94 #include "TRegexp.h"
95 #include "TPRegexp.h"
96 //
97 #include "TSystem.h"
98 #include "TObjArray.h"
99 #include "TString.h"
100 #include "TTree.h"
101 #include "TMessage.h"
102 #include <TGrid.h>
103 #include <TEnv.h>
104 //
105 #include "AliCDBManager.h"
106 #include "AliCDBEntry.h"
107 #include "AliOCDBtoolkit.h"
108 #include "AliCDBStorage.h"
109 #include "TTreeStream.h"
110 #include "AliProdInfo.h"
111 
112 using std::cout;
113 using std::cerr;
114 using std::endl;
115 using std::exception;
116 
117 
122 Int_t AliOCDBtoolkit::fgRun=1;
123 TString AliOCDBtoolkit::fgPath="";
124 AliProdInfo * AliOCDBtoolkit::fgProdInfo=0; // production information
125 
127  //
128  // Example usage for the MC
129  // To run example case, assuming presence of following files in working directory:
130  // - rec.log
131  // - galice.root
132  // - AliESDs.root
133  //
135  AliOCDBtoolkit::LoadOCDBFromLog("rec.log",0);
136  const TMap *cdbMapLog= man->GetStorageMap(); // this is map of
137  const TList *cdbListLog=man->GetRetrievedIds(); // this is list of AliCDBId
138  // TList *cdbListLog0=man->GetRetrievedIds(); // this is list of AliCDBId
139  //
140  TFile *fmc = TFile::Open("galice.root");
141  TMap *cdbMapMC= (TMap*)fmc->Get("cdbMap"); //
142  TList *cdbListMC0= (TList*)fmc->Get("cdbList"); // this is list of TObjStrings
143  TList *cdbListMC = AliOCDBtoolkit::ConvertListStringToCDBId(cdbListMC0); // convert to the TObjArray of AliCDBids
144  //
145  TFile *fesd = TFile::Open("AliESDs.root");
146  TList *listESD = ((TTree*)fesd->Get("esdTree"))->GetUserInfo();
147  TMap *cdbMapESD= (TMap*)listESD->FindObject("cdbMap");
148  TList *cdbListESD0= (TList*)listESD->FindObject("cdbList"); // this is list of TObjStrings
149  TList *cdbListESD = AliOCDBtoolkit::ConvertListStringToCDBId(cdbListESD0); // convert to the TObjArray of AliCDBids
150  //
151  //
152  //
153  printf("\n\n");
154  printf("Diff log>>>ESD\n\n:");
155  MakeDiff(cdbMapLog, cdbListLog, cdbMapESD, cdbListESD,0);
156  printf("\n\n");
157  printf("Diff ESD>>>log\n\n:");
158  MakeDiff(cdbMapESD, cdbListESD,cdbMapLog, cdbListLog,0);
159  //
160  printf("\n\n");
161  printf("Diff ESD>>>MC\n\n:");
162  MakeDiff(cdbMapMC, cdbListMC, cdbMapESD, cdbListESD,0);
163 }
164 
165 
166 
167 void AliOCDBtoolkit::DumpOCDBAsTxt(const TString fInput, const TString fType, const TString outfile){
168  //
169  //
170  //
171  TFile *file;
172  const TMap *cdbMap=0;
173  const TList *cdbList=0;
174  Bool_t cvmfsExist = gSystem->AccessPathName("/cvmfs/alice-ocdb.cern.ch/calibration/")==kFALSE; // check presence of the OCDB in cvfms
176  //
177  //
179  if (fInput.Contains("alien://") && gGrid==0){
180  TGrid *myGrid = TGrid::Connect("alien://"); //Oddly this will return also a pointer if connection fails
181  if(myGrid->GetPort()==0){ //if connection fails port 0 is saved, using this to check for successful connection
182  cerr << "Cannot connect to grid!" << endl;
183  return;
184  }
185  }
186  if(fType.EqualTo("MC",TString::kIgnoreCase)){
187  file = TFile::Open(fInput.Data());
188  fgPath=fInput;
189  cdbMap = (TMap*)file->Get("cdbMap");
190  if (!cdbMap){
191  printf("cdbMap does not exist in input file\t%s. Exiting\n",fInput.Data());
192  return;
193  }
194  //
195  TString cdbStorage=((TPair*)cdbMap->FindObject("default"))->Value()->GetName();
196  AliOCDBtoolkit::CleanCDBPath(cdbStorage,cvmfsExist); // use cvmfs instead of alien: if available
197  man->SetDefaultStorage(cdbStorage.Data());
198  TList *cdbListMC0 = (TList*)file->Get("cdbList"); // this is list of TObjStrings
199  cdbList = AliOCDBtoolkit::ConvertListStringToCDBId(cdbListMC0); // convert to the TObjArray of AliCDBids
200  }
201  else if(fType.EqualTo("ESD",TString::kIgnoreCase)){
202  file = TFile::Open(fInput.Data());
203  fgPath=fInput;
204  if (!file) {
205  printf("Input file does not exist %s. Exiting\n",fInput.Data());
206  return;
207  }
208  TTree * tree = ((TTree*)file->Get("esdTree"));
209  if (!tree || (tree->Draw("fRunNumber","","goff",1)<=0)){
210  ::Error("AliOCDBtoolkit::DumpOCDBAsTxt","Input esdTree does not exist in %s",fInput.Data());
211  return;
212  }
213  fgRun = tree->GetV1()[0];
214  TList *listESD = tree->GetUserInfo();
215  if (listESD) fgProdInfo->Init(tree->GetUserInfo());
216  cdbMap = (TMap*)listESD->FindObject("cdbMap");
217  if (!cdbMap){
218  printf("cdbMap does not exist in input file\t%s. Exiting\n",fInput.Data());
219  return;
220  }
222  TList *cdbListESD0= (TList*)listESD->FindObject("cdbList"); // this is list of TObjStrings
223  cdbList = ConvertListStringToCDBId(cdbListESD0); // convert to the TObjArray of AliCDBids
224  }
225  else if(fType.EqualTo("log",TString::kIgnoreCase)){
226  LoadOCDBFromLog(fInput.Data(),0);
227  cdbMap = man->GetStorageMap(); // this is map of
228  cdbList =man->GetRetrievedIds(); // this is list of AliCDBId
229  }
230  else{
231  printf("unsupported option: %s",fType.Data());
232  return;
233  }
234  cout <<"BEGINDUMP:" << endl;
235  DumpOCDB(cdbMap,cdbList,outfile);
236 }
237 
238 
239 Bool_t AliOCDBtoolkit::ParseInfoFromOcdbString(TString ocdbString, TString &ocdbPath, Int_t &run0, Int_t &run1, Int_t &version, Int_t &subVersion){
240  // Functionalit
241  // Parse OCDB id string and provide basic ocdb information
242  //
243  // a.) parse ocdbPath
244  Int_t indexBeginPath= ocdbString.Index("path: ")+7;
245  if (indexBeginPath<0) return kFALSE;
246  Int_t indexEndPath=ocdbString.Index(";",indexBeginPath);
247  if (indexEndPath<0) return kFALSE;
248  ocdbPath=TString(&(ocdbString.Data()[indexBeginPath]), indexEndPath-indexBeginPath-1);
249  // b.) parse runRange
250  Int_t indexRun0= ocdbString.Index(": [",indexEndPath)+3;
251  if (indexRun0<0) return kFALSE;
252  Int_t indexRun1= ocdbString.Index(",",indexRun0)+1;
253  if (indexRun1<0) return kFALSE;
254  run0=atoi(&(ocdbString.Data()[indexRun0]));
255  run1=atoi(&(ocdbString.Data()[indexRun1]));
256  AliCDBRunRange runRange(run0,run1);
257  //c.) parse version, subversion
258  Int_t indexVersion= ocdbString.Index("version: v",indexRun1)+10;
259  if (indexVersion<0) return kFALSE;
260  Int_t indexSubVersion= ocdbString.Index("_s",indexVersion)+2;
261  if (indexSubVersion<0) return kFALSE;
262  version=atoi(&(ocdbString.Data()[indexVersion]));
263  subVersion=atoi(&(ocdbString.Data()[indexSubVersion]));
264  return kTRUE;
265 }
266 
267 Bool_t AliOCDBtoolkit::ParseInfoFromOcdbString(TString ocdbString, AliCDBId &cdbId){
268  //
269  // Parse OCDB id string and provide basic ocdb information and fillcdbID object
270  //
271  TString ocdbPath;
272  Int_t run0=0, run1=0;
273  Int_t version=0, subVersion=0;
274  Bool_t parseStatus = ParseInfoFromOcdbString(ocdbString, ocdbPath, run0,run1,version,subVersion);
275  if (parseStatus) {
276  AliCDBRunRange runRange(run0,run1);
277  cdbId=AliCDBId(ocdbPath.Data(),runRange,version,subVersion);
278  AliCDBId* id = AliCDBId::MakeFromString(ocdbString);
279  cdbId=*id;
280  delete id;
281  }
282  //
283  return parseStatus;
284 }
285 
287  //
288  // Convert input list of the TObjString to list to AliCDBid
289  //
290  cdbList0->Sort();
291  Int_t entriesList0=cdbList0->GetEntries();
292  TList * array0 = new TList();
293  AliCDBId tmp0;
294  for (Int_t ientry0=0; ientry0<entriesList0; ientry0++){
295  if (cdbList0->At(ientry0)==0) continue;
296  Bool_t isId = cdbList0->At(ientry0)->IsA()->InheritsFrom("AliCDBId");
297  if (isId){
298  array0->AddLast(cdbList0->At(ientry0));
299  }else{
300  Bool_t isString = cdbList0->At(ientry0)->IsA()->InheritsFrom("TObjString");
301  if (isString){
302  TObjString* sid0 = dynamic_cast<TObjString*> (cdbList0->At(ientry0));
303  Bool_t status = ParseInfoFromOcdbString(sid0->String(), tmp0);
304  if (!status) continue;
305  array0->AddLast(new AliCDBId(tmp0));
306  }
307  }
308  }
309  return array0;
310 }
311 
312 
313 
314 void AliOCDBtoolkit::LoadOCDBFromLog(const char *logName, Int_t verbose){
315  //
316  // Initilaize OCDB
317  // Load OCDB setting as specified in log
318  // Assuming fixed version of the log
319  // AliCDBManager is initilaized - ocdbMap and ID list can be exported
320  //
321 
322  // Parsing/loading sequence:
323  // 0.) SetDefault storage *** Default Storage URI:
324  // 1.) SetSpecific storage *** Specific storage
325  // 2.) SetRunNumber Run number:
326  // 3.) Set used IDs
327  //
329  //
330  // 0.) SetDefault storage *** Default Storage URI:
331  //
332  TString defaultOCDB = gSystem->GetFromPipe(TString::Format("cat %s| grep \"Storage URI:\"",logName).Data());
333  TObjArray *array = defaultOCDB.Tokenize("\"");
334  man->SetDefaultStorage(array->Last()->GetName());
335  delete array;
336  //
337  // 1.) SetSpecific storage *** Specific storage
338  //
339  TString specificStorage = gSystem->GetFromPipe(TString::Format("cat %s| grep \"Specific storage\"",logName).Data());
340  array = specificStorage.Tokenize("\"");
341  Int_t entries = array->GetEntries();
342  for (Int_t i=1; i<entries-2; i+=4){
343  // add protection here line shuld be in expected format
344  if ((verbose&2)>0) printf("%s\t%s\n",array->At(i)->GetName(),array->At(i+2)->GetName());
345  man->SetSpecificStorage(array->At(i)->GetName(),array->At(i+2)->GetName());
346  }
347  delete array;
348  //
349  // 2.) SetRunNumber Run number:
350  //
351  TString runLine = gSystem->GetFromPipe(TString::Format("cat %s| grep \"I-AliCDBManager::Print: Run number =\"",logName).Data());
352  array = runLine.Tokenize("=");
353  Int_t run = 0;
354  if (array->GetEntries()>1) run=atoi(array->At(1)->GetName());
355  delete array;
356  man->SetRun(run);
357  //
358  // 3.) Set used IDs
359  //
360  TString ids = gSystem->GetFromPipe(TString::Format("cat %s| grep I-AliCDB | grep path| grep range | grep version", logName).Data());
361  array= ids.Tokenize("\n");
362  entries = array->GetEntries();
363  //
364  for (Int_t i=0; i<entries; i++){
365  //
366  TString ocdbString = array->At(i)->GetName();
367  TString ocdbEntry;
368  TString ocdbPath;
369  Int_t run0=0, run1=0;
370  Int_t version=0, subVersion=0;
371  Bool_t parseStatus = ParseInfoFromOcdbString(ocdbString, ocdbPath, run0,run1,version,subVersion);
372  if (!parseStatus) continue;
373  AliCDBRunRange runRange(run0,run1);
374  //
375  if ((verbose&2)!=0) {
376  printf("%s/Run%d_%d_v%d_s%d.root\n",ocdbPath.Data(),run0,run1,version,subVersion);
377  }
378  try {
379  man->Get(ocdbPath.Data(),runRange,version,subVersion);
380  } catch(const exception &e){
381  cerr << "OCDB retrieval failed!" << endl;
382  cerr << "Detailes: " << e.what() << endl;
383  }
384  }
385  if ((verbose&1)!=0){
386  man->Print();
387  man->GetStorageMap()->Print();
388  man->GetRetrievedIds()->Print();
389  }
390 }
391 
392 void AliOCDBtoolkit::SetStorage(const TMap *cdbMap){
393  //
394  // Set storages as specified in the map - TO CHECK..
395  // Should go to the AliCDBmanager if not alreadyhhere +++MI
396  //
397  // In case OCDB_PATH local variable is defined
398  // alien storage is replaced by OCDB_PATH prefix: e.g: local:///cvmfs/alice.gsi.de/
399  //
400  // Regexp extensivelly used - see documentation in ????
401  // http://wwwacs.gantep.edu.tr/guides/programming/root/htmldoc/examples/tstring.C.html
403  TIter iter(cdbMap->GetTable());
404  TPair* aPair=0;
405  Bool_t cvmfsExist = gSystem->AccessPathName("/cvmfs/alice-ocdb.cern.ch/calibration/")==kFALSE; // check presence of the OCDB in cvfms
406 
407 
408  while ((aPair = (TPair*) iter.Next())) {
409  // aPair->Value();
410  //aPair->Print();
411  TString urlOrig = aPair->Value()->GetName();
412  TString url=urlOrig; // e.g TString url="alien://?User=?DBFolder=/alice/data/2010/OCDB?SE=default?CacheFolder=?OperateDisconnected=1?CacheSize=1073741824?CleanupInterval=0"
413  man->ExtractBaseFolder(url); // url==alien://Folder=/alice/data/2010/OCDB"
414  TString ocdbPrefix(gSystem->Getenv("OCDB_PATHTEST"));
415  if (ocdbPrefix.Length()>0){
416  TRegexp alienPrefix("^alien://Folder=");
417  url(alienPrefix)=ocdbPrefix+"";
418  }
419  AliOCDBtoolkit::CleanCDBPath(url,cvmfsExist); // use cvmfs instead of alien: if available
420 
421  printf("%s\t%s\t%s\n", aPair->GetName(), urlOrig.Data(), url.Data());
422  if (TString(aPair->GetName())=="default") man->SetDefaultStorage(url);
423  else
424  man->SetSpecificStorage(aPair->GetName(), url);
425  }
426 }
427 
428 void AliOCDBtoolkit::LoadOCDBFromMap(const TMap *cdbMap, const TList *cdbList){
429  //
430  // Initilaize OCDB
431  // Load OCDB setting as specified in maps
432  // Or Do we have already implementation in AliCDBanager? TO CHECK.. Should go to the AliCDBmanager if not alreadyhhere
436  TIter iter(cdbList);
437  TObjString *ocdbString=0;
438  while (( ocdbString= (TObjString*) iter.Next())) {
439  AliCDBId* cdbId = AliCDBId::MakeFromString(ocdbString->String());
440  if (fgVerbose>0) cdbId->Print();
441  if (IsEntrySelected( cdbId->GetPath(),fgExcludeList)) continue;
442  try {
443  // AliCDBEntry * cdbEntry = (AliCDBEntry*) man->Get(*cdbId,kTRUE);
444 
445  man->Get(*cdbId);
446  } catch(const exception &e){
447  cerr << "OCDB retrieval failed!" << endl;
448  cerr << "Detailes: " << e.what() << endl;
449  }
450  }
451 }
452 
454  //
455  // Load OCDB setup from the ESD file
456  //
457  TFile * fesd = TFile::Open(fname);
458  TList *listESD = ((TTree*)fesd->Get("esdTree"))->GetUserInfo();
459  TMap *cdbMapESD= (TMap*)listESD->FindObject("cdbMap");
460  TList *cdbListESD0= (TList*)listESD->FindObject("cdbList"); // this is list of TObjStrings
461  AliOCDBtoolkit::SetStorage(cdbMapESD);
462  AliOCDBtoolkit::LoadOCDBFromMap(cdbMapESD, cdbListESD0);
463 }
464 
465 
466 void AliOCDBtoolkit::MakeDiff(const TMap *cdbMap0, const TList *cdbList0, const TMap */*cdbMap1*/, const TList *cdbList1, Int_t /*verbose*/){
467  //
468  //
469  // Print difference between the 2 ocdb maps
470  // Input:
471  // maps and list charactireizing OCDB setup
472  // Output:
473  // To be decided.
474  //
476  Int_t entriesList0=cdbList0->GetEntries();
477  Int_t entriesList1=cdbList1->GetEntries();
478  //
479  for (Int_t ientry0=0; ientry0<entriesList0; ientry0++){
480  AliCDBId *id0 = dynamic_cast<AliCDBId*> (cdbList0->At(ientry0));
481  AliCDBId *id1=0;
482  for (Int_t ientry1=0; ientry1<entriesList1; ientry1++){
483  AliCDBId *cid1 = dynamic_cast<AliCDBId*> (cdbList1->At(ientry1));
484  //id0.Print();
485  //cid1.Print();
486  if (cid1->GetPath().Contains(id0->GetPath().Data())==0) continue;
487  id1=cid1;
488  }
489  if (!id1) {
490  printf("Missing entry\t");
491  id0->Print();
492  continue;
493  }
494  // Bool_t isOK=kTRUE;
495  if (id0->GetFirstRun()!= id1->GetFirstRun() ||id0->GetLastRun()!= id1->GetLastRun()){
496  printf("Differrent run range\n");
497  id0->Print();
498  id1->Print();
499  }
500  if (id0->GetVersion()!= id1->GetVersion() ||id0->GetSubVersion()!= id1->GetSubVersion()){
501  printf("Differrent version\n");
502  id0->Print();
503  id1->Print();
504  }
505  }
506 }
507 
508 void AliOCDBtoolkit::DumpOCDB(const TMap *cdbMap0, const TList *cdbList0, const TString outfile){
509  //
510  // Dump the OCDB configuatation as formated text file
511  // with following collumns
512  // cdb name prefix cdb path
513  // OCDB entries are sorted alphabetically
514  // e.g:
515  // TPC/Calib/RecoParam /hera/alice/jwagner/software/aliroot/AliRoot_TPCdev/OCDB/ TPC/Calib/RecoParam/Run0_999999999_v0_s0.root $SIZE_AliCDBEntry_Object $HASH_AliCDBEntry_Object
516  if (!fgExcludeList) {
518  }
519  SetXRDTimeOutAll(-1);
521  AliOCDBtoolkit::SetStorage(cdbMap0);
522  TList * cdbList = (TList*) cdbList0; // sorted array
523  AliCDBId *CDBId=0;
524  TString cdbName="";
525  TString cdbPath="";
526  TObjString *ostr;
527  AliCDBEntry *cdbEntry=0;
528  TGrid *myGrid = NULL;
529  UInt_t hash=0;
530  TMessage * file;
531  Int_t size=0;
532  FILE *ofs = fopen(outfile.Data(),"w");
533  TTreeSRedirector *pcstream = new TTreeSRedirector((outfile+".root").Data(),"recreate");
534  TObjString spass,speriod,syear,srun;
535  Int_t year=0;
536  if (fgPath.Length()>0){ // in case fgPath haexist decompose year/period/pass/run information
537  TObjArray *mArr=0;
538  TPRegexp regPass("/.?ass.+?/");
539  TPRegexp regYear("/.?20.+?/");
540  TPRegexp regPeriod("/.?LHC.+?/");
541  TPRegexp regRun("/.?000.+?/");
542  if (regPass.Match(fgPath,"i")>0) {mArr=regPass.MatchS(fgPath,"i"); spass=mArr->At(0)->GetName(); delete mArr;}
543  if (regYear.Match(fgPath,"i")>0) {mArr=regYear.MatchS(fgPath,"i"); syear=mArr->At(0)->GetName(); delete mArr;}
544  if (regPeriod.Match(fgPath,"i")>0) {mArr=regPeriod.MatchS(fgPath,"i"); speriod=mArr->At(0)->GetName(); delete mArr;}
545  if (regRun.Match(fgPath,"i")>0) {mArr=regRun.MatchS(fgPath,"i"); srun=mArr->At(0)->GetName(); delete mArr;}
546  spass.String().ReplaceAll("/","");
547  syear.String().ReplaceAll("/","");
548  speriod.String().ReplaceAll("/","");
549  srun.String().ReplaceAll("/000","");
550  srun.String().ReplaceAll("/","");
551  if (srun.String().Atoi()>0) fgRun=srun.String().Atoi();
552  if (syear.String().Atoi()>0) year=syear.String().Atoi();
553 
554  }
555 
556  for (Int_t iter=0;iter<2; iter++){
557  size=0;
558  hash=0;
559  // in first dump the table without detailed infromation
560  // in second iteration dump full requested information including size/hash/metadata and xml/prin if specified
561  TIter next(cdbList);
562  while ((CDBId =(AliCDBId*) next())){
563  cdbName = CDBId->GetPath();
564  ostr = (TObjString*)cdbMap0->GetValue(cdbName.Data());
565  if(!ostr) ostr = (TObjString*)cdbMap0->GetValue("default");
566  cdbPath = ostr->GetString();
567  if(cdbPath.Contains("local://"))cdbPath=cdbPath(8,cdbPath.Length()).Data();
568  if(!myGrid && cdbPath.Contains("alien://")){ //check if connection to alien is initialized
569  myGrid = TGrid::Connect("alien://"); //Oddly this will return also a pointer if connection fails
570  if(myGrid->GetPort()==0){ //if connection fails port 0 is saved, using this to check for successful connection
571  cerr << "Cannot connect to grid!" << endl;
572  continue;
573  }
574  }
575  if (iter > 0 && !(IsEntrySelected( cdbName.Data(),fgExcludeList))) { //get detailed information
576  try {
577  ::Info("AliOCDBtoolkit::DumpOCDB","%s",cdbName.Data());
578  cdbEntry = (AliCDBEntry*) man->Get(*CDBId,kFALSE);
579  }catch(const exception &e){
580  cerr << "OCDB retrieval failed!" << endl;
581  cerr << "Detailes: " << e.what() << endl;
582  CDBId->Print();
583  hash=0;
584  size=-1;
585  }
586  if (!cdbEntry) {
587  printf("Object not avaliable\n");
588  CDBId->Print();
589  continue;
590  }
591  TObject *obj = cdbEntry->GetObject();
592  file = new TMessage(TBuffer::kWrite);
593  file->WriteObject(obj);
594  size = file->Length();
595  if(!obj){
596  fprintf(ofs,"object %s empty!\n",cdbName.Data());
597  continue;
598  }
599  hash = TString::Hash(file->Buffer(),size);
600  delete file;
601  if (IsEntrySelected( cdbName.Data(),fgXmlOCDBDumpList)){
602  ::Info("AliOCDBtoolkit::DumpOCDB","XML dump %s",cdbName.Data());
603  gSystem->mkdir(cdbName.Data(),1);
604  TString fname=TString::Format("%s/Run%d_%d_v%d_s%d.xml", cdbName.Data(), CDBId->GetFirstRun(), CDBId->GetLastRun(),
605  CDBId->GetVersion(),CDBId->GetSubVersion());
606  TFile * f = TFile::Open(fname.Data(),"recreate");
607  cdbEntry->Write("AliCDBEntry");
608  f->Close();
609 
610  // XML dump
611  }
612  if (IsEntrySelected( cdbName.Data(),fgPrintOCDBDumpList)){ // !!!! code crash in case stdout redirected to the log file
613  // Print dump
614  gSystem->mkdir(cdbName.Data(),1);
615  TString fname=TString::Format("%s/Run%d_%d_v%d_s%d.print", cdbName.Data(), CDBId->GetFirstRun(), CDBId->GetLastRun(),
616  CDBId->GetVersion(),CDBId->GetSubVersion());
617  gROOT->ProcessLine(TString::Format("((TObject*)%p)->Dump(); >%s",cdbEntry, fname.Data()).Data());
618  gROOT->ProcessLine(TString::Format("((TObject*)%p)->Dump(); >>%s",obj, fname.Data()).Data());
619  gROOT->ProcessLine(TString::Format("((TObject*)%p)->Print(\"all\"); >>%s",obj, fname.Data()).Data());
620 
621  }
622 
623  }
624  AliOCDBtoolkit::CleanCDBPath(cdbPath,kFALSE);
625  (*pcstream)<<"ocdbTable"<<
626  "run="<<fgRun<< // run number
627  // - this infromation can be stored in friend tree .. in future
628  "prodInfo.="<<fgProdInfo<< // production information - can be in another tree
629  "path.="<<fgPath<< // OCDB source path
630  "period.="<<&speriod<< // period
631  "pass.="<<&spass<< // path
632  "syear.="<<&syear<< // year as string
633  "year="<<year<< // year as string
634  //
635  "cdbID.="<<CDBId<< // ID of the OCDb object
636  "size="<<size<< // size of the OCDB entry
637  "\n";
638  fprintf(ofs,"%s\t%s\t%s/Run%d_%d_v%d_s%d.root\t%d\t%u\n",
639  cdbName.Data(),
640  cdbPath.Data(),
641  cdbName.Data(),
642  CDBId->GetFirstRun(),
643  CDBId->GetLastRun(),
644  CDBId->GetVersion(),
645  CDBId->GetSubVersion(),
646  size,
647  hash
648  );
649  fflush(ofs);
650  //if(!(CDBId->GetPathLevel(0)).Contains("TPC")) continue;
651  //cout << CDBId.ToString() << endl;
652  }
653  }
654  delete pcstream;
655  fclose(ofs);
656 }
657 
658 
659 //====================================================================================================
660 // Dump object part
661 //====================================================================================================
662 
663 
664 
665 
666 
667 void AliOCDBtoolkit::DumpOCDBFile(const char *finput , const char *foutput, Bool_t dumpMetaData, TString printOption ){
678  /*
679  AliOCDBtoolkit::DumpOCDBFile("$ALICE_ROOT/OCDB/TPC/Calib/PadGainFactor/Run0_999999999_v0_s3.root", "TPC_Calib_PadGainFactor_Run0_999999999_v0_s3.print",1,"pocdb");
680  AliOCDBtoolkit::DumpOCDBFile("$ALICE_ROOT/OCDB/TPC/Calib/PadGainFactor/Run0_999999999_v0_s3.root", "TPC_Calib_PadGainFactor_Run0_999999999_v0_s3.dump",1,"docdb")
681  AliOCDBtoolkit::DumpOCDBFile("$ALICE_ROOT/OCDB/TPC/Calib/PadGainFactor/Run0_999999999_v0_s3.root", "TPC_Calib_PadGainFactor_Run0_999999999_v0_s3.mi",1,"mi")
682  AliOCDBtoolkit::DumpOCDBFile("$ALICE_ROOT/OCDB/TPC/Calib/PadGainFactor/Run0_999999999_v0_s3.root", "TPC_Calib_PadGainFactor_Run0_999999999_v0_s3.print",1,"XML")
683  */
684 
685 
686  TString optionString = printOption;
687  optionString.ToLower();
688 
689  if (finput==0) return ;
690  if (TString(finput).Contains("alien://") && gGrid==0){
691  TGrid *myGrid = TGrid::Connect("alien://"); //Oddly this will return also a pointer if connection fails
692  if(myGrid->GetPort()==0){ //if connection fails port 0 is saved, using this to check for successful connection
693  cerr << "Cannot connect to grid!" << endl;
694  return;
695  }
696  }
697  TFile *falignITS = TFile::Open(finput);
698  AliCDBEntry *entry = (AliCDBEntry*)falignITS->Get("AliCDBEntry");
699  if (!entry) return;
700  TObject *obj = ((AliCDBEntry*)falignITS->Get("AliCDBEntry"))->GetObject();
701  //
702  // print option indicated ()
703  if (optionString.Contains("pocdb")){
704  if (dumpMetaData) gROOT->ProcessLine(TString::Format("((TObject*)%p)->Dump(); >%s",entry, foutput).Data());
705  if (!obj) return;
706  gROOT->ProcessLine(TString::Format("((TObject*)%p)->Print(\"%s\"); >>%s",obj, printOption.Data(), foutput).Data());
707  return;
708  }
709  if (optionString.Contains("docdb")){
710  if (dumpMetaData) gROOT->ProcessLine(TString::Format("((TObject*)%p)->Dump(); >%s",entry, foutput).Data());
711  if (!obj) return;
712  gROOT->ProcessLine(TString::Format("((TObject*)%p)->Dump(); >>%s",obj, foutput).Data());
713  return;
714  }
715  //
716  if (optionString.Contains("mi")){
717  if (dumpMetaData) gROOT->ProcessLine(TString::Format("((TObject*)%p)->Dump(); >%s",entry, foutput).Data());
718  if (!obj) return;
719  gROOT->ProcessLine(TString::Format("AliOCDBtoolkit::DumpObjectRecursive((TObject*)%p); >>%s",obj, foutput).Data());
720  return;
721  }
722  if (optionString.Contains("xml")){
723  TFile * f = TFile::Open(TString::Format("%s",foutput).Data(),"recreate");
724  if (dumpMetaData) entry->Write("AliCDBEntry");
725  else obj->Write("AliCDBEntry");
726  f->Close();
727  return;
728  }
729  ::Error("AliOCDBtoolkit::DumpOCDBFile","Not recognized option %s", optionString.Data());
730 }
731 
732 
733 
735  //
736  //
737  //
738  Int_t counterRec=0;
739  printf("==> Dumping object at: %p, name=%s, class=%s)\n", obj, obj->GetName(), (obj->IsA()->GetName()));
740  DumpObjectRecursive(obj, TString(obj->IsA()->GetName())+".",counterRec);
741 }
742 
743 //
744 //
745 //
746 void AliOCDBtoolkit::DumpObjectRecursive(TObject *obj, TString prefix, Int_t &counterRec){
747  //
748  // Recursive dump of the TObject
749  // Dump all basic types and follow pointers to the objects
750  // current limitation:
751  // a.) clases and structures not derived from TObject not followed (to fix)
752  // b.) dynamic arrays not followed
753  // c.) std maps,array .... not followed
754  //
755  //
756  if (!obj) return;
757  //
758  // Special case of Collection classes
759  //
760  if (obj->IsA()->InheritsFrom(TCollection::Class())) {
761  TIter myiter((TCollection*)obj);
762  TObject *arObject=0;
763  Int_t counter=0;
764  while ((arObject = (TObject*)myiter.Next())) {
765  TString prefixArr = TString::Format("%s[%d]",prefix.Data(),counter);
766  DumpObjectRecursive(arObject,prefixArr,counterRec);
767  counter++;
768  }
769  counterRec++;
770  return;
771  }
772 
773  TClass * cl = obj->IsA();
774  if (!(cl->GetListOfRealData())) cl->BuildRealData();
775  TRealData* rd = 0;
776  TIter next(cl->GetListOfRealData());
777  while ((rd = (TRealData*) next())) {
778  counterRec++;
779  TDataMember* dm = rd->GetDataMember();
780  TDataType* dtype = dm->GetDataType();
781  Int_t offset = rd->GetThisOffset();
782  char* pointer = ((char*) obj) + offset;
783 
784  if (dm->IsaPointer()) {
785  // We have a pointer to an object or a pointer to an array of basic types.
786  TClass* clobj = 0;
787  if (!dm->IsBasic()) {
788  clobj = TClass::GetClass(dm->GetTypeName());
789  }
790  if (clobj) {
791  // We have a pointer to an object.
792  //
793  if (!clobj->InheritsFrom(TObject::Class())) {
794  // It must be a TObject object.
795  continue;
796  }
797  char** apointer = (char**) pointer;
798  TObject* robj = (TObject*) *apointer;
799  //
800  if(!robj)
801  printf("M:%s%s\n",prefix.Data(),dm->GetName()); // Missing - 0 pointer
802  else{
803  printf("T:%s\t%s%s\n", clobj->GetName(),prefix.Data(), dm->GetName());
804  TString prefixNew=prefix;
805  prefixNew+=dm->GetName();
806  prefixNew+=".";
807  if (robj!=obj) DumpObjectRecursive(robj,prefixNew,counterRec); // trivial check
808  if (robj==obj){
809  printf("R:%s\t%s%s\n",clobj->GetName(),prefix.Data(), dm->GetName());
810  }
811  }
812  }
813  } else if (dm->IsBasic()) {
814  //
815  // Basic data type
816  //
817  const char* index = dm->GetArrayIndex();
818  if (dm->GetArrayDim()==0){
819  printf("B:\t%s%s\t%s\n", prefix.Data(),rd->GetName(), dtype->AsString(pointer));
820  }
821  //
822  // Basic array - fixed length
823  //
824  // if (dm->GetArrayDim()>0 && strlen(index) != 0){
825  if (dm->GetArrayDim()>0 ){
826  printf("A:\t%s%s\t",prefix.Data(),rd->GetName());
827  Int_t counter=0;
828  for (Int_t idim=0; idim<dm->GetArrayDim(); idim++){
829  //printf("A:%d\t%d\n", dm->GetArrayDim(),dm->GetMaxIndex(idim));
830  for (Int_t j=0; j<dm->GetMaxIndex(idim); j++){
831  printf("%s\t",dtype->AsString(pointer+dm->GetUnitSize()*counter));
832  counter++;
833  if (counter%5==0) printf("\nA:\t%s%s\t",prefix.Data(),rd->GetName());
834  }
835  }
836  printf("\n");
837  }
838  //
839  // Basic array - dynamic length
840  //
841  if (dm->GetArrayDim()>0 && strlen(index) != 0){
842  //
843  // Dump first only for the moment
844  //
845  printf("B:\t%s%s\t%s\n",prefix.Data(),rd->GetName(), dtype->AsString(pointer));
846  }
847  } else {
848  }
849  }
850 }
851 
852 //
853 // Small checks to test the TRealData and TDataType
854 //
855 
856 
857 
859  //
860  // Dump example for elenatr data types
861  //
862  TObject *obj = new TVectorD(20);
863  TClass * cl = obj->IsA();
864  if (!cl->GetListOfRealData()) cl->BuildRealData();
865  //
866  TRealData* rd = 0;
867  rd = (TRealData*)(cl->GetListOfRealData()->FindObject("fNrows"));
868  TDataMember* dm = rd->GetDataMember();
869  TDataType* dtype = dm->GetDataType();
870  //
871  Int_t offset = rd->GetThisOffset();
872  char* pointer = ((char*) obj) + offset;
873  printf("%s\n",dtype->AsString(pointer));
874 }
875 
877  //
878  // print array example
879  //
880  TObject *obj = new TVectorD(20);
881  TClass * cl = obj->IsA();
882  if (!cl->GetListOfRealData()) cl->BuildRealData();
883  TRealData* rd = 0;
884  rd = (TRealData*)(cl->GetListOfRealData()->FindObject("*fElements"));
885  TDataMember* dm = rd->GetDataMember();
886  TDataType* dtype = dm->GetDataType();
887  dtype->Print();
888  //
889  Int_t offset = rd->GetThisOffset();
890  char* pointer = ((char*) obj) + offset;
891  printf("%s\n",dtype->AsString(pointer));
892 }
893 
895  //
896  //
897  //
898  TObjArray *array = new TObjArray(10);
899  for (Int_t i=0; i<10; i++) array->AddLast(new TNamed(Form("n%d",i), Form("n%d",i)));
901  //
902  //
903  TObject *obj = array;
904  TClass * cl = obj->IsA();
905  if (!cl->GetListOfRealData()) cl->BuildRealData();
906  TRealData* rd = 0;
907  rd = (TRealData*)(cl->GetListOfRealData()->FindObject("*fCont"));
908  TDataMember* dm = rd->GetDataMember();
909  TDataType* dtype = dm->GetDataType();
910  //
911  Int_t offset = rd->GetThisOffset();
912  char* pointer = ((char*) obj) + offset;
913  char** apointer = (char**) pointer;
914  //we have pointer to pointer here
915  TObject** ppobj = (TObject**) *apointer;
916  (*ppobj)->Print();
917  //
918  TIter myiter(array);
919  TObject *arObject;
920  dtype->Print();
921  while ((arObject = (TObject*)myiter.Next())) {
923  }
924 }
925 
926 
927 Bool_t AliOCDBtoolkit::AddoptOCDBEntry( const char *finput, const char *output, Int_t ustartRun, Int_t uendRun){
928  //
929  // Addopt OCDB entry - keeping all of the CDBentry quantities
930  // // Example usage:
931  // AliOCDBtoolkit::AddoptOCDBEntry("/cvmfs/alice.gsi.de/alice/simulation/2008/v4-15-Release/Residual/TPC/Calib/ClusterParam/Run127712_130850_v4_s0.root",0,0,AliCDBRunRange::Infinity())
932  TFile * fin = TFile::Open(finput);
933  if (!fin) return kFALSE;
934  AliCDBEntry * entry = (AliCDBEntry*) fin->Get("AliCDBEntry");
935  if (!entry) return kFALSE;
936 
937  AliCDBStorage* pocdbStorage = 0;
938  if (output!=0) AliCDBManager::Instance()->GetStorage(output);
939  else{
940  TString localStorage = "local://"+gSystem->GetFromPipe("pwd")+"/OCDB";
941  pocdbStorage = AliCDBManager::Instance()->GetStorage(localStorage.Data());
942  }
943  //
944  AliCDBId idIn = entry->GetId();
945  AliCDBMetaData *metaDataIn = entry->GetMetaData();
946 
947  AliCDBMetaData *metaData= new AliCDBMetaData();
948  metaData->SetObjectClassName(metaDataIn->GetObjectClassName());
949  metaData->SetResponsible(TString::Format("%s: copy",metaDataIn->GetResponsible()).Data());
950  metaData->SetBeamPeriod(metaDataIn->GetBeamPeriod());
951  //
952  metaData->SetAliRootVersion(metaDataIn->GetAliRootVersion()); //root version
953  metaData->SetComment((TString::Format("%s: copy",metaDataIn->GetComment()).Data()));
954  AliCDBId* id1=NULL;
955  id1=new AliCDBId(idIn.GetPath(), ustartRun, uendRun);
956  pocdbStorage->Put(entry->GetObject(), (*id1), metaData);
957  return kTRUE;
958 }
959 
960 
961 void AliOCDBtoolkit::MakeSnapshotFromTxt(const TString fInput, const TString outfile, Bool_t singleKeys){
962  //
963  // Make snasphot form the txt file
964  //
966  LoadOCDBFromList(fInput.Data());
967  man->DumpToSnapshotFile(outfile.Data(), singleKeys);
968 
969 }
970 
971 
972 void AliOCDBtoolkit::CleanCDBPath(TString &cdbPath, Bool_t useCVMFS){
973  //
974  // 1.) clean alien path removing caching flags
975  // 2.) repalce alien path wiht the cvmfs in case specified and cvmfs accessible
976  // return value - change the content of the cdbPath string
977  /* Example:
978 
979  Input: alien://?User=?DBFolder=/alice/data/2010/OCDB?SE=default?CacheFolder=?OperateDisconnected=1?CacheSize=1073741824?CleanupInterval=0
980  AliOCDBtoolkit::CleanCDBPath(cdbStorage,kTRUE);
981  AliOCDBtoolkit::CleanCDBPath Output:local:///cvmfs/alice-ocdb.cern.ch/calibration/data/2010/OCDB
982 
983  */
984  Bool_t isAlienPath = cdbPath.Contains("alien://");
985  if (!isAlienPath) return;
986  if (useCVMFS){
987  useCVMFS= gSystem->AccessPathName("/cvmfs/alice-ocdb.cern.ch/calibration/")==kFALSE; // is cvfms available ? bizzare function convention
988  }
989 
990  if (useCVMFS){
991  TPRegexp repAlien0("alien://.*=/alice/"); // replace alien cache prefix
992  repAlien0.Substitute(cdbPath, "local:///cvmfs/alice-ocdb.cern.ch/calibration/");
993  }else{
994  TPRegexp repAlien0("alien://.*=/"); // replace alien cache prefix
995  repAlien0.Substitute(cdbPath, "alien:///");
996  }
997  TPRegexp repAlien1("\\?.*"); // replace ? suffix - caching flags
998  repAlien1.Substitute(cdbPath, "");
999 }
1000 
1001 
1002 
1003 
1005  //
1006  // load OCDB toolkit configuration
1007  //
1008  TString config=gSystem->Getenv("AliOCDBtoolkitCFG");
1009  if (config.Length()==0){
1010  config="$ALICE_PHYSICS/PWGPP/CalibMacros/AliOCDBtoolkit.cfg";
1011  }
1012  if (gSystem->AccessPathName(config.Data())!=0) {
1013  ::Error("AliOCDBtoolkit::LoadAliOCDBtoolkitSetup","Invalid path to configuration file");
1014  }
1015  // Exclude OCDB list - Some entries has to be removed form the list as OCDB is not always back compatible
1016  // Exclude pattern have to start with Exclude
1017  TString excludeStr=gSystem->GetFromPipe(TString::Format("cat %s|grep ^Exclude: | sed s_^E.*:__ | sed 's/[[:blank:]]//g' | tr ',' '\n'", config.Data()).Data());
1018  fgExcludeList=excludeStr.Tokenize("\n,");
1019  //
1020  TString xmlStr=gSystem->GetFromPipe(TString::Format("cat %s|grep ^XML: | sed s_^XML.*:__ | sed 's/[[:blank:]]//g' | tr ',' '\n'", config.Data()).Data());
1021  fgXmlOCDBDumpList=xmlStr.Tokenize("\n,");
1022  //
1023  TString printStr=gSystem->GetFromPipe(TString::Format("cat %s|grep ^Print: | sed s_^Print.*:__ | sed 's/[[:blank:]]//g' | tr ',' '\n'", config.Data()).Data());
1024  fgPrintOCDBDumpList=printStr.Tokenize("\n,");
1025  if (verbose>0){
1026  ::Info("AliOCDBtoolkit::LoadAliOCDBtoolkitSetup","ExludeList");
1027  fgExcludeList->Print();
1028  ::Info("AliOCDBtoolkit::LoadAliOCDBtoolkitSetup","XMLlist");
1029  fgXmlOCDBDumpList->Print();
1030  ::Info("AliOCDBtoolkit::LoadAliOCDBtoolkitSetup","Printlist");
1031  fgPrintOCDBDumpList->Print();
1032  }
1033 }
1034 
1035 Bool_t AliOCDBtoolkit::IsEntrySelected(TString entry, TObjArray *selList){
1036  //
1037  // check if the entry was selected - means it was specified in the list
1038  /*
1039  TString entry="TPC/Calib/RecoParam";
1040  selList=printOCDBDumpList;
1041  */
1042  //
1043  if (selList==NULL) return 0;
1044  if (selList->FindObject(entry.Data())!=NULL) return kTRUE;
1045 
1046  Bool_t isSelected=kFALSE;
1047  for (Int_t ientry=0; ientry<selList->GetEntriesFast(); ientry++){
1048  TRegexp regexp(selList->At(ientry)->GetName());
1049  TPRegexp pregexp(selList->At(ientry)->GetName());
1050  if (entry.Contains(regexp)>0) isSelected=kTRUE;
1051  if (entry.Contains(pregexp)>0) isSelected=kTRUE;
1052  }
1053  return isSelected;
1054 }
1055 
1056 
1057 Double_t AliOCDBtoolkit::SetXRDTimeOutAll(Double_t timeOut ){
1058  //
1059  // Set timeout for XRD
1060  // Problems oberved accessing small UserInfo objects (waiting for minutes and afterwards failing in some T2,T3)
1061  // normally access aroud 2 seconds
1062  //
1063  if (timeOut<0 && gSystem->Getenv("XRDCLIENTMAXWAIT")){
1064  timeOut=TString(gSystem->Getenv("XRDCLIENTMAXWAIT")).Atoi();
1065  }
1066  if (timeOut>0){
1067  gEnv->SetValue("XNet.RequestTimeout", timeOut);
1068  gEnv->SetValue("XNet.ConnectTimeout", timeOut);
1069  gEnv->SetValue("XNet.TransactionTimeout", timeOut);
1070  gEnv->SetValue("XNet.FirstConnectMaxCnt", 5);
1071  TFile::SetOpenTimeout(timeOut);
1072  }
1073  return timeOut;
1074 }
1075 
static AliProdInfo * fgProdInfo
void DumpTObjectArray()
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
static void CleanCDBPath(TString &cdbPath, Bool_t useCVMFSPath)
TFile * Open(const char *filename, Long64_t &nevents)
static TObjArray * fgPrintOCDBDumpList
static void DumpObjectRecursive(TObject *obj)
Bool_t Put(TObject *object, AliCDBId &id, AliCDBMetaData *metaData, const char *mirrors="", AliCDBManager::DataType type=AliCDBManager::kPrivate)
static void MakeDiffExampleUseCase()
Int_t year
year for detector configuration
Definition: Config.C:96
#define TObjArray
static void LoadOCDBFromLog(const char *logName, Int_t verbose)
void ExtractBaseFolder(TString &url)
static void MakeDiff(const TMap *cdbMap0, const TList *cdbList0, const TMap *cdbMap1, const TList *cdbList1, Int_t verbose)
static TObjArray * fgXmlOCDBDumpList
static Double_t SetXRDTimeOutAll(Double_t timeOut)
static void LoadOCDBFromList(const char *)
void DumpToSnapshotFile(const char *snapshotFileName, Bool_t singleKeys) const
void DumpDataArray()
TROOT * gROOT
UInt_t GetBeamPeriod() const
const char * GetComment() const
void SetComment(const char *comment)
static void DumpOCDB(const TMap *cdbMap0, const TList *cdbList0, const TString outfile)
TTreeSRedirector * pcstream
static void SetStorage(const TMap *cdbMap0)
static Bool_t AddoptOCDBEntry(const char *finput, const char *output, Int_t ustartRun, Int_t uendRun)
void SetResponsible(const char *yourName)
Int_t GetVersion() const
Definition: AliCDBId.h:59
Int_t GetLastRun() const
Definition: AliCDBId.h:49
const TList * GetRetrievedIds() const
Definition: AliCDBManager.h:48
TTree * tree
static AliCDBId * MakeFromString(const TString &idString)
Definition: AliCDBId.cxx:85
static TList * ConvertListStringToCDBId(TList *)
static void LoadAliOCDBtoolkitSetup(Int_t verbose)
Int_t run0
static Int_t fgVerbose
TObjArray * array
Definition: AnalyzeLaser.C:12
AliCDBEntry * Get(const AliCDBId &query, Bool_t forceCaching=kFALSE)
static void DumpOCDBFile(const char *finput, const char *foutput, Bool_t dumpMetaData, TString printOption)
TObject * GetObject()
Definition: AliCDBEntry.h:56
static void LoadOCDBFromESD(const char *fname="AliESDs.root")
AliCDBStorage * GetStorage(const char *dbString)
void SetSpecificStorage(const char *calibType, const char *dbString, Int_t version=-1, Int_t subVersion=-1)
const char * GetObjectClassName() const
void SetBeamPeriod(UInt_t period)
static void DumpOCDBAsTxt(const TString fInput, const TString fType, const TString outfile)
char * prefix
const TMap * GetStorageMap() const
Definition: AliCDBManager.h:47
void SetAliRootVersion(const char *version)
void DumpDataSimple()
static TString fgPath
void SetRun(Int_t run)
Definition: AliCDBEntry.h:18
static void LoadOCDBFromMap(const TMap *cdbMap, const TList *cdbList)
TF1 * f
Definition: interpolTest.C:21
void SetDefaultStorage(const char *dbString)
void Print(Option_t *option="") const
const char * GetResponsible() const
void SetObjectClassName(const char *name)
AliCDBMetaData * GetMetaData()
Definition: AliCDBEntry.h:60
static void MakeSnapshotFromTxt(const TString fInput, const TString outfile, Bool_t singleKeys)
static Bool_t ParseInfoFromOcdbString(TString ocdbString, TString &ocdbPath, Int_t &run0, Int_t &run1, Int_t &version, Int_t &subVersion)
void Init(TList *userInfo)
static Bool_t IsEntrySelected(TString entry, TObjArray *selList)
static TObjArray * fgExcludeList
const TString & GetPath() const
Definition: AliCDBId.h:40
static PprRun_t srun
Definition: ConfigCosmic.C:124
class TVectorT< Double_t > TVectorD
AliCDBId & GetId()
Definition: AliCDBEntry.h:51
static AliCDBManager * Instance(TMap *entryCache=NULL, Int_t run=-1)
const char * GetAliRootVersion() const
void Print(Option_t *option="") const
Definition: AliCDBId.cxx:175
Int_t run1
char * fname
Int_t GetFirstRun() const
Definition: AliCDBId.h:48
static Int_t fgRun
Int_t GetSubVersion() const
Definition: AliCDBId.h:60