35 int main(
int argc, 
char **argv)
 
   40   typedef JAbstractHistogram<double> JHistogram_t;
 
   49   JHistogram_t   histogram;
 
   54     JParser<> zap(
"Program to verify generation of arrival times of Cherenkov photons from a shower using tabulated CDF.");
 
   58     zap[
'E'] = 
make_field(
E,         
"muon energy [GeV]")          = 1.0;
 
   60     zap[
'c'] = 
make_field(cd,        
"cosine emission angle");
 
   61     zap[
'D'] = 
make_field(dir,       
"(theta, phi) of PMT [rad]");
 
   63     zap[
'H'] = 
make_field(histogram, 
"histogram binning")          = JHistogram_t();
 
   68   catch(
const exception& error) {
 
   69     FATAL(error.what() << endl);
 
   73   typedef JHermiteSplineFunction1D_t                              JFunction1D_t;
 
   76   typedef JMAPLIST<JPolint1FunctionalMap,
 
   77                    JPolint1FunctionalMap,
 
   78                    JPolint1FunctionalGridMap,
 
   79                    JPolint1FunctionalGridMap>::maplist            JMapList_t;
 
   80   typedef JCDFTable<JFunction1D_t, JMapList_t>                    JCDF_t;
 
   82   const int N = inputFile.size();
 
   88     for (
int i = 0; 
i != 
N; ++
i) {
 
   90       NOTICE(
"loading input from file " << inputFile[
i] << 
"... " << flush);
 
   92       cdf [
i].load(inputFile[
i].c_str());
 
   97   catch(
const JException& error) {
 
   98     FATAL(error.what() << endl);
 
  108       cout << 
"> " << flush;
 
  113       for (
int i = 0; 
i != 
N; ++
i) {
 
  117           const double npe = 
cdf[
i].getNPE (
D, cd, dir.getTheta(), dir.getPhi()) * 
E;
 
  118           const double t   = 
cdf[
i].getTime(
D, cd, dir.getTheta(), dir.getPhi(), 
x);
 
  120           cout << 
' ' << 
FIXED(6,2) << t << 
' ' << 
FIXED(5,2) << npe;
 
  122         catch(
const exception& error) {
 
  123           ERROR(error.what() << endl);
 
  143   const double t0   =  0.0;                                   
 
  145   if (!histogram.is_valid()) {
 
  152       for ( ; x <  -10.0; x +=  5.0) { X.push_back(t0 + x); }
 
  153       for ( ; x <  +20.0; x +=  1.0) { X.push_back(t0 + x); }
 
  154       for ( ; x <  +50.0; x +=  2.0) { X.push_back(t0 + x); }
 
  157       for ( ; x < +100.0; x +=  5.0) { X.push_back(t0 + x); }
 
  158       for ( ; x < +250.0; x += 10.0) { X.push_back(t0 + x); }
 
  159       for ( ; x < +500.0; x += 25.0) { X.push_back(t0 + x); }
 
  160       for ( ; x < +900.0; x += 50.0) { X.push_back(t0 + x); }
 
  163     h0 = 
new TH1D(
"h0", NULL,  X.size() - 1, X.data());
 
  167     h0 = 
new TH1D(
"h0", NULL, histogram.getNumberOfBins(), histogram.getLowerLimit(), histogram.getUpperLimit());
 
  172   JManager<int, TH1D> H1(
new TH1D(
"h1[%]", NULL, 100000, 0.0, +1.0));
 
  174   for (
int i = 0; 
i != 
N; ++
i) {
 
  176     for (
int j = 1; 
j <= H1->GetNbinsX(); ++
j) {
 
  180         const double x = H1->GetBinCenter(
j);
 
  181         const double t = 
cdf[
i].getTime(
D, cd, dir.getTheta(), dir.getPhi(), 
x);
 
  183         H1[
i]->SetBinContent(
j, t);
 
  185       catch(
const exception& error) {
 
  186         ERROR(error.what() << endl);
 
  191   if (numberOfEvents > 0) {
 
  197     for (
int counter = 0; counter != numberOfEvents; ++counter) {
 
  199       if (counter%1000== 0) { 
 
  205       for (
int i = 0; 
i != 
N; ++
i) {
 
  209           const double npe = 
cdf[
i].getNPE(
D, cd, dir.getTheta(), dir.getPhi()) * 
E;
 
  211           for (
int j = gRandom->Poisson(npe); 
j != 0; --
j) {
 
  213             const double x = gRandom->Rndm();
 
  214             const double t = 
cdf[
i].getTime(
D, cd, dir.getTheta(), dir.getPhi(), 
x);
 
  219         catch(
const exception& error) {
 
  220           NOTICE(error.what() << endl);
 
  228     const double W = 1.0 / (double) numberOfEvents;
 
  231       timer.print(cout, W);
 
Utility class to parse command line options. 
 
int main(int argc, char *argv[])
 
then usage $script< input file >[option[primary[working directory]]] nWhere option can be E
 
Dynamic ROOT object management. 
 
Auxiliary data structure for floating point format specification. 
 
Various implementations of functional maps. 
 
Numbering scheme for PDF types. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
void convertToPDF(TH1 &h1, const std::string &option="NW", const double factor=1.0)
Convert 1D histogram to PDF. 
 
direct light from EM shower 
 
General purpose messaging. 
 
then for FUNCTION in pdf npe cdf
 
int getPDFType(const std::string &file_name)
Get PDF type. 
 
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
 
Utility class to parse command line options. 
 
no fit printf nominal n $STRING awk v X
 
do echo Generating $dir eval D
 
#define DEBUG(A)
Message macros.