16#include "Framework/Conventions/GBuild.h"
60 <<
"Generating kinematics uniformly over the allowed phase space";
110 assert(xl.
min>0 && yl.
min>0);
122 double dx = xl.
max - xl.
min;
123 double dy = yl.
max - yl.
min;
124 double dt = tl.
max - tl.
min;
125 double gx=-1, gy=-1, gt=-1, gW=-1,
gQ2=-1, xsec=-1;
127 unsigned int iter = 0;
133 <<
" Couldn't select kinematics after " << iter <<
" iterations";
136 exception.
SetReason(
"Couldn't select kinematics");
151 <<
"Trying: x = " << gx <<
", y = " << gy <<
", t = " << gt;
159 double n = xsec_max * rnd->
RndKine().Rndm();
162#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
164 <<
"xsec= " << xsec <<
", J= " << J <<
", Rnd= " << n;
166 accept = (n < J*xsec);
182 double totxsec = evrec->
XSec();
183 double wght = (vol/totxsec)*xsec;
184 LOG(
"DFRKinematics",
pNOTICE) <<
"Kinematics wght = "<< wght;
188 LOG(
"DFRKinematics",
pNOTICE) <<
"Current event wght = " << wght;
196 <<
"Selected x,y => W = " << gW <<
", Q2 = " <<
gQ2;
261#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
263 <<
"Computing max xsec in allowed phase space";
265 double max_xsec = 0.0;
275 double xmin = xl.
min;
276 double xmax = xl.
max;
277 double ymin = yl.
min;
278 double ymax = yl.
max;
279 double dx = (xmax-xmin)/(Nx-1);
280 double dy = (ymax-ymin)/(Ny-1);
283#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
285 <<
"Searching max. in x [" << xmin <<
", " << xmax
286 <<
"], y [" << ymin <<
", " << ymax <<
"], z [" << zmin <<
", " << zmax <<
"]";
288 double xseclast_y = -1;
291 for(
int i=0; i<Ny; i++) {
292 double gy = ymin + i*dy;
295#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
296 LOG(
"DFRKinematics",
pDEBUG) <<
"y = " << gy;
298 for(
int j=0; j<Nx; j++) {
299 double gx = xmin + j*dx;
314 double tmin = tl.
min;
315 double tmax = tl.
max;
316 double dt = (tmax-tmin)/(Nt-1);
317 for(
int k=0; k<Nt; k++) {
318 double gt = tmin + k*dt;
322#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
324 <<
"xsec(y=" << gy <<
", x=" << gx <<
", t=" << gt <<
") = " << xsec;
327 max_xsec = TMath::Max(xsec, max_xsec);
330 increasing_y = max_xsec-xseclast_y>=0;
331 xseclast_y = max_xsec;
333#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
335 <<
"d2xsec/dxdy stopped increasing. Exiting y loop";
345#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
347 SLOG(
"DFRKinematics",
pDEBUG) <<
"Max xsec in phase space = " << max_xsec;
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
virtual void Configure(const Registry &config)
bool GetParamDef(const RgKey &name, T &p, const T &def) const
double ComputeMaxXSec(const Interaction *interaction) const
void ProcessEventRecord(GHepRecord *event_rec) const
void Configure(const Registry &config)
~DFRKinematicsGenerator()
Defines the EventGeneratorI interface.
virtual const XSecAlgorithmI * CrossSectionAlg(void) const =0
GENIE's GHEP MC event record.
virtual double Weight(void) const
virtual void SetDiffXSec(double xsec, KinePhaseSpace_t ps)
virtual double XSec(void) const
virtual Interaction * Summary(void) const
virtual TBits * EventFlags(void) const
virtual void SetWeight(double wght)
Initial State information.
const Target & Tgt(void) const
double ProbeE(RefFrame_t rf) const
Summary information for an interaction.
string AsString(void) const
const KPhaseSpace & PhaseSpace(void) const
const InitialState & InitState(void) const
Kinematics * KinePtr(void) const
Range1D_t XLim(void) const
x limits
Range1D_t Q2Lim_W(void) const
Q2 limits @ fixed W.
Range1D_t TLim(void) const
t limits
Range1D_t YLim(void) const
y limits
Range1D_t WLim(void) const
W limits.
Range1D_t Limits(KineVar_t kvar) const
Return the kinematical variable limits.
static double GetTMaxDFR()
virtual void AssertXSecLimits(const Interaction *in, double xsec, double xsec_max) const
bool fGenerateUniformly
uniform over allowed phase space + event weight?
double fMaxXSecDiffTolerance
max{100*(xsec-maxxsec)/.5*(xsec+maxxsec)} if xsec>maxxsec
double fEMin
min E for which maxxsec is cached - forcing explicit calc.
double fSafetyFactor
ComputeMaxXSec -> ComputeMaxXSec * fSafetyFactor.
virtual double MaxXSec(GHepRecord *evrec, const int nkey=0) const
const XSecAlgorithmI * fXSecModel
void Setx(double x, bool selected=false)
void SetQ2(double Q2, bool selected=false)
double Q2(bool selected=false) const
void Sett(double t, bool selected=false)
double W(bool selected=false) const
void ClearRunningValues(void)
void Sety(double y, bool selected=false)
void SetW(double W, bool selected=false)
A singleton holding random number generator classes. All random number generation in GENIE should tak...
static RandomGen * Instance()
Access instance.
TRandom3 & RndKine(void) const
rnd number generator used by kinematics generators
A simple [min,max] interval for doubles.
A registry. Provides the container for algorithm configuration parameters.
Keep info on the event generation thread currently on charge. This is used so that event generation m...
static RunningThreadInfo * Instance(void)
const EventGeneratorI * RunningThread(void)
const TLorentzVector & HitNucP4(void) const
An exception thrown by EventRecordVisitorI when the normal processing sequence has to be disrupted (f...
void SwitchOnFastForward(void)
void SetReason(string reason)
Misc GENIE control constants.
static const unsigned int kRjMaxIterations
Simple functions for loading and reading nucleus dependent keys from config files.
void UpdateWQ2FromXY(const Interaction *in)
void XYtoWQ2(double Ev, double M, double &W, double &Q2, double x, double y)
double PhaseSpaceVolume(const Interaction *const i, KinePhaseSpace_t ps)
bool IsWithinLimits(double x, Range1D_t range)
Root of GENIE utility namespaces.
THE MAIN GENIE PROJECT NAMESPACE
const UInt_t kISkipKinematicChk
if set, skip kinematic validity checks
const UInt_t kISkipProcessChk
if set, skip process validity checks