#include #include #include #include "km3net-dataformat/offline/Head.hh" #include "km3net-dataformat/offline/MultiHead.hh" #include "km3net-dataformat/offline/Evt.hh" #include "km3net-dataformat/tools/time_converter.hh" #include "JAAnet/JHead.hh" #include "JAAnet/JHeadToolkit.hh" #include "JAAnet/JAAnetToolkit.hh" #include "JDAQ/JDAQEventIO.hh" #include "JDAQ/JDAQTimesliceIO.hh" #include "JDAQ/JDAQSummarysliceIO.hh" #include "JTrigger/JTriggerParameters.hh" #include "JSupport/JTriggeredFileScanner.hh" #include "JSupport/JFileRecorder.hh" #include "JSupport/JMonteCarloFileSupportkit.hh" #include "JSupport/JSupport.hh" #include "JSupport/JMeta.hh" #include "JReconstruction/JEvt.hh" #include "JReconstruction/JEvtToolkit.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Auxiliary program to store Monte Carlo true muon in JFIT::JEvt format. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; using namespace KM3NETDAQ; typedef JTYPELIST::typelist typelist; JTriggeredFileScanner<> inputFile; JFileRecorder outputFile; JLimit_t& numberOfEvents = inputFile.getLimit(); int debug; try { JParser<> zap("Auxiliary program to store Monte Carlo true muon in format for subsequent fits."); zap['f'] = make_field(inputFile, "output of JTriggerEfficiency[.sh]"); zap['o'] = make_field(outputFile) = "mcevt.root"; zap['n'] = make_field(numberOfEvents) = JLimit::max(); zap['d'] = make_field(debug) = 2; zap(argc, argv); } catch(const exception& error) { FATAL(error.what() << endl); } const JVector3D center = get(getHeader(inputFile)); outputFile.open(); outputFile.put(JMeta(argc, argv)); while (inputFile.hasNext()) { STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl); JTriggeredFileScanner<>::multi_pointer_type ps = inputFile.next(); const JDAQEvent* tev = ps; const Evt* event = ps; JEvt out; const time_converter converter(*event, *tev); vector::const_iterator muon = find_if(event->mc_trks.begin(), event->mc_trks.end(), is_muon); if (muon != event->mc_trks.end()) { JTrack3E ta = getTrack(*muon); ta.add(center); ta.add(converter.putTime()); out.push_back(getFit(JMCEVT, ta, 0.0, 0, ta.getE())); if (has_neutrino(*event)) { out.rbegin()->setW(0, (get_neutrino(*event).pos - muon->pos).len()); } } outputFile.put(out); } STATUS(endl); JMultipleFileScanner::typelist> io(inputFile); io >> outputFile; outputFile.close(); }