30 using namespace
genie;
31 using namespace genie::constants;
32 using namespace genie::flux;
40 GCylindTH1Flux::~GCylindTH1Flux()
59 p3.SetMag(TMath::Sqrt(Ev*Ev - Md*Md));
62 fgP4.SetPxPyPzE(p3.Px(), p3.Py(), p3.Pz(), Ev);
71 fgX4.SetXYZT(0.,0.,0.,0.);
78 TVector3 vec = vec0.Orthogonal();
91 fgX4.SetXYZT(x,y,z,0.);
108 "No Clear(Option_t * opt) method implemented for opt: "<<
opt;
116 "No GenerateWeighted(bool gen_weighted) method implemented for " <<
117 "gen_weighted: " << gen_weighted;
122 LOG(
"Flux",
pNOTICE) <<
"Initializing GCylindTH1Flux driver";
141 fgP4.SetPxPyPzE (0.,0.,0.,0.);
142 fgX4.SetXYZT (0.,0.,0.,0.);
155 unsigned int nspectra =
fSpectrum.size();
156 for(
unsigned int i = 0; i < nspectra; i++) {
166 fDirVec =
new TVector3(direction);
177 LOG (
"Flux",
pNOTICE) <<
"Setting R[transverse] = " << Rt;
185 LOG(
"Flux",
pNOTICE) <<
"Adding flux spectrum for pdg = " << nu_pdgc;
192 <<
"The pdg-code isn't recognized and the spectrum was ignored";
196 int nb = spectrum->GetNbinsX();
197 Axis_t
max = spectrum->GetBinLowEdge(nb)+spectrum->GetBinWidth(nb);
201 <<
"Updating maximum energy of flux particles to: " <<
fMaxEv;
215 fRtDep =
new TF1(
"rdep", rdep.c_str(), 0,
fRt);
220 LOG(
"Flux",
pNOTICE) <<
"Computing combined flux";
228 spectrum_iter !=
fSpectrum.end(); ++spectrum_iter) {
229 TH1D * spectrum = *spectrum_iter;
246 spectrum_iter !=
fSpectrum.end(); ++spectrum_iter) {
247 TH1D * spectrum = *spectrum_iter;
248 fraction[inu++] = spectrum->GetBinContent(spectrum->FindBin(Ev));
252 for(inu = 0; inu <
n; inu++) {
253 sum += fraction[
inu];
255 LOG(
"Flux",
pDEBUG) <<
"SUM-FRACTION(0->" << inu <<
") = " << sum;
259 double R = sum * rnd->
RndFlux().Rndm();
263 for(inu = 0; inu <
n; inu++) {
if ( R < fraction[inu] )
return inu;}
265 LOG(
"Flux",
pERROR) <<
"Could not select a neutrino species";
280 double Rt =
fRtDep->GetRandom();
string P4AsShortString(const TLorentzVector *p)
void ResetSelection(void)
static constexpr double nb
THE MAIN GENIE PROJECT NAMESPACE
static RandomGen * Instance()
Access instance.
PDGCodeList * fPdgCList
list of neutrino pdg-codes
bool GenerateNext(void)
generate the next flux neutrino (return false in err)
void SetRtDependence(string rdep)
TLorentzVector fgP4
running generated nu 4-momentum
bool ExistsInPDGCodeList(int pdg_code) const
void Clear(Option_t *opt)
reset state variables based on opt
A singleton holding random number generator classes. All random number generation in GENIE should tak...
TVector3 * fBeamSpot
beam spot position
TLorentzVector fgX4
running generated nu 4-position
vector< TH1D * > fSpectrum
flux = f(Ev), 1/neutrino species
TF1 * fRtDep
transverse radius dependence
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
const int kPdgAntiDarkMatter
double GenerateRt(void) const
TVector3 * fDirVec
neutrino direction
int fgPdgC
running generated nu pdg-code
A generic GENIE flux driver. Generates a 'cylindrical' neutrino beam along the input direction...
double fRt
transverse size of neutrino beam
int SelectNeutrino(double Ev)
static int max(int a, int b)
void SetTransverseRadius(double Rt)
void SetNuDirection(const TVector3 &direction)
double GeneratePhi(void) const
static PDGLibrary * Instance(void)
TH1D * fTotSpectrum
combined flux = f(Ev)
void GenerateWeighted(bool gen_weighted)
set whether to generate weighted or unweighted neutrinos
void SetBeamSpot(const TVector3 &spot)
void AddEnergySpectrum(int nu_pdgc, TH1D *spectrum)
TParticlePDG * Find(int pdgc, bool must_exist=true)
TRandom3 & RndFlux(void) const
rnd number generator used by flux drivers
string X4AsString(const TLorentzVector *x)
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
#define FLUXDRIVERREG4(_nsa, _nsb, _name, _fqname)
void push_back(int pdg_code)
double fMaxEv
maximum energy