#include #include #include #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 "JTrigger/JTriggerParameters.hh" #include "antares-dataformat/TimeSlice.hh" #include "antares-dataformat/PhysicsEvent.hh" #include "JROOT/JTreeParameters.hh" #include "JROOT/JChainReader.hh" #include "JSupport/JSupport.hh" #include "JLang/JBool.hh" #include "JLang/JType.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" namespace { using namespace JPP; /** * Auxiliary class to build list of valid TreeReader pointers. */ class JChainList : public std::vector { public: /** * Constructor. * * \param typelist type list */ template JChainList(JType typelist) { for_each(*this, typelist); } /** * Addition of class. * * \param type type */ template void operator()(JType type) { add(type, JBool::result>()); } private: /** * Addition of TChain compatible class. */ template void add(JType, JBool) { this->push_back(new JChainReader(getTreeParameters(JType()))); } /** * No addition of TChain incompatible class. */ template void add(JType, JBool) {} }; } /** * \file * * Auxiliary program to print ROOT TChain information. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; typedef JAppend::typelist typelist; vector inputFile; int debug; try { JParser<> zap("Auxiliary program to print ROOT TChain information."); zap['f'] = make_field(inputFile); zap['d'] = make_field(debug) = 1; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } JType type; JChainList inspector(type); for (JChainList::iterator i = inspector.begin(); i != inspector.end(); ++i) { for (vector::const_iterator file = inputFile.begin(); file != inputFile.end(); ++file) { (*i)->Add(file->c_str()); } } DEBUG("Number of files " << inputFile.size() << endl); gErrorIgnoreLevel = kFatal; for (JChainList::iterator i = inspector.begin(); i != inspector.end(); ++i) { cout << setw(24) << left << (*i)->GetName() << ' ' << setw(10) << right << (*i)->GetEntries() << endl; } }