16 #include "Framework/Conventions/GBuild.h"
33 using namespace genie;
34 using namespace genie::controls;
35 using namespace genie::utils;
59 <<
"Generating kinematics uniformly over the allowed phase space";
83 LOG(
"RESKinematics",
pWARN) <<
"No available phase space";
86 exception.
SetReason(
"No available phase space");
91 const InitialState & init_state = interaction -> InitState();
103 double dW = W.
max - W.
min;
106 unsigned int iter = 0;
112 <<
"*** Could not select a valid (W,Q^2) pair after "
113 << iter <<
" iterations";
116 exception.
SetReason(
"Couldn't select kinematics");
133 if(Q2.
max<=0. || Q2.
min>=Q2.
max)
continue;
156 gQD2 = QD2min + (QD2max - QD2min) * rnd->
RndKine().Rndm();
162 LOG(
"RESKinematics",
pINFO) <<
"Trying: W = " << gW <<
", Q2 = " <<
gQ2;
175 double t = xsec_max * rnd->
RndKine().Rndm();
187 <<
"Selected: W = " << gW <<
", Q2 = " <<
gQ2;
205 double totxsec = evrec->
XSec();
206 double wght = (vol/totxsec)*xsec;
207 LOG(
"RESKinematics",
pNOTICE) <<
"Kinematics wght = "<< wght;
211 LOG(
"RESKinematics",
pNOTICE) <<
"Current event wght = " << wght;
266 gROOT->GetListOfFunctions()->Remove(
fEnvelope);
280 double max_xsec = 0.;
282 const InitialState & init_state = interaction -> InitState();
302 Wmax = TMath::Min(Wmax,
fWcut);
304 Wmin = TMath::Max(Wmin, md-.3);
305 Wmax = TMath::Min(Wmax, md+.3);
307 if(Wmax-Wmin<0.05) { NW=1; Wmin=Wmax; }
309 double dW = (NW>1) ? (Wmax-Wmin)/(NW-1) : 0.;
311 for(
int iw=0; iw<NW; iw++)
313 double W = Wmin + iw*dW;
320 if( rQ2.
max < Q2Thres || rQ2.
min <=0 )
continue;
321 if( rQ2.
max-rQ2.
min<0.02 ) {NQ2=5; NQ2b=3;}
325 double dlogQ2 = (logQ2max - logQ2min) /(NQ2-1);
326 double xseclast = -1;
327 bool increasing =
true;
329 for(
int iq2=0; iq2<NQ2; iq2++)
331 double Q2 = TMath::Exp(logQ2min + iq2 * dlogQ2);
335 <<
"xsec(W= " << W <<
", Q2= " << Q2 <<
") = " << xsec;
336 max_xsec = TMath::Max(xsec, max_xsec);
337 increasing = xsec-xseclast>=0;
346 for(
int iq2b=0; iq2b<NQ2b; iq2b++)
348 Q2 = TMath::Exp(TMath::Log(Q2) - dlogQ2);
349 if(Q2 < rQ2.
min)
continue;
353 <<
"xsec(W= " << W <<
", Q2= " << Q2 <<
") = " << xsec;
354 max_xsec = TMath::Max(xsec, max_xsec);
double fWcut
Wcut parameter in DIS/RES join scheme.
const KPhaseSpace & PhaseSpace(void) const
virtual void SetWeight(double wght)
bool fGenerateUniformly
uniform over allowed phase space + event weight?
double Q2(const Interaction *const i)
virtual Interaction * Summary(void) const
static RandomGen * Instance()
Access instance.
void SetQ2(double Q2, bool selected=false)
Kinematics * KinePtr(void) const
double fSafetyFactor
ComputeMaxXSec -> ComputeMaxXSec * fSafetyFactor.
A simple [min,max] interval for doubles.
virtual void AssertXSecLimits(const Interaction *in, double xsec, double xsec_max) const
bool KnownResonance(void) const
double fMaxXSecDiffTolerance
max{100*(xsec-maxxsec)/.5*(xsec+maxxsec)} if xsec>maxxsec
Defines the EventGeneratorI interface.
virtual double MaxXSec(GHepRecord *evrec, const int nkey=0) const
virtual double Weight(void) const
double Mass(Resonance_t res)
resonance mass (GeV)
static const double kMinQ2Limit
Range1D_t Q2Lim_W(void) const
Q2 limits @ fixed W.
Abstract class. Provides a data caching mechanism for for concrete implementations of the EventRecord...
enum genie::EResonance Resonance_t
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.
const XSecAlgorithmI * fXSecModel
static const double kMinQ2Limit
double PhaseSpaceVolume(const Interaction *const i, KinePhaseSpace_t ps)
double W(const Interaction *const i)
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...
double QD2toQ2(double QD2)
void WQ2toXY(double Ev, double M, double W, double Q2, double &x, double &y)
virtual void Configure(const Registry &config)
static const double kASmallNum
~RESKinematicsGenerator()
TRandom3 & RndKine(void) const
rnd number generator used by kinematics generators
TF2 * fEnvelope
2-D envelope used for importance sampling
Resonance_t Resonance(void) const
double Q2toQD2(double Q2)
const UInt_t kISkipKinematicChk
if set, skip kinematic validity checks
virtual double XSec(const Interaction *i, KinePhaseSpace_t k=kPSfE) const =0
Compute the cross section for the input interaction.
void Setx(double x, bool selected=false)
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)
const XclsTag & ExclTag(void) const
double fEMin
min E for which maxxsec is cached - forcing explicit calc.
void ProcessEventRecord(GHepRecord *event_rec) const
virtual const XSecAlgorithmI * CrossSectionAlg(void) const =0
virtual double XSec(void) const
const ProcessInfo & ProcInfo(void) const
void ClearRunningValues(void)
bool GetParamDef(const RgKey &name, T &p, const T &def) const
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
const Target & Tgt(void) const
static const unsigned int kRjMaxIterations
void Configure(const Registry &config)
const EventGeneratorI * RunningThread(void)
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...
double ComputeMaxXSec(const Interaction *interaction) const
Range1D_t WLim(void) const
W limits.
const UInt_t kISkipProcessChk
if set, skip process validity checks
virtual void SetDiffXSec(double xsec, KinePhaseSpace_t ps)
Initial State information.
double RESImportanceSamplingEnvelope(double *x, double *par)