#include #include #include "km3net-dataformat/offline/Head.hh" #include "km3net-dataformat/offline/MultiHead.hh" #include "km3net-dataformat/offline/Evt.hh" #include "JDAQ/JDAQEventIO.hh" #include "JDAQ/JDAQTimesliceIO.hh" #include "JDAQ/JDAQSummarysliceIO.hh" #include "JTrigger/JTriggerParameters.hh" #include "JDetector/JModuleRouter.hh" #include "JDetector/JDetectorToolkit.hh" #include "JDetector/JModuleRouter.hh" #include "JDynamics/JDynamics.hh" #include "JSupport/JParallelFileScanner.hh" #include "JSupport/JSupport.hh" #include "JSupport/JFileRecorder.hh" #include "JSupport/JMeta.hh" #include "JSupport/JTreeScanner.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" #include "JReconstruction/JEvt.hh" #include "JReconstruction/JShowerPointSimplexParameters_t.hh" #include "JReconstruction/JShowerPointSimplex.hh" #include "JReconstruction/JMultiThreadedReconstruction.hh" #include "JLang/JSharedPointer.hh" /** * \file * * Program to perform EM Shower Fit for ORCA with I/O of JFIT::JEvt data. * The reconstruction is made at the PMT level. * \author adomi, vcarretero */ int main(int argc, char** argv){ using namespace std; using namespace JPP; using namespace KM3NETDAQ; typedef JTYPELIST::typelist typelist; typedef JParallelFileScanner< JTypeList > JParallelFileScanner_t; typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type; typedef JTYPELIST::typelist calibration_types; typedef JMultipleFileScanner JCalibration_t; JParallelFileScanner_t inputFile; JFileRecorder outputFile; JShowerPointSimplexParameters_t parameters; JLimit_t& numberOfEvents = inputFile.getLimit(); string detectorFile; JCalibration_t calibrationFile; double Tmax_s; int debug; size_t threads; // number of parallel threads try { JParser<> zap; zap['f'] = make_field(inputFile) ; zap['o'] = make_field(outputFile) = "JORCAShowerPointSimplex_Output.root"; zap['a'] = make_field(detectorFile) ; zap['+'] = make_field(calibrationFile) = JPARSER::initialised(); zap['@'] = make_field(parameters) = JPARSER::initialised(); zap['T'] = make_field(Tmax_s) = 100.0; zap['n'] = make_field(numberOfEvents) = JLimit::max(); zap['d'] = make_field(debug) = 2; zap['N'] = make_field(threads) = 0; zap(argc, argv); } catch(const exception& error) { FATAL(error.what() << endl); } getTreeParameters().setSplitLevel(0); JDetector detector; try { load(detectorFile, detector); } catch(const JException& error) { FATAL(error); } unique_ptr dynamics; if (!calibrationFile.empty()) { try { dynamics.reset(new JDynamics(detector, Tmax_s)); dynamics->load(calibrationFile); } catch(const exception& error) { FATAL(error.what()); } } const JModuleRouter router(dynamics ? dynamics->getDetector() : detector); JShowerPointSimplex fit(parameters, debug); outputFile.open(); outputFile.put(JMeta(argc, argv)); { JMultiThreadedReconstruction fits(fit, outputFile, threads, 2 * threads); while (inputFile.hasNext()) { STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl); multi_pointer_type ps = inputFile.next(); const JDAQEvent* tev = ps; const JFIT::JEvt* in = ps; if (dynamics) { dynamics->update(*tev); } auto input = fit.getInput(router, *tev, *in, dynamics ? dynamics->getCoverage() : coverage_type()); if (threads > 0) fits.enqueue(input); else outputFile.put(fit(input)); } STATUS(endl); } JSingleFileScanner::typelist> io(inputFile); io >> outputFile; outputFile.close(); }