GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
genie::flux::GPointSourceAstroFlux Class Reference

#include <GAstroFlux.h>

Inheritance diagram for genie::flux::GPointSourceAstroFlux:
Inheritance graph
[legend]
Collaboration diagram for genie::flux::GPointSourceAstroFlux:
Collaboration graph
[legend]

Public Member Functions

 GPointSourceAstroFlux ()
 
 ~GPointSourceAstroFlux ()
 
bool GenerateNext (void)
 generate the next flux neutrino (return false in err) More...
 
void AddPointSource (string name, double ra, double dec, double rel_intensity)
 
- Public Member Functions inherited from genie::flux::GAstroFlux
virtual ~GAstroFlux ()
 
virtual const PDGCodeListFluxParticles (void)
 declare list of flux neutrinos that can be generated (for init. purposes) More...
 
virtual double MaxEnergy (void)
 declare the max flux neutrino energy that can be generated (for init. purposes) More...
 
virtual int PdgCode (void)
 returns the flux neutrino pdg code More...
 
virtual double Weight (void)
 returns the flux neutrino weight (if any) More...
 
virtual const TLorentzVector & Momentum (void)
 returns the flux neutrino 4-momentum More...
 
virtual const TLorentzVector & Position (void)
 returns the flux neutrino 4-position (note: expect SI rather than physical units) More...
 
virtual bool End (void)
 true if no more flux nu's can be thrown (eg reaching end of beam sim ntuples) More...
 
virtual long int Index (void)
 returns corresponding index for current flux neutrino (e.g. for a flux ntuple returns the current entry number) More...
 
virtual void Clear (Option_t *opt)
 reset state variables based on opt More...
 
virtual void GenerateWeighted (bool gen_weighted)
 set whether to generate weighted or unweighted neutrinos More...
 
void ForceMinEnergy (double emin)
 
void ForceMaxEnergy (double emax)
 
void SetDetectorPosition (double latitude, double longitude, double depth, double size)
 
void SetRelNuPopulations (double nnue=1, double nnumu=2, double nnutau=0, double nnuebar=1, double nnumubar=2, double nnutaubar=0)
 
void SetEnergyPowLawIdx (double n)
 
void SetUserCoordSystem (TRotation &rotation)
 rotation Topocentric Horizontal -> User-defined Topocentric Coord System More...
 
- Public Member Functions inherited from genie::GFluxI
virtual ~GFluxI ()
 

Private Member Functions

bool SelectSource (void)
 

Private Attributes

map< int, string > fPntSrcName
 point source name More...
 
map< int, double > fPntSrcRA
 right ascension More...
 
map< int, double > fPntSrcDec
 declination More...
 
map< int, double > fPntSrcRelI
 relative intensity More...
 
double fPntSrcTotI
 sum of all relative intensities More...
 
unsigned int fSelSourceId
 

Additional Inherited Members

- Protected Member Functions inherited from genie::flux::GAstroFlux
 GAstroFlux ()
 
void Initialize (void)
 
void CleanUp (void)
 
void ResetSelection (void)
 
- Protected Member Functions inherited from genie::GFluxI
 GFluxI ()
 
- Protected Attributes inherited from genie::flux::GAstroFlux
PDGCodeListfPdgCList
 declared list of neutrino pdg-codes that can be thrown by current instance More...
 
int fgPdgC
 (current) generated nu pdg-code More...
 
TLorentzVector fgP4
 (current) generated nu 4-momentum More...
 
TLorentzVector fgX4
 (current) generated nu 4-position More...
 
double fgWeight
 (current) generated nu weight More...
 
double fMaxEvCut
 (config) user-defined maximum energy cut More...
 
double fMinEvCut
 (config) user-defined minimum energy cut More...
 
bool fGenWeighted
 (config) generate a weighted or unweighted flux? More...
 
double fDetGeoLatitude
 (config) detector: geographic latitude More...
 
double fDetGeoLongitude
 (config) detector: geographic longitude More...
 
double fDetGeoDepth
 (config) detector: depth from surface More...
 
double fDetSize
 (config) detector: size (detector should be enclosed in sphere of this radius) More...
 
map< int, double > fRelNuPopulations
 (config) relative neutrino populations More...
 
TRotation fRotGEF2THz
 (config) coord. system rotation: GEF translated to detector centre -> THZ More...
 
TRotation fRotTHz2User
 (config) coord. system rotation: THZ -> Topocentric user-defined More...
 
TVector3 fDetCenter
 
TH1D * fEnergySpectrum
 
TH2D * fSolidAngleAcceptance
 
NuGeneratorfNuGen
 
NuPropagatorfNuPropg
 

Detailed Description

Definition at line 244 of file GAstroFlux.h.

Constructor & Destructor Documentation

GPointSourceAstroFlux::GPointSourceAstroFlux ( )

Definition at line 553 of file GAstroFlux.cxx.

References clear, fPntSrcDec, fPntSrcName, fPntSrcRA, fPntSrcRelI, and fPntSrcTotI.

553  :
554 GAstroFlux()
555 {
556  fPntSrcName.clear();
557  fPntSrcRA. clear();
558  fPntSrcDec. clear();
559  fPntSrcRelI.clear();
560 
561  fPntSrcTotI = 0;
562 }
map< int, double > fPntSrcRelI
relative intensity
Definition: GAstroFlux.h:262
map< int, string > fPntSrcName
point source name
Definition: GAstroFlux.h:259
double fPntSrcTotI
sum of all relative intensities
Definition: GAstroFlux.h:263
map< int, double > fPntSrcDec
declination
Definition: GAstroFlux.h:261
map< int, double > fPntSrcRA
right ascension
Definition: GAstroFlux.h:260
vector< vector< double > > clear
GPointSourceAstroFlux::~GPointSourceAstroFlux ( )

