Example application to test printing of objects using ROOT dictionary.
24{
27
28 string inputFile;
32
33 try {
34
36
39 zap[
'n'] =
make_field(numberOfEvents,
"number of events, if applicable") = 1;
41
42 zap(argc, argv);
43 }
44 catch(const exception &error) {
45 FATAL(error.what() << endl);
46 }
47
48 gErrorIgnoreLevel = kError;
49
50
51 TFile* in = TFile::Open(inputFile.c_str());
52
53 if (in == NULL || !in->IsOpen()) {
54 FATAL(
"Error opening file " << inputFile << endl);
55 }
56
57 if (
debug >= debug_t) {
58 for (TIter i(in->GetListOfKeys()); TKey* key = dynamic_cast<TKey*>(i.Next()); ) {
59 cout <<
"key: " <<
key->GetName() <<
' ' <<
key->GetClassName() << endl;
60 }
61 }
62
64
65 if (key == NULL) {
67 }
68
70
71 TClass* cs = TClass::GetClass(
key->GetClassName());
72
73 if (cs != NULL) {
74
75 void* ps =
key->ReadObjectAny(cs);
76
77 if (cs == TTree::Class()) {
78
79 TTree* ts = (TTree*) ps;
80
82
83 for (TIter next(ts->GetListOfBranches()); TBranch*
p1 =
dynamic_cast<TBranch*
>(next()); ) {
85 }
86
87
88
90 ts->GetBranch(tp.getName())->SetAddress(tp.getAddress());
91 }
92
94
95 cout << ts->GetName() << "[" << i << "]:" << endl;
96
97 ts->GetEvent(i);
98
100 printer(cout,tp);
101 }
102 }
103
104 } else {
105
106 printer(cout, cs->GetStreamerInfo(), (const char*) ps);
107 }
108 }
109}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Utility class to parse command line options.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary class for defining the range of iterations of objects.
Auxiliary data structure to list files in directory.