CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Attributes
CMSCGEN Class Reference

#include <CMSCGEN.h>

Public Member Functions

 CMSCGEN ()
 
double cos_theta ()
 
double dNdEmudEnu (double Enu, double Emu, double theta)
 
double flux ()
 
int generate ()
 
int generateNuMu ()
 
int initialize (double, double, double, double, CLHEP::HepRandomEngine *, bool, bool)
 
int initialize (double, double, double, double, int, bool, bool)
 
int initializeNuMu (double, double, double, double, double, double, double, double, double, CLHEP::HepRandomEngine *)
 
int initializeNuMu (double, double, double, double, double, double, double, double, double, int)
 
double momentum_times_charge ()
 
void setRandomEngine (CLHEP::HepRandomEngine *v)
 
 ~CMSCGEN ()
 

Public Attributes

double AR
 
double dNdEmudEnuMax
 
double negabs
 
double negfrac
 
double ProdAlt
 
double Rnunubar
 
double sigma
 

Private Attributes

double b0
 
double b0c [3]
 
double b1
 
double b1c [3]
 
double b2
 
double b2c [3]
 
double c
 
double c1
 
double c2
 
double cemax
 
double cmax
 
double cmax_in
 
double cmax_max
 
double cmax_min
 
double cmin
 
double cmin_in
 
double corr [101]
 
bool delRanGen
 
double enumax
 
double enumin
 
int initialization
 
double integrated_flux
 
double Lfac
 
double Lmax
 
double Lmin
 
double pe [9]
 
double pmax
 
double pmin
 
double pmin_max
 
double pmin_min
 
double pq
 
CLHEP::HepRandomEngine * RanGen2
 
bool TIFOnly_const
 
bool TIFOnly_lin
 
double xemax
 
double xemin
 

Detailed Description

Definition at line 29 of file CMSCGEN.h.

Constructor & Destructor Documentation

◆ CMSCGEN()

CMSCGEN::CMSCGEN ( )

Definition at line 13 of file CMSCGEN.cc.

13 : initialization(0), RanGen2(nullptr), delRanGen(false) {}

◆ ~CMSCGEN()

CMSCGEN::~CMSCGEN ( )

Definition at line 15 of file CMSCGEN.cc.

15  {
16  if (delRanGen)
17  delete RanGen2;
18 }

References delRanGen, and RanGen2.

Member Function Documentation

◆ cos_theta()

double CMSCGEN::cos_theta ( )

Definition at line 431 of file CMSCGEN.cc.

431  {
432  if (initialization == 1) {
433  // here convert between coordinate systems:
434  return -c;
435  } else {
436  std::cout << " >>> CMSCGEN <<< warning: not initialized" << std::endl;
437  return -0.9999;
438  }
439 }

References c, gather_cfg::cout, and initialization.

Referenced by CosmicMuonGenerator::nextEvent().

◆ dNdEmudEnu()

double CMSCGEN::dNdEmudEnu ( double  Enu,
double  Emu,
double  theta 
)

Definition at line 544 of file CMSCGEN.cc.

544  {
545  double cthetaNu = 1. + ctheta; //swap cos(theta) from down to up range
546  double thetas = asin(sin(acos(cthetaNu)) * (Rearth - SurfaceOfEarth) / (Rearth + ProdAlt));
547  double costhetas = cos(thetas);
548  double dNdEnudW =
549  0.0286 * pow(Enu, -2.7) *
550  (1. / (1. + (6. * Enu * costhetas) / 115.) + 0.213 / (1. + (1.44 * Enu * costhetas) / 850.)); //cm^2*s*sr*GeV
551  double dNdEmudEnu = N_A * sigma / alpha * dNdEnudW * 1. / (1. + Emu / epsilon) *
552  (Enu - Emu + AR / 3 * (Enu * Enu * Enu - Emu * Emu * Emu) / (Enu * Enu));
553  return dNdEmudEnu;
554 }

References zMuMuMuonUserData::alpha, AR, funct::cos(), geometryDiff::epsilon, N_A, funct::pow(), ProdAlt, Rearth, sigma, funct::sin(), and SurfaceOfEarth.

Referenced by generateNuMu(), and initializeNuMu().

◆ flux()

double CMSCGEN::flux ( )

Definition at line 441 of file CMSCGEN.cc.

441  {
442  if (initialization == 1) {
443  return integrated_flux;
444  } else {
445  std::cout << " >>> CMSCGEN <<< warning: not initialized" << std::endl;
446  return -0.9999;
447  }
448 }

References gather_cfg::cout, initialization, and integrated_flux.

◆ generate()

int CMSCGEN::generate ( )

Definition at line 249 of file CMSCGEN.cc.

