16#include "Framework/Conventions/GBuild.h"
58 <<
"Generating kinematics uniformly over the allowed phase space";
81 if(W.max <=0 || W.min>=W.max) {
82 LOG(
"DISKinematics",
pWARN) <<
"No available phase space";
85 exception.
SetReason(
"No available phase space");
96 assert(xl.
min>0 && yl.
min>0);
108 double dx = xl.
max - xl.
min;
109 double dy = yl.
max - yl.
min;
110 double gx=-1, gy=-1, gW=-1,
gQ2=-1, xsec=-1;
112 unsigned int iter = 0;
118 <<
" Couldn't select kinematics after " << iter <<
" iterations";
121 exception.
SetReason(
"Couldn't select kinematics");
134 <<
"Trying: x = " << gx <<
", y = " << gy
135 <<
" (W = " << interaction->
KinePtr()->
W() <<
","
136 <<
" (Q2 = " << interaction->
KinePtr()->
Q2() <<
")";
144 double t = xsec_max * rnd->
RndKine().Rndm();
147#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
149 <<
"xsec= " << xsec <<
", J= " << J <<
", Rnd= " << t;
151 accept = (t < J*xsec);
160 <<
"Selected: x = " << gx <<
", y = " << gy
161 <<
" (W = " << interaction->
KinePtr()->
W() <<
","
162 <<
" (Q2 = " << interaction->
KinePtr()->
Q2() <<
")";
175 double totxsec = evrec->
XSec();
176 double wght = (vol/totxsec)*xsec;
177 LOG(
"DISKinematics",
pNOTICE) <<
"Kinematics wght = "<< wght;
181 LOG(
"DISKinematics",
pNOTICE) <<
"Current event wght = " << wght;
190 <<
"Selected x,y => W = " << gW <<
", Q2 = " <<
gQ2;
249#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
250 LOG(
"DISKinematics",
pDEBUG)<<
"Computing max xsec in allowed phase space";
252 double max_xsec = 0.0;
286 double xmin = TMath::Max(xpeak-xwindow, TMath::Max(xl.
min, 5E-3));
287 double xmax = TMath::Min(xpeak+xwindow, xl.
max);
288 double ymin = TMath::Max(ypeak-ywindow, TMath::Max(yl.
min, 2E-3));
289 double ymax = TMath::Min(ypeak+ywindow, yl.
max);
290 double dx = (xmax-xmin)/(Nx-1);
291 double dy = (ymax-ymin)/(Ny-1);
293#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
295 <<
"Searching max. in x [" << xmin <<
", " << xmax <<
"], y [" << ymin <<
", " << ymax <<
"]";
297 double xseclast_y = -1;
300 for(
int i=0; i<Ny; i++) {
301 double gy = ymin + i*dy;
305#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
306 LOG(
"DISKinematics",
pDEBUG) <<
"y = " << gy;
308 double xseclast_x = -1;
311 for(
int j=0; j<Nx; j++) {
312 double gx = xmin + j*dx;
318#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
320 <<
"xsec(y=" << gy <<
", x=" << gx <<
") = " << xsec;
323 max_xsec = TMath::Max(xsec, max_xsec);
325 increasing_x = xsec-xseclast_x>=0;
332#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
334 <<
"d2xsec/dxdy|x stopped increasing. Stepping back & exiting x loop";
337 double dxn = dx/(Nxb+1);
338 for(
int ik=0; ik<Nxb; ik++) {
344#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
346 <<
"xsec(y=" << gy <<
", x=" << gx <<
") = " << xsec;
352 increasing_y = max_xsec-xseclast_y>=0;
353 xseclast_y = max_xsec;
355#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
357 <<
"d2xsec/dxdy stopped increasing. Exiting y loop";
369#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
371 SLOG(
"DISKinematics",
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...
virtual void Configure(const Registry &config)
bool GetParamDef(const RgKey &name, T &p, const T &def) const
void ProcessEventRecord(GHepRecord *event_rec) const
void Configure(const Registry &config)
double ComputeMaxXSec(const Interaction *interaction) const
~DISKinematicsGenerator()
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 Limits(KineVar_t kvar) const
Return the kinematical variable limits.
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
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)
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
const TLorentzVector & HitNucP4(void) const
bool HitSeaQrk(void) const
bool HitQrkIsSet(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)
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