GENIEGenerator
Loading...
Searching...
No Matches
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-2025, 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
30using std::string;
31using std::map;
32
33namespace genie {
34namespace flux {
35
36class GPowerLawFlux: public GFluxI {
37
38public :
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
68private:
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_
A list of PDG codes.
Definition PDGCodeList.h:32
double fMaxEv
maximum energy
void SetNuDirection(const TVector3 &direction)
const TLorentzVector & Momentum(void)
returns the flux neutrino 4-momentum
bool GenerateNext(void)
generate the next flux neutrino (return false in err)
bool End(void)
true if no more flux nu's can be thrown (eg reaching end of beam sim ntuples)
double fSpectralIndex
spectral index (E^{-alpha})
const PDGCodeList & FluxParticles(void)
declare list of flux neutrinos that can be generated (for init. purposes)
double Weight(void)
returns the flux neutrino weight (if any)
TLorentzVector fgX4
running generated nu 4-position
void SetDirectionCos(double dx, double dy, double dz)
TLorentzVector fgP4
running generated nu 4-momentum
long int Index(void)
returns corresponding index for current flux neutrino (e.g. for a flux ntuple returns the current ent...
int fgPdgC
running generated nu pdg-code
map< int, double > fProb
cumulative probability of neutrino types
void GenerateWeighted(bool gen_weighted)
set whether to generate weighted or unweighted neutrinos
double MaxEnergy(void)
declare the max flux neutrino energy that can be generated (for init. purposes)
void SetRayOrigin(double x, double y, double z)
void SetBeamSpot(const TVector3 &spot)
PDGCodeList * fPdgCList
list of neutrino pdg-codes
void Clear(Option_t *opt)
reset state variables based on opt
int PdgCode(void)
returns the flux neutrino pdg code
double fMinEv
minimum energy
const TLorentzVector & Position(void)
returns the flux neutrino 4-position (note: expect SI rather than physical units)
void Initialize(void)
GENIE flux drivers.
Utilities for improving the code readability when using PDG codes.
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25