249  {
250  if (initialization == 0) {
251  std::cout << " >>> CMSCGEN <<< warning: not initialized" << std::endl;
252  return -1;
253  }
254 
255  // note: use historical notation (fortran version l3cgen.f)
256 
257  //
258  // +++ determine x = 1/e**2
259  //
260  // explanation: the energy distribution
261  // dn/d(1/e**2) = dn/de * e**3 = dn/dlog10(e) * e**2
262  // is parametrized by a polynomial. accordingly xe = 1/e**2 is sampled
263  // and e calculated
264  //
265  // need precise random variable with high precison since for
266  // emin = 3 GeV energies around 3000 GeV are very rare!
267  //
268 
269  double r1, r2, r3;
270  double xe, e, ce, L, L2;
271  int k;
272  double prob;
273 
274  double c_max;
275  double z, z_max;
276 
277  while (true) {
278  prob = RanGen2->flat();
279  r1 = double(prob);
280  prob = RanGen2->flat();
281  r2 = double(prob);
282 
283  xe = xemin + r1 * (xemax - xemin);
284 
285  if ((1. / sqrt(xe) < 3) &&
286  TIFOnly_const == true) { //generate constant energy dependence for E<2GeV, only used for TIF
287  //compute constant to match to CMSCGEN spectrum
288  e = 3.;
289  L = log10(e);
290  L2 = L * L;
291 
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 +
293  pe[0];
294 
295  k = int((L - Lmin) * Lfac + 1.);
296  k = TMath::Max(1, TMath::Min(k, 100));
297  ce = ce * corr[k];
298 
299  e = 1. / sqrt(xe);
300  if (r2 < (e * e * e * ce / (cemax * 3. * 3. * 3.)))
301  break;
302 
303  } else if ((1. / sqrt(xe) < 3) &&
304  TIFOnly_lin == true) { //generate linear energy dependence for E<2GeV, only used for TIF
305  //compute constant to match to CMSCGEN spectrum
306  e = 3.;
307  L = log10(e);
308  L2 = L * L;
309 
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 +
311  pe[0];
312 
313  k = int((L - Lmin) * Lfac + 1.);
314  k = TMath::Max(1, TMath::Min(k, 100));
315  ce = ce * corr[k];
316 
317  e = 1. / sqrt(xe);
318  if (r2 < (e * e * e * e * ce / (cemax * 3. * 3. * 3. * 3.)))
319  break;
320 
321  } else { //this is real CMSCGEN energy-dependence
322 
323  e = 1. / sqrt(xe);
324  L = log10(e);
325  L2 = L * L;
326 
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 +
328  pe[0];
329 
330  k = int((L - Lmin) * Lfac + 1.);
331  k = TMath::Max(1, TMath::Min(k, 100));
332  ce = ce * corr[k];
333 
334  if (cemax * r2 < ce)
335  break;
336 
337  } //end of CMSCGEN energy-dependence
338  } //end of while
339 
340  pq = e;
341 
342  //
343  // +++ charge ratio 1.280
344  //
345  prob = RanGen2->flat();
346  r3 = double(prob);
347 
348  double charg = 1.;
349  if (r3 < 0.439)
350  charg = -1.;
351 
352  pq = pq * charg;
353 
354  //
355  // +++ determine cos(angle)
356  //
357  // simple trial and rejection method
358  //
359 
360  // first calculate energy dependent coefficients b_i
361 
362  if (TIFOnly_const == true && e < 3.) { //forTIF (when E<2GeV use angles of 2GeV cosmic)
363  L = log10(3.);
364  L2 = L * L;
365  }
366  if (TIFOnly_lin == true && e < 3.) { //forTIF (when E<2GeV use angles of 2GeV cosmic)
367  L = log10(3.);
368  L2 = L * L;
369  }
370 
371  b0 = b0c[0] + b0c[1] * L + b0c[2] * L2;
372  b1 = b1c[0] + b1c[1] * L + b1c[2] * L2;
373  b2 = b2c[0] + b2c[1] * L + b2c[2] * L2;
374 
375  //
376  // need to know the maximum of z(c)
377  //
378  // first calculate c for which c distribution z(c) = maximum
379  //
380  // (note: maximum of curve is NOT always at c = -1, but never at c = -0.1)
381  //
382 
383  // try extremal value (from z'(c) = 0), but only if z''(c) < 0
384  //
385  // z'(c) = b1 + b2 * c => at c_max = - b1 / (2 b_2) is z'(c) = 0
386  //
387  // z''(c) = b2
388 
389  c_max = -1.;
390 
391  if (b2 < 0.) {
392  c_max = -0.5 * b1 / b2;
393  if (c_max < -1.)
394  c_max = -1.;
395  if (c_max > -0.1)
396  c_max = -0.1;
397  }
398 
399  z_max = b0 + b1 * c_max + b2 * c_max * c_max;
400 
401  // again cut out explicitly regions of zero flux
402  double c_cut = -0.42 + L * 0.35;
403  if (c_cut > cmax)
404  c_cut = cmax;
405 
406  // now we throw dice:
407 
408  while (true) {
409  prob = RanGen2->flat();
410  r1 = double(prob);
411  prob = RanGen2->flat();
412  r2 = double(prob);
413  c = cmin + (c_cut - cmin) * r1;
414  z = b0 + b1 * c + b2 * c * c;
415  if (z > z_max * r2)
416  break;
417  }
418 
419  return 0;
420 }

References b0, b0c, b1, b1c, b2, b2c, c, cemax, cmax, cmin, corr, gather_cfg::cout, MillePedeFileConverter_cfg::e, initialization, createfilelist::int, dqmdumpme::k, dttmaxenums::L, PixelRegions::L2, Lfac, Lmin, Max(), Min(), pe, pq, TtFullHadEvtBuilder_cfi::prob, diffTwoXMLs::r1, diffTwoXMLs::r2, RanGen2, mathSSE::sqrt(), TIFOnly_const, TIFOnly_lin, xemax, xemin, and z.

Referenced by CosmicMuonGenerator::nextEvent().

◆ generateNuMu()

int CMSCGEN::generateNuMu ( )

Definition at line 556 of file CMSCGEN.cc.

556  {
557  if (initialization == 0) {
558  std::cout << " >>> CMSCGEN <<< warning: not initialized" << std::endl;
559  return -1;
560  }
561 
562  double ctheta, Emu;
563  while (true) {
564  ctheta = cmin + (cmax - cmin) * RanGen2->flat();
565  Emu = pmin + (pmax - pmin) * RanGen2->flat();
566  double Enu = enumin + (enumax - enumin) * RanGen2->flat();
567  double rate = dNdEmudEnu(Enu, Emu, ctheta);
568  if (rate > dNdEmudEnuMax * RanGen2->flat())
569  break;
570  }
571 
572  c = -ctheta; //historical sign convention
573 
574  pq = Emu;
575  //
576  // +++ nu/nubar ratio (~1.2)
577  //
578  double charg = 1.; //nubar -> mu+
579  if (RanGen2->flat() > Rnunubar / (1. + Rnunubar))
580  charg = -1.; //neutrino -> mu-
581 
582  pq = pq * charg;
583 
584  //int flux += this event rate
585 
586  return 1;
587 }

References c, cmax, cmin, gather_cfg::cout, dNdEmudEnu(), dNdEmudEnuMax, enumax, enumin, initialization, pmax, pmin, pq, RanGen2, RPCpg::rate(), and Rnunubar.

Referenced by CosmicMuonGenerator::nextEvent().

◆ initialize() [1/2]

int CMSCGEN::initialize ( double  pmin_in,
double  pmax_in,
double  thetamin_in,
double  thetamax_in,
CLHEP::HepRandomEngine *  rnd,
bool  TIFOnly_constant,
bool  TIFOnly_linear 
)

Definition at line 27 of file CMSCGEN.cc.

33  {
34  if (delRanGen)
35  delete RanGen2;
36  RanGen2 = rnd;
37  delRanGen = false;
38 
39  //set bools for TIFOnly options (E<2GeV with unphysical energy dependence)
42 
43  // units: GeV
44 
45  // WARNING: coordinate system:
46  // - to outside world define z axis downwards, i.e.
47  // muon coming from above, vertically: cos = 1
48  // (used for backward compatibility)
49  // - internally use frame with z axis upwards, i.e.
50  // muon coming from above, vertically: cos = -1
51  // (corresponds to CMS note definition)
52 
53  //set cmin and cmax, here convert between coordinate systems:
54  cmin_in = -TMath::Cos(thetamin_in); //input angle already converted from Deg to Rad!
55  cmax_in = -TMath::Cos(thetamax_in); //input angle already converted from Deg to Rad!
56 
57  //allowed energy range
58  pmin_min = 3.;
59  //pmin_max = 100.;
60  pmin_max = 3000.;
61  pmax = 3000.;
62  //allowed angular range
63  //cmax_max = -0.1,
64  cmax_max = -0.01, cmax_min = -0.9999;
65 
66  if (TIFOnly_const == true || TIFOnly_lin == true)
67  pmin_min = 0.; //forTIF
68 
69  // set pmin
70  if (pmin_in < pmin_min || pmin_in > pmin_max) {
71  std::cout << " >>> CMSCGEN.initialize <<< warning: illegal pmin_in =" << pmin_in;
72  return (-1);
73  } else if (pmax_in > pmax) {
74  std::cout << " >>> CMSCGEN.initialize <<< warning: illegal pmax_in =" << pmax_in;
75  return (-1);
76  } else {
77  pmin = pmin_in;
78  pmax = pmax_in;
79  xemax = 1. / (pmin * pmin);
80  xemin = 1. / (pmax * pmax);
81  }
82 
83  // set cmax and cmin
84  if (cmax_in < cmax_min || cmax_in > cmax_max) {
85  std::cout << " >>> CMSCGEN.initialize <<< warning: illegal cmax_in =" << cmax_in;
86  return (-1);
87  } else {
88  cmax = cmax_in;
89  cmin = cmin_in;
90  }
91 
92  initialization = 1;
93 
94  if (TIFOnly_const == true || TIFOnly_lin == true)
95  pmin_min = 3.; //forTIF
96 
97  // Lmin = log10(pmin_min);
98  Lmin = log10(pmin);
99  Lmax = log10(pmax);
100  Lfac = 100. / (Lmax - Lmin);
101 
102  //
103  // +++ coefficients for energy spectrum
104  //
105 
106  pe[0] = -1.;
107  pe[1] = 6.22176;
108  pe[2] = -13.9404;
109  pe[3] = 18.1643;
110  pe[4] = -9.22784;
111  pe[5] = 1.99234;
112  pe[6] = -0.156434;
113  pe[7] = 0.;
114  pe[8] = 0.;
115 
116  //
117  // +++ coefficients for cos theta distribution
118  //
119 
120  b0c[0] = 0.6639;
121  b0c[1] = -0.9587;
122  b0c[2] = 0.2772;
123 
124  b1c[0] = 5.820;
125  b1c[1] = -6.864;
126  b1c[2] = 1.367;
127 
128  b2c[0] = 10.39;
129  b2c[1] = -8.593;
130  b2c[2] = 1.547;
131 
132  //
133  // +++ calculate correction table for different cos theta dependence!
134  // reference range: c1 to c2
135  //
136  // explanation: the parametrization of the energy spectrum as used above
137  // is the integral over the c = cos(zenith angle) range -1...-0.1
138  // since the c distribution depends on energy, the integrated energy
139  // spectrum depends on this range. Here a correction factor is determined,
140  // based on the linear c dependence of the c distribution.
141  // The correction is calculated for 100 bins in L = log10(energy).
142  //
143  // +++ in same loop calculate integrated flux
144  // (integrated over angles and momentum)
145 
146  c1 = -1.;
147  c2 = -0.1;
148 
149  double cemax0 = 1.0;
150  double L, L2;
151  double s;
152  double p, p1, p2;
153  double integral_here, integral_ref;
154  double c_cut;
155 
156  integrated_flux = 0.;
157 
158  for (int k = 1; k <= 100; k++) {
159  L = Lmin + (k - 0.5) / Lfac;
160  L2 = L * L;
161  p = pow(10, L);
162  p1 = pow(10, L - 0.5 / Lfac);
163  p2 = pow(10, L + 0.5 / Lfac);
164 
165  b0 = b0c[0] + b0c[1] * L + b0c[2] * L2;
166  b1 = b1c[0] + b1c[1] * L + b1c[2] * L2;
167  b2 = b2c[0] + b2c[1] * L + b2c[2] * L2;
168 
169  // cut out explicitly regions of zero flux
170  // (for low momentum and near horizontal showers)
171  // since parametrization for z distribution doesn't work here
172  // (can become negative)
173 
174  c_cut = -0.42 + L * 0.35;
175 
176  if (c_cut > c2)
177  c_cut = c2;
178 
179  integral_ref =
180  b0 * (c_cut - c1) + b1 / 2. * (c_cut * c_cut - c1 * c1) + b2 / 3. * (c_cut * c_cut * c_cut - c1 * c1 * c1);
181 
182  if (c_cut > cmax)
183  c_cut = cmax;
184 
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);
187 
188  corr[k] = integral_here / integral_ref;
189 
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 +
191  pe[0];
192 
193  integrated_flux += 1. / pow(p, 3) * s * corr[k] * (p2 - p1);
194 
195  /*
196  std::cout << k << " "
197  << corr[k] << " "
198  << p << " "
199  << s << " "
200  << p1 << " "
201  << p2 << " "
202  << integrated_flux << " "
203  << std::endl;
204  */
205 
206  // std::cout << k << " " << corr[k] << " " << std::endl;
207  }
208 
209  integrated_flux *= 1.27E3;
210  std::cout << " >>> CMSCGEN.initialize <<< "
211  << " Integrated flux = " << integrated_flux << " /m**2/s " << std::endl;
212 
213  // find approximate peak value, for Monte Carlo sampling
214  // peak is near L = 2
215 
216  double ce;
217 
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]) *
219  2. +
220  pe[0];
221 
222  // normalize to 0.5 (not 1) to have some margin if peak is not at L=2
223  //
224  ce = 0.5 / ce;
225 
226  for (int k = 0; k < 9; k++) {
227  pe[k] = pe[k] * ce;
228  }
229 
230  cemax = cemax0 * corr[50];
231 
232  return initialization;
233 }

References b0, b0c, b1, b1c, b2, b2c, c1, c2, cemax, cmax, cmax_in, cmax_max, cmax_min, cmin, cmin_in, corr, gather_cfg::cout, delRanGen, initialization, integrated_flux, dqmdumpme::k, dttmaxenums::L, PixelRegions::L2, Lfac, Lmax, Lmin, AlCaHLTBitMon_ParallelJobs::p, p1, p2, pe, pmax, pmin, pmin_max, pmin_min, funct::pow(), RanGen2, alignCSCRings::s, TIFOnly_const, CMSCGENproducer_cfi::TIFOnly_constant, TIFOnly_lin, CMSCGENproducer_cfi::TIFOnly_linear, xemax, and xemin.

Referenced by initialize(), and CosmicMuonGenerator::initialize().

◆ initialize() [2/2]

int CMSCGEN::initialize ( double  pmin_in,
double  pmax_in,
double  thetamin_in,
double  thetamax_in,
int  RanSeed,
bool  TIFOnly_constant,
bool  TIFOnly_linear 
)

Definition at line 235 of file CMSCGEN.cc.

241  {
242  CLHEP::HepRandomEngine *rnd = new CLHEP::HepJamesRandom;
243  //set seed for Random Generator (seed can be controled by config-file), P.Biallass 2006
244  rnd->setSeed(RanSeed, 0);
245  delRanGen = true;
246  return initialize(pmin_in, pmax_in, thetamin_in, thetamax_in, rnd, TIFOnly_constant, TIFOnly_linear);
247 }

References delRanGen, initialize(), CMSCGENproducer_cfi::TIFOnly_constant, and CMSCGENproducer_cfi::TIFOnly_linear.

◆ initializeNuMu() [1/2]

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 
)

Definition at line 450 of file CMSCGEN.cc.

459  {
460  if (delRanGen)
461  delete RanGen2;
462  RanGen2 = rnd;
463  delRanGen = false;
464 
465  ProdAlt = ProdAlt_in;
466 
467  Rnunubar = 1.2;
468 
469  sigma = (0.72 * Rnunubar + 0.09) / (1 + Rnunubar) * 1.e-38; //cm^2GeV^-1
470 
471  AR = (0.69 + 0.06 * Rnunubar) / (0.09 + 0.72 * Rnunubar);
472 
473  //set smin and smax, here convert between coordinate systems:
474  pmin = pmin_in;
475  pmax = pmax_in;
476  cmin = TMath::Cos(thetamin_in); //input angle already converted from Deg to Rad!
477  cmax = TMath::Cos(thetamax_in); //input angle already converted from Deg to Rad!
478  enumin = (Enumin_in < 10.) ? 10. : Enumin_in; //no nu's below 10GeV
479  enumax = Enumax_in;
480 
481  //do initial run of flux rate to determine Maximum
482  integrated_flux = 0.;
483  dNdEmudEnuMax = 0.;
484  negabs = 0.;
485  negfrac = 0.;
486  int trials = 100000;
487  for (int i = 0; i < trials; ++i) {
488  double ctheta = cmin + (cmax - cmin) * RanGen2->flat();
489  double Emu = pmin + (pmax - pmin) * RanGen2->flat();
490  double Enu = enumin + (enumax - enumin) * RanGen2->flat();
491  double rate = dNdEmudEnu(Enu, Emu, ctheta);
492  //std::cout << "trial=" << i << " ctheta=" << ctheta << " Emu=" << Emu << " Enu=" << Enu
493  // << " rate=" << rate << std::endl;
494  //std::cout << "cmin=" << cmin << " cmax=" << cmax
495  // << " pmin=" << pmin << " pmax=" << pmax
496  // << " enumin=" << enumin << " enumax=" << enumax << std::endl;
497  if (rate > 0.) {
499  if (rate > dNdEmudEnuMax)
501  } else
502  negabs++;
503  }
504  negfrac = negabs / trials;
505  integrated_flux /= trials;
506 
507  std::cout << "CMSCGEN::initializeNuMu: After " << trials << " trials:" << std::endl;
508  std::cout << "dNdEmudEnuMax=" << dNdEmudEnuMax << std::endl;
509  std::cout << "negfrac=" << negfrac << std::endl;
510 
511  //multiply by phase space boundaries
512  integrated_flux *= (cmin - cmax);
513  integrated_flux *= (Phimax_in - Phimin_in);
514  integrated_flux *= (pmax - pmin);
516  //remove negative phase space areas which do not contribute anything
517  integrated_flux *= (1. - negfrac);
518  std::cout << " >>> CMSCGEN.initializeNuMu <<< "
519  << " Integrated flux = " << integrated_flux << " units??? " << std::endl;
520 
521  initialization = 1;
522 
523  return initialization;
524 }

References AR, cmax, cmin, gather_cfg::cout, delRanGen, dNdEmudEnu(), dNdEmudEnuMax, MillePedeFileConverter_cfg::e, enumax, enumin, mps_fire::i, initialization, integrated_flux, negabs, negfrac, pmax, pmin, ProdAlt, RanGen2, RPCpg::rate(), Rnunubar, and sigma.

Referenced by CosmicMuonGenerator::initialize(), and initializeNuMu().

