49 GCylindTH1Flux::~GCylindTH1Flux()
66 fgP4.SetPxPyPzE(p3.Px(), p3.Py(), p3.Pz(), Ev);
75 fgX4.SetXYZT(0.,0.,0.,0.);
82 TVector3
vec = vec0.Orthogonal();
95 fgX4.SetXYZT(x,y,z,0.);
112 "No Clear(Option_t * opt) method implemented for opt: "<<
opt;
120 "No GenerateWeighted(bool gen_weighted) method implemented for " <<
121 "gen_weighted: " << gen_weighted;
126 LOG(
"Flux",
pNOTICE) <<
"Initializing GCylindTH1Flux driver";
145 fgP4.SetPxPyPzE (0.,0.,0.,0.);
146 fgX4.SetXYZT (0.,0.,0.,0.);
159 unsigned int nspectra =
fSpectrum.size();
160 for(
unsigned int i = 0;
i < nspectra;
i++) {
170 fDirVec =
new TVector3(direction);
181 LOG (
"Flux",
pNOTICE) <<
"Setting R[transverse] = " << Rt;
189 LOG(
"Flux",
pNOTICE) <<
"Adding flux spectrum for pdg = " << nu_pdgc;
196 <<
"The pdg-code isn't recognized and the spectrum was ignored";
200 int nb = spectrum->GetNbinsX();
201 Axis_t
max = spectrum->GetBinLowEdge(nb)+spectrum->GetBinWidth(nb);
205 <<
"Updating maximum energy of flux particles to: " <<
fMaxEv;
219 fRtDep =
new TF1(
"rdep", rdep.c_str(), 0,
fRt);
224 LOG(
"Flux",
pNOTICE) <<
"Computing combined flux";
228 vector<TH1D *>::const_iterator spectrum_iter;
232 spectrum_iter !=
fSpectrum.end(); ++spectrum_iter) {
233 TH1D * spectrum = *spectrum_iter;
246 vector<TH1D *>::const_iterator spectrum_iter;
250 spectrum_iter !=
fSpectrum.end(); ++spectrum_iter) {
251 TH1D * spectrum = *spectrum_iter;
252 fraction[inu++] = spectrum->GetBinContent(spectrum->FindBin(Ev));
256 for(inu = 0; inu <
n; inu++) {
257 sum += fraction[inu];
259 LOG(
"Flux",
pDEBUG) <<
"SUM-FRACTION(0->" << inu <<
") = " <<
sum;
263 double R = sum * rnd->
RndFlux().Rndm();
267 for(inu = 0; inu <
n; inu++) {
if ( R < fraction[inu] )
return inu;}
269 LOG(
"Flux",
pERROR) <<
"Could not select a neutrino species";
284 double Rt =
fRtDep->GetRandom();
A class for generating concrete GFluxI derived classes based on the factory pattern. This code supplies a CPP macro which allows the classes to self-register and thus no modification of this class is needed in order to expand the list of classes it knows about.
string P4AsShortString(const TLorentzVector *p)
void ResetSelection(void)
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
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
void Initialize(Bool_t useTMVAStyle=kTRUE)
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...
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)
void SetTransverseRadius(double Rt)
void SetNuDirection(const TVector3 &direction)
double GeneratePhi(void) const
TH1D * fTotSpectrum
combined flux = f(Ev)
assert(nhit_max >=nhit_nbins)
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)
TRandom3 & RndFlux(void) const
rnd number generator used by flux drivers
string X4AsString(const TLorentzVector *x)
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
#define FLUXDRIVERREG4(_nsa, _nsb, _name, _fqname)
void push_back(int pdg_code)
double fMaxEv
maximum energy