32 JPMTParameters parameters;
37 JProperties properties = parameters.getProperties();
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;
63 const JPMTDefaultSimulator simulator(parameters, pmt);
65 JPMTData<JPMTSignal> input;
66 JPMTData<JPMTPulse> output;
71 TProfile h0(
"tot", NULL, 1000, parameters.threshold, 1000.0);
72 TProfile h1(
"hit", NULL, 1000, parameters.threshold, 1000.0);
73 TProfile2D h2(
"2D", NULL, 50, 0.0, 250.0, 100, 0.0, 1000.0);
76 for (
int i = 1; i <= h1.GetNbinsX(); ++i) {
78 const double t_ns = 100.0;
79 const double x = h1.GetBinCenter(i);
80 const int npe = (int) x;
82 for (
int i = 0; i != numberOfHits; ++i) {
87 input.push_back(JPMTSignal(t_ns, npe));
89 simulator.processHits(pmt, calibration, input, output);
93 for (JPMTData<JPMTPulse>::const_iterator hit = output.begin(); hit != output.end(); ++hit) {
98 h1.Fill(x, (
double) output.size());
103 for (
int i = 1; i <= h2.GetXaxis()->GetNbins(); ++i) {
104 for (
int j = 1;
j <= h2.GetYaxis()->GetNbins(); ++
j) {
106 const double t_ns = (int) h2.GetXaxis()->GetBinCenter(i);
107 const int npe = (int) h2.GetYaxis()->GetBinCenter(
j);
109 for (
int i = 0; i != numberOfHits; ++i) {
114 input.push_back(JPMTSignal(0.0, npe));
115 input.push_back(JPMTSignal(t_ns, 1));
117 simulator.processHits(pmt, calibration, input, output);
119 if (!output.empty()) {
120 h2.Fill(t_ns, (
double) npe, output.begin()->tot_ns);