30{
33
36
37 try {
38
39 JParser<> zap(
"Auxiliary program to print contents of 1D ROOT objects.");
40
41 zap[
'f'] =
make_field(inputFile,
"<input file>:<object name>");
43
44 zap(argc, argv);
45 }
46 catch(const exception &error) {
47 FATAL(error.what() << endl);
48 }
49
50
51 for (vector<JRootObjectID>::const_iterator input = inputFile.begin(); input != inputFile.end(); ++input) {
52
53 DEBUG(
"Input: " << *input << endl);
54
56
57 if (dir == NULL) {
58 ERROR(
"File: " << input->getFullFilename() <<
" not opened." << endl);
59 continue;
60 }
61
62 const TRegexp regexp(input->getObjectName());
63
64 TIter iter(dir->GetListOfKeys());
65
66 for (TKey* key; (
key = (TKey*) iter.Next()) != NULL; ) {
67
68 const TString tag(
key->GetName());
69
70 DEBUG(
"Key: " << tag <<
" match = " << tag.Contains(regexp) << endl);
71
72
73
74 if (tag.Contains(regexp) &&
isTObject(key)) {
75
77
78 try {
79
80 TH1& h1 = dynamic_cast<TH1&>(*object);
81
82 for (Int_t ix = 1; ix <= h1.GetXaxis()->GetNbins(); ++ix) {
83
84 cout << setw(32) << left <<
key->GetName() << right <<
' '
85 << setw(4) << ix << ' '
86 <<
SCIENTIFIC(15,5) << h1.GetXaxis()->GetBinCenter (ix) <<
' '
87 <<
SCIENTIFIC(15,5) << h1.GetBinContent(ix) << endl;
88 }
89 }
90 catch(exception&) {}
91
92 try {
93
94 TProfile& h1 = dynamic_cast<TProfile&>(*object);
95
96 for (Int_t ix = 1; ix <= h1.GetXaxis()->GetNbins(); ++ix) {
97
98 cout << setw(32) << left <<
key->GetName() << right <<
' '
99 << setw(4) << ix << ' '
100 <<
SCIENTIFIC(15,5) << h1.GetXaxis()->GetBinCenter (ix) <<
' '
101 <<
SCIENTIFIC(15,5) << h1.GetBinContent(ix) << endl;
102 }
103 }
104 catch(exception&) {}
105
106 try {
107
108 TGraph&
g1 =
dynamic_cast<TGraph&
>(*object);
109
110 for (Int_t i = 0; i !=
g1.GetN(); ++i) {
111
112 cout << setw(32) << left <<
key->GetName() << right <<
' '
113 << setw(4) << i << ' '
116 }
117 }
118 catch(exception&) {}
119 }
120 }
121 }
122}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Double_t g1(const Double_t x)
Function.
Utility class to parse command line options.
TDirectory * getDirectory(const JRootObjectID &id)
Get TDirectory pointer.
bool isTObject(const TKey *key)
Check if given key corresponds to a TObject.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.