CMSCGEN

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
#ifndef CMSCGEN_h
#define CMSCGEN_h

//
// CMSCGEN.cc  version 3.0     Thomas Hebbeker 2007-05-15
//
// implemented in CMSSW by P. Biallass 2007-05-28
//
// documentation: CMS internal note 2007 "Improved Parametrization of the Cosmic Muon Flux for the generator CMSCGEN" by Biallass + Hebbeker
//
// inspired by fortran version l3cgen.f, version 4.0, 1999
//
// history: new version of parametrization of energy and angular distribution of cosmic muons,
//          now based on new version 6.60 of CORSIKA (2007). Revisited parametrization, now using slightly different polynomials and new coefficients.
//
// new range: 3...3000 GeV, cos(incident angle) = 0.1...1 which means theta=0°...84.26° where z-axis vertical axis
//            Now parametrization obtained from full range, thus no extrapolation to any angles or energies needed any more.
// accuracy: now well known, see internal note for details
//           7% for range 10...500 GeV, 50% for 3000 GeV and 25% for 3 GeV

#include <iostream>

#include "GeneratorInterface/CosmicMuonGenerator/interface/CosmicMuonParameters.h"

namespace CLHEP {
  class HepRandomEngine;
}

class CMSCGEN {
  // all units: GeV

private:
  int initialization;  // energy and cos theta range set ?

  double pmin;
  double pmax;
  double cmin;
  double cmax;
  double cmin_in;
  double cmax_in;

  double pq;
  double c;

  double xemin;
  double xemax;

  double pmin_min;
  double pmin_max;

  double cmax_min;
  double cmax_max;

  double Lmin;
  double Lmax;
  double Lfac;

  double c1;
  double c2;

  double b0;
  double b1;
  double b2;

  double integrated_flux;

  double cemax;

  double pe[9];
  double b0c[3], b1c[3], b2c[3];
  double corr[101];

  CLHEP::HepRandomEngine* RanGen2;  // random number generator
  bool delRanGen;

  bool TIFOnly_const;
  bool TIFOnly_lin;

  //variables for upgoing muons from neutrinos
  double enumin;
  double enumax;

public:
  // constructor
  CMSCGEN();

  //destructor
  ~CMSCGEN();

  void setRandomEngine(CLHEP::HepRandomEngine* v);

  // to set the energy and cos theta range
  int initialize(double, double, double, double, CLHEP::HepRandomEngine*, bool, bool);
  int initialize(double, double, double, double, int, bool, bool);

  int generate();
  // to generate energy*charge and cos theta for one cosmic

  double momentum_times_charge();

  double cos_theta();

  double flux();

  //upward going muons from neutrinos
  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);
  int generateNuMu();

  double Rnunubar;  //Ration of nu to nubar
  double ProdAlt;   //production altitude in atmosphere
  double sigma;
  double AR;
  double dNdEmudEnu(double Enu, double Emu, double theta);
  double dNdEmudEnuMax;
  double negabs, negfrac;
};
#endif