Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JChargeProbability.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 charge probability distributions.
22 * \author mdejong
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 charge probability distributions.");
39
40 zap['o'] = make_field(outputFile) = "charge.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 = max(0.0, NPE - 5.0 * sqrt(NPE));
58 const double xmax = NPE + 5.0 * sqrt(NPE) + 2.5;
59 const int nx = (int) ((xmax - xmin) / 0.05);
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 = getChargeProbability(cpu, x, NPE);
67
68 h0.SetBinContent(i, y);
69 }
70
71 out.Write();
72 out.Close();
73}
int main(int argc, char **argv)
string outputFile
General purpose messaging.
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
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:2142
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:1698
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:68