#include #include #include #include "km3net-dataformat/definitions/reconstruction.hh" #include "km3net-dataformat/offline/Head.hh" #include "km3net-dataformat/offline/Evt.hh" #include "JDAQ/JDAQEventIO.hh" #include "JDAQ/JDAQSummarysliceIO.hh" #include "JSupport/JMeta.hh" #include "JSupport/JSupport.hh" #include "JSupport/JFileRecorder.hh" #include "JSupport/JParallelFileScanner.hh" #include "JSupport/JMonteCarloFileSupportkit.hh" #include "JTrigger/JTriggerParameters.hh" #include "JTools/JRange.hh" #include "JReconstruction/JEvt.hh" #include "JReconstruction/JEvtToolkit.hh" #include "JReconstruction/JEventSelector.hh" #include "Jeep/JPrint.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Program to extract events based on muon reconstruction.\n * Events outside the accepted range of cosine zenith angle will have no hits. * * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; using namespace KM3NETDAQ; typedef JRange JRange_t; typedef JTYPELIST::typelist, JFIT::JEvt>::typelist typelist; typedef JParallelFileScanner< JTypeList > JParallelFileScanner_t; typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type; JParallelFileScanner_t inputFile; size_t numberOfEvents; JFileRecorder outputFile; JRange_t ct; int debug; try { JParser<> zap("Program to extract events based on muon reconstruction."\ "\nEvents outside the accepted range of cosine zenith angle will have no hits."); zap['f'] = make_field(inputFile, "input file (output of JXXXMuonReconstruction.sh)"); zap['n'] = make_field(numberOfEvents) = std::numeric_limits::max(); zap['o'] = make_field(outputFile, "output file name") = "extract.root"; zap['c'] = make_field(ct, "accepted range of cosine zenith angle") = JRange_t(); zap['d'] = make_field(debug) = 2; zap(argc, argv); } catch(const exception& error) { FATAL(error.what() << endl); } outputFile.open(); outputFile.put(JMeta(argc, argv)); while (inputFile.hasNext()) { STATUS("event: " << setw(8) << inputFile.getCounter() << '\r' << flush); multi_pointer_type ps = inputFile.next(); JDAQEvent* tev = ps; JEvt* evt = ps; bool status = true; if (has_reconstructed_muon(*evt)) { const JFit& fit = get_best_reconstructed_muon(*evt); status = ct(fit.getDZ()); } if (status) outputFile.put(*tev); else outputFile.put(JDAQEvent(tev->getDAQEventHeader())); } STATUS(endl); { JMultipleFileScanner::typelist>::typelist> io(inputFile); io >> outputFile; } outputFile.close(); return 0; }