/home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/gen/include/RAT/SNgen.hh Source File

Ratpac-two: /home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/gen/include/RAT/SNgen.hh Source File
Ratpac-two
SNgen.hh
1 #ifndef __RAT_SNgen__
2 #define __RAT_SNgen__
3 
4 // Generates an neutrino-elastic scattering event, based on the
5 // cross-section as function of neutrino energy and the electron's
6 // recoil energy. Allow for variations in the weak mixing angle and
7 // the possibility of a neutrino magnetic moment
8 //
9 // J. Formaggio (UW) -02/09/2005
10 
11 // Converted to Geant4+GLG4Sim+RAT by Bill Seligman (07-Feb-2006).
12 // I'm following the code structure of the IBD classes:
13 // RATVertexGen_ES handles the G4-related tasks of constructing an
14 // event, while this class deals with the physics of the
15 // cross-section. Some of the code (the flux in particular) is copied
16 // from IBDgen.
17 
18 #include <CLHEP/Vector/LorentzVector.h>
19 
20 #include <G4ThreeVector.hh>
21 #include <RAT/LinearInterp.hh>
22 
23 #include "RAT/DB.hh"
24 #include "TF1.h"
25 #include "TFile.h"
26 #include "TGraph.h"
27 #include "TH1D.h"
28 #include "TMath.h"
29 
30 namespace RAT {
31 
32 // Forward delcarations within the namespace
33 class SNgenMessenger;
34 
35 class SNgen {
36  public:
37  SNgen();
38  ~SNgen();
39 
40  // Generate random event vectors
41  // Pass in the neutrino direction (unit vector)
42  // Returns 4-momentum vectors for resulting electron.
43  CLHEP::HepLorentzVector GenerateEvent(const G4ThreeVector &nu_dir);
44 
45  // Flux as a function of energy. Interpolated from table in ES RATDB table
46  double Flux(double E) const { return rmpflux(E); };
47 
48  void Reset();
49  void Show();
50 
51  void SetMixingAngle(double sin2thw = WEAKANGLE);
52  void SetNeutrinoMoment(double vMu = 0.0);
53 
54  double GetXSec(double Enu, double T);
55 
56  void SetXSecMax(int ntry = NTRIAL);
57 
58  double GetRandomNumber(double rmin = 0., double rmax = 1.);
59 
60  inline bool GetNormFlag() { return FlagNorm; };
61  inline void SetNormFlag(bool iFlag) { FlagNorm = iFlag; };
62 
63  inline double GetMixingAngle() { return SinSqThetaW; };
64  inline double GetMagneticMoment() { return MagneticMoment; };
65  inline double GetXSecMax() { return XSecMax; };
66 
67  inline double GetIBDAmplitude() { return IBDAmp; };
68  inline double GetESAmplitude() { return ESAmp; };
69  inline double GetCCAmplitude() { return CCAmp; };
70  inline double GetICCAmplitude() { return ICCAmp; };
71  inline double GetNCAmplitude() { return NCAmp; };
72  inline double GetINCAmplitude() { return INCAmp; };
73  inline int GetModel() { return ModelTmp; };
74 
75  void SetIBDAmplitude(double IBDAm = IBDDEFAULT);
76  void SetESAmplitude(double ESAm = ESDEFAULT);
77  void SetCCAmplitude(double CCAm = CCDEFAULT);
78  void SetICCAmplitude(double ICCAm = ICCDEFAULT);
79  void SetNCAmplitude(double NCAm = NCDEFAULT);
80  void SetINCAmplitude(double INCAm = INCDEFAULT);
81  void SetModel(double ModelTm = MODELDEFAULT);
82 
83  void LoadSpectra();
84 
85  double GetIBDRandomEnergy(Double_t &dt);
86  double GetESRandomEnergy(Double_t &dt);
87  double GetCCRandomEnergy(Double_t &dt);
88  double GetICCRandomEnergy(Double_t &dt);
89  double GetNCRandomEnergy(Double_t &dt);
90  double GetNCRandomNuEnergy();
91  double GetINCRandomEnergy(Double_t &dt);
92  double GetRandomTime();
93 
94  double GetTime();
95  double SetTime();
96  double banana();
97  int n;
98 
99  // Float_t q1_f;
100  // Float_t q2_f;
101  // Float_t q3_f;
102 
103  protected:
104  // double IBDTGraph2TF1(Double_t *x, Double_t *);
105  // double ESTGraph2TF1(Double_t *x, Double_t *);
106  // double CCTGraph2TF1(Double_t *x, Double_t *);
107  // double ICCTGraph2TF1(Double_t *x, Double_t *);
108  // double NCTGraph2TF1(Double_t *x, Double_t *);
109  //
110  LinearInterp<double> rmpflux;
111  double Emax;
112  double Emin;
113  double FluxMax;
114 
115  bool FlagNorm;
116 
117  double SinSqThetaW;
118  double MagneticMoment;
119  double XSecMax;
120 
121  double massElectron;
122  static const double WEAKANGLE;
123  static const int NTRIAL;
124 
125  double IBDAmp;
126  double ESAmp;
127  double CCAmp;
128  double ICCAmp;
129  double NCAmp;
130  double INCAmp;
131  double ModelTmp;
132 
133  static const double IBDDEFAULT;
134  static const double ESDEFAULT;
135  static const double CCDEFAULT;
136  static const double ICCDEFAULT;
137  static const double NCDEFAULT;
138  static const double INCDEFAULT;
139  static const int MODELDEFAULT;
140 
141  // TGraph *graphIBD;
142  // TGraph *graphES;
143  // TGraph *graphCC;
144  // TGraph *graphICC;
145  // TGraph *graphNC;
146  //
147  TF1 *funcIBD;
148  TF1 *funcES;
149  TF1 *funcCC;
150  TF1 *funcICC;
151  TF1 *funcNC;
152  TF1 *funcNCNU;
153  TF1 *funcINC;
154 
155  std::vector<double> spec_E; // spectrum energy values
156  std::vector<double> spec_mag;
157  DBLinkPtr _lspec; // link to spectrum entry in database
158 
159  //
160 
161  // Allows the user to change parameters via the command line.
162  SNgenMessenger *messenger;
163 };
164 
165 } // namespace RAT
166 
167 #endif
Definition: SNgenMessenger.hh:22
Definition: SNgen.hh:35
Definition: CCCrossSecMessenger.hh:29