#include #include #include #include "TROOT.h" #include "TFile.h" #include "TH2D.h" #include "JROOT/JManager.hh" #include "km3net-dataformat/online/JDAQ.hh" #include "JDAQ/JDAQTimesliceIO.hh" #include "JDAQ/JDAQSummarysliceIO.hh" #include "JDetector/JDetectorToolkit.hh" #include "JDetector/JModuleRouter.hh" #include "JTools/JRange.hh" #include "JSupport/JMultipleFileScanner.hh" #include "JSupport/JSupport.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Monitoring of PMT time over threshold distributions. * \author mkarel */ int main(int argc, char **argv) { using namespace std; using namespace JPP; using namespace KM3NETDAQ; JMultipleFileScanner inputFile; string outputFile; int debug; try { JParser<> zap("Monitoring of PMT time over threshold distributions."); zap['f'] = make_field(inputFile); zap['o'] = make_field(outputFile) = "monitor.root"; zap['d'] = make_field(debug) = 1; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } using namespace KM3NETDAQ; const double factor = 1.0/1000 ; const int Nbins = 90 ; // reasonable range for singles rates from 0-20 kHz JManager SinglesRatedistr(new TH2D("%.2S", NULL, NUMBER_OF_PMTS, -0.5, NUMBER_OF_PMTS-0.5, Nbins, JDAQRate::getData(factor))) ; while (inputFile.hasNext()) { STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl); JDAQSummaryslice* summary = inputFile.next() ; for (KM3NETDAQ::JDAQSummaryslice::const_iterator summary_frame = summary->begin(); summary_frame != summary->end(); ++summary_frame) { int DOMID = summary_frame->getModuleID() ; TH2D* h_i = SinglesRatedistr[DOMID] ; for (int ipmt = 0 ; ipmtFill(ipmt, summary_frame->getRate(ipmt, factor), summary_frame->getWeight(ipmt, factor)); } } } STATUS(endl); // Store histogram(s). TFile out(outputFile.c_str(), "recreate"); SinglesRatedistr.Write(out) ; out.Write(); out.Close(); }