29 int main(
int argc,
char **argv)
35 JPMTParametersMap parametersMap;
44 JParser<> zap(
"Example program to histogram time over threshold distributions.");
48 zap[
'p'] =
make_field(pmt) = JPMTIdentifier(1,0);
57 catch(
const exception &error) {
58 FATAL(error.what() << endl);
61 const JPMTParameters
parameters = parametersMap.getPMTParameters(pmt);
63 const JPMTAnalogueSignalProcessor cpu (
parameters);
70 const double dQ = (cpu.threshold - cpu.thresholdBand) / 5.5;
71 const double Qmin = 0.0 - 0.5 * dQ;
72 const double Qmax = 10.0 + 0.5 * dQ;
73 const int nq = (int) ((Qmax - Qmin) / dQ);
75 TH1D h0(
"h0", NULL, nq, Qmin, Qmax);
76 TH1D
h1(
"h1", NULL, nq, Qmin, Qmax);
80 for (
int i=1; i <= h0.GetNbinsX(); ++i) {
82 const double npe = h0.GetBinCenter(i);
83 const double p = cpu.getChargeProbability(npe,NPE);
85 h0.SetBinContent(i,p);
89 if (numberOfHits > 0) {
91 int number_of_hits = 0;
93 for (
int i=0; i != numberOfHits; ++i) {
95 const double npe = cpu.getRandomCharge(NPE);
99 if (cpu.applyThreshold(npe) > cpu.BELOW_THRESHOLDBAND) {
106 }
catch (
const JValueOutOfRange& exception) {
108 DEBUG(exception.what());
114 h1.Scale(1.0 / (
double) number_of_hits / dQ);
121 for (
int i = 1; i <= h0.GetNbinsX(); ++i) {
123 const Double_t x = h0.GetBinCenter (i);
124 const Double_t y0 = h0.GetBinContent(i);
125 const Double_t y1 = h1.GetBinContent(i);
127 DEBUG(
"[" << setw(3) << i <<
"]" <<
' '
128 <<
FIXED(5,3) << x <<
' '
129 <<
FIXED(6,4) << y0 <<
' '
130 <<
FIXED(6,4) << y1 << endl);
132 ASSERT(fabs(y0 - y1) < precision);
Utility class to parse command line options.
*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
then for HISTOGRAM in h0 h1
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary data structure for floating point format specification.
#define ASSERT(A,...)
Assert macro.
I/O formatting auxiliaries.
#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.
#define DEBUG(A)
Message macros.
int main(int argc, char *argv[])