36int main(
int argc, 
char **argv)
 
   54    JParser<> zap(
"Program to verify generation of arrival times of Cherenkov photons from a muon using tabulated CDF.");
 
   58    zap[
'E'] = 
make_field(E,         
"muon energy [GeV]")          = 1.0;
 
   59    zap[
'R'] = 
make_field(R,         
"distance of approach [m]");
 
   60    zap[
'D'] = 
make_field(dir,       
"(theta, phi) of PMT [rad]");
 
   67  catch(
const exception& error) {
 
   68    FATAL(error.what() << endl);
 
   80  const int N = inputFile.size();
 
   87    for (
int i = 0; i != N; ++i) {
 
   89      NOTICE(
"loading input from file " << inputFile[i] << 
"... " << flush);
 
   91      type[i] = getPDFType(inputFile[i]);
 
   93      cdf [i].load(inputFile[i].c_str());
 
   99    FATAL(error.what() << endl);
 
  109      cout << 
"> " << flush;
 
  114      for (
int i = 0; i != N; ++i) {
 
  121          if        (is_bremsstrahlung(type[i])) {
 
  123          } 
else if (is_deltarays(type[i])) {
 
  124            npe *= getDeltaRaysFromMuon(E);
 
  127          cout << 
' ' << 
FIXED(6,2) << t << 
' ' << 
FIXED(5,2) << npe;
 
  129        catch(
const exception& error) {
 
  130          ERROR(error.what() << endl);
 
  143  if (inputFile.size() == 1 && getPDFType(inputFile[0]) == DIRECT_LIGHT_FROM_MUON) {
 
  151  const double t0   =  0.0;                                   
 
  160      for ( ; x <  -10.0; x +=  5.0) { X.push_back(t0 + x); }
 
  161      for ( ; x <  +20.0; x +=  1.0) { X.push_back(t0 + x); }
 
  162      for ( ; x <  +50.0; x +=  2.0) { X.push_back(t0 + x); }
 
  165      for ( ; x < +100.0; x +=  5.0) { X.push_back(t0 + x); }
 
  166      for ( ; x < +250.0; x += 10.0) { X.push_back(t0 + x); }
 
  167      for ( ; x < +500.0; x += 25.0) { X.push_back(t0 + x); }
 
  168      for ( ; x < +900.0; x += 50.0) { X.push_back(t0 + x); }
 
  171    h0 = 
new TH1D(
"h0", NULL,  X.size() - 1, X.data());
 
  180  JManager<int, TH1D> H1(
new TH1D(
"h1[%]", NULL, 100000, 0.0, +1.0));
 
  182  for (
int i = 0; i != N; ++i) {
 
  184    for (
int j = 1; j <= H1->GetNbinsX(); ++j) {
 
  188        const double x = H1->GetBinCenter(j);
 
  189        const double t = cdf[i].getTime(R, dir.
getTheta(), dir.
getPhi(), x);
 
  191        H1[i]->SetBinContent(j, t);
 
  193      catch(
const exception& error) {
 
  194        ERROR(error.what() << endl);
 
  199  if (numberOfEvents > 0) {
 
  205    for (
int counter = 0; counter != numberOfEvents; ++counter) {
 
  207      if (counter%1000== 0) { 
 
  213      for (
int i = 0; i != N; ++i) {
 
  219          if        (is_bremsstrahlung(type[i])) {
 
  221          } 
else if (is_deltarays(type[i])) {
 
  222            npe *= getDeltaRaysFromMuon(E);
 
  225          for (
int j = gRandom->Poisson(npe); j != 0; --j) {
 
  227            const double x = gRandom->Rndm();
 
  228            const double t = cdf[i].getTime(R, dir.
getTheta(), dir.
getPhi(), x);
 
  233        catch(
const exception& error) {
 
  234          NOTICE(error.what() << endl);
 
  242    const double W = 1.0 / (double) numberOfEvents;
 
  245      timer.
print(cout, W);
 
  248    convertToPDF(*h0, 
"WE", W);