16 #include "Framework/Conventions/GBuild.h" 33 using namespace genie;
59 <<
"Generating kinematics uniformly over the allowed phase space";
85 LOG(
"RESKinematics",
pWARN) <<
"No available phase space";
88 exception.
SetReason(
"No available phase space");
93 const InitialState & init_state = interaction -> InitState();
107 double dW = W.
max - W.
min;
110 unsigned int iter = 0;
116 <<
"*** Could not select a valid (W,Q^2) pair after " 117 << iter <<
" iterations";
120 exception.
SetReason(
"Couldn't select kinematics");
135 if(Q2.
max<=0. || Q2.
min>=Q2.
max)
continue;
149 LOG(
"RESKinematics",
pINFO) <<
"Initializing the sampling envelope";
151 LOG(
"RESKinematics",
pFATAL) <<
"Null sampling envelope!";
165 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 167 <<
"Q^2: [" << Q2min <<
", " << Q2max <<
"] => " 168 <<
"QD^2: [" << QD2min <<
", " << QD2max <<
"]";
177 gR = (E>mR) ? 0.220 : 0.400;
179 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 181 <<
"(m,g) = (" << mR <<
", " << gR
182 <<
"), max(xsec,W) = (" << xsec_max <<
", " << W.
max <<
")";
198 LOG(
"RESKinematics",
pINFO) <<
"Trying: W = " << gW <<
", Q2 = " <<
gQ2;
212 double t = max * rnd->
RndKine().Rndm();
217 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 219 <<
"xsec= " << xsec <<
", J= " << J <<
", Rnd= " <<
t;
221 accept = (t < J*xsec);
230 <<
"Selected: W = " << gW <<
", Q2 = " <<
gQ2;
249 double totxsec = evrec->
XSec();
250 double wght = (vol/totxsec)*xsec;
251 LOG(
"RESKinematics",
pNOTICE) <<
"Kinematics wght = "<< wght;
255 LOG(
"RESKinematics",
pNOTICE) <<
"Current event wght = " << wght;
310 gROOT->GetListOfFunctions()->Remove(
fEnvelope);
324 double max_xsec = 0.;
326 const InitialState & init_state = interaction -> InitState();
331 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 332 LOG(
"RESKinematics",
pDEBUG) <<
"Scanning phase space for E= " <<
E;
347 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 349 <<
"Will search for max{xsec} along W(=MRes) = " <<
md;
356 if( rQ2.
max < Q2Thres || rQ2.
min <=0 )
return 0.;
362 double dlogQ2 = (logQ2max - logQ2min) /(NQ2-1);
364 double xseclast = -1;
365 bool increasing =
true;
367 for(
int iq2=0; iq2<NQ2; iq2++) {
368 double Q2 = TMath::Exp(logQ2min + iq2 * dlogQ2);
371 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 373 <<
"xsec(W= " << md <<
", Q2= " << Q2 <<
") = " << xsec;
375 max_xsec = TMath::Max(xsec, max_xsec);
376 increasing = xsec-xseclast>=0;
384 for(
int iq2b=0; iq2b<NQ2b; iq2b++) {
385 Q2 = TMath::Exp(TMath::Log(Q2) - dlogQ2);
386 if(Q2 < rQ2.
min)
continue;
389 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 391 <<
"xsec(W= " << md <<
", Q2= " << Q2 <<
") = " << xsec;
393 max_xsec = TMath::Max(xsec, max_xsec);
410 Wmax = TMath::Min(Wmax,
fWcut);
412 Wmin = TMath::Max(Wmin, md-.3);
413 Wmax = TMath::Min(Wmax, md+.3);
415 if(Wmax-Wmin<0.05) { NW=1; Wmin=Wmax; }
417 double dW = (NW>1) ? (Wmax-Wmin)/(NW-1) : 0.;
419 for(
int iw=0; iw<NW; iw++) {
420 double W = Wmin + iw*dW;
427 if( rQ2.
max < Q2Thres || rQ2.
min <=0 )
continue;
428 if( rQ2.
max-rQ2.
min<0.02 ) {NQ2=5; NQ2b=3;}
432 double dlogQ2 = (logQ2max - logQ2min) /(NQ2-1);
433 double xseclast = -1;
434 bool increasing =
true;
436 for(
int iq2=0; iq2<NQ2; iq2++) {
437 double Q2 = TMath::Exp(logQ2min + iq2 * dlogQ2);
441 <<
"xsec(W= " << W <<
", Q2= " << Q2 <<
") = " << xsec;
442 max_xsec = TMath::Max(xsec, max_xsec);
443 increasing = xsec-xseclast>=0;
451 for(
int iq2b=0; iq2b<NQ2b; iq2b++) {
452 Q2 = TMath::Exp(TMath::Log(Q2) - dlogQ2);
453 if(Q2 < rQ2.
min)
continue;
457 <<
"xsec(W= " << W <<
", Q2= " << Q2 <<
") = " << xsec;
458 max_xsec = TMath::Max(xsec, max_xsec);
471 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 473 LOG(
"RESKinematics",
pDEBUG) <<
"Max xsec in phase space = " << max_xsec;
double fWcut
Wcut parameter in DIS/RES join scheme.
virtual double MaxXSec(GHepRecord *evrec) 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
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
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
bool KnownResonance(void) const
double fMaxXSecDiffTolerance
max{100*(xsec-maxxsec)/.5*(xsec+maxxsec)} if xsec>maxxsec
Defines the EventGeneratorI interface.
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.
string AsString(void) const
const XSecAlgorithmI * fXSecModel
static const double kMinQ2Limit
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...
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()
static int max(int a, int b)
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)
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)
static RunningThreadInfo * Instance(void)
virtual const AlgId & Id(void) const
Get algorithm ID.
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 double XSec(void) const
double Jacobian(const Interaction *const i, KinePhaseSpace_t f, KinePhaseSpace_t t)
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
Root of GENIE utility namespaces.
cet::coded_exception< error, detail::translate > exception
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)