29int main(
int argc,
char **argv)
39 JParser<> zap(
"Auxiliary program to print contents of 1D ROOT objects.");
41 zap[
'f'] =
make_field(inputFile,
"<input file>:<object name>");
46 catch(
const exception &error) {
47 FATAL(error.what() << endl);
51 for (vector<JRootObjectID>::const_iterator input = inputFile.begin(); input != inputFile.end(); ++input) {
53 DEBUG(
"Input: " << *input << endl);
55 TDirectory* dir = getDirectory(*input);
58 ERROR(
"File: " << input->getFullFilename() <<
" not opened." << endl);
62 const TRegexp regexp(input->getObjectName());
64 TIter iter(dir->GetListOfKeys());
66 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
68 const TString tag(key->GetName());
70 DEBUG(
"Key: " << tag <<
" match = " << tag.Contains(regexp) << endl);
74 if (tag.Contains(regexp) && isTObject(key)) {
76 TObject*
object = key->ReadObj();
80 TH1& h1 =
dynamic_cast<TH1&
>(*object);
82 for (Int_t ix = 1; ix <= h1.GetXaxis()->GetNbins(); ++ix) {
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;
94 TProfile& h1 =
dynamic_cast<TProfile&
>(*object);
96 for (Int_t ix = 1; ix <= h1.GetXaxis()->GetNbins(); ++ix) {
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;
108 TGraph&
g1 =
dynamic_cast<TGraph&
>(*object);
110 for (Int_t i = 0; i !=
g1.GetN(); ++i) {
112 cout << setw(32) << left << key->GetName() << right <<
' '
113 << setw(4) << i <<
' '