GENIEGenerator
Loading...
Searching...
No Matches
genie::flux::GPointSourceAstroFlux Class Reference

#include <GAstroFlux.h>

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

Public Member Functions

 GPointSourceAstroFlux ()
 ~GPointSourceAstroFlux ()
bool GenerateNext (void)
 generate the next flux neutrino (return false in err)
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)
virtual double MaxEnergy (void)
 declare the max flux neutrino energy that can be generated (for init. purposes)
virtual int PdgCode (void)
 returns the flux neutrino pdg code
virtual double Weight (void)
 returns the flux neutrino weight (if any)
virtual const TLorentzVector & Momentum (void)
 returns the flux neutrino 4-momentum
virtual const TLorentzVector & Position (void)
 returns the flux neutrino 4-position (note: expect SI rather than physical units)
virtual bool End (void)
 true if no more flux nu's can be thrown (eg reaching end of beam sim ntuples)
virtual long int Index (void)
 returns corresponding index for current flux neutrino (e.g. for a flux ntuple returns the current entry number)
virtual void Clear (Option_t *opt)
 reset state variables based on opt
virtual void GenerateWeighted (bool gen_weighted)
 set whether to generate weighted or unweighted neutrinos
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
Public Member Functions inherited from genie::GFluxI
virtual ~GFluxI ()

Private Member Functions

bool SelectSource (void)

Private Attributes

map< int, string > fPntSrcName
 point source name
map< int, double > fPntSrcRA
 right ascension
map< int, double > fPntSrcDec
 declination
map< int, double > fPntSrcRelI
 relative intensity
double fPntSrcTotI
 sum of all relative intensities
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
int fgPdgC
 (current) generated nu pdg-code
TLorentzVector fgP4
 (current) generated nu 4-momentum
TLorentzVector fgX4
 (current) generated nu 4-position
double fgWeight
 (current) generated nu weight
double fMaxEvCut
 (config) user-defined maximum energy cut
double fMinEvCut
 (config) user-defined minimum energy cut
bool fGenWeighted
 (config) generate a weighted or unweighted flux?
double fDetGeoLatitude
 (config) detector: geographic latitude
double fDetGeoLongitude
 (config) detector: geographic longitude
double fDetGeoDepth
 (config) detector: depth from surface
double fDetSize
 (config) detector: size (detector should be enclosed in sphere of this radius)
map< int, double > fRelNuPopulations
 (config) relative neutrino populations
TRotation fRotGEF2THz
 (config) coord. system rotation: GEF translated to detector centre -> THZ
TRotation fRotTHz2User
 (config) coord. system rotation: THZ -> Topocentric user-defined
TVector3 fDetCenter
TH1D * fEnergySpectrum
TH2D * fSolidAngleAcceptance
NuGeneratorfNuGen
NuPropagatorfNuPropg

Detailed Description

Definition at line 244 of file GAstroFlux.h.

Constructor & Destructor Documentation

◆ GPointSourceAstroFlux()

GPointSourceAstroFlux::GPointSourceAstroFlux ( )

Definition at line 553 of file GAstroFlux.cxx.

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

References clear, fPntSrcDec, fPntSrcName, fPntSrcRA, fPntSrcRelI, fPntSrcTotI, and genie::flux::GAstroFlux::GAstroFlux().

◆ ~GPointSourceAstroFlux()

GPointSourceAstroFlux::~GPointSourceAstroFlux ( )

Definition at line 564 of file GAstroFlux.cxx.

565{
566
567}

Member Function Documentation

◆ AddPointSource()

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

Definition at line 574 of file GAstroFlux.cxx.

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}

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

◆ GenerateNext()

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}

◆ SelectSource()

bool GPointSourceAstroFlux::SelectSource ( void )
private

Definition at line 595 of file GAstroFlux.cxx.

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}
static RandomGen * Instance()
Access instance.
Definition RandomGen.cxx:74
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
bool fGenWeighted
(config) generate a weighted or unweighted flux?
Definition GAstroFlux.h:181

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

Member Data Documentation

◆ fPntSrcDec

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

declination

Definition at line 261 of file GAstroFlux.h.

Referenced by AddPointSource(), and GPointSourceAstroFlux().

◆ fPntSrcName

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().

◆ fPntSrcRA

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

right ascension

Definition at line 260 of file GAstroFlux.h.

Referenced by AddPointSource(), and GPointSourceAstroFlux().

◆ fPntSrcRelI

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

relative intensity

Definition at line 262 of file GAstroFlux.h.

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

◆ fPntSrcTotI

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().

◆ fSelSourceId

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: