33int main(
int argc, 
char* argv[])
 
   49    JParser<> zap(
"Mickey-mouse program to propagate neutrinos through the Earth.");
 
   52    zap[
'E'] = 
make_field(E_GeV,              
"neutrino energy at source");
 
   53    zap[
'n'] = 
make_field(numberOfEvents,     
"number of generated events");
 
   56                          << nc_enabled        << 
" -> " << 
"Neutral-current interactions as simulated."                       << endl
 
   57                          << nc_no_energy_loss << 
" -> " << 
"Neutral-current interactions with Bjorken-Y set to zero."         << endl
 
   58                          << nc_no_scattering  << 
" -> " << 
"Neutral-current interactions with transverse energy set to zero." << endl
 
   59                          << nc_disabled       << 
" -> " << 
"Neutral-current interactions which have no effect."               << endl
 
   60                          << nc_absorption     << 
" -> " << 
"Neutral-current interactions lead to absorption."                 << endl) =
 
   71  catch(
const exception &error) {
 
   72    FATAL(error.what() << endl);
 
   76  gRandom->SetSeed(seed);
 
   79  const double R_SOURCE_M         =  40000.0;                 
 
   80  const double R_TARGET_M         =    500.0;                 
 
   81  const double EMIN_GEV           =     10.0;                 
 
   84  const double Zmin = 0.0;                                    
 
   85  const double Zmax = R_EARTH_KM * 2.0e3;                     
 
   93  const JCrossSection* sigma[N] = { NULL };                   
 
  100          101, -R_SOURCE_M, +R_SOURCE_M,
 
  101          101, -R_SOURCE_M, +R_SOURCE_M);
 
  104          101, -R_SOURCE_M, +R_SOURCE_M,
 
  105          101, -R_SOURCE_M, +R_SOURCE_M);
 
  107  TH1D hn(
"hn", NULL, 11, -0.5, 10.5);
 
  109  TH1D ha(
"ha", NULL, 100, 0.0, 1.0);
 
  110  TH1D hb(
"hb", NULL, 100, 0.0, 1.0);
 
  117  for (
counter_type count = 0; count != numberOfEvents; ++count) {
 
  119    if (count%10000 == 0) {
 
  120      STATUS(
"event " << setw(9) << count << 
'\r'); 
DEBUG(endl);
 
  123    const bool neutrino = (count%2 == 0);                     
 
  129      sigma[CC] = &cc_nubar;
 
  130      sigma[NC] = &nc_nubar;
 
  133    const double r2  = gRandom->Uniform(0.0, R_SOURCE_M * R_SOURCE_M);
 
  134    const double r1  = sqrt(r2);
 
  135    const double phi = gRandom->Uniform(-PI, +PI);
 
  139    double x  = r1 * cos(phi);
 
  140    double y  = r1 * sin(phi);
 
  148    const int i1 = (sqrt(x*x + y*y) <= R_TARGET_M ? 0 : 1);   
 
  152    while (ni[CC] == 0 && E > EMIN_GEV) {
 
  157      for (
int i = 0; i != N; ++i) {
 
  158        ls += li[i] = 1.0e+2 * (*sigma[i])(E) * DENSITY_EARTH * AVOGADRO;
 
  161      double dz = gRandom->Exp(1.0) / 
ls;
 
  169      if (option != nc_disabled && option != nc_no_scattering) {
 
  181        double y = gRandom->Uniform(
ls);
 
  183        if ((y-= li[CC]) < 0.0) {                             
 
  190        if ((y-= li[NC]) < 0.0) {                             
 
  194          if (option == nc_absorption) {
 
  200          double s   = E * (MASS_PROTON + MASS_NEUTRON);
 
  201          double ET  = 0.5 * sqrt(s) * gRandom->Uniform(0.0, 1.0);
 
  202          double phi = gRandom->Uniform(-PI, +PI);
 
  204          double By  = gRandom->Uniform(0.0, 1.0);
 
  207            while (gRandom->Rndm() > (1.0 - By) * (1.0 - By)) {
 
  208              By  = gRandom->Uniform(0.0, 1.0);
 
  212          if (option == nc_disabled || option == nc_no_scattering) {
 
  217          if (option == nc_disabled || option == nc_no_energy_loss) {
 
  226          Tx = ET * cos(phi) / E;
 
  227          Ty = ET * sin(phi) / E;
 
  234      hn.Fill((
double) ni[NC]);
 
  239    if (z >= Zmax && sqrt(x*x + y*y) <= R_TARGET_M) {         
 
  241      number_of_events[i1][0] += 1;                           
 
  244        number_of_events[i1][1] += 1;                         
 
  252  const double n00 = number_of_events[0][0];                  
 
  253  const double n10 = number_of_events[1][0];                  
 
  254  const double n01 = number_of_events[0][1];                  
 
  256  if (option == nc_enabled) {
 
  257    cout << 
" " << 
SCIENTIFIC(7,1) << E_GeV << flush; 
 
  260    cout << 
" & " << 
FIXED(7,0) << n00 << flush;
 
  262  if (option != nc_disabled && option != nc_no_scattering) {
 
  263    cout << 
" & " << 
FIXED(7,0) << n10 << flush;
 
  265  if (option == nc_enabled) {
 
  266    cout << 
" & " << 
FIXED(7,0) << n01 << 
" & " << 
FIXED(5,2) << (n00 + n10) / n01 << flush;
 
  268  if (option == nc_disabled) {
 
  269    cout << 
"  \\\\" << endl;
 
  272  if (
debug >= status_t) {
 
  274    cout << 
' ' << setw(8) << right << 
"inside"  << 
' ' << setw(8) << right << 
"outside" << endl;
 
  276    for (
int row = 0; row != N; ++row) {
 
  277      for (
int col = 0; col != N; ++col) {
 
  278        cout << 
' ' << setw(8) << number_of_events[row][col];