Jpp 21.0.0-rc.1-88-g0130508c4
the software that should make you happy
Loading...
Searching...
No Matches
JToTProbabilityDensity.cc
Go to the documentation of this file.
1
2#include <string>
3#include <iostream>
4#include <iomanip>
5
6#include "TROOT.h"
7#include "TFile.h"
8#include "TH1D.h"
9
12
13#include "Jeep/JPrint.hh"
14#include "Jeep/JParser.hh"
15#include "Jeep/JMessage.hh"
16
17
18/**
19 * \file
20 *
21 * Example program to histogram time-over-threshold probability distributions.
22 * \author mdejong & evancampenhout
23 */
24int main(int argc, char **argv)
25{
26 using namespace std;
27 using namespace JPP;
28
29 string outputFile;
30 JPMTParameters parameters;
31 double NPE;
32 int debug;
33
34 try {
35
36 JProperties properties = parameters.getProperties();
37
38 JParser<> zap("Example program to histogram time-over-threshold probability distributions.");
39
40 zap['o'] = make_field(outputFile) = "time-over-threshold.root";
41 zap['P'] = make_field(properties) = JPARSER::initialised();
42 zap['N'] = make_field(NPE);
43 zap['d'] = make_field(debug) = 0;
44
45 zap(argc, argv);
46
47 }
48 catch(const exception &error) {
49 FATAL(error.what() << endl);
50 }
51
52 const JPMTAnalogueSignalProcessor cpu(parameters);
53
54 TFile out(outputFile.c_str(), "recreate");
55
56
57 const double xmin = 0.0;
58 const double xmax = 255.0;
59 const int nx = (int) ((xmax - xmin) / 0.1);
60
61 TH1D h0("h0", NULL, nx, xmin, xmax);
62
63 for (int i = 1; i <= h0.GetNbinsX(); ++i) {
64
65 const double x = h0.GetBinCenter(i);
66 const double y = cpu.getTimeOverThresholdProbability(x, NPE);
67
68 h0.SetBinContent(i, y);
69 }
70
71 out.Write();
72 out.Close();
73}
string outputFile
General purpose messaging.
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:74
PMT analogue signal processor.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2140
I/O formatting auxiliaries.
Data structure for PMT parameters.
JProperties getProperties(const JEquationParameters &equation=JPMTParameters::getEquationParameters())
Get properties of this class.
Utility class to parse parameter values.
Utility class to parse command line options.
Definition JParser.hh:1697
int main()
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
double getTimeOverThresholdProbability(const double tot_ns, const int NPE) const
Get probability of having a pulse with specific time-over-threshold.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:67