20 #include "Framework/Conventions/GBuild.h" 36 using namespace genie;
62 <<
"Generating kinematics uniformly over the allowed phase space";
86 LOG(
"DMDISKinematics",
pWARN) <<
"No available phase space";
89 exception.
SetReason(
"No available phase space");
97 LOG(
"DMDISKinematics",
pNOTICE) <<
"x: [" << xl.
min <<
", " << xl.
max <<
"]";
98 LOG(
"DMDISKinematics",
pNOTICE) <<
"y: [" << yl.
min <<
", " << yl.
max <<
"]";
100 assert(xl.
min>0 && yl.
min>0);
112 double dx = xl.
max - xl.
min;
113 double dy = yl.
max - yl.
min;
114 double gx=-1, gy=-1, gW=-1,
gQ2=-1, xsec=-1;
116 unsigned int iter = 0;
122 <<
" Couldn't select kinematics after " << iter <<
" iterations";
125 exception.
SetReason(
"Couldn't select kinematics");
138 <<
"Trying: x = " << gx <<
", y = " << gy
139 <<
" (W = " << interaction->
KinePtr()->
W() <<
"," 140 <<
" (Q2 = " << interaction->
KinePtr()->
Q2() <<
")";
148 double t = xsec_max * rnd->
RndKine().Rndm();
151 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 153 <<
"xsec= " << xsec <<
", J= " << J <<
", Rnd= " <<
t;
155 accept = (t < J*xsec);
164 <<
"Selected: x = " << gx <<
", y = " << gy
165 <<
" (W = " << interaction->
KinePtr()->
W() <<
"," 166 <<
" (Q2 = " << interaction->
KinePtr()->
Q2() <<
")";
179 double totxsec = evrec->
XSec();
180 double wght = (vol/totxsec)*xsec;
181 LOG(
"DMDISKinematics",
pNOTICE) <<
"Kinematics wght = "<< wght;
185 LOG(
"DMDISKinematics",
pNOTICE) <<
"Current event wght = " << wght;
193 <<
"Selected x,y => W = " << gW <<
", Q2 = " <<
gQ2;
252 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 253 LOG(
"DMDISKinematics",
pDEBUG)<<
"Computing max xsec in allowed phase space";
255 double max_xsec = 0.0;
271 double xmin = TMath::Max(xl.
min, 5
E-3);
272 double xmax = xl.
max;
273 double ymin = TMath::Max(yl.
min, 2
E-3);
274 double ymax = yl.
max;
275 double dx = (xmax-xmin)/(Nx-1);
276 double dy = (ymax-ymin)/(Ny-1);
278 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 280 <<
"Searching max. in x [" << xmin <<
", " << xmax <<
"], y [" << ymin <<
", " << ymax <<
"]";
282 double xseclast_y = -1;
285 for(
int i=0; i<Ny; i++) {
286 double gy = ymin + i*dy;
290 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 291 LOG(
"DMDISKinematics",
pDEBUG) <<
"y = " << gy;
293 double xseclast_x = -1;
296 for(
int j=0; j<Nx; j++) {
297 double gx = xmin + j*dx;
303 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 305 <<
"xsec(y=" << gy <<
", x=" << gx <<
") = " << xsec;
308 max_xsec = TMath::Max(xsec, max_xsec);
310 increasing_x = xsec-xseclast_x>=0;
317 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 319 <<
"d2xsec/dxdy|x stopped increasing. Stepping back & exiting x loop";
322 double dxn = dx/(Nxb+1);
323 for(
int ik=0; ik<Nxb; ik++) {
329 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 331 <<
"xsec(y=" << gy <<
", x=" << gx <<
") = " << xsec;
337 increasing_y = max_xsec-xseclast_y>=0;
338 xseclast_y = max_xsec;
340 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 342 <<
"d2xsec/dxdy stopped increasing. Exiting y loop";
354 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 356 SLOG(
"DMDISKinematics",
pDEBUG) <<
"Max xsec in phase space = " << max_xsec;
virtual double MaxXSec(GHepRecord *evrec) const
double W(bool selected=false) const
const KPhaseSpace & PhaseSpace(void) const
virtual void SetWeight(double wght)
bool fGenerateUniformly
uniform over allowed phase space + event weight?
double J(double q0, double q3, double Enu, double ml)
THE MAIN GENIE PROJECT NAMESPACE
virtual Interaction * Summary(void) const
static RandomGen * Instance()
Access instance.
void SetQ2(double Q2, bool selected=false)
Kinematics * KinePtr(void) const
double fSafetyFactor
maxxsec -> maxxsec * safety_factor
virtual double XSec(const Interaction *i, KinePhaseSpace_t k=kPSfE) const =0
Compute the cross section for the input interaction.
A simple [min,max] interval for doubles.
virtual void AssertXSecLimits(const Interaction *in, double xsec, double xsec_max) const
double fMaxXSecDiffTolerance
max{100*(xsec-maxxsec)/.5*(xsec+maxxsec)} if xsec>maxxsec
Defines the EventGeneratorI interface.
virtual double Weight(void) const
Abstract class. Provides a data caching mechanism for for concrete implementations of the EventRecord...
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Range1D_t Limits(KineVar_t kvar) const
Return the kinematical variable limits.
string AsString(void) const
const XSecAlgorithmI * fXSecModel
double PhaseSpaceVolume(const Interaction *const i, KinePhaseSpace_t ps)
Summary information for an interaction.
const TLorentzVector & HitNucP4(void) const
An exception thrown by EventRecordVisitorI when the normal processing sequence has to be disrupted (f...
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
~DMDISKinematicsGenerator()
double ComputeMaxXSec(const Interaction *interaction) const
void XYtoWQ2(double Ev, double M, double &W, double &Q2, double x, double y)
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
virtual void Configure(const Registry &config)
TRandom3 & RndKine(void) const
rnd number generator used by kinematics generators
Misc GENIE control constants.
const UInt_t kISkipKinematicChk
if set, skip kinematic validity checks
virtual const XSecAlgorithmI * CrossSectionAlg(void) const =0
void Setx(double x, bool selected=false)
void UpdateWQ2FromXY(const Interaction *in)
static RunningThreadInfo * Instance(void)
void SetW(double W, bool selected=false)
void SwitchOnFastForward(void)
void SetReason(string reason)
virtual TBits * EventFlags(void) const
A registry. Provides the container for algorithm configuration parameters.
void Sety(double y, bool selected=false)
double fEMin
min E for which maxxsec is cached - forcing explicit calc.
void Configure(const Registry &config)
virtual double XSec(void) const
const InitialState & InitState(void) const
DMDISKinematicsGenerator()
double Q2(bool selected=false) const
void ClearRunningValues(void)
bool GetParamDef(const RgKey &name, T &p, const T &def) const
const Target & Tgt(void) const
static const unsigned int kRjMaxIterations
const EventGeneratorI * RunningThread(void)
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
double ProbeE(RefFrame_t rf) const
GENIE's GHEP MC event record.
Keep info on the event generation thread currently on charge. This is used so that event generation m...
Root of GENIE utility namespaces.
cet::coded_exception< error, detail::translate > exception
const UInt_t kISkipProcessChk
if set, skip process validity checks
void ProcessEventRecord(GHepRecord *event_rec) const
virtual void SetDiffXSec(double xsec, KinePhaseSpace_t ps)
Initial State information.