Jpp - the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JPrintTree.cc File Reference

Auxiliary program to print ROOT TTree information. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "TError.h"
#include "TROOT.h"
#include "TFile.h"
#include "km3net-dataformat/offline/Head.hh"
#include "km3net-dataformat/offline/Evt.hh"
#include "JDAQ/JDAQEventIO.hh"
#include "JDAQ/JDAQTimesliceIO.hh"
#include "JDAQ/JDAQSummarysliceIO.hh"
#include "antares-dataformat/TimeSlice.hh"
#include "antares-dataformat/PhysicsEvent.hh"
#include "JROOT/JTreeParameters.hh"
#include "JROOT/JTreeReader.hh"
#include "JSupport/JSupport.hh"
#include "JLang/JSinglePointer.hh"
#include "JLang/JBool.hh"
#include "JLang/JType.hh"
#include "JLang/JTypeList.hh"
#include "JLang/JNullType.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to print ROOT TTree information.

Author
mdejong

Definition in file JPrintTree.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 96 of file JPrintTree.cc.

97 {
98  using namespace std;
99 
100  vector<string> inputFile;
101  int debug;
102 
103  try {
104 
105  JParser<> zap("Auxiliary program to print ROOT TTree information.");
106 
107  zap['f'] = make_field(inputFile);
108  zap['d'] = make_field(debug) = 1;
109 
110  zap(argc, argv);
111  }
112  catch(const exception &error) {
113  FATAL(error.what() << endl);
114  }
115 
116  cout.tie(&cerr);
117 
118  gErrorIgnoreLevel = kFatal;
119 
121 
122  JTreeList inspector(typelist);
123 
124  int number_of_errors = 0;
125 
126  for (vector<string>::const_iterator file_name = inputFile.begin(); file_name != inputFile.end(); ++file_name) {
127 
128  TFile* fp = TFile::Open(file_name->c_str());
129 
130  cout << *file_name << flush;
131 
132  if (fp != NULL) {
133 
134  cout << endl;
135 
136  for (JTreeList::iterator i = inspector.begin(); i != inspector.end(); ++i) {
137 
138  if ((*i)->load(fp)) {
139  cout << setw(24) << left << (**i)->GetName() << ' '
140  << setw(32) << left << (*i)->getDictionary()->GetName() << ' '
141  << setw(10) << right << (**i)->GetEntries() << ' '
142  << setw( 6) << right << ((**i)->GetTotBytes() >> 20) << " [MB]" << endl;
143  }
144  }
145 
146  } else {
147 
148  ++number_of_errors;
149 
150  cout << " not opened." << endl;
151  }
152  }
153 
154  return (number_of_errors == 0 ? 0 : 1);
155 }
Utility class to parse command line options.
Definition: JParser.hh:1500
Auxiliary class for a type holder.
Definition: JType.hh:19
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:63
#define FATAL(A)
Definition: JMessage.hh:67