30 public JEquals<tree_info>
40 number_of_bytes_zipped(0),
41 compression_factor(0.)
50 tree_info(TTree* tree) :
55 name = tree->GetName();
56 number_of_entries = tree->GetEntries();
57 number_of_bytes = tree->GetTotBytes();
58 number_of_bytes_zipped = tree->GetZipBytes();
60 if (number_of_bytes != 0){
61 compression_factor = double(number_of_bytes) / number_of_bytes_zipped;
64 TObjArray* ts = tree->GetListOfBranches();
68 if (ts->GetEntries() == 1) {
70 TBranch* branch =
dynamic_cast<TBranch*
>(tree->GetListOfBranches()->At(0));
73 type = branch->GetClassName();
78 for (TIter next(ts);
TObject* ps = next(); ) {
79 type += (type ==
"" ?
"" :
",") + std::string(ps->GetName());
82 type =
"{" + type +
"}";
95 bool equals(
const tree_info&
object)
const
97 return ((this->name ==
"" ||
object.name ==
"" || this->name ==
object.name) &&
98 (this->type ==
"" ||
object.type ==
"" ||
equals(this->type,
object.type)));
109 return (name !=
"" && type !=
"");
120 friend inline std::ostream&
operator<<(std::ostream& out,
const tree_info&
object)
124 return out << setw(24) << left <<
object.name <<
' '
125 << setw(32) << left <<
object.type <<
' '
126 << setw(10) << right <<
object.number_of_entries <<
' '
127 << setw( 6) << right << (
object.number_of_bytes >> 20) <<
" [MB] "
128 << setw( 6) << right << (
object.number_of_bytes_zipped >> 20) <<
" [MB] "
129 <<
FIXED(5,2) << (
object.compression_factor) <<
' ';
134 Long64_t number_of_entries;
135 Long64_t number_of_bytes;
136 Long64_t number_of_bytes_zipped;
137 double compression_factor;
147 static bool equals(
const std::string& first,
const std::string& second)
152 if (first ==
"") {
return true; }
153 if (second ==
"") {
return true; }
155 if (getNamespace(first) ==
"" ||
156 getNamespace(second) ==
"")
157 return getClassname(first) == getClassname(second);
159 return first == second;
200 JParser<> zap(
"Auxiliary program to print ROOT TTree information.");
204 zap[
'k'] =
make_field(key) =
"", get_keys(format);
209 catch(
const exception &error) {
210 FATAL(error.what() << endl);
213 gErrorIgnoreLevel = kFatal;
215 inputFile = getFilenames(inputFile);
217 int number_of_errors = 0;
219 for (vector<string>::const_iterator file_name = inputFile.begin(); file_name != inputFile.end(); ++file_name) {
221 TFile* file = TFile::Open(file_name->c_str());
227 cerr << *file_name <<
" not opened." << endl;
233 cout << *file_name << endl;
236 TIter iter(file->GetListOfKeys(), kIterBackward);
238 for (TKey* _key; (_key = (TKey*) iter.Next()) != NULL; ) {
240 TKey* p =
dynamic_cast<TKey*
>(file->GetListOfKeys()->Before(_key));
242 DEBUG(
"Key: " << _key->GetName() <<
' ' << (p == NULL || strcmp(_key->GetName(), p->GetName()) != 0) << endl);
244 if (p == NULL || strcmp(_key->GetName(), p->GetName()) != 0) {
246 tb = tree_info(
dynamic_cast<TTree*
>(_key->ReadObj()));
250 if (tb.is_valid() && ta == tb) {
255 format.
write(cout, key) <<
' ';
265 return (number_of_errors == 0 ? 0 : 1);
General purpose messaging.
#define DEBUG(A)
Message macros.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int main(int argc, char **argv)
Utility class to parse parameter values.
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Auxiliary methods to convert data members or return values of member methods of a set of objects to a...
Utility class to parse parameter values.
std::ostream & write(std::ostream &out) const
Write the current parameter values.
Utility class to parse command line options.
bool equals(const JFirst_t &first, const JSecond_t &second, const double precision=std::numeric_limits< double >::min())
Check equality.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
bool is_valid(const json &js)
Check validity of JSon data.
Auxiliary data structure for floating point format specification.
Template definition of auxiliary base class for comparison of data structures.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...