GAtmoFlux.h
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3 
4 \class genie::flux::GAtmoFlux
5 
6 \brief A base class for the FLUKA, BGLRS and ATMNC atmo. nu. flux drivers.
7  The driver depends on data files provided by the atmospheric neutrino
8  flux simulation authors in order to determine the angular and energy
9  dependence for each neutrino species.
10  The position of each flux neutrino [going towards a detector centered
11  at (0,0,0)] is generated uniformly on a plane that is perpendicular
12  to a sphere of radius Rl at the point that is determined by the
13  generated neutrino direction (theta,phi). The size of the area of
14  that plane, where flux neutrinos are generated, is determined by the
15  transverse radius Rt. You can tweak Rl, Rt to match the size of your
16  detector.
17  Initially, neutrino coordinates are generated in a default detector
18  coordinate system (Topocentric Horizontal Coordinate -THZ-):
19  +z: Points towards the local zenith.
20  +x: On same plane as local meridian, pointing south.
21  +y: As needed to make a right-handed coordinate system.
22  origin: detector centre
23  Alternative user-defined topocentric systems can
24  be defined by specifying the appropriate rotation from THZ.
25  The driver allows minimum and maximum energy cuts.
26  Also it provides the options to generate wither unweighted or weighted
27  flux neutrinos (the latter giving smoother distributions at the tails).
28 
29 \author Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
30  University of Liverpool & STFC Rutherford Appleton Laboratory
31 
32 \created January 26, 2008
33 
34 \cpright Copyright (c) 2003-2020, The GENIE Collaboration
35  For the full text of the license visit http://copyright.genie-mc.org
36 */
37 //____________________________________________________________________________
38 
39 #ifndef _GATMO_FLUX_H_
40 #define _GATMO_FLUX_H_
41 
42 #include <string>
43 #include <map>
44 #include <vector>
45 
46 #include <TLorentzVector.h>
47 #include <TRotation.h>
48 
50 
51 class TH3D;
52 
53 using std::string;
54 using std::map;
55 using std::vector;
56 
57 namespace genie {
58 namespace flux {
59 
60 class GAtmoFlux: public GFluxI {
61 
62 public :
63  virtual ~GAtmoFlux();
64 
65  // methods implementing the GENIE GFluxI interface
66  virtual const PDGCodeList & FluxParticles (void) { return *fPdgCList; }
67  virtual double MaxEnergy (void);
68  virtual bool GenerateNext (void);
69  virtual int PdgCode (void) { return fgPdgC; }
70  virtual double Weight (void) { return fWeight; }
71  virtual const TLorentzVector & Momentum (void) { return fgP4; }
72  virtual const TLorentzVector & Position (void) { return fgX4; }
73  virtual bool End (void) { return false; }
74  virtual long int Index (void) { return -1; }
75  virtual void Clear (Option_t * opt);
76  virtual void GenerateWeighted (bool gen_weighted);
77 
78  // get neutrino energy/direction of generated events
79  double Enu (void) { return fgP4.Energy(); }
80  double Energy (void) { return fgP4.Energy(); }
81  double CosTheta (void) { return -fgP4.Pz()/fgP4.Energy(); }
82  double CosZenith (void) { return -fgP4.Pz()/fgP4.Energy(); }
83 
84  // methods specific to the atmospheric flux drivers
85  long int NFluxNeutrinos (void) const; ///< Number of flux nu's generated. Not the same as the number of nu's thrown towards the geometry (if there are cuts).
86  void ForceMinEnergy (double emin);
87  void ForceMaxEnergy (double emax);
88  void SetSpectralIndex (double index);
89  void SetRadii (double Rlongitudinal, double Rtransverse);
90  double GetFluxSurfaceArea(void);
91  double GetLongitudinalRadius(void);
92  double GetTransverseRadius(void);
93 
94  void SetUserCoordSystem (TRotation & rotation); ///< Rotation: Topocentric Horizontal -> User-defined Topocentric Coord System.
95  void AddFluxFile (int neutrino_pdg, string filename);
96  void AddFluxFile (string filename);
97  bool LoadFluxData (void);
98 
99  TH3D* GetFluxHistogram (int flavour);
100  /* Returns the total integrated flux in units of 1/(m^2 s). */
101  double GetTotalFlux (void);
102  /* Returns the total integrated flux in units of 1/(m^2 s) between the
103  * minimum and maximum energy .*/
104  double GetTotalFluxInEnergyRange(void);
105  double GetFlux (int flavour);
106  double GetFlux (int flavour, double energy);
107  double GetFlux (int flavour, double energy, double costh);
108  double GetFlux (int flavour, double energy, double costh, double phi);
109 
110 protected:
111 
112  // abstract class, ctor hidden
113  GAtmoFlux();
114 
115  // protected methods
116  bool GenerateNext_1try (void);
117  void Initialize (void);
118  void CleanUp (void);
119  void ResetSelection (void);
120  double MinEnergy (void) { return fMinEvCut; }
121  TH3D * CreateFluxHisto (string name, string title);
122  void ZeroFluxHisto (TH3D * hist);
123  void AddAllFluxes (void);
124  int SelectNeutrino (double Ev, double costheta, double phi);
125  TH3D* CreateNormalisedFluxHisto ( TH3D* hist); // normalise flux files
126 
127  // pure virtual methods; to be implemented by concrete flux drivers
128  virtual bool FillFluxHisto (int nu_pdg, string filename) = 0;
129 
130  // protected data members
131  double fMaxEv; ///< maximum energy (in input flux files)
132  PDGCodeList * fPdgCList; ///< input list of neutrino pdg-codes
133  int fgPdgC; ///< current generated nu pdg-code
134  TLorentzVector fgP4; ///< current generated nu 4-momentum
135  TLorentzVector fgX4; ///< current generated nu 4-position
136  double fWeight; ///< current generated nu weight
137  long int fNNeutrinos; ///< number of flux neutrinos thrown so far
138  double fMaxEvCut; ///< user-defined cut: maximum energy
139  double fMinEvCut; ///< user-defined cut: minimum energy
140  double fRl; ///< defining flux neutrino generation surface: longitudinal radius
141  double fRt; ///< defining flux neutrino generation surface: transverse radius
142  TRotation fRotTHz2User; ///< coord. system rotation: THZ -> Topocentric user-defined
143  unsigned int fNumPhiBins; ///< number of phi bins in input flux data files
144  unsigned int fNumCosThetaBins; ///< number of cos(theta) bins in input flux data files
145  unsigned int fNumEnergyBins; ///< number of energy bins in input flux data files
146  double * fPhiBins; ///< phi bins in input flux data files
147  double * fCosThetaBins; ///< cos(theta) bins in input flux data files
148  double * fEnergyBins; ///< energy bins in input flux data files
149  bool fGenWeighted; ///< generate a weighted or unweighted flux?
150  double fSpectralIndex; ///< power law function used for weighted flux
151  bool fInitialized; ///< flag to check that initialization is run
152  TH3D * fTotalFluxHisto; ///< flux = f(Ev,cos8,phi) summed over neutrino species
153  double fTotalFluxHistoIntg; ///< fFluxSum2D integral
154  map<int, TH3D*> fFluxHistoMap; ///< flux = f(Ev,cos8,phi) for each neutrino species
155  map<int, TH3D*> fRawFluxHistoMap; ///< flux = f(Ev,cos8,phi) for each neutrino species
156  vector<int> fFluxFlavour; ///< input flux file for each neutrino species
157  vector<string> fFluxFile; ///< input flux file for each neutrino species
158 };
159 
160 } // flux namespace
161 } // genie namespace
162 
163 #endif // _GATMO_FLUX_H_
static QCString name
Definition: declinfo.cpp:673
int SelectNeutrino(double Ev, double costheta, double phi)
Definition: GAtmoFlux.cxx:580
int fgPdgC
current generated nu pdg-code
Definition: GAtmoFlux.h:133
vector< int > fFluxFlavour
input flux file for each neutrino species
Definition: GAtmoFlux.h:156
double CosZenith(void)
Definition: GAtmoFlux.h:82
map< int, TH3D * > fFluxHistoMap
flux = f(Ev,cos8,phi) for each neutrino species
Definition: GAtmoFlux.h:154
double GetLongitudinalRadius(void)
Definition: GAtmoFlux.cxx:383
double * fPhiBins
phi bins in input flux data files
Definition: GAtmoFlux.h:146
vector< string > fFluxFile
input flux file for each neutrino species
Definition: GAtmoFlux.h:157
unsigned int fNumEnergyBins
number of energy bins in input flux data files
Definition: GAtmoFlux.h:145
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
double GetFluxSurfaceArea(void)
Definition: GAtmoFlux.cxx:378
std::string string
Definition: nybbler.cc:12
unsigned int fNumCosThetaBins
number of cos(theta) bins in input flux data files
Definition: GAtmoFlux.h:144
TH3D * CreateNormalisedFluxHisto(TH3D *hist)
Definition: GAtmoFlux.cxx:497
double Enu(void)
Definition: GAtmoFlux.h:79
opt
Definition: train.py:196
double fSpectralIndex
power law function used for weighted flux
Definition: GAtmoFlux.h:150
TH3D * GetFluxHistogram(int flavour)
Definition: GAtmoFlux.cxx:628
struct vector vector
long int NFluxNeutrinos(void) const
Number of flux nu&#39;s generated. Not the same as the number of nu&#39;s thrown towards the geometry (if the...
Definition: GAtmoFlux.cxx:222
long int fNNeutrinos
number of flux neutrinos thrown so far
Definition: GAtmoFlux.h:137
void SetRadii(double Rlongitudinal, double Rtransverse)
Definition: GAtmoFlux.cxx:369
double fRl
defining flux neutrino generation surface: longitudinal radius
Definition: GAtmoFlux.h:140
bool fInitialized
flag to check that initialization is run
Definition: GAtmoFlux.h:151
double GetTotalFluxInEnergyRange(void)
Definition: GAtmoFlux.cxx:659
string filename
Definition: train.py:213
double GetFlux(int flavour)
Definition: GAtmoFlux.cxx:711
virtual void GenerateWeighted(bool gen_weighted)
set whether to generate weighted or unweighted neutrinos
Definition: GAtmoFlux.cxx:246
TRotation fRotTHz2User
coord. system rotation: THZ -> Topocentric user-defined
Definition: GAtmoFlux.h:142
double GetTransverseRadius(void)
Definition: GAtmoFlux.cxx:388
A list of PDG codes.
Definition: PDGCodeList.h:32
double fMinEvCut
user-defined cut: minimum energy
Definition: GAtmoFlux.h:139
double fMaxEvCut
user-defined cut: maximum energy
Definition: GAtmoFlux.h:138
void ForceMaxEnergy(double emax)
Definition: GAtmoFlux.cxx:233
double fTotalFluxHistoIntg
fFluxSum2D integral
Definition: GAtmoFlux.h:153
virtual double Weight(void)
returns the flux neutrino weight (if any)
Definition: GAtmoFlux.h:70
virtual bool FillFluxHisto(int nu_pdg, string filename)=0
void SetSpectralIndex(double index)
Definition: GAtmoFlux.cxx:251
double Energy(void)
Definition: GAtmoFlux.h:80
bool fGenWeighted
generate a weighted or unweighted flux?
Definition: GAtmoFlux.h:149
double * fCosThetaBins
cos(theta) bins in input flux data files
Definition: GAtmoFlux.h:147
unsigned int fNumPhiBins
number of phi bins in input flux data files
Definition: GAtmoFlux.h:143
double * fEnergyBins
energy bins in input flux data files
Definition: GAtmoFlux.h:148
virtual double MaxEnergy(void)
declare the max flux neutrino energy that can be generated (for init. purposes)
Definition: GAtmoFlux.cxx:44
double MinEnergy(void)
Definition: GAtmoFlux.h:120
virtual const TLorentzVector & Momentum(void)
returns the flux neutrino 4-momentum
Definition: GAtmoFlux.h:71
double GetTotalFlux(void)
Definition: GAtmoFlux.cxx:640
void SetUserCoordSystem(TRotation &rotation)
Rotation: Topocentric Horizontal -> User-defined Topocentric Coord System.
Definition: GAtmoFlux.cxx:263
virtual long int Index(void)
returns corresponding index for current flux neutrino (e.g. for a flux ntuple returns the current ent...
Definition: GAtmoFlux.h:74
virtual bool GenerateNext(void)
generate the next flux neutrino (return false in err)
Definition: GAtmoFlux.cxx:49
TLorentzVector fgP4
current generated nu 4-momentum
Definition: GAtmoFlux.h:134
virtual const PDGCodeList & FluxParticles(void)
declare list of flux neutrinos that can be generated (for init. purposes)
Definition: GAtmoFlux.h:66
void ZeroFluxHisto(TH3D *hist)
Definition: GAtmoFlux.cxx:544
map< int, TH3D * > fRawFluxHistoMap
flux = f(Ev,cos8,phi) for each neutrino species
Definition: GAtmoFlux.h:155
double fRt
defining flux neutrino generation surface: transverse radius
Definition: GAtmoFlux.h:141
void AddFluxFile(int neutrino_pdg, string filename)
Definition: GAtmoFlux.cxx:394
virtual const TLorentzVector & Position(void)
returns the flux neutrino 4-position (note: expect SI rather than physical units) ...
Definition: GAtmoFlux.h:72
TH3D * fTotalFluxHisto
flux = f(Ev,cos8,phi) summed over neutrino species
Definition: GAtmoFlux.h:152
TH3D * CreateFluxHisto(string name, string title)
Definition: GAtmoFlux.cxx:569
void ResetSelection(void)
Definition: GAtmoFlux.cxx:326
virtual void Clear(Option_t *opt)
reset state variables based on opt
Definition: GAtmoFlux.cxx:239
PDGCodeList * fPdgCList
input list of neutrino pdg-codes
Definition: GAtmoFlux.h:132
bool GenerateNext_1try(void)
Definition: GAtmoFlux.cxx:71
A base class for the FLUKA, BGLRS and ATMNC atmo. nu. flux drivers. The driver depends on data files ...
Definition: GAtmoFlux.h:60
void ForceMinEnergy(double emin)
Definition: GAtmoFlux.cxx:227
double fMaxEv
maximum energy (in input flux files)
Definition: GAtmoFlux.h:131
TLorentzVector fgX4
current generated nu 4-position
Definition: GAtmoFlux.h:135
virtual bool End(void)
true if no more flux nu&#39;s can be thrown (eg reaching end of beam sim ntuples)
Definition: GAtmoFlux.h:73
double CosTheta(void)
Definition: GAtmoFlux.h:81
double fWeight
current generated nu weight
Definition: GAtmoFlux.h:136
GENIE Interface for user-defined flux classes.
Definition: GFluxI.h:29
virtual int PdgCode(void)
returns the flux neutrino pdg code
Definition: GAtmoFlux.h:69