Jpp
18.0.1-rc.1
the software that should make you happy
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JDetector
JTransitTime.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
#include "TRandom3.h"
10
11
#include "
JDetector/JPMTTransitTimeProbability.hh
"
12
#include "
JDetector/JPMTParameters.hh
"
13
#include "
JDetector/JPMTAnalogueSignalProcessor.hh
"
14
15
#include "
Jeep/JParser.hh
"
16
#include "
Jeep/JMessage.hh
"
17
18
19
/**
20
* \file
21
*
22
* Example program to histogram PMT transit time distribution.
23
* \author mdejong
24
*/
25
int
main
(
int
argc,
char
**argv)
26
{
27
using namespace
std;
28
using namespace
JPP;
29
30
string
outputFile
;
31
JPMTParameters
parameters
;
32
int
numberOfEvents;
33
int
option;
34
int
debug
;
35
36
try
{
37
38
JProperties
properties =
parameters
.getProperties();
39
40
JParser<>
zap(
"Example program to histogram PMT transit time distribution."
);
41
42
zap[
'o'
] =
make_field
(
outputFile
) =
"histogram.root"
;
43
zap[
'P'
] =
make_field
(properties) =
JPARSER::initialised
();
44
zap[
'n'
] =
make_field
(numberOfEvents) = 0;
45
zap[
'O'
] =
make_field
(option) = 0;
46
zap[
'd'
] =
make_field
(
debug
) = 0;
47
48
zap(argc, argv);
49
}
50
catch
(
const
exception &error) {
51
FATAL
(error.what() << endl);
52
}
53
54
if
(
debug
>=
JEEP::debug_t
) {
55
cout <<
"PMT parameters:"
<< endl;
56
cout <<
parameters
.getProperties(
JEquationParameters
(
"="
,
"\n"
,
""
,
""
)) << endl;
57
}
58
59
parameters
.TTS_ns = -option;
60
61
const
JPMTAnalogueSignalProcessor cpu(
parameters
);
62
63
TFile out(
outputFile
.c_str(),
"recreate"
);
64
65
TH1D h1(
"tts"
, NULL, 1300, -30.0, +100.0);
66
TH1D h2(
"pmt"
, NULL, 130, -30.0, +100.0);
67
68
double
W = 0.0;
69
70
for
(
int
i
= 1;
i
<= h1.GetNbinsX(); ++
i
) {
71
72
const
double
t1 = h1.GetBinCenter(
i
);
73
const
double
y
=
getTransitionTimeProbability
(t1, option);
74
const
double
z = h1.GetBinWidth (
i
);
75
76
h1.SetBinContent(
i
, y);
77
78
W += y * z;
79
}
80
81
h1.Scale(1.0 / W,
"nosw2"
);
82
83
if
(numberOfEvents > 0) {
84
85
for
(
int
i
= 0;
i
!= numberOfEvents; ++
i
) {
86
87
const
double
t0 = 0.0;
88
const
double
t1 = cpu.getRandomTime(t0);
89
90
h2.Fill(t1);
91
}
92
93
h2.Scale(1.0 / numberOfEvents);
94
}
95
96
out.Write();
97
out.Close();
98
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1514
i
then rm i
Definition:
JEvtReweightGSeaGenParameterScan.sh:337
JEEP::debug_t
debug
Definition:
JMessage.hh:29
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JEEP::JProperties
Utility class to parse parameter values.
Definition:
JProperties.hh:496
parameters
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition:
diff-Tuna.sh:38
JLANG::JEquationParameters
Simple data structure to support I/O of equations (see class JLANG::JEquation).
Definition:
JEquationParameters.hh:20
JPARSER::initialised
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition:
JParser.hh:83
outputFile
string outputFile
Definition:
JDAQTimesliceSelector.cc:37
JPMTTransitTimeProbability.hh
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1989
makedeclinationtable.y
tuple y
Definition:
makedeclinationtable.py:51
JPMTParameters.hh
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JParser.hh
Utility class to parse command line options.
JPMTAnalogueSignalProcessor.hh
PMT analogue signal processor.
JDETECTOR::getTransitionTimeProbability
JDETECTOR::getTransitionTimeProbability getTransitionTimeProbability
Function object of transition time prabability.
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
Generated by
1.8.5