26{
29
30 string inputFile;
34
35 try {
36
38
41 zap[
'n'] =
make_field(numberOfEvents,
"number of events, if applicable") = 1;
43
44 zap(argc, argv);
45 }
46 catch(const exception &error) {
47 FATAL(error.what() << endl);
48 }
49
50 gErrorIgnoreLevel = kError;
51
52
53 TFile* in = TFile::Open(inputFile.c_str());
54
55 if (in == NULL || !in->IsOpen()) {
56 FATAL(
"Error opening file " << inputFile << endl);
57 }
58
59 const TRegexp regexp(
target.c_str());
60
62
63 TIter iter(in->GetListOfKeys());
64
65 for (TKey* key; (
key = (TKey*) iter.Next()) != NULL; ) {
66
67 const TString tag(
key->GetName());
68
69 DEBUG(
"Key: " << tag <<
" match = " << tag.Contains(regexp) << endl);
70
71
72
73 if (tag.Contains(regexp) && TClass::GetClass(
key->GetClassName())->IsTObject()) {
74
75 TClass* cs = TClass::GetClass(
key->GetClassName());
76
77 if (cs != NULL) {
78
79 DEBUG(
"TClass " << cs->GetName() << endl);
80 DEBUG(
"TKey::ReadObjectAny(..)" << endl);
81
82 void* ps =
key->ReadObjectAny(cs);
83
84 if (cs == TTree::Class()) {
85
86 TTree* ts = (TTree*) ps;
87
88 DEBUG(
"TTree " << ts->GetName() << endl);
89
91
92 for (TIter next(ts->GetListOfBranches()); TBranch*
p1 =
dynamic_cast<TBranch*
>(next()); ) {
94 }
95
96
97
99
100 DEBUG(
"TBranch " << tp.getName() <<
' ' << (tp.getType() == kOther_t) <<
' ' << tp.getTypename() << endl);
101
102 ts->GetBranch(tp.getName())->SetAddress(tp.getAddress());
103 }
104
106
107 cout << ts->GetName() << "[" << i << "]:" << endl;
108
109 DEBUG(
"TTree::GetEvent(" << i <<
")" << endl);
110
111 ts->GetEvent(i);
112
113 for (
auto& tp :
ls) {
114 printer(cout,tp);
115 }
116 }
117
118 } else {
119
120 printer(cout, cs->GetStreamerInfo(), (const char*) ps);
121 }
122 }
123 }
124 }
125}
#define DEBUG(A)
Message macros.
#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).
ROOT readable class for TBranch.
Auxiliary class for defining the range of iterations of objects.
Auxiliary data structure to list files in directory.