]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/macros/MakeOCDBDiff.C
.so cleanup: more gSystem->Load()
[u/mrichter/AliRoot.git] / TPC / macros / MakeOCDBDiff.C
1 /*
2   .L  $ALICE_ROOT/TPC/macros//MakeOCDBDiff.C
3 */
4
5 Bool_t  MakeOCDBDiff(const char *ocdb1, const char *ocdb2){
6   //
7   // Compare by by byte the content of the OCDB entry
8   // Input parameters:
9   //   ocdb1 - path to the OCDB file1
10   //   ocdb2 - path to the OCDB file2
11   // Return value:
12   //   kTRUE - in case the content of the OCDB object (persistent part) is exactly the same 
13   //   kFALSE - othewise
14   /* 
15      ocdb1="Run188720_192738_v2_s0.root"
16      ocdb1="Run0_188719_v2_s0.root"
17      ocdb2="Run192739_999999999_v2_s0.root" 
18   */
19   TFile * f1 = TFile::Open(ocdb1);
20   TFile * f2 = TFile::Open(ocdb2);
21   {if (!f1 || !f2){
22     printf("Problem 0:  Files not accessible (%s,%s)\n",ocdb1,ocdb2);
23     return kFALSE;
24     }}
25   AliCDBEntry * entry1 = (AliCDBEntry*)f1->Get("AliCDBEntry");
26   AliCDBEntry * entry2 = (AliCDBEntry*)f2->Get("AliCDBEntry");
27   {if (!entry1||!entry2){
28     printf("Problem 1:  OCDB entry not available (%s,%s)\n",ocdb1,ocdb2);
29     return kFALSE; 
30     }}
31   TObject* object1=entry1->GetObject();
32   TObject* object2=entry2->GetObject();
33   TMessage * file1 = new TMessage(TBuffer::kWrite);
34   file1->WriteObject(object1);
35   Int_t size1=file1->Length();  
36   TMessage * file2 = new TMessage(TBuffer::kWrite);
37   file2->WriteObject(object2);
38   Int_t size2=file2->Length(); 
39   {if (size1!=size2){
40     printf("Problem 2:  OCDB entry of different size (%d,%d)",size1,size2);
41     return kFALSE;
42     }}
43   Int_t countDiff=0;
44   for (Int_t i=0; i<size1; i++)    if (file1->Buffer()[i]!=file2->Buffer()[i]) countDiff++;
45   {if (countDiff>0){
46     printf("Objects are different. %d different bytes\n", countDiff );
47     return kFALSE;
48     }}
49   printf("OCDB Objects are the same\n");
50
51   TClass *cl1= object1->Class();
52   
53   
54   return kTRUE;
55 }