8 #include <CLHEP/Random/RandomEngine.h> 9 #include <CLHEP/Random/JamesRandom.h> 30 int CMSCGEN::initialize(
double pmin_in,
double pmax_in,
double thetamin_in,
double thetamax_in, CLHEP::HepRandomEngine *rnd,
bool TIFOnly_constant,
bool TIFOnly_linear)
53 cmin_in = - TMath::Cos(thetamin_in);
54 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;
85 if(cmax_in < cmax_min || cmax_in >
cmax_max)
87 std::cout <<
" >>> CMSCGEN.initialize <<< warning: illegal cmax_in =" <<
cmax_in;
157 double integral_here, integral_ref;
162 for(
int k=1;
k<=100;
k++)
179 c_cut = -0.42 + L*0.35;
181 if (c_cut >
c2) c_cut =
c2;
183 integral_ref =
b0 * (c_cut -
c1)
184 +
b1/2. * (c_cut*c_cut -
c1*
c1)
185 +
b2/3. * (c_cut*c_cut*c_cut - c1*c1*
c1);
189 integral_here =
b0 * (c_cut -
cmin)
191 +
b2/3. * (c_cut*c_cut*c_cut - cmin*cmin*
cmin);
193 corr[
k] = integral_here/integral_ref;
222 std::cout <<
" >>> CMSCGEN.initialize <<< " <<
223 " Integrated flux = " << integrated_flux <<
" /m**2/s " << std::endl;
244 for (
int k=0;
k<9;
k++)
254 int CMSCGEN::initialize(
double pmin_in,
double pmax_in,
double thetamin_in,
double thetamax_in,
int RanSeed,
bool TIFOnly_constant,
bool TIFOnly_linear)
256 CLHEP::HepRandomEngine *rnd =
new CLHEP::HepJamesRandom;
258 rnd->setSeed(RanSeed, 0);
260 return initialize(pmin_in, pmax_in, thetamin_in, thetamax_in, rnd, TIFOnly_constant, TIFOnly_linear);
268 std::cout <<
" >>> CMSCGEN <<< warning: not initialized" << std::endl;
287 double xe,
e, ce,
L, L2;
324 if(r2 < ( e*e*e*ce/(
cemax*3.*3.*3.) ))
break;
347 if(r2 < ( e*e*e*e*ce/(
cemax*3.*3.*3.*3.) ))
break;
369 if(
cemax*r2 < ce)
break;
383 if(r3 < 0.439) charg=-1.;
425 c_max = - 0.5 *
b1/
b2;
426 if(c_max < -1.) c_max = -1.;
427 if(c_max > -0.1) c_max = -0.1;
430 z_max =
b0 +
b1 * c_max +
b2 * c_max * c_max;
433 double c_cut = -0.42 + L*0.35;
446 if (z > z_max*r2)
break;
463 std::cout <<
" >>> CMSCGEN <<< warning: not initialized" << std::endl;
479 std::cout <<
" >>> CMSCGEN <<< warning: not initialized" << std::endl;
494 std::cout <<
" >>> CMSCGEN <<< warning: not initialized" << std::endl;
502 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)
521 cmin = TMath::Cos(thetamin_in);
522 cmax = TMath::Cos(thetamax_in);
523 enumin = (Enumin_in < 10.) ? 10. : Enumin_in;
533 for (
int i=0;
i<trials; ++
i) {
553 std::cout <<
"CMSCGEN::initializeNuMu: After " << trials <<
" trials:" << std::endl;
564 std::cout <<
" >>> CMSCGEN.initializeNuMu <<< " <<
574 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)
576 CLHEP::HepRandomEngine *rnd =
new CLHEP::HepJamesRandom;
578 rnd->setSeed(RanSeed, 0);
580 return initializeNuMu(pmin_in, pmax_in, thetamin_in, thetamax_in, Enumin_in, Enumax_in, Phimin_in, Phimax_in, ProdAlt_in, rnd);
585 double cthetaNu = 1. + ctheta;
587 double costhetas =
cos(thetas);
588 double dNdEnudW = 0.0286*
pow(Enu,-2.7)*(1./(1.+(6.*Enu*costhetas)/115.)+0.213/(1.+(1.44*Enu*costhetas)/850.));
590 (Enu-Emu+
AR/3*(Enu*Enu*Enu-Emu*Emu*Emu)/(Enu*Enu));
598 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)