GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GPowerLawFlux.h
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3 
4 \class genie::flux::GPowerLawFlux
5 
6 \brief A simple GENIE flux driver for neutrinos following a power law
7  spectrum. Can handle a mix of neutrinos with their corresponding
8  weight.
9 
10 \author Alfonso Garcia <aagarciasoto \at km3net.de>
11  IFIC
12 
13 \created May 02, 2023
14 
15 \cpright Copyright (c) 2003-2024, The GENIE Collaboration
16  For the full text of the license visit http://copyright.genie-mc.org
17 */
18 //____________________________________________________________________________
19 
20 #ifndef _G_POWERLAW_FLUX_H_
21 #define _G_POWERLAW_FLUX_H_
22 
23 #include <string>
24 #include <map>
25 
26 #include <TLorentzVector.h>
27 
29 
30 using std::string;
31 using std::map;
32 
33 namespace genie {
34 namespace flux {
35 
36 class GPowerLawFlux: public GFluxI {
37 
38 public :
39  GPowerLawFlux();
40  GPowerLawFlux(double alpha, double emin, double emax, int pdg);
41  GPowerLawFlux(double alpha, double emin, double emax, const map<int,double> & numap /* pdg -> weight*/);
43 
44  // methods implementing the GENIE GFluxI interface
45  const PDGCodeList & FluxParticles (void) { return *fPdgCList; }
46  double MaxEnergy (void) { return fMaxEv; }
47  bool GenerateNext (void);
48  int PdgCode (void) { return fgPdgC; }
49  double Weight (void) { return 1.0; }
50  const TLorentzVector & Momentum (void) { return fgP4; }
51  const TLorentzVector & Position (void) { return fgX4; }
52  bool End (void) { return false; }
53  long int Index (void) { return -1; }
54  void Clear (Option_t * opt);
55  void GenerateWeighted (bool gen_weighted);
56 
57  // special setters for this class
58  void SetDirectionCos (double dx, double dy, double dz);
59  void SetRayOrigin (double x, double y, double z);
60  // setters consistent w/ GCylindTH1Flux naming
61  void SetNuDirection (const TVector3 & direction);
62  void SetBeamSpot (const TVector3 & spot);
63 
64  // allow re-initialization, and/or initialization after default ctor
65  void Initialize (double alpha, double emin, double emax, int pdg);
66  void Initialize (double alpha, double emin, double emax, const map<int,double> & numap);
67 
68 private:
69 
70  // private methods
71  void CleanUp (void);
72 
73  // private data members
74  double fSpectralIndex; ///< spectral index (E^{-alpha})
75  double fMinEv; ///< minimum energy
76  double fMaxEv; ///< maximum energy
77  PDGCodeList * fPdgCList; ///< list of neutrino pdg-codes
78  int fgPdgC; ///< running generated nu pdg-code
79  TLorentzVector fgP4; ///< running generated nu 4-momentum
80  TLorentzVector fgX4; ///< running generated nu 4-position
81  map<int, double> fProb; ///< cumulative probability of neutrino types
82  double fProbMax;
83 };
84 
85 } // flux namespace
86 } // genie namespace
87 
88 #endif // _G_POWERLAW_FLUX_H_
void SetRayOrigin(double x, double y, double z)
const PDGCodeList & FluxParticles(void)
declare list of flux neutrinos that can be generated (for init. purposes)
Definition: GPowerLawFlux.h:45
double Weight(void)
returns the flux neutrino weight (if any)
Definition: GPowerLawFlux.h:49
bool End(void)
true if no more flux nu&#39;s can be thrown (eg reaching end of beam sim ntuples)
Definition: GPowerLawFlux.h:52
int PdgCode(void)
returns the flux neutrino pdg code
Definition: GPowerLawFlux.h:48
map< int, double > fProb
cumulative probability of neutrino types
Definition: GPowerLawFlux.h:81
A simple GENIE flux driver for neutrinos following a power law spectrum. Can handle a mix of neutrino...
Definition: GPowerLawFlux.h:36
PDGCodeList * fPdgCList
list of neutrino pdg-codes
Definition: GPowerLawFlux.h:77
A list of PDG codes.
Definition: PDGCodeList.h:32
double fSpectralIndex
spectral index (E^{-alpha})
Definition: GPowerLawFlux.h:74
const TLorentzVector & Momentum(void)
returns the flux neutrino 4-momentum
Definition: GPowerLawFlux.h:50
TLorentzVector fgX4
running generated nu 4-position
Definition: GPowerLawFlux.h:80
void Clear(Option_t *opt)
reset state variables based on opt
double fMaxEv
maximum energy
Definition: GPowerLawFlux.h:76
long int Index(void)
returns corresponding index for current flux neutrino (e.g. for a flux ntuple returns the current ent...
Definition: GPowerLawFlux.h:53
bool GenerateNext(void)
generate the next flux neutrino (return false in err)
void SetNuDirection(const TVector3 &direction)
void SetDirectionCos(double dx, double dy, double dz)
int fgPdgC
running generated nu pdg-code
Definition: GPowerLawFlux.h:78
void GenerateWeighted(bool gen_weighted)
set whether to generate weighted or unweighted neutrinos
void SetBeamSpot(const TVector3 &spot)
double MaxEnergy(void)
declare the max flux neutrino energy that can be generated (for init. purposes)
Definition: GPowerLawFlux.h:46
void Initialize(double alpha, double emin, double emax, int pdg)
const TLorentzVector & Position(void)
returns the flux neutrino 4-position (note: expect SI rather than physical units) ...
Definition: GPowerLawFlux.h:51
double fMinEv
minimum energy
Definition: GPowerLawFlux.h:75
GENIE Interface for user-defined flux classes.
Definition: GFluxI.h:29
TLorentzVector fgP4
running generated nu 4-momentum
Definition: GPowerLawFlux.h:79