27 int main(
int argc, 
char **argv)
 
   33   JPMTParametersMap parametersMap;
 
   42     JParser<> zap(
"Example program to histogram charge distributions.");
 
   46     zap[
'p'] = 
make_field(pmt)              = JPMTIdentifier(1,0);
 
   55   catch(
const exception &error) {
 
   56     FATAL(error.what() << endl);
 
   59   const JPMTParameters 
parameters = parametersMap.getPMTParameters(pmt);
 
   65     const double dx   = JPMTSignalProcessorInterface::getQmin();
 
   66     const double xmin = 0.0  -  0.5*dx;
 
   67     const int    nx   = (int) ((10.0 - xmin) / dx);
 
   69     H0[1] = 
new TH1D(
"1.0", NULL, nx, xmin, xmin + nx * dx);
 
   70     H1[1] = 
new TH1D(
"1.1", NULL, nx, xmin, xmin + nx * dx);
 
   73     const double dx   = 0.02;
 
   75     const int    nx   = (int) ((10.0 - xmin) / dx);
 
   77     H0[2] = 
new TH1D(
"2.0", NULL, nx, xmin, xmin + nx * dx);
 
   78     H1[2] = 
new TH1D(
"2.1", NULL, nx, xmin, xmin + nx * dx);
 
   86   for (JPMTSignalProcessorInterface* cpu : {
 
   87       (JPMTSignalProcessorInterface*) 
new JPMTSignalProcessorInterface(),
 
   88       (JPMTSignalProcessorInterface*) 
new JPMTAnalogueSignalProcessor(
parameters)
 
   91     for (
int i=1; 
i <= H0[test]->GetNbinsX(); ++
i) {
 
   93       const double npe = H0[test]->GetBinCenter(
i);
 
   94       const double p   = cpu->getChargeProbability(npe,NPE);
 
   96       H0[test]->SetBinContent(
i,p);
 
   99     if (numberOfHits > 0) {
 
  101       int number_of_hits = 0;
 
  103       for (
int i = 0; 
i != numberOfHits; ++
i) {
 
  105         const double npe = cpu->getRandomCharge(NPE);
 
  109           if (cpu->applyThreshold(npe)) {
 
  116         } 
catch (
const JValueOutOfRange& exception) {
 
  118           DEBUG(exception.what());
 
  123       const double dx = (H1[test]->GetXaxis()->GetXmax() - H1[test]->GetXaxis()->GetXmin()) / H1[test]->GetXaxis()->GetNbins();
 
  125       H1[test]->Scale(1.0 / (
double) number_of_hits / dx);
 
  135   for (
auto& 
i : H0) { out << *
i.second; }
 
  136   for (
auto& 
i : H1) { out << *
i.second; }
 
  145   for (
int i = 1; 
i != test; ++
i) {
 
  147     DEBUG(
"Test " << 
i << endl);
 
  149     for (
int ix = 1; ix <= H0[
i]->GetNbinsX(); ++ix) {
 
  151       const Double_t 
x  = H0[
i]->GetBinCenter (ix);
 
  152       const Double_t y0 = H0[
i]->GetBinContent(ix);
 
  153       const Double_t y1 = H1[
i]->GetBinContent(ix);
 
  155       DEBUG(
"[" << setw(3) << ix << 
"]"  << 
' '  
  156             << 
FIXED(5,3) << x  << 
' ' 
  157             << 
FIXED(6,4) << y0 << 
' ' 
  158             << 
FIXED(6,4) << y1 << endl);
 
  160       ASSERT(fabs(y0 - y1) < precision);
 
Utility class to parse command line options. 
 
int main(int argc, char *argv[])
 
*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
 
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.