Definition at line 564 of file GAstroFlux.cxx.

565 {
566 
567 }

Member Function Documentation

void GPointSourceAstroFlux::AddPointSource ( string  name,
double  ra,
double  dec,
double  rel_intensity 
)

Definition at line 574 of file GAstroFlux.cxx.

References fPntSrcDec, fPntSrcName, fPntSrcRA, fPntSrcRelI, fPntSrcTotI, and genie::constants::kPi.

576 {
577  bool accept =
578  (ra >= 0. && ra < 2.*kPi) &&
579  (dec >= -kPi/2. && dec <= kPi/2.) &&
580  (rel_intensity > 0) &&
581  (name.size() > 0);
582 
583  if(accept) {
584  int id = fPntSrcName.size();
585 
586  fPntSrcName.insert( map<int, string>::value_type(id, name ) );
587  fPntSrcRA. insert( map<int, double>::value_type(id, ra ) );
588  fPntSrcDec. insert( map<int, double>::value_type(id, dec ) );
589  fPntSrcRelI.insert( map<int, double>::value_type(id, rel_intensity) );
590 
591  fPntSrcTotI += rel_intensity;
592  }
593 }
map< int, double > fPntSrcRelI
relative intensity
Definition: GAstroFlux.h:262
map< int, string > fPntSrcName
point source name
Definition: GAstroFlux.h:259
double fPntSrcTotI
sum of all relative intensities
Definition: GAstroFlux.h:263
const char * name
map< int, double > fPntSrcDec
declination
Definition: GAstroFlux.h:261
map< int, double > fPntSrcRA
right ascension
Definition: GAstroFlux.h:260
bool GPointSourceAstroFlux::GenerateNext ( void  )
virtual

generate the next flux neutrino (return false in err)

Reimplemented from genie::flux::GAstroFlux.

Definition at line 569 of file GAstroFlux.cxx.

570 {
571  return true;
572 }
bool GPointSourceAstroFlux::SelectSource ( void  )
private

Definition at line 595 of file GAstroFlux.cxx.

References genie::flux::GAstroFlux::fGenWeighted, genie::flux::GAstroFlux::fgWeight, fPntSrcName, fPntSrcRelI, fPntSrcTotI, fSelSourceId, genie::RandomGen::Instance(), and genie::RandomGen::RndFlux().

596 {
597  if(fPntSrcRelI.size() == 0) {
598  return false;
599  }
600 
601  if(fPntSrcTotI <= 0.) {
602  return false;
603  }
604 
605  unsigned int srcid = 0;
606  double wght = 0;
607 
608  // Generate weighted flux:
609  //
610  if(fGenWeighted) {
611  RandomGen * rnd = RandomGen::Instance();
612  unsigned int nsrc = fPntSrcName.size();
613  srcid = rnd->RndFlux().Integer(nsrc);
614  wght = fPntSrcRelI[srcid] / fPntSrcTotI;
615  }
616  // Generate un-weighted flux:
617  //
618  else {
619  RandomGen * rnd = RandomGen::Instance();
620  double xsum = 0.;
621  double xrnd = fPntSrcTotI * rnd->RndFlux().Uniform();
622  map<int,double>::const_iterator piter = fPntSrcRelI.begin();
623  for( ; piter != fPntSrcRelI.end(); ++piter) {
624  xsum += piter->second;
625  if(xrnd < xsum) {
626  srcid = piter->first;
627  break;
628  }
629  }
630  wght = 1.;
631  }
632 
633  //
634  fSelSourceId = srcid;
635 
636  //
637  fgWeight *= wght;
638 
639  return true;
640 }
bool fGenWeighted
(config) generate a weighted or unweighted flux?
Definition: GAstroFlux.h:181
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:71
map< int, double > fPntSrcRelI
relative intensity
Definition: GAstroFlux.h:262
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:29
map< int, string > fPntSrcName
point source name
Definition: GAstroFlux.h:259
double fPntSrcTotI
sum of all relative intensities
Definition: GAstroFlux.h:263
TRandom3 & RndFlux(void) const
rnd number generator used by flux drivers
Definition: RandomGen.h:71
double fgWeight
(current) generated nu weight
Definition: GAstroFlux.h:177

Member Data Documentation

map<int, double> genie::flux::GPointSourceAstroFlux::fPntSrcDec
private

declination

Definition at line 261 of file GAstroFlux.h.

Referenced by AddPointSource(), and GPointSourceAstroFlux().

map<int, string> genie::flux::GPointSourceAstroFlux::fPntSrcName
private

point source name

Definition at line 259 of file GAstroFlux.h.

Referenced by AddPointSource(), GPointSourceAstroFlux(), and SelectSource().

map<int, double> genie::flux::GPointSourceAstroFlux::fPntSrcRA
private

right ascension

Definition at line 260 of file GAstroFlux.h.

Referenced by AddPointSource(), and GPointSourceAstroFlux().

map<int, double> genie::flux::GPointSourceAstroFlux::fPntSrcRelI
private

relative intensity

Definition at line 262 of file GAstroFlux.h.

Referenced by AddPointSource(), GPointSourceAstroFlux(), and SelectSource().

double genie::flux::GPointSourceAstroFlux::fPntSrcTotI
private

sum of all relative intensities

Definition at line 263 of file GAstroFlux.h.

Referenced by AddPointSource(), GPointSourceAstroFlux(), and SelectSource().

unsigned int genie::flux::GPointSourceAstroFlux::fSelSourceId
private

Definition at line 265 of file GAstroFlux.h.

Referenced by SelectSource().


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