◆ initializeNuMu() [2/2]

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 
)

Definition at line 526 of file CMSCGEN.cc.

535  {
536  CLHEP::HepRandomEngine *rnd = new CLHEP::HepJamesRandom;
537  //set seed for Random Generator (seed can be controled by config-file), P.Biallass 2006
538  rnd->setSeed(RanSeed, 0);
539  delRanGen = true;
540  return initializeNuMu(
541  pmin_in, pmax_in, thetamin_in, thetamax_in, Enumin_in, Enumax_in, Phimin_in, Phimax_in, ProdAlt_in, rnd);
542 }

References delRanGen, and initializeNuMu().

◆ momentum_times_charge()

double CMSCGEN::momentum_times_charge ( )

Definition at line 422 of file CMSCGEN.cc.

422  {
423  if (initialization == 1) {
424  return pq;
425  } else {
426  std::cout << " >>> CMSCGEN <<< warning: not initialized" << std::endl;
427  return -9999.;
428  }
429 }

References gather_cfg::cout, initialization, and pq.

Referenced by CosmicMuonGenerator::nextEvent().

◆ setRandomEngine()

void CMSCGEN::setRandomEngine ( CLHEP::HepRandomEngine *  v)

Definition at line 20 of file CMSCGEN.cc.

20  {
21  if (delRanGen)
22  delete RanGen2;
23  RanGen2 = v;
24  delRanGen = false;
25 }

References delRanGen, RanGen2, and findQualityFiles::v.

Referenced by CosmicMuonGenerator::setRandomEngine().

Member Data Documentation

◆ AR

double CMSCGEN::AR

Definition at line 113 of file CMSCGEN.h.

Referenced by dNdEmudEnu(), and initializeNuMu().

◆ b0

double CMSCGEN::b0
private

Definition at line 61 of file CMSCGEN.h.

Referenced by generate(), and initialize().

◆ b0c

double CMSCGEN::b0c[3]
private

Definition at line 70 of file CMSCGEN.h.

Referenced by generate(), and initialize().

◆ b1

double CMSCGEN::b1
private

Definition at line 62 of file CMSCGEN.h.

Referenced by generate(), and initialize().

◆ b1c

double CMSCGEN::b1c[3]
private

Definition at line 70 of file CMSCGEN.h.

Referenced by generate(), and initialize().

◆ b2

double CMSCGEN::b2
private

Definition at line 63 of file CMSCGEN.h.

Referenced by generate(), and initialize().

◆ b2c

double CMSCGEN::b2c[3]
private

Definition at line 70 of file CMSCGEN.h.

Referenced by generate(), and initialize().

◆ c

double CMSCGEN::c
private

Definition at line 43 of file CMSCGEN.h.

Referenced by cos_theta(), generate(), and generateNuMu().

◆ c1

double CMSCGEN::c1
private

Definition at line 58 of file CMSCGEN.h.

Referenced by initialize().

◆ c2

double CMSCGEN::c2
private

Definition at line 59 of file CMSCGEN.h.

Referenced by initialize().

◆ cemax

double CMSCGEN::cemax
private

Definition at line 67 of file CMSCGEN.h.

Referenced by generate(), and initialize().

◆ cmax

double CMSCGEN::cmax
private

Definition at line 38 of file CMSCGEN.h.

Referenced by generate(), generateNuMu(), initialize(), and initializeNuMu().

◆ cmax_in

double CMSCGEN::cmax_in
private

Definition at line 40 of file CMSCGEN.h.

Referenced by initialize().

◆ cmax_max

double CMSCGEN::cmax_max
private

Definition at line 52 of file CMSCGEN.h.

Referenced by initialize().

◆ cmax_min

double CMSCGEN::cmax_min
private

Definition at line 51 of file CMSCGEN.h.

Referenced by initialize().

◆ cmin

double CMSCGEN::cmin
private

Definition at line 37 of file CMSCGEN.h.

Referenced by generate(), generateNuMu(), initialize(), and initializeNuMu().

◆ cmin_in

double CMSCGEN::cmin_in
private

Definition at line 39 of file CMSCGEN.h.

Referenced by initialize().

◆ corr

double CMSCGEN::corr[101]
private

Definition at line 71 of file CMSCGEN.h.

Referenced by MuScleFitCorrector.MuScleFitCorr::corrected_p4(), generate(), and initialize().

◆ delRanGen

bool CMSCGEN::delRanGen
private

Definition at line 74 of file CMSCGEN.h.

Referenced by initialize(), initializeNuMu(), setRandomEngine(), and ~CMSCGEN().

◆ dNdEmudEnuMax

double CMSCGEN::dNdEmudEnuMax

Definition at line 115 of file CMSCGEN.h.

Referenced by generateNuMu(), and initializeNuMu().

◆ enumax

double CMSCGEN::enumax
private

Definition at line 81 of file CMSCGEN.h.

Referenced by generateNuMu(), and initializeNuMu().

