70 double wght_species = 1.;
71 double wght_energy = 1.;
72 double wght_origin = 1.;
75 double log10E = -99999;
77 double costheta = -999999;
81 status =
fNuGen->SelectNuPdg(
87 status =
fNuGen->SelectEnergy(
92 double Ev = TMath::Power(10.,log10E);
94 status =
fNuGen->SelectOrigin(
110 int pnupdg =
fNuPropg->NuPdgAtDetVolBoundary();
111 TVector3 & px3 =
fNuPropg->X3AtDetVolBoundary();
112 TVector3 & pp3 =
fNuPropg->P3AtDetVolBoundary();
128 fgWeight = wght_species * wght_energy * wght_origin;
133 fgP4.SetE(pp3.Mag());
154 LOG(
"Flux",
pERROR) <<
"No clear method implemented for option:"<< opt;
163 double latitude,
double longitude,
double depth,
double size)
168 assert(latitude >= -
kPi/2. && latitude <=
kPi/2.);
169 assert(longitude >= 0. && longitude < 2.*
kPi );
188 double sintheta = TMath::Sin(theta);
189 double costheta = TMath::Cos(theta);
190 double sinphi = TMath::Sin(phi);
191 double cosphi = TMath::Cos(phi);
193 double xdc = radius * sintheta * cosphi;
194 double ydc = radius * sintheta * sinphi;
195 double zdc = radius * costheta;
209 double nnue,
double nnumu,
double nnutau,
210 double nnuebar,
double nnumubar,
double nnutaubar)
217 map<int,double>::value_type(
kPdgNuE, nnue));
222 map<int,double>::value_type(
kPdgNuMu, nnumu));
227 map<int,double>::value_type(
kPdgNuTau, nnutau));
232 map<int,double>::value_type(
kPdgAntiNuE, nnuebar));
246 double tot = nnue + nnumu + nnutau + nnuebar + nnumubar + nnutaubar;
252 double fraction = iter->second;
253 double norm_fraction = fraction/tot;
271 double Ev = TMath::Power(10., log10E);
272 double flux = TMath::Power(Ev, -1*n);
288 LOG(
"Flux",
pNOTICE) <<
"Initializing flux driver";
290 bool allow_dup =
false;
338 fgP4.SetPxPyPzE (0.,0.,0.,0.);
339 fgX4.SetXYZT (0.,0.,0.,0.);
364 bool weighted,
const map<int,double> & nupdgpdf,
365 int & nupdg,
double & wght)
372 if(nupdgpdf.size() == 0) {
381 unsigned int nnu = nupdgpdf.size();
382 unsigned int inu = rnd->
RndFlux().Integer(nnu);
383 map<int,double>::const_iterator iter = nupdgpdf.begin();
392 double xrnd = rnd->
RndFlux().Uniform();
393 map<int,double>::const_iterator iter = nupdgpdf.begin();
394 for( ; iter != nupdgpdf.end(); ++iter) {
395 xsum += iter->second;
412 bool weighted, TH1D & log10Epdf,
double log10Emin,
double log10Emax,
413 double & log10E,
double & wght)
421 if(log10Emax <= log10Emin) {
429 log10E = log10Emin + (log10Emax-log10Emin) * rnd->
RndFlux().Rndm();
430 wght = log10Epdf.GetBinContent(log10Epdf.FindBin(log10E));
437 log10E = log10Epdf.GetRandom();
439 while(log10E < log10Emin || log10E > log10Emax);
447 bool weighted, TH2D & opdf,
448 double & phi,
double & costheta,
double & wght)
459 costheta = -1. + 2.*rnd->
RndFlux().Rndm();
460 wght = opdf.GetBinContent(opdf.FindBin(phi,costheta));
466 opdf.GetRandom2(phi,costheta);
474 double phi,
double costheta,
const TVector3 & detector_centre,
475 double detector_sz,
int nu_pdg,
double Ev)
483 double sintheta = TMath::Sqrt(1-costheta*costheta);
484 double cosphi = TMath::Cos(phi);
485 double sinphi = TMath::Sin(phi);
487 double zs = REarth * costheta;
488 double ys = REarth * sintheta * cosphi;
489 double xs = REarth * sintheta * sinphi;
491 TVector3 start_position(xs,ys,zs);
492 fX3 = start_position - detector_centre;
497 TVector3 direction_unit_vec = -1. *
fX3.Unit();
498 fP3 = Ev * direction_unit_vec;
505 LOG(
"Flux",
pWARN) <<
"|detsize| = " << detector_sz;
508 double currdist =
fX3.Mag();
509 if(currdist <= detector_sz - 0.1)
break;
511 double stepsz = (currdist-detector_sz >
fStepSize) ?
513 if(stepsz <= 0.)
break;
524 fX3 += (stepsz * direction_unit_vec);
575 string name,
double ra,
double dec,
double rel_intensity)
578 (ra >= 0. && ra < 2.*
kPi) &&
579 (dec >= -
kPi/2. && dec <=
kPi/2.) &&
580 (rel_intensity > 0) &&
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) );
605 unsigned int srcid = 0;
613 srcid = rnd->
RndFlux().Integer(nsrc);
622 map<int,double>::const_iterator piter =
fPntSrcRelI.begin();
624 xsum += piter->second;
626 srcid = piter->first;
vector< vector< double > > clear
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils.
A singleton holding random number generator classes. All random number generation in GENIE should tak...
static RandomGen * Instance()
Access instance.
TRandom3 & RndFlux(void) const
rnd number generator used by flux drivers
bool SelectNuPdg(bool weighted, const map< int, double > &nupdgpdf, int &nupdg, double &wght)
bool SelectEnergy(bool weighted, TH1D &log10epdf, double log10emin, double log10emax, double &log10e, double &wght)
bool SelectOrigin(bool weighted, TH2D &opdf, double &phi, double &costheta, double &wght)
bool Go(double phi_start, double costheta_start, const TVector3 &detector_centre, double detector_sz, int nu_pdg, double Ev)
double fMaxEvCut
(config) user-defined maximum energy cut
TLorentzVector fgP4
(current) generated nu 4-momentum
double fgWeight
(current) generated nu weight
void ForceMaxEnergy(double emax)
void SetUserCoordSystem(TRotation &rotation)
rotation Topocentric Horizontal -> User-defined Topocentric Coord System
void SetEnergyPowLawIdx(double n)
map< int, double > fRelNuPopulations
(config) relative neutrino populations
void ResetSelection(void)
PDGCodeList * fPdgCList
declared list of neutrino pdg-codes that can be thrown by current instance
virtual double MaxEnergy(void)
declare the max flux neutrino energy that can be generated (for init. purposes)
int fgPdgC
(current) generated nu pdg-code
TRotation fRotGEF2THz
(config) coord. system rotation: GEF translated to detector centre -> THZ
double fDetGeoLatitude
(config) detector: geographic latitude
virtual void Clear(Option_t *opt)
reset state variables based on opt
TRotation fRotTHz2User
(config) coord. system rotation: THZ -> Topocentric user-defined
TLorentzVector fgX4
(current) generated nu 4-position
double fDetGeoDepth
(config) detector: depth from surface
double fMinEvCut
(config) user-defined minimum energy cut
void ForceMinEnergy(double emin)
TH2D * fSolidAngleAcceptance
bool fGenWeighted
(config) generate a weighted or unweighted flux?
double fDetGeoLongitude
(config) detector: geographic longitude
virtual void GenerateWeighted(bool gen_weighted)
set whether to generate weighted or unweighted neutrinos
virtual bool GenerateNext(void)
generate the next flux neutrino (return false in err)
void SetRelNuPopulations(double nnue=1, double nnumu=2, double nnutau=0, double nnuebar=1, double nnumubar=2, double nnutaubar=0)
double fDetSize
(config) detector: size (detector should be enclosed in sphere of this radius)
void SetDetectorPosition(double latitude, double longitude, double depth, double size)
bool GenerateNext(void)
generate the next flux neutrino (return false in err)
unsigned int fSelSourceId
map< int, double > fPntSrcRA
right ascension
double fPntSrcTotI
sum of all relative intensities
map< int, double > fPntSrcRelI
relative intensity
void AddPointSource(string name, double ra, double dec, double rel_intensity)
map< int, string > fPntSrcName
point source name
map< int, double > fPntSrcDec
declination
static const double kREarth
const double kAstroDefMinEv
const int kAstroNlog10EvBins
const double kAstroDefMaxEv
static constexpr double km
static constexpr double m
static constexpr double GeV
THE MAIN GENIE PROJECT NAMESPACE