9 #include "TProfile2D.h"
25 int main(
int argc,
char **argv)
39 JParser<> zap(
"Example program to histogram PMT simulator features.");
48 catch(
const exception &error) {
49 FATAL(error.what() << endl);
54 cout <<
"PMT parameters:" << endl;
58 const JPMTAnalogueSignalProcessor cpu(
parameters);
60 const JPMTIdentifier pmt(1,0);
61 const JCalibration calibration;
64 const JPMTDefaultSimulator simulator(
parameters, pmt);
66 JPMTData<JPMTSignal> input;
67 JPMTData<JPMTPulse> output;
72 TProfile h0(
"tot", NULL, 1000,
parameters.threshold, 1000.0);
73 TProfile
h1(
"hit", NULL, 1000,
parameters.threshold, 1000.0);
74 TProfile2D h2(
"2D", NULL, 50, 0.0, 250.0, 100, 0.0, 1000.0);
77 for (
int i = 1; i <= h1.GetNbinsX(); ++i) {
79 const double t_ns = 100.0;
80 const double x = h1.GetBinCenter(i);
81 const int npe = (int) x;
83 for (
int i = 0; i != numberOfHits; ++i) {
88 input.push_back(JPMTSignal(t_ns, npe));
90 simulator.processHits(pmt, calibration, status, input, output);
94 for (JPMTData<JPMTPulse>::const_iterator hit = output.begin(); hit != output.end(); ++hit) {
99 h1.Fill(x, (
double) output.size());
104 for (
int i = 1; i <= h2.GetXaxis()->GetNbins(); ++i) {
105 for (
int j = 1;
j <= h2.GetYaxis()->GetNbins(); ++
j) {
107 const double t_ns = (int) h2.GetXaxis()->GetBinCenter(i);
108 const int npe = (int) h2.GetYaxis()->GetBinCenter(
j);
110 for (
int i = 0; i != numberOfHits; ++i) {
115 input.push_back(JPMTSignal(0.0, npe));
116 input.push_back(JPMTSignal(t_ns, 1));
118 simulator.processHits(pmt, calibration, status, input, output);
120 if (!output.empty()) {
121 h2.Fill(t_ns, (
double) npe, output.begin()->tot_ns);
Utility class to parse command line options.
int main(int argc, char *argv[])
Utility class to parse parameter values.
*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
Simple data structure to support I/O of equations (see class JLANG::JEquation).
then for HISTOGRAM in h0 h1
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
General purpose messaging.
Utility class to parse command line options.
PMT analogue signal processor.