#include #include #include #include #include "km3net-dataformat/offline/Head.hh" #include "km3net-dataformat/offline/Evt.hh" #include "JAAnet/JAAnetToolkit.hh" #include "JSupport/JMultipleFileScanner.hh" #include "JSupport/JSupport.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" namespace { /** * Print track. * * \param out output stream * \param prefix prefix * \param trk track */ inline void print(std::ostream& out, const std::string& prefix, const Trk& trk) { using namespace std; out << prefix << ' ' << FIXED(7,2) << trk.pos.x << ' ' << FIXED(7,2) << trk.pos.y << ' ' << FIXED(7,2) << trk.pos.z << ' ' << FIXED(7,4) << trk.dir.x << ' ' << FIXED(7,4) << trk.dir.y << ' ' << FIXED(7,4) << trk.dir.z << ' ' << FIXED(11,1) << trk.t << ' ' << setw(3) << trk.status << ':'; for (const auto i : trk.rec_stages) { out << ' ' << i; } out << endl; } /** * Recursively print track with given mother identifier. * * \param out output stream * \param prefix prefix * \param evt event * \param id identifier */ inline void print(std::ostream& out, const std::string& prefix, const Evt& evt, const int id) { if (id != -1) { for (const Trk& i : evt.trks) { if (i.id == id) { print(out, prefix, i); print(out, " " + prefix, evt, i.mother_id); break; } } } } } /** * \file * * Example program to print track fit results from Evt formatted data. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; JMultipleFileScanner inputFile; JLimit_t& numberOfEvents = inputFile.getLimit(); int debug; try { JParser<> zap("Example program to print track fit results from Evt formatted data."); zap['f'] = make_field(inputFile); zap['n'] = make_field(numberOfEvents) = JLimit::max(); zap['d'] = make_field(debug) = 2; zap(argc, argv); } catch(const exception& error) { FATAL(error.what() << endl); } while (inputFile.hasNext()) { cout << "event " << setw(10) << inputFile.getCounter() << endl; const Evt* evt = inputFile.next(); if (has_reconstructed_jppmuon(*evt)) { const Trk trk = get_best_reconstructed_jppmuon(*evt); print(cout, "", trk); print(cout, "->", *evt, trk.mother_id); } } }