8 #include <CLHEP/Random/RandomEngine.h>
9 #include <CLHEP/Random/JamesRandom.h>
23 int CMSCGEN::initialize(
double pmin_in,
double pmax_in,
double thetamin_in,
double thetamax_in, CLHEP::HepRandomEngine *rnd,
bool TIFOnly_constant,
bool TIFOnly_linear)
46 cmin_in = - TMath::Cos(thetamin_in);
47 cmax_in = - TMath::Cos(thetamax_in);
63 if(pmin_in < pmin_min || pmin_in >
pmin_max){
64 std::cout <<
" >>> CMSCGEN.initialize <<< warning: illegal pmin_in =" << pmin_in;
66 }
else if(pmax_in >
pmax ){
67 std::cout <<
" >>> CMSCGEN.initialize <<< warning: illegal pmax_in =" << pmax_in;
78 if(cmax_in < cmax_min || cmax_in >
cmax_max)
80 std::cout <<
" >>> CMSCGEN.initialize <<< warning: illegal cmax_in =" <<
cmax_in;
150 double integral_here, integral_ref;
155 for(
int k=1;
k<=100;
k++)
172 c_cut = -0.42 + L*0.35;
174 if (c_cut >
c2) c_cut =
c2;
176 integral_ref =
b0 * (c_cut -
c1)
177 +
b1/2. * (c_cut*c_cut -
c1*
c1)
178 +
b2/3. * (c_cut*c_cut*c_cut - c1*c1*
c1);
182 integral_here =
b0 * (c_cut -
cmin)
184 +
b2/3. * (c_cut*c_cut*c_cut - cmin*cmin*
cmin);
186 corr[
k] = integral_here/integral_ref;
215 std::cout <<
" >>> CMSCGEN.initialize <<< " <<
237 for (
int k=0;
k<9;
k++)
247 int CMSCGEN::initialize(
double pmin_in,
double pmax_in,
double thetamin_in,
double thetamax_in,
int RanSeed,
bool TIFOnly_constant,
bool TIFOnly_linear)
249 CLHEP::HepRandomEngine *rnd =
new CLHEP::HepJamesRandom;
251 rnd->setSeed(RanSeed, 0);
253 return initialize(pmin_in, pmax_in, thetamin_in, thetamax_in, rnd, TIFOnly_constant, TIFOnly_linear);
261 std::cout <<
" >>> CMSCGEN <<< warning: not initialized" << std::endl;
280 double xe,
e, ce,
L, L2;
317 if(r2 < ( e*e*e*ce/(
cemax*3.*3.*3.) ))
break;
340 if(r2 < ( e*e*e*e*ce/(
cemax*3.*3.*3.*3.) ))
break;
362 if(
cemax*r2 < ce)
break;
376 if(r3 < 0.439) charg=-1.;
418 c_max = - 0.5 *
b1/
b2;
419 if(c_max < -1.) c_max = -1.;
420 if(c_max > -0.1) c_max = -0.1;
423 z_max =
b0 +
b1 * c_max +
b2 * c_max * c_max;
426 double c_cut = -0.42 + L*0.35;
439 if (z > z_max*r2)
break;
456 std::cout <<
" >>> CMSCGEN <<< warning: not initialized" << std::endl;
472 std::cout <<
" >>> CMSCGEN <<< warning: not initialized" << std::endl;
487 std::cout <<
" >>> CMSCGEN <<< warning: not initialized" << std::endl;
495 int CMSCGEN::initializeNuMu(
double pmin_in,
double pmax_in,
double thetamin_in,
double thetamax_in,
double Enumin_in,
double Enumax_in,
double Phimin_in,
double Phimax_in,
double ProdAlt_in, CLHEP::HepRandomEngine *rnd)
514 cmin = TMath::Cos(thetamin_in);
515 cmax = TMath::Cos(thetamax_in);
516 enumin = (Enumin_in < 10.) ? 10. : Enumin_in;
526 for (
int i=0;
i<trials; ++
i) {
546 std::cout <<
"CMSCGEN::initializeNuMu: After " << trials <<
" trials:" << std::endl;
557 std::cout <<
" >>> CMSCGEN.initializeNuMu <<< " <<
567 int CMSCGEN::initializeNuMu(
double pmin_in,
double pmax_in,
double thetamin_in,
double thetamax_in,
double Enumin_in,
double Enumax_in,
double Phimin_in,
double Phimax_in,
double ProdAlt_in,
int RanSeed)
569 CLHEP::HepRandomEngine *rnd =
new CLHEP::HepJamesRandom;
571 rnd->setSeed(RanSeed, 0);
573 return initializeNuMu(pmin_in, pmax_in, thetamin_in, thetamax_in, Enumin_in, Enumax_in, Phimin_in, Phimax_in, ProdAlt_in, rnd);
578 double cthetaNu = 1. + ctheta;
580 double costhetas =
cos(thetas);
581 double dNdEnudW = 0.0286*
pow(Enu,-2.7)*(1./(1.+(6.*Enu*costhetas)/115.)+0.213/(1.+(1.44*Enu*costhetas)/850.));
583 (Enu-Emu+
AR/3*(Enu*Enu*Enu-Emu*Emu*Emu)/(Enu*Enu));
591 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)
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)