#include #include #include "TROOT.h" #include "TFile.h" #include "TGraph.h" #include "TH1D.h" #include "JDB/JToAshort.hh" #include "JDB/JSupport.hh" #include "JROOT/JGraph.hh" #include "JROOT/JManager.hh" #include "JSupport/JMultipleFileScanner.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Example program to monitor "toashort" data. */ int main(int argc, char **argv) { using namespace std; using namespace JPP; JMultipleFileScanner inputFile; JLimit_t& numberOfEvents = inputFile.getLimit(); string outputFile; int debug; try { JParser<> zap("Example program to monitor \"toashort\" data."); zap['f'] = make_field(inputFile, "output of JConvertDB -q toashort"); zap['n'] = make_field(numberOfEvents) = JLimit::max(); zap['o'] = make_field(outputFile) = "toashort.root"; zap['d'] = make_field(debug) = 1; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } map G1; JManager H1(new TH1D("H[%].quality", NULL, 100, 0.0, 8.0)); while (inputFile.hasNext()) { if (inputFile.getCounter()%1000 == 0) { STATUS("counter: " << setw(8) << inputFile.getCounter() << '\r' << flush); DEBUG(endl); } const JToAshort* toashort = inputFile.next(); G1[toashort->EMITTERID].put(toashort->UNIXTIMEBASE + toashort->TOA_S, log10(toashort->QUALITYFACTOR)); H1[toashort->EMITTERID]->Fill(log10(toashort->QUALITYFACTOR)); } STATUS(endl); TFile out(outputFile.c_str(), "recreate"); for (map::const_iterator i = G1.begin(); i != G1.end(); ++i) { out << JGraph(i->second, MAKE_CSTRING("G[" << i->first << "].toa")); } out << H1; out.Write(); out.Close(); }