GENIEGenerator
Loading...
Searching...
No Matches
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 <c.andreopoulos \at cern.ch>
30 University of Liverpool
31
32\created January 26, 2008
33
34\cpright Copyright (c) 2003-2025, 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
51class TH3D;
52
53using std::string;
54using std::map;
55using std::vector;
56
57namespace genie {
58namespace flux {
59
60class GAtmoFlux: public GFluxI {
61
62public :
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
110protected:
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_
A list of PDG codes.
Definition PDGCodeList.h:32
TH3D * CreateNormalisedFluxHisto(TH3D *hist)
map< int, TH3D * > fRawFluxHistoMap
flux = f(Ev,cos8,phi) for each neutrino species
Definition GAtmoFlux.h:155
double MinEnergy(void)
Definition GAtmoFlux.h:120
bool fInitialized
flag to check that initialization is run
Definition GAtmoFlux.h:151
void AddFluxFile(int neutrino_pdg, string filename)
int fgPdgC
current generated nu pdg-code
Definition GAtmoFlux.h:133
bool GenerateNext_1try(void)
Definition GAtmoFlux.cxx:71
double fRl
defining flux neutrino generation surface: longitudinal radius
Definition GAtmoFlux.h:140
virtual bool GenerateNext(void)
generate the next flux neutrino (return false in err)
Definition GAtmoFlux.cxx:49
double fWeight
current generated nu weight
Definition GAtmoFlux.h:136
TH3D * CreateFluxHisto(string name, string title)
void ForceMaxEnergy(double emax)
double GetTransverseRadius(void)
double GetTotalFlux(void)
PDGCodeList * fPdgCList
input list of neutrino pdg-codes
Definition GAtmoFlux.h:132
double fMaxEvCut
user-defined cut: maximum energy
Definition GAtmoFlux.h:138
vector< string > fFluxFile
input flux file for each neutrino species
Definition GAtmoFlux.h:157
double GetTotalFluxInEnergyRange(void)
TH3D * GetFluxHistogram(int flavour)
TH3D * fTotalFluxHisto
flux = f(Ev,cos8,phi) summed over neutrino species
Definition GAtmoFlux.h:152
virtual void Clear(Option_t *opt)
reset state variables based on opt
virtual const TLorentzVector & Momentum(void)
returns the flux neutrino 4-momentum
Definition GAtmoFlux.h:71
double GetFluxSurfaceArea(void)
unsigned int fNumEnergyBins
number of energy bins in input flux data files
Definition GAtmoFlux.h:145
virtual const TLorentzVector & Position(void)
returns the flux neutrino 4-position (note: expect SI rather than physical units)
Definition GAtmoFlux.h:72
vector< int > fFluxFlavour
input flux file for each neutrino species
Definition GAtmoFlux.h:156
void ForceMinEnergy(double emin)
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 the...
virtual void GenerateWeighted(bool gen_weighted)
set whether to generate weighted or unweighted neutrinos
void ZeroFluxHisto(TH3D *hist)
double fMaxEv
maximum energy (in input flux files)
Definition GAtmoFlux.h:131
bool fGenWeighted
generate a weighted or unweighted flux?
Definition GAtmoFlux.h:149
virtual const PDGCodeList & FluxParticles(void)
declare list of flux neutrinos that can be generated (for init. purposes)
Definition GAtmoFlux.h:66
double fMinEvCut
user-defined cut: minimum energy
Definition GAtmoFlux.h:139
double fTotalFluxHistoIntg
fFluxSum2D integral
Definition GAtmoFlux.h:153
unsigned int fNumPhiBins
number of phi bins in input flux data files
Definition GAtmoFlux.h:143
void SetRadii(double Rlongitudinal, double Rtransverse)
TLorentzVector fgX4
current generated nu 4-position
Definition GAtmoFlux.h:135
void SetUserCoordSystem(TRotation &rotation)
Rotation: Topocentric Horizontal -> User-defined Topocentric Coord System.
double Energy(void)
Definition GAtmoFlux.h:80
TRotation fRotTHz2User
coord. system rotation: THZ -> Topocentric user-defined
Definition GAtmoFlux.h:142
double * fPhiBins
phi bins in input flux data files
Definition GAtmoFlux.h:146
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
double CosTheta(void)
Definition GAtmoFlux.h:81
virtual bool FillFluxHisto(int nu_pdg, string filename)=0
map< int, TH3D * > fFluxHistoMap
flux = f(Ev,cos8,phi) for each neutrino species
Definition GAtmoFlux.h:154
double * fCosThetaBins
cos(theta) bins in input flux data files
Definition GAtmoFlux.h:147
unsigned int fNumCosThetaBins
number of cos(theta) bins in input flux data files
Definition GAtmoFlux.h:144
virtual bool End(void)
true if no more flux nu's can be thrown (eg reaching end of beam sim ntuples)
Definition GAtmoFlux.h:73
virtual double Weight(void)
returns the flux neutrino weight (if any)
Definition GAtmoFlux.h:70
virtual int PdgCode(void)
returns the flux neutrino pdg code
Definition GAtmoFlux.h:69
int SelectNeutrino(double Ev, double costheta, double phi)
double * fEnergyBins
energy bins in input flux data files
Definition GAtmoFlux.h:148
TLorentzVector fgP4
current generated nu 4-momentum
Definition GAtmoFlux.h:134
double GetLongitudinalRadius(void)
void SetSpectralIndex(double index)
double CosZenith(void)
Definition GAtmoFlux.h:82
long int fNNeutrinos
number of flux neutrinos thrown so far
Definition GAtmoFlux.h:137
double fSpectralIndex
power law function used for weighted flux
Definition GAtmoFlux.h:150
virtual double MaxEnergy(void)
declare the max flux neutrino energy that can be generated (for init. purposes)
Definition GAtmoFlux.cxx:44
double fRt
defining flux neutrino generation surface: transverse radius
Definition GAtmoFlux.h:141
GAtmoFlux * GetFlux(void)
GENIE flux drivers.
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25