check_proxy.C
Go to the documentation of this file.
1 // This macro loads a CAF with regular Reflex-based StandardRecord and with
2 // SRProxy. It recurses through all branches in every event checking for
3 // differences and printing a message if it finds any. Run me with cafe.
4 
5 #include "TFile.h"
6 #include "TTree.h"
7 
10 
11 void check_proxy(std::string fname, int N = -1)
12 {
13  TFile* f = TFile::Open(fname.c_str());
14  assert(!f->IsZombie());
15  TTree* recTree = (TTree*)f->Get("recTree");
16  assert(recTree);
17 
18  // Use an entirely seperate tree to prevent any interference between the two
19  // methods.
20  TFile* f2 = TFile::Open(fname.c_str());
21  assert(!f2->IsZombie());
22  TTree* recTree2 = (TTree*)f2->Get("recTree");
23  assert(recTree2);
24 
25 
27  recTree->SetBranchAddress("rec", &sr);
28 
29  caf::SRProxy srProxy(0, recTree2, "rec", 0, 0);
30 
31  if(N < 0 || N > recTree->GetEntries()) N = recTree->GetEntries();
32  for(int i = 0; i < N; ++i){
33  std::cout << i << " / " << N << std::endl;
34 
35  recTree->GetEntry(i);
36 
37  recTree2->LoadTree(i);
38 
39  srProxy.CheckEquals(*sr);
40  }
41 }
42 
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
Float_t f2
void CheckEquals(const caf::StandardRecord &sr) const
Definition: SRProxy.cxx:4292
caf::StandardRecord * sr
OStream cout
Definition: OStream.cxx:6
The StandardRecord is the primary top-level object in the Common Analysis File trees.
void check_proxy(std::string fname, int N=-1)
Definition: check_proxy.C:11
assert(nhit_max >=nhit_nbins)
enum BeamMode string