8 #include <CLHEP/Random/RandomEngine.h>
9 #include <CLHEP/Random/JamesRandom.h>
31 CLHEP::HepRandomEngine *rnd,
32 bool TIFOnly_constant,
33 bool TIFOnly_linear) {
54 cmin_in = -TMath::Cos(thetamin_in);
55 cmax_in = -TMath::Cos(thetamax_in);
70 if (pmin_in < pmin_min || pmin_in >
pmin_max) {
71 std::cout <<
" >>> CMSCGEN.initialize <<< warning: illegal pmin_in =" << pmin_in;
73 }
else if (pmax_in >
pmax) {
74 std::cout <<
" >>> CMSCGEN.initialize <<< warning: illegal pmax_in =" << pmax_in;
84 if (cmax_in < cmax_min || cmax_in >
cmax_max) {
85 std::cout <<
" >>> CMSCGEN.initialize <<< warning: illegal cmax_in =" <<
cmax_in;
153 double integral_here, integral_ref;
158 for (
int k = 1;
k <= 100;
k++) {
174 c_cut = -0.42 + L * 0.35;
180 b0 * (c_cut -
c1) +
b1 / 2. * (c_cut * c_cut -
c1 *
c1) +
b2 / 3. * (c_cut * c_cut * c_cut - c1 * c1 *
c1);
185 integral_here =
b0 * (c_cut -
cmin) +
b1 / 2. * (c_cut * c_cut -
cmin *
cmin) +
186 b2 / 3. * (c_cut * c_cut * c_cut - cmin * cmin *
cmin);
188 corr[
k] = integral_here / integral_ref;
190 s = (((((((
pe[8] * L +
pe[7]) * L +
pe[6]) * L +
pe[5]) * L +
pe[4]) * L +
pe[3]) * L +
pe[2]) * L +
pe[1]) * L +
210 std::cout <<
" >>> CMSCGEN.initialize <<< "
211 <<
" Integrated flux = " <<
integrated_flux <<
" /m**2/s " << std::endl;
218 ce = (((((((
pe[8] * 2. +
pe[7]) * 2. +
pe[6]) * 2. +
pe[5]) * 2. +
pe[4]) * 2. +
pe[3]) * 2. +
pe[2]) * 2. +
pe[1]) *
226 for (
int k = 0;
k < 9;
k++) {
240 bool TIFOnly_constant,
241 bool TIFOnly_linear) {
242 CLHEP::HepRandomEngine *rnd =
new CLHEP::HepJamesRandom;
244 rnd->setSeed(RanSeed, 0);
246 return initialize(pmin_in, pmax_in, thetamin_in, thetamax_in, rnd, TIFOnly_constant, TIFOnly_linear);
251 std::cout <<
" >>> CMSCGEN <<< warning: not initialized" << std::endl;
270 double xe,
e, ce,
L,
L2;
285 if ((1. /
sqrt(xe) < 3) &&
292 ce = (((((((
pe[8] * L +
pe[7]) * L +
pe[6]) * L +
pe[5]) * L +
pe[4]) * L +
pe[3]) * L +
pe[2]) * L +
pe[1]) * L +
300 if (r2 < (e * e * e * ce / (
cemax * 3. * 3. * 3.)))
303 }
else if ((1. /
sqrt(xe) < 3) &&
310 ce = (((((((
pe[8] * L +
pe[7]) * L +
pe[6]) * L +
pe[5]) * L +
pe[4]) * L +
pe[3]) * L +
pe[2]) * L +
pe[1]) * L +
318 if (r2 < (e * e * e * e * ce / (
cemax * 3. * 3. * 3. * 3.)))
327 ce = (((((((
pe[8] * L +
pe[7]) * L +
pe[6]) * L +
pe[5]) * L +
pe[4]) * L +
pe[3]) * L +
pe[2]) * L +
pe[1]) * L +
392 c_max = -0.5 *
b1 /
b2;
399 z_max =
b0 +
b1 * c_max +
b2 * c_max * c_max;
402 double c_cut = -0.42 + L * 0.35;
426 std::cout <<
" >>> CMSCGEN <<< warning: not initialized" << std::endl;
436 std::cout <<
" >>> CMSCGEN <<< warning: not initialized" << std::endl;
445 std::cout <<
" >>> CMSCGEN <<< warning: not initialized" << std::endl;
459 CLHEP::HepRandomEngine *rnd) {
476 cmin = TMath::Cos(thetamin_in);
477 cmax = TMath::Cos(thetamax_in);
478 enumin = (Enumin_in < 10.) ? 10. : Enumin_in;
487 for (
int i = 0;
i < trials; ++
i) {
507 std::cout <<
"CMSCGEN::initializeNuMu: After " << trials <<
" trials:" << std::endl;
518 std::cout <<
" >>> CMSCGEN.initializeNuMu <<< "
519 <<
" Integrated flux = " <<
integrated_flux <<
" units??? " << std::endl;
536 CLHEP::HepRandomEngine *rnd =
new CLHEP::HepJamesRandom;
538 rnd->setSeed(RanSeed, 0);
541 pmin_in, pmax_in, thetamin_in, thetamax_in, Enumin_in, Enumax_in, Phimin_in, Phimax_in, ProdAlt_in, rnd);
545 double cthetaNu = 1. + ctheta;
547 double costhetas =
cos(thetas);
549 0.0286 *
pow(Enu, -2.7) *
550 (1. / (1. + (6. * Enu * costhetas) / 115.) + 0.213 / (1. + (1.44 * Enu * costhetas) / 850.));
552 (Enu - Emu +
AR / 3 * (Enu * Enu * Enu - Emu * Emu * Emu) / (Enu * Enu));
558 std::cout <<
" >>> CMSCGEN <<< warning: not initialized" << std::endl;
Sin< T >::type sin(const T &t)
CLHEP::HepRandomEngine * RanGen2
int initialize(double, double, double, double, CLHEP::HepRandomEngine *, bool, bool)
void setRandomEngine(CLHEP::HepRandomEngine *v)
const double SurfaceOfEarth
Cos< T >::type cos(const T &t)
double momentum_times_charge()
double dNdEmudEnu(double Enu, double Emu, double theta)
int initializeNuMu(double, double, double, double, double, double, double, double, double, CLHEP::HepRandomEngine *)
Power< A, B >::type pow(const A &a, const B &b)