38   typedef JAbstractHistogram<double> JHistogram_t;
 
   46   JHistogram_t  histogram;
 
   51     JParser<> zap(
"Program to verify generation of arrival times of Cherenkov photons from a muon using tabulated CDF.");
 
   55     zap[
'E'] = 
make_field(
E,         
"muon energy [GeV]")          = 1.0;
 
   56     zap[
'R'] = 
make_field(
R,         
"distance of approach [m]");
 
   57     zap[
'D'] = 
make_field(dir,       
"(theta, phi) of PMT [rad]");
 
   59     zap[
'H'] = 
make_field(histogram, 
"histogram binning")          = JHistogram_t();
 
   64   catch(
const exception& error) {
 
   65     FATAL(error.what() << endl);
 
   69   typedef JSplineFunction1D_t                                     JFunction1D_t;
 
   71   typedef JMAPLIST<JPolint1FunctionalMap,
 
   72                    JPolint1FunctionalGridMap,
 
   73                    JPolint1FunctionalGridMap>::maplist            JMapList_t;
 
   74   typedef JCDFTable<JFunction1D_t, JMapList_t>                    JCDF_t;
 
   81     NOTICE(
"loading input from file " << inputFile << 
"... " << flush);
 
   83     cdf.load(inputFile.c_str());
 
   87   catch(
const JException& error) {
 
   88     FATAL(error.what() << endl);
 
   98       cout << 
"> " << flush;
 
  103         const double npe = 
cdf.getNPE (
R, dir.getTheta(), dir.getPhi()) * 
E;        
 
  104         const double t   = 
cdf.getTime(
R, dir.getTheta(), dir.getPhi(), 
x);
 
  106         cout << 
" --> " << t << 
' ' << npe;
 
  108       catch(
const exception& error) {
 
  109         ERROR(error.what() << endl);
 
  128     const double t0   =  0.0;                                   
 
  130     if (!histogram.is_valid()) {
 
  134         histogram = JHistogram_t(t0 - 20.0, t0 + 50.0);
 
  136         histogram.setBinWidth(0.1);
 
  140         histogram = JHistogram_t(t0 - 20.0, t0 + 500.0);
 
  142         histogram.setBinWidth(0.5);
 
  146     TH1D h0(
"h0", NULL, histogram.getNumberOfBins(), histogram.getLowerLimit(), histogram.getUpperLimit());
 
  147     TH1D 
h1(
"h1", NULL, 100000, 0.0, +1.0);
 
  151     for (
int j = 1; 
j <= 
h1.GetNbinsX(); ++
j) {
 
  155         const double x = 
h1.GetBinCenter(
j);
 
  156         const double t = 
cdf.getTime(
R, dir.getTheta(), dir.getPhi(), 
x);
 
  158         h1.SetBinContent(
j, t);
 
  160       catch(
const exception& error) {
 
  161         ERROR(error.what() << endl);
 
  165     if (numberOfEvents > 0) {
 
  172       for (
int i = 0; i != numberOfEvents; ++i) {
 
  174         if (i%1000== 0) { 
NOTICE(i << 
'\r'); }
 
  180           const double npe = 
cdf.getNPE(
R, dir.getTheta(), dir.getPhi()) * 
E;
 
  182           for (
int j = gRandom->Poisson(npe); 
j != 0; --
j) {
 
  184             const double x = gRandom->Rndm();
 
  185             const double t = 
cdf.getTime(
R, dir.getTheta(), dir.getPhi(), 
x);
 
  190         catch(
const exception& error) {
 
  191           NOTICE(error.what() << endl);
 
  198       const double w = 1.0 / (double) numberOfEvents;
 
  201         timer.print(cout, w);
 
  206       for (
int j = 1; 
j <= h0.GetNbinsX(); ++
j) {
 
  208         const double y  = h0.GetBinContent(
j);
 
  209         const double z  = h0.GetBinError  (
j);
 
  210         const double dx = h0.GetBinWidth  (
j);
 
  212         h0.SetBinContent(
j, y / (dx*numberOfEvents*
E));
 
  213         h0.SetBinError  (
j, z / (dx*numberOfEvents*E));
 
Utility class to parse command line options. 
std::string getLabel(const JLocation &location)
Get module label for monitoring and other applications. 
then for HISTOGRAM in h0 h1
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
then usage $script[distance] fi case set_variable R
then for FUNCTION in pdf npe cdf