// c++ standard library #include #include // Jpp #include "km3net-dataformat/offline/Head.hh" #include "JAAnet/JAAnetDictionary.hh" #include "JDetector/JDetector.hh" #include "JDetector/JModuleRouter.hh" #include "JDetector/JDetectorToolkit.hh" #include "JTools/JRange.hh" #include "JSupport/JSupport.hh" #include "JSupport/JMeta.hh" #include "JSupport/JMultipleFileScanner.hh" #include "JSupport/JTreeScanner.hh" #include "JSupport/JMonteCarloFileSupportkit.hh" #include "JSupport/JFileRecorder.hh" #include "JReconstruction/JEvt.hh" #include "JReconstruction/JEvtToolkit.hh" #include "Jeep/JProperties.hh" #include "Jeep/JParser.hh" #include "km3net-dataformat/online/JDAQ.hh" #include "km3net-dataformat/online/JDAQHeader.hh" #include "JDAQ/JDAQEventIO.hh" #include "JDAQ/JDAQTimesliceIO.hh" #include "JDAQ/JDAQSummarysliceIO.hh" #include "JLang/JObjectReader.hh" #include "TROOT.h" #include "JROOT/JRootFileReader.hh" #include "JROOT/JROOTClassSelector.hh" #include "JROOT/JRootToolkit.hh" #include "JROOT/JRootFileWriter.hh" #include "JROOT/JTreeParameters.hh" #include "JSupport/JSupport.hh" #include "JSupport/JSupportToolkit.hh" #include "JRunAnalyzer/JRunInfo.hh" //JRunAnalyzer #include "JRunAnalyzer.hh" #include "JRunHistograms.hh" #include #include "TTree.h" /** * \author rgruiz, adomi */ int main(int argc, char **argv) { using namespace KM3NETDAQ; using namespace JPP; JSingleFileScanner<> inputFile; JFileRecorder::typelist> outputFile; string detectorFile; JLimit_t numberOfTimeslices = JLimit::max(); JLimit_t numberOfSummaryslices = JLimit::max(); JLimit_t numberOfEvents = JLimit::max(); int analysis_level; try { JProperties properties; properties.insert(gmake_property(numberOfTimeslices)); properties.insert(gmake_property(numberOfSummaryslices)); properties.insert(gmake_property(numberOfEvents)); JParser<> zap; zap['f'] = make_field(inputFile , "input file " ); zap['o'] = make_field(outputFile , "output file" ) = "out.root"; zap['a'] = make_field(detectorFile , "detector file" ); zap['@'] = make_field(properties) = JPARSER::initialised(); zap['L'] = make_field(analysis_level , "analysis level") = 0, 1, 2; zap(argc,argv); } catch(const exception &error) { ERROR(error.what() << endl); } JDetector detector; try { load (detectorFile, detector); } catch(const JException & error) { FATAL( "FATAL ERROR. Could not open detector file '" << detectorFile << "'." << endl); } if(analysis_level == 1){ cout << "ANALYSIS OF ALL AVAILABLE PMTs INFORMATION. It may take a while!" << endl; } else if (analysis_level == 2){ cout << "BASIC ANALYSIS AT TRIGGER AND RECONSTRUCTION LEVEL." << endl; } else { cout << "JRUNANALYZER RUNNING WITH A REDUCED NUMBER OF PLOTS." << endl; } JSingleFileScanner in(inputFile); Head head; try{ head = getHeader(in); }catch(const exception&){} JHead buffer(head); buffer.DAQ.livetime_s = getLivetime(inputFile); buffer.push(& JAANET::JHead::DAQ); copy(buffer, head); cout << "START\n"; outputFile.open(); JRootFile* p = dynamic_cast(outputFile.get()); if (p == NULL) { FATAL("WRONG FILE TYPE"); } TFile* out = p->getFile(); cout << out->GetName() << endl; outputFile.put(JMeta(argc, argv)); JDAQHeader header; for(JTreeScanner in(inputFile); in.hasNext();){ const JDAQEvent* event = in.next(); if (header.getDetectorID() != event->getDetectorID() || header.getRunNumber () != event->getRunNumber ()) { header = event->getDAQHeader(); putObject(out, header); break; } } const run_info runinfo(header.getDetectorID(), header.getRunNumber(), buffer.DAQ.livetime_s, buffer.livetime.numberOfSeconds); outputFile.put(runinfo); JRunAnalyzer Analyzer (inputFile, detector, out, numberOfTimeslices, numberOfSummaryslices, numberOfEvents, analysis_level); cout << "read events\n"; Analyzer.readEvents (); cout << "read summarydata\n"; Analyzer.readSummaryData (); cout << "read timeslices\n"; Analyzer.readTimesliceData (); Analyzer.readTimesliceData(); Analyzer.readTimesliceData(); Analyzer.readTimesliceData(); Analyzer.readTimesliceData(); if(analysis_level == 2){ cout << "read reconstructed events\n"; Analyzer.readRecoEvents (); } Analyzer.writeToFile(out, analysis_level); outputFile.close(); }