◆ enumin

double CMSCGEN::enumin
private

Definition at line 80 of file CMSCGEN.h.

Referenced by generateNuMu(), and initializeNuMu().

◆ initialization

int CMSCGEN::initialization
private

◆ integrated_flux

double CMSCGEN::integrated_flux
private

Definition at line 65 of file CMSCGEN.h.

Referenced by flux(), initialize(), and initializeNuMu().

◆ Lfac

double CMSCGEN::Lfac
private

Definition at line 56 of file CMSCGEN.h.

Referenced by generate(), and initialize().

◆ Lmax

double CMSCGEN::Lmax
private

Definition at line 55 of file CMSCGEN.h.

Referenced by initialize().

◆ Lmin

double CMSCGEN::Lmin
private

Definition at line 54 of file CMSCGEN.h.

Referenced by generate(), and initialize().

◆ negabs

double CMSCGEN::negabs

Definition at line 116 of file CMSCGEN.h.

Referenced by initializeNuMu().

◆ negfrac

double CMSCGEN::negfrac

Definition at line 116 of file CMSCGEN.h.

Referenced by initializeNuMu().

◆ pe

double CMSCGEN::pe[9]
private

Definition at line 69 of file CMSCGEN.h.

Referenced by generate(), and initialize().

◆ pmax

double CMSCGEN::pmax
private

Definition at line 36 of file CMSCGEN.h.

Referenced by generateNuMu(), initialize(), and initializeNuMu().

◆ pmin

double CMSCGEN::pmin
private

Definition at line 35 of file CMSCGEN.h.

Referenced by generateNuMu(), initialize(), and initializeNuMu().

◆ pmin_max

double CMSCGEN::pmin_max
private

Definition at line 49 of file CMSCGEN.h.

Referenced by initialize().

◆ pmin_min

double CMSCGEN::pmin_min
private

Definition at line 48 of file CMSCGEN.h.

Referenced by initialize().

◆ pq

double CMSCGEN::pq
private

Definition at line 42 of file CMSCGEN.h.

Referenced by generate(), generateNuMu(), and momentum_times_charge().

◆ ProdAlt

double CMSCGEN::ProdAlt

Definition at line 111 of file CMSCGEN.h.

Referenced by dNdEmudEnu(), and initializeNuMu().

◆ RanGen2

CLHEP::HepRandomEngine* CMSCGEN::RanGen2
private

Definition at line 73 of file CMSCGEN.h.

Referenced by generate(), generateNuMu(), initialize(), initializeNuMu(), setRandomEngine(), and ~CMSCGEN().

◆ Rnunubar

double CMSCGEN::Rnunubar

Definition at line 110 of file CMSCGEN.h.

Referenced by generateNuMu(), and initializeNuMu().

◆ sigma

double CMSCGEN::sigma

Definition at line 112 of file CMSCGEN.h.

Referenced by dNdEmudEnu(), and initializeNuMu().

◆ TIFOnly_const

bool CMSCGEN::TIFOnly_const
private

Definition at line 76 of file CMSCGEN.h.

Referenced by generate(), and initialize().

◆ TIFOnly_lin

bool CMSCGEN::TIFOnly_lin
private

Definition at line 77 of file CMSCGEN.h.

Referenced by generate(), and initialize().

◆ xemax

double CMSCGEN::xemax
private

Definition at line 46 of file CMSCGEN.h.

Referenced by generate(), and initialize().

◆ xemin

double CMSCGEN::xemin
private

Definition at line 45 of file CMSCGEN.h.

Referenced by generate(), and initialize().

CMSCGEN::pmin_min
double pmin_min
Definition: CMSCGEN.h:48
CMSCGEN::initializeNuMu
int initializeNuMu(double, double, double, double, double, double, double, double, double, CLHEP::HepRandomEngine *)
Definition: CMSCGEN.cc:450
dttmaxenums::L
Definition: DTTMax.h:29
CMSCGEN::Lmax
double Lmax
Definition: CMSCGEN.h:55
CMSCGEN::cmax_in
double cmax_in
Definition: CMSCGEN.h:40
CMSCGEN::c2
double c2
Definition: CMSCGEN.h:59
mps_fire.i
i
Definition: mps_fire.py:355
PixelRegions::L2
Definition: PixelRegionContainers.h:28
CMSCGEN::cmax_max
double cmax_max
Definition: CMSCGEN.h:52
CMSCGEN::Lfac
double Lfac
Definition: CMSCGEN.h:56
CMSCGEN::delRanGen
bool delRanGen
Definition: CMSCGEN.h:74
CMSCGEN::initialize
int initialize(double, double, double, double, CLHEP::HepRandomEngine *, bool, bool)
Definition: CMSCGEN.cc:27
CMSCGEN::b2c
double b2c[3]
Definition: CMSCGEN.h:70
SurfaceOfEarth
const double SurfaceOfEarth
Definition: CosmicMuonParameters.h:27
zMuMuMuonUserData.alpha
alpha
zGenParticlesMatch = cms.InputTag(""),
Definition: zMuMuMuonUserData.py:9
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CMSCGEN::b0c
double b0c[3]
Definition: CMSCGEN.h:70
gather_cfg.cout
cout
Definition: gather_cfg.py:144
CMSCGEN::pmin
double pmin
Definition: CMSCGEN.h:35
CMSCGEN::c
double c
Definition: CMSCGEN.h:43
CMSCGEN::pq
double pq
Definition: CMSCGEN.h:42
CMSCGEN::pe
double pe[9]
Definition: CMSCGEN.h:69
CMSCGEN::pmin_max
double pmin_max
Definition: CMSCGEN.h:49
findQualityFiles.v
v
Definition: findQualityFiles.py:179
RPCpg::rate
double rate(double x)
Definition: Constants.cc:3
geometryDiff.epsilon
int epsilon
Definition: geometryDiff.py:26
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
alignCSCRings.s
s
Definition: alignCSCRings.py:92
CMSCGEN::dNdEmudEnu
double dNdEmudEnu(double Enu, double Emu, double theta)
Definition: CMSCGEN.cc:544
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
CMSCGEN::cmin
double cmin
Definition: CMSCGEN.h:37
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
CMSCGEN::cemax
double cemax
Definition: CMSCGEN.h:67
CMSCGEN::cmin_in
double cmin_in
Definition: CMSCGEN.h:39
DDAxes::z
p2
double p2[4]
Definition: TauolaWrapper.h:90
CMSCGEN::AR
double AR
Definition: CMSCGEN.h:113
CMSCGENproducer_cfi.TIFOnly_linear
TIFOnly_linear
Definition: CMSCGENproducer_cfi.py:6
dqmdumpme.k
k
Definition: dqmdumpme.py:60
Rearth
const double Rearth
Definition: CosmicMuonParameters.h:68
CMSCGEN::b1
double b1
Definition: CMSCGEN.h:62
CMSCGEN::integrated_flux
double integrated_flux
Definition: CMSCGEN.h:65
CMSCGEN::dNdEmudEnuMax
double dNdEmudEnuMax
Definition: CMSCGEN.h:115
CMSCGEN::pmax
double pmax
Definition: CMSCGEN.h:36
CMSCGEN::Rnunubar
double Rnunubar
Definition: CMSCGEN.h:110
CMSCGEN::c1
double c1
Definition: CMSCGEN.h:58
CMSCGEN::initialization
int initialization
Definition: CMSCGEN.h:33
CMSCGEN::xemax
double xemax
Definition: CMSCGEN.h:46
CMSCGEN::b0
double b0
Definition: CMSCGEN.h:61
diffTwoXMLs.r2
r2
Definition: diffTwoXMLs.py:73
CMSCGEN::cmax_min
double cmax_min
Definition: CMSCGEN.h:51
createfilelist.int
int
Definition: createfilelist.py:10
CMSCGEN::b1c
double b1c[3]
Definition: CMSCGEN.h:70
CMSCGEN::enumin
double enumin
Definition: CMSCGEN.h:80
p1
double p1[4]
Definition: TauolaWrapper.h:89
CMSCGEN::cmax
double cmax
Definition: CMSCGEN.h:38
Max
T Max(T a, T b)
Definition: MathUtil.h:44
CMSCGEN::xemin
double xemin
Definition: CMSCGEN.h:45
CMSCGEN::Lmin
double Lmin
Definition: CMSCGEN.h:54
CMSCGEN::ProdAlt
double ProdAlt
Definition: CMSCGEN.h:111
CMSCGEN::enumax
double enumax
Definition: CMSCGEN.h:81
CMSCGEN::corr
double corr[101]
Definition: CMSCGEN.h:71
CMSCGEN::TIFOnly_lin
bool TIFOnly_lin
Definition: CMSCGEN.h:77
CMSCGEN::negabs
double negabs
Definition: CMSCGEN.h:116
N_A
const double N_A
Definition: CosmicMuonParameters.h:64
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
CMSCGEN::sigma
double sigma
Definition: CMSCGEN.h:112
CMSCGEN::b2
double b2
Definition: CMSCGEN.h:63
CMSCGEN::TIFOnly_const
bool TIFOnly_const
Definition: CMSCGEN.h:76
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
CMSCGEN::RanGen2
CLHEP::HepRandomEngine * RanGen2
Definition: CMSCGEN.h:73
Min
T Min(T a, T b)
Definition: MathUtil.h:39
CMSCGEN::negfrac
double negfrac
Definition: CMSCGEN.h:116
CMSCGENproducer_cfi.TIFOnly_constant
TIFOnly_constant
Definition: CMSCGENproducer_cfi.py:5
TtFullHadEvtBuilder_cfi.prob
prob
Definition: TtFullHadEvtBuilder_cfi.py:33
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37