Jpp 21.0.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JSlewing.cc File Reference

Example program to histogram time over threshold as a function of number of photo-electrons. More...

#include <string>
#include <iostream>
#include <iomanip>
#include <cmath>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "JDetector/JPMTAnalogueSignalProcessor.hh"
#include "JTrigger/JTimeSlewing.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to histogram time over threshold as a function of number of photo-electrons.

Author
mdejong

Definition in file JSlewing.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 24 of file JSlewing.cc.

25{
26 using namespace std;
27 using namespace JPP;
28
29 string outputFile;
30 JPMTParameters parameters;
31 int debug;
32
33 try {
34
35 JProperties properties = parameters.getProperties();
36
37 JParser<> zap("Example program to histogram time over threshold as a function of number of photo-electrons.");
38
39 zap['o'] = make_field(outputFile) = "histogram.root";
40 zap['P'] = make_field(properties) = JPARSER::initialised();
41 zap['d'] = make_field(debug) = 0;
42
43 zap(argc, argv);
44 }
45 catch(const exception &error) {
46 FATAL(error.what() << endl);
47 }
48
49
50 const int type = (parameters.TTS_ns < 0 ? (int) -parameters.TTS_ns : 1);
51
52 if (debug >= JEEP::debug_t) {
53 cout << "PMT parameters:" << endl;
54 cout << parameters.getProperties(JEquationParameters("=", "\n", "", "")) << endl;
55 cout << "Slewing option: " << type << endl;
56 }
57
58 JPMTAnalogueSignalProcessor cpu(parameters);
59
60 TFile out(outputFile.c_str(), "recreate");
61
62 TH1D h0("[model]", NULL, 510, 0.0, 255.0);
63 TH1D h1("[parametrisation]", NULL, 510, 0.0, 255.0);
64
65 for (int i = 1; i <= h0.GetNbinsX(); ++i) {
66
67 try {
68
69 const double x = h0.GetBinCenter(i);
70
71 double npe = cpu.getNPE(x);
72
73 if (npe > cpu.saturation) {
74 npe = cpu.saturation;
75 }
76
77 double y = cpu.getRiseTime(npe);
78
79 DEBUG(" " << FIXED(4,1) << x << ' ' << FIXED(7,3) << npe << ' ' << FIXED(7,3) << y << ' ' << FIXED(7,3) << getTimeSlewing(x, type) << endl);
80
81 h0.SetBinContent(i, y);
82 h1.SetBinContent(i, getTimeSlewing(x, type));
83 }
84 catch(const JValueOutOfRange& error) {}
85 }
86
87 out.Write();
88 out.Close();
89}
string outputFile
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:74
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2140
Data structure for PMT parameters.
double TTS_ns
transition time spread [ns]
JProperties getProperties(const JEquationParameters &equation=JPMTParameters::getEquationParameters())
Get properties of this class.
Utility class to parse parameter values.
Simple data structure to support I/O of equations (see class JLANG::JEquation).
Exception for accessing a value in a collection that is outside of its range.
Utility class to parse command line options.
Definition JParser.hh:1697
@ debug_t
debug
Definition JMessage.hh:29
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:67