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 DIAMETER_EARTH_KM = 12724.0;
80 const double DENSITY_EARTH = 5.5;
81 const double R_SOURCE_M = 40000.0;
82 const double R_TARGET_M = 500.0;
83 const double EMIN_GEV = 10.0;
86 const double Zmin = 0.0;
87 const double Zmax = DIAMETER_EARTH_KM * 1.0e3;
95 const JCrossSection* sigma[
N] = { NULL };
102 101, -R_SOURCE_M, +R_SOURCE_M,
103 101, -R_SOURCE_M, +R_SOURCE_M);
106 101, -R_SOURCE_M, +R_SOURCE_M,
107 101, -R_SOURCE_M, +R_SOURCE_M);
109 TH1D hn(
"hn", NULL, 11, -0.5, 10.5);
111 TH1D ha(
"ha", NULL, 100, 0.0, 1.0);
112 TH1D hb(
"hb", NULL, 100, 0.0, 1.0);
121 if (
count%10000 == 0) {
125 const bool neutrino = (
count%2 == 0);
135 const double r2 = gRandom->Uniform(0.0, R_SOURCE_M * R_SOURCE_M);
136 const double r1 = sqrt(r2);
137 const double phi = gRandom->Uniform(-
PI, +
PI);
141 double x = r1 * cos(phi);
142 double y = r1 * sin(phi);
150 const int i1 = (sqrt(x*x + y*y) <= R_TARGET_M ? 0 : 1);
154 while (ni[CC] == 0 && E > EMIN_GEV) {
159 for (
int i = 0; i !=
N; ++i) {
160 ls += li[i] = 1.0e+2 * (*sigma[i])(E) * DENSITY_EARTH *
AVOGADRO;
163 double dz = gRandom->Exp(1.0) / ls;
171 if (option != nc_disabled && option != nc_no_scattering) {
183 double y = gRandom->Uniform(ls);
185 if ((y-= li[CC]) < 0.0) {
192 if ((y-= li[NC]) < 0.0) {
196 if (option == nc_absorption) {
203 double ET = 0.5 * sqrt(s) * gRandom->Uniform(0.0, 1.0);
204 double phi = gRandom->Uniform(-
PI, +
PI);
206 double By = gRandom->Uniform(0.0, 1.0);
209 while (gRandom->Rndm() > (1.0 - By) * (1.0 - By)) {
210 By = gRandom->Uniform(0.0, 1.0);
214 if (option == nc_disabled || option == nc_no_scattering) {
219 if (option == nc_disabled || option == nc_no_energy_loss) {
228 Tx = ET * cos(phi) /
E;
229 Ty = ET * sin(phi) /
E;
236 hn.Fill((
double) ni[NC]);
241 if (z >= Zmax && sqrt(x*x + y*y) <= R_TARGET_M) {
243 number_of_events[i1][0] += 1;
246 number_of_events[i1][1] += 1;
254 const double n00 = number_of_events[0][0];
255 const double n10 = number_of_events[1][0];
256 const double n01 = number_of_events[0][1];
258 if (option == nc_enabled) {
259 cout <<
" " <<
SCIENTIFIC(7,1) << E_GeV << flush;
262 cout <<
" & " <<
FIXED(7,0) << n00 << flush;
264 if (option != nc_disabled && option != nc_no_scattering) {
265 cout <<
" & " <<
FIXED(7,0) << n10 << flush;
267 if (option == nc_enabled) {
268 cout <<
" & " <<
FIXED(7,0) << n01 <<
" & " <<
FIXED(5,2) << (n00 + n10) / n01 << flush;
270 if (option == nc_disabled) {
271 cout <<
" \\\\" << endl;
276 cout <<
' ' << setw(8) << right <<
"inside" <<
' ' << setw(8) << right <<
"outside" << endl;
278 for (
int row = 0; row !=
N; ++row) {
279 for (
int col = 0; col !=
N; ++col) {
280 cout <<
' ' << setw(8) << number_of_events[row][col];
Utility class to parse command line options.
static const JNCnu nc_nu
Function object for neutral current neutrino cross section [cm^2] as a function of neutrino energy [G...
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
#define MAKE_CSTRING(A)
Make C-string.
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...
static const double MASS_PROTON
proton mass [GeV]
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
Auxiliary data structure for floating point format specification.