30 JPMTParametersMap parametersMap;
39 JParser<> zap(
"Example program to histogram charge distributions.");
43 zap[
'p'] =
make_field(pmt) = JPMTIdentifier(1,0);
52 catch(
const exception &error) {
53 FATAL(error.what() << endl);
56 const JPMTParameters
parameters = parametersMap.getPMTParameters(pmt);
58 const JPMTAnalogueSignalProcessor cpu (
parameters);
65 const double dQ = (cpu.threshold - cpu.thresholdBand) / 5.5;
66 const double Qmin = 0.0 - 0.5 * dQ;
67 const double Qmax = 10.0 + 0.5 * dQ;
68 const int nq = (int) ((Qmax - Qmin) / dQ);
70 TH1D h0(
"h0", NULL, nq, Qmin, Qmax);
71 TH1D
h1(
"h1", NULL, nq, Qmin, Qmax);
75 for (
int i=1; i <= h0.GetNbinsX(); ++i) {
77 const double npe = h0.GetBinCenter(i);
78 const double p = cpu.getChargeProbability(npe,NPE);
80 h0.SetBinContent(i,p);
84 if (numberOfHits > 0) {
86 int number_of_hits = 0;
88 for (
int i=0; i != numberOfHits; ++i) {
90 const double npe = cpu.getRandomCharge(NPE);
94 if (cpu.applyThreshold(npe) > cpu.BELOW_THRESHOLDBAND) {
101 }
catch (
const JValueOutOfRange& exception) {
103 DEBUG(exception.what());
109 h1.Scale(1.0 / (
double) number_of_hits / dQ);
116 for (
int i = 1; i <= h0.GetNbinsX(); ++i) {
118 const Double_t
x = h0.GetBinCenter (i);
119 const Double_t y0 = h0.GetBinContent(i);
120 const Double_t y1 =
h1.GetBinContent(i);
122 DEBUG(
"[" << setw(3) << i <<
"]" <<
' '
123 <<
FIXED(5,3) << x <<
' '
124 <<
FIXED(6,4) << y0 <<
' '
125 <<
FIXED(6,4) << y1 << endl);
127 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.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG