Functions
test_derived_flat_tree.cxx File Reference
#include "garana/Accessors/TreeManager.h"
#include <string>
#include <iostream>

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 23 of file test_derived_flat_tree.cxx.

23  {
24 
25  //// check we got what we need from the command line ////
26  if(argc<3) {
27  cerr << "use error(test_derived_flat_tree): you must specify a root file to analyze ->" << '\n'
28  << " usage (input file order does not matter): test_derived_flat_tree "
29  << "<my_structured_tree.root> <my_flat_tree.root>" << endl;
30  return 1;
31  }
32 
33  if(argc>3) {
34  cerr << "use error(test_derived_flat_tree): too many arguments!" << endl;
35  return 2;
36  }
37 
38  // setup files
39  std::cout << "open TreeManager for file, " << argv[1] << endl;
40  TreeManager* tm1 = new TreeManager(argv[1]); //input file 1
41  std::cout << "open TreeManager for file, " << argv[2] << endl;
42  TreeManager* tm2 = new TreeManager(argv[2]); //input file 2
43  std::cout << "done constructing TreeManagers." << std::endl;
44 
45  bool pass = true;
46 
47  //Check header trees. only difference should be branch, TreeType
48  std::cout << "open headerTree 1" << std::endl;
49  HeaderTree* header1 = tm1->GetHeaderTree();
50  std::cout << "open headerTree 2" << std::endl;
51  HeaderTree* header2 = tm2->GetHeaderTree();
52  std::cout << "done constructing HeaderTrees." << std::endl;
53 
54  if(!CheckHeader(header1,header2)) {
55  cerr << "WARNING: header trees are incompatible" << endl;
56  pass = false;
57  }
58  else
59  std::cout << "Headers are compatible." << endl;
60 
61  GenTree* gen1 = tm1->GetGenTree();
62  GenTree* gen2 = tm2->GetGenTree();
63 
64  if(!CheckGen(gen1,gen2)) {
65  cerr << "WARNING: gen trees are incompatible" << endl;
66  pass = false;
67  }
68 
69  if(!pass){
70  cerr << "WARNING: test failed. something is amiss with your trees." << endl;
71  return 1;
72  }
73  else {
74  std::cout << "SUCESS!!!!!! =D" << std::endl;
75  }
76 
77  return 0;
78 }
HLTPathStatus const pass
HeaderTree * GetHeaderTree() const
GenTree * GetGenTree() const
QTextStream & endl(QTextStream &s)