Public Member Functions | Private Member Functions | Private Attributes | List of all members
genie::flux::GMonoEnergeticFlux Class Reference

A simple GENIE flux driver for monoenergetic neutrinos along the z direction. Can handle a mix of neutrinos with their corresponding weight. This trivial flux driver was added in so that single energy neutrinos can be easily used with the event generation driver that can handle a target mix or detailed geometries. More...

#include <GMonoEnergeticFlux.h>

Inheritance diagram for genie::flux::GMonoEnergeticFlux:
genie::GFluxI

Public Member Functions

 GMonoEnergeticFlux ()
 
 GMonoEnergeticFlux (double Ev, int pdg)
 
 GMonoEnergeticFlux (double Ev, const map< int, double > &numap)
 
 ~GMonoEnergeticFlux ()
 
const PDGCodeListFluxParticles (void)
 declare list of flux neutrinos that can be generated (for init. purposes) More...
 
double MaxEnergy (void)
 declare the max flux neutrino energy that can be generated (for init. purposes) More...
 
bool GenerateNext (void)
 generate the next flux neutrino (return false in err) More...
 
int PdgCode (void)
 returns the flux neutrino pdg code More...
 
double Weight (void)
 returns the flux neutrino weight (if any) More...
 
const TLorentzVector & Momentum (void)
 returns the flux neutrino 4-momentum More...
 
const TLorentzVector & Position (void)
 returns the flux neutrino 4-position (note: expect SI rather than physical units) More...
 
bool End (void)
 true if no more flux nu's can be thrown (eg reaching end of beam sim ntuples) More...
 
long int Index (void)
 returns corresponding index for current flux neutrino (e.g. for a flux ntuple returns the current entry number) More...
 
void Clear (Option_t *opt)
 reset state variables based on opt More...
 
void GenerateWeighted (bool gen_weighted)
 set whether to generate weighted or unweighted neutrinos More...
 
void SetDirectionCos (double dx, double dy, double dz)
 
void SetRayOrigin (double x, double y, double z)
 
void SetNuDirection (const TVector3 &direction)
 
void SetBeamSpot (const TVector3 &spot)
 
void Initialize (double Ev, int pdg)
 
void Initialize (double Ev, const map< int, double > &numap)
 
- Public Member Functions inherited from genie::GFluxI
virtual ~GFluxI ()
 

Private Member Functions

void CleanUp (void)
 

Private Attributes

double fMaxEv
 maximum energy More...
 
PDGCodeListfPdgCList
 list of neutrino pdg-codes More...
 
int fgPdgC
 running generated nu pdg-code More...
 
TLorentzVector fgP4
 running generated nu 4-momentum More...
 
TLorentzVector fgX4
 running generated nu 4-position More...
 
map< int, double > fProb
 
double fProbMax
 

Additional Inherited Members

- Protected Member Functions inherited from genie::GFluxI
 GFluxI ()
 

Detailed Description

A simple GENIE flux driver for monoenergetic neutrinos along the z direction. Can handle a mix of neutrinos with their corresponding weight. This trivial flux driver was added in so that single energy neutrinos can be easily used with the event generation driver that can handle a target mix or detailed geometries.

Author
Costas Andreopoulos <constantinos.andreopoulos cern.ch> University of Liverpool & STFC Rutherford Appleton Laboratory

Feb 08, 2008

Copyright (c) 2003-2020, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 38 of file GMonoEnergeticFlux.h.

Constructor & Destructor Documentation

GMonoEnergeticFlux::GMonoEnergeticFlux ( )

Definition at line 28 of file GMonoEnergeticFlux.cxx.

28  :
29 GFluxI()
30 {
31  // default ctor for consistency with GFluxDriverFactory needs
32  // up to user to call Initialize() to set energy and flavor(s)
33 }
GMonoEnergeticFlux::GMonoEnergeticFlux ( double  Ev,
int  pdg 
)

Definition at line 35 of file GMonoEnergeticFlux.cxx.

35  :
36 GFluxI()
37 {
38  this->Initialize(Ev,pdg);
39 }
void Initialize(double Ev, int pdg)
GMonoEnergeticFlux::GMonoEnergeticFlux ( double  Ev,
const map< int, double > &  numap 
)

Definition at line 41 of file GMonoEnergeticFlux.cxx.

42  :
43 GFluxI()
44 {
45  this->Initialize(Ev,numap);
46 }
void Initialize(double Ev, int pdg)
GMonoEnergeticFlux::~GMonoEnergeticFlux ( )

Definition at line 48 of file GMonoEnergeticFlux.cxx.

49 {
50  this->CleanUp();
51 }

Member Function Documentation

void GMonoEnergeticFlux::CleanUp ( void  )
private

Definition at line 130 of file GMonoEnergeticFlux.cxx.

131 {
132  LOG("Flux", pNOTICE) << "Cleaning up...";
133 
134  if (fPdgCList) delete fPdgCList;
135 }
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
PDGCodeList * fPdgCList
list of neutrino pdg-codes
#define pNOTICE
Definition: Messenger.h:61
void GMonoEnergeticFlux::Clear ( Option_t *  opt)
virtual

reset state variables based on opt

Implements genie::GFluxI.

Definition at line 77 of file GMonoEnergeticFlux.cxx.

78 {
79 // Dummy clear method needed to conform to GFluxI interface
80 //
81  LOG("Flux", pERROR) <<
82  "No Clear(Option_t * opt) method implemented for opt: "<< opt;
83 }
#define pERROR
Definition: Messenger.h:59
opt
Definition: train.py:196
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
bool genie::flux::GMonoEnergeticFlux::End ( void  )
inlinevirtual

true if no more flux nu's can be thrown (eg reaching end of beam sim ntuples)

Implements genie::GFluxI.

Definition at line 54 of file GMonoEnergeticFlux.h.

54 { return false; }
const PDGCodeList& genie::flux::GMonoEnergeticFlux::FluxParticles ( void  )
inlinevirtual

declare list of flux neutrinos that can be generated (for init. purposes)

Implements genie::GFluxI.

Definition at line 47 of file GMonoEnergeticFlux.h.

47 { return *fPdgCList; }
PDGCodeList * fPdgCList
list of neutrino pdg-codes
bool GMonoEnergeticFlux::GenerateNext ( void  )
virtual

generate the next flux neutrino (return false in err)

Implements genie::GFluxI.

Definition at line 53 of file GMonoEnergeticFlux.cxx.

54 {
56  double p = fProbMax * rnd->RndFlux().Rndm();
57 
59  for(iter = fProb.begin(); iter != fProb.end(); ++iter) {
60  int nupdgc = iter->first;
61  double prob = iter->second;
62  if (p<prob) {
63  fgPdgC = nupdgc;
64  break;
65  }
66  }
67 
68  LOG("Flux", pINFO)
69  << "Generated neutrino: "
70  << "\n pdg-code: " << fgPdgC
71  << "\n p4: " << utils::print::P4AsShortString(&fgP4)
72  << "\n x4: " << utils::print::X4AsString(&fgX4);
73 
74  return true;
75 }
string P4AsShortString(const TLorentzVector *p)
Definition: PrintUtils.cxx:45
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:71
int fgPdgC
running generated nu pdg-code
TLorentzVector fgP4
running generated nu 4-momentum
intermediate_table::const_iterator const_iterator
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:29
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
p
Definition: test.py:223
#define pINFO
Definition: Messenger.h:62
TLorentzVector fgX4
running generated nu 4-position
TRandom3 & RndFlux(void) const
rnd number generator used by flux drivers
Definition: RandomGen.h:71
string X4AsString(const TLorentzVector *x)
Definition: PrintUtils.cxx:57
void GMonoEnergeticFlux::GenerateWeighted ( bool  gen_weighted)
virtual

set whether to generate weighted or unweighted neutrinos

Implements genie::GFluxI.

Definition at line 85 of file GMonoEnergeticFlux.cxx.

86 {
87 // Dummy implementation needed to conform to GFluxI interface
88 //
89  LOG("Flux", pERROR) <<
90  "No GenerateWeighted(bool gen_weighted) method implemented for " <<
91  "gen_weighted: " << gen_weighted;
92 }
#define pERROR
Definition: Messenger.h:59
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
long int genie::flux::GMonoEnergeticFlux::Index ( void  )
inlinevirtual

returns corresponding index for current flux neutrino (e.g. for a flux ntuple returns the current entry number)

Implements genie::GFluxI.

Definition at line 55 of file GMonoEnergeticFlux.h.

55 { return -1; }
void GMonoEnergeticFlux::Initialize ( double  Ev,
int  pdg 
)

Definition at line 94 of file GMonoEnergeticFlux.cxx.

95 {
96  map<int,double> numap;
97  numap.insert( map<int, double>::value_type(pdg, 1.) );
98 
99  this->Initialize(Ev,numap);
100 }
void Initialize(double Ev, int pdg)
void GMonoEnergeticFlux::Initialize ( double  Ev,
const map< int, double > &  numap 
)

Definition at line 102 of file GMonoEnergeticFlux.cxx.

103 {
104  LOG("Flux", pNOTICE) << "Initializing GMonoEnergeticFlux driver";
105 
106  fMaxEv = Ev + 0.05;
107 
108  fPdgCList = new PDGCodeList;
109  fPdgCList->clear();
110 
111  fProbMax = 0;
112  fProb.clear();
113 
115  for(iter = numap.begin(); iter != numap.end(); ++iter) {
116  int nupdgc = iter->first;
117  double nuwgt = iter->second;
118 
119  fPdgCList->push_back(nupdgc);
120 
121  fProbMax+=nuwgt;
122  fProb.insert(map<int, double>::value_type(nupdgc,fProbMax));
123  }
124 
125  fgPdgC = 0;
126  fgP4.SetPxPyPzE (0.,0.,Ev,Ev);
127  fgX4.SetXYZT (0.,0.,0.,0.);
128 }
int fgPdgC
running generated nu pdg-code
TLorentzVector fgP4
running generated nu 4-momentum
intermediate_table::const_iterator const_iterator
A list of PDG codes.
Definition: PDGCodeList.h:32
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
PDGCodeList * fPdgCList
list of neutrino pdg-codes
TLorentzVector fgX4
running generated nu 4-position
#define pNOTICE
Definition: Messenger.h:61
void push_back(int pdg_code)
Definition: PDGCodeList.cxx:58
double genie::flux::GMonoEnergeticFlux::MaxEnergy ( void  )
inlinevirtual

declare the max flux neutrino energy that can be generated (for init. purposes)

Implements genie::GFluxI.

Definition at line 48 of file GMonoEnergeticFlux.h.

48 { return fMaxEv; }
const TLorentzVector& genie::flux::GMonoEnergeticFlux::Momentum ( void  )
inlinevirtual

returns the flux neutrino 4-momentum

Implements genie::GFluxI.

Definition at line 52 of file GMonoEnergeticFlux.h.

52 { return fgP4; }
TLorentzVector fgP4
running generated nu 4-momentum
int genie::flux::GMonoEnergeticFlux::PdgCode ( void  )
inlinevirtual

returns the flux neutrino pdg code

Implements genie::GFluxI.

Definition at line 50 of file GMonoEnergeticFlux.h.

50 { return fgPdgC; }
int fgPdgC
running generated nu pdg-code
const TLorentzVector& genie::flux::GMonoEnergeticFlux::Position ( void  )
inlinevirtual

returns the flux neutrino 4-position (note: expect SI rather than physical units)

Implements genie::GFluxI.

Definition at line 53 of file GMonoEnergeticFlux.h.

53 { return fgX4; }
TLorentzVector fgX4
running generated nu 4-position
void GMonoEnergeticFlux::SetBeamSpot ( const TVector3 &  spot)

Definition at line 160 of file GMonoEnergeticFlux.cxx.

161 {
162  SetRayOrigin(spot.x(), spot.y(), spot.z());
163 }
void SetRayOrigin(double x, double y, double z)
void GMonoEnergeticFlux::SetDirectionCos ( double  dx,
double  dy,
double  dz 
)

Definition at line 137 of file GMonoEnergeticFlux.cxx.

138 {
139  TVector3 dircos1 = TVector3(dx,dy,dz).Unit();
140  LOG("Flux", pNOTICE) << "SetDirectionCos "
141  << utils::print::P3AsString(&dircos1);
142  double E = fgP4.E();
143  fgP4.SetVect(E*dircos1);
144 
145 }
TLorentzVector fgP4
running generated nu 4-momentum
string P3AsString(const TVector3 *vec)
Definition: PrintUtils.cxx:69
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pNOTICE
Definition: Messenger.h:61
void GMonoEnergeticFlux::SetNuDirection ( const TVector3 &  direction)

Definition at line 155 of file GMonoEnergeticFlux.cxx.

156 {
158 }
void SetDirectionCos(double dx, double dy, double dz)
void GMonoEnergeticFlux::SetRayOrigin ( double  x,
double  y,
double  z 
)

Definition at line 147 of file GMonoEnergeticFlux.cxx.

148 {
149  TVector3 xyz(x,y,z);
150  LOG("Flux", pNOTICE) << "SetRayOrigin "
152  fgX4.SetVect(xyz);
153 }
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
list x
Definition: train.py:276
TLorentzVector fgX4
running generated nu 4-position
#define pNOTICE
Definition: Messenger.h:61
string Vec3AsString(const TVector3 *vec)
Definition: PrintUtils.cxx:80
double genie::flux::GMonoEnergeticFlux::Weight ( void  )
inlinevirtual

returns the flux neutrino weight (if any)

Implements genie::GFluxI.

Definition at line 51 of file GMonoEnergeticFlux.h.

51 { return 1.0; }

Member Data Documentation

TLorentzVector genie::flux::GMonoEnergeticFlux::fgP4
private

running generated nu 4-momentum

Definition at line 79 of file GMonoEnergeticFlux.h.

int genie::flux::GMonoEnergeticFlux::fgPdgC
private

running generated nu pdg-code

Definition at line 78 of file GMonoEnergeticFlux.h.

TLorentzVector genie::flux::GMonoEnergeticFlux::fgX4
private

running generated nu 4-position

Definition at line 80 of file GMonoEnergeticFlux.h.

double genie::flux::GMonoEnergeticFlux::fMaxEv
private

maximum energy

Definition at line 76 of file GMonoEnergeticFlux.h.

PDGCodeList* genie::flux::GMonoEnergeticFlux::fPdgCList
private

list of neutrino pdg-codes

Definition at line 77 of file GMonoEnergeticFlux.h.

map<int, double> genie::flux::GMonoEnergeticFlux::fProb
private

Definition at line 81 of file GMonoEnergeticFlux.h.

double genie::flux::GMonoEnergeticFlux::fProbMax
private

Definition at line 82 of file GMonoEnergeticFlux.h.


The documentation for this class was generated from the following files: