19 const char nc_enabled =
'A';
20 const char nc_no_energy_loss =
'C';
21 const char nc_no_scattering =
'D';
22 const char nc_disabled =
'E';
23 const char nc_absorption =
'F';
33 int 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;
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);
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) {
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) {
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;
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];
Utility class to parse command line options.
static const double R_EARTH_KM
Geophysics constants.
int main(int argc, char *argv[])
static const JNCnu nc_nu
Function object for neutral current neutrino cross section [cm^2] as a function of neutrino energy [G...
then usage $script< input file >[option[primary[working directory]]] nWhere option can be E
static const double AVOGADRO
Avogadro's number [gr^-1].
Long64_t counter_type
Type definition for counter.
Auxiliary data structure for floating point format specification.
static const JCCnubar cc_nubar
Function object for charged current anti-neutrino cross section [cm^2] as a function of neutrino ener...
static const double MASS_NEUTRON
neutron mass [GeV]
static const JNCnubar nc_nubar
Function object for neutral current anti-neutrino cross section [cm^2] as a function of neutrino ener...
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
static const double PI
Mathematical constants.
static const JCCnu cc_nu
Function object for charged current neutrino cross section [cm^2] as a function of neutrino energy [G...
General purpose messaging.
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
Utility class to parse command line options.
static const double MASS_PROTON
proton mass [GeV]
Auxiliary data structure for floating point format specification.
static const double DENSITY_EARTH
Average density of the Earth [gr/cm³].
#define DEBUG(A)
Message macros.