f208787c |
1 | #if !defined(__CINT__) || defined(__MAKECINT__) |
2 | #include "AliCDBManager.h" |
3 | #include "AliCDBStorage.h" |
4 | #include "AliCDBEntry.h" |
5 | #include "AliCDBId.h" |
6 | #include <TString.h> |
7 | #include <TList.h> |
8 | #endif |
9 | |
10 | void CheckCDBentries(const char* dest) |
11 | { |
12 | AliCDBManager* cdb = AliCDBManager::Instance(); |
162637e4 |
13 | const char* ref="local://$ALICE_ROOT/OCDB"; |
f208787c |
14 | cdb->SetDefaultStorage(ref); |
15 | cdb->SetRun(0); |
16 | AliCDBStorage* newstor = cdb->GetStorage(dest); |
17 | // Missing here a check that newstor is a valid storage |
18 | // otherwise exit |
19 | TList* allentries = cdb->GetAll("*/*/*"); |
20 | TList* allnewentries = newstor->GetAll("*/*/*",0); |
21 | Int_t nall = allentries->GetEntries(); |
22 | Int_t nallnew = allnewentries->GetEntries(); |
23 | Printf("Number of entries in reference OCDB %d and in checked OCDB %d",nall, nallnew); |
24 | TString missing; |
25 | Int_t nMissing=0; |
26 | if(nall!=nallnew) |
27 | { |
28 | AliCDBEntry *entry, *newentry; |
29 | TString cdbpath; |
30 | for(Int_t i=0; i<nall; i++) |
31 | { |
32 | entry = dynamic_cast<AliCDBEntry*>(allentries->At(i)); |
33 | cdbpath = ((AliCDBId)entry->GetId()).GetPath(); |
34 | newentry = newstor->Get(cdbpath.Data(),0); |
35 | if(!newentry) |
36 | { |
37 | missing += cdbpath; |
38 | missing.Insert(missing.Length(),'\n'); |
39 | nMissing++; |
40 | } |
41 | } |
42 | } |
43 | if(nMissing) |
44 | { |
45 | Printf("\n\nEntries missing in destination OCDB folder %s w.r.t. reference folder %s:",dest,ref); |
46 | Printf("%s",missing.Data()); |
47 | }else{ |
48 | Printf("\n\nNo entry is missing in destination OCDB folder %s w.r.t. reference folder %s:",dest,ref); |
49 | } |
50 | } |