#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 "JDetector/JModuleRouter.hh" #include "JDetector/JDetectorToolkit.hh" #include "JSupport/JParallelFileScanner.hh" #include "JSupport/JSupport.hh" #include "JSupport/JFileRecorder.hh" #include "JSupport/JMeta.hh" #include "JSupport/JTreeScanner.hh" #include "JSupport/JSummaryFileRouter.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" #include "JReconstruction/JEvt.hh" #include "JReconstruction/JShowerEnergyCorrection.hh" #include "JReconstruction/JShowerParameters.hh" #include "JReconstruction/JShowerBjorkenYParameters_t.hh" #include "JReconstruction/JShowerBjorkenY.hh" #include "JLang/JSharedPointer.hh" /** * \file * * Program to perform Shower Bjorken Y Fit for ORCA with I/O of JFIT::JEvt data. * The reconstruction is made at the PMT level. * \author adomi */ int main(int argc, char** argv){ using namespace std; using namespace JPP; using namespace KM3NETDAQ; typedef JParallelFileScanner< JTypeList > JParallelFileScanner_t; typedef JTYPELIST::typelist typelist; typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type; JParallelFileScanner_t inputFile; JFileRecorder outputFile; JShowerBjorkenYParameters_t parameters; JLimit_t& numberOfEvents = inputFile.getLimit(); string detectorFile; string pdfFile; JShowerEnergyCorrection correct; int debug; try { JParser<> zap; zap['f'] = make_field(inputFile) ; zap['o'] = make_field(outputFile) = "JORCAShowerBjorkenY_Output.root"; zap['a'] = make_field(detectorFile) ; zap['F'] = make_field(pdfFile) ; zap['E'] = make_field(correct) = JShowerEnergyCorrection(); // off zap['@'] = make_field(parameters) = JPARSER::initialised(); zap['n'] = make_field(numberOfEvents) = JLimit::max(); zap['d'] = make_field(debug) = 2; zap(argc, argv); } catch(const exception& error) { FATAL(error.what() << endl); } JDetector detector; try { load(detectorFile, detector); } catch(const JException& error) { FATAL(error); } outputFile.open(); outputFile.put(JMeta(argc, argv)); const JModuleRouter router(detector); JSummaryFileRouter summary(inputFile, parameters.R_Hz); JShowerBjorkenY fit(parameters, router, summary, pdfFile, correct, debug); while (inputFile.hasNext()) { STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl); multi_pointer_type ps = inputFile.next(); JDAQEvent* tev = ps; JEvt* in = ps; summary.update(*tev); // select start values JEvt cp = *in; cp.select(parameters.numberOfPrefits, qualitySorter); if (!cp.empty()) { cp.select(JHistory::is_event(cp.begin()->getHistory())); } // fit JEvt out = fit(*tev, cp); // apply default sorter sort(out.begin(), out.end(), qualitySorter); copy(in->begin(), in->end(), back_inserter(out)); outputFile.put(out); } STATUS(endl); JSingleFileScanner::typelist> io(inputFile); io >> outputFile; outputFile.close(); }