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