#include #include #include #include #include "TROOT.h" #include "TFile.h" #include "TH1D.h" #include "JDetector/JPMTAnalogueSignalProcessor.hh" #include "JTrigger/JGetRiseTime.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Example program to histogram time over threshold as a function of number of photo-electrons. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; string outputFile; JPMTParameters parameters; int debug; try { JProperties properties = parameters.getProperties(); JParser<> zap("Example program to histogram time over threshold as a function of number of photo-electrons."); zap['o'] = make_field(outputFile) = "histogram.root"; zap['P'] = make_field(properties) = JPARSER::initialised(); zap['d'] = make_field(debug) = 0; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } if (debug >= JEEP::debug_t) { cout << "PMT parameters:" << endl; cout << parameters.getProperties(JEquationParameters("=", "\n", "", "")) << endl; } JPMTAnalogueSignalProcessor cpu(parameters); TFile out(outputFile.c_str(), "recreate"); TH1D h0("[model]", NULL, 510, 0.0, 255.0); TH1D h1("[parametrisation]", NULL, 510, 0.0, 255.0); for (int i = 1; i <= h0.GetNbinsX(); ++i) { try { const double x = h0.GetBinCenter(i); const double npe = cpu.getNPE(x); const double y = cpu.getRiseTime(npe); h0.SetBinContent(i, y); h1.SetBinContent(i, getRiseTime(x)); } catch(const JValueOutOfRange& error) {} } out.Write(); out.Close(); }