Jpp
19.0.0
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
JTransitTimeGenerator.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
10
#include "
JDetector/JPMTSimulator.hh
"
11
#include "
JDetector/JPMTDefaultSimulator.hh
"
12
13
#include "
Jeep/JParser.hh
"
14
#include "
Jeep/JMessage.hh
"
15
16
17
/**
18
* \file
19
*
20
* Example program to test generation of transit times using PMT simulator.
21
* \author mdejong
22
*/
23
int
main
(
int
argc,
char
**argv)
24
{
25
using namespace
std;
26
using namespace
JPP;
27
28
string
outputFile
;
29
int
numberOfHits
;
30
JPMTParameters
parameters
;
31
int
debug
;
32
33
try
{
34
35
JProperties
properties =
parameters
.getProperties();
36
37
JParser<>
zap(
"Example program to test generation of transit times using PMT simulator."
);
38
39
zap[
'o'
] =
make_field
(
outputFile
) =
"pmt.root"
;
40
zap[
'n'
] =
make_field
(
numberOfHits
) = 10000;
41
zap[
'P'
] =
make_field
(properties) =
JPARSER::initialised
();
42
zap[
'd'
] =
make_field
(
debug
) = 0;
43
44
zap(argc, argv);
45
}
46
catch
(
const
exception &error) {
47
FATAL
(error.what() << endl);
48
}
49
50
51
if
(
debug
>=
JEEP::debug_t
) {
52
cout <<
"PMT parameters:"
<< endl;
53
cout <<
parameters
.getProperties(
JEquationParameters
(
"="
,
"\n"
,
""
,
""
)) << endl;
54
}
55
56
const
JPMTIdentifier pmt(1,0);
57
const
JCalibration calibration;
58
const
JStatus status;
59
60
const
JPMTDefaultSimulator simulator(
parameters
, pmt);
61
62
63
TFile out(
outputFile
.c_str(),
"recreate"
);
64
65
JPMTData<JPMTSignal> input;
66
JPMTData<JPMTPulse> output;
67
68
69
TH1D h1(
"tts"
, NULL, 120, -20.0, +100.0);
70
71
for
(
int
i
= 0;
i
!=
numberOfHits
; ++
i
) {
72
73
const
double
t_ns = 0.0;
74
const
int
npe = 1;
75
const
double
W = 1.0 / (double)
numberOfHits
;
76
77
input .clear();
78
output.clear();
79
80
input.push_back(JPMTSignal(t_ns, npe));
81
82
simulator.processHits(pmt, calibration, status, input, output);
83
84
for
(JPMTData<JPMTPulse>::const_iterator hit = output.begin(); hit != output.end(); ++hit) {
85
h1.Fill(hit->t_ns, W);
86
}
87
}
88
89
out.Write();
90
out.Close();
91
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1711
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:497
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:84
outputFile
string outputFile
Definition:
JDAQTimesliceSelector.cc:37
JPMTSimulator.hh
i
then rm i
Definition:
JEvtReweightMupageParameterScan.sh:309
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:2158
JPMTDefaultSimulator.hh
numberOfHits
numberOfHits
Definition:
pre-calibration_D0ARCA028.sh:110
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JParser.hh
Utility class to parse command line options.
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
Generated by
1.8.5