18 #include "Framework/Conventions/GBuild.h" 35 using namespace genie;
62 <<
"Generating kinematics uniformly over the allowed phase space";
92 LOG(
"IBD",
pWARN) <<
"No available phase space";
95 exception.
SetReason(
"No available phase space");
111 const double Q2min = Q2.
min;
112 const double Q2max = Q2.
max;
116 unsigned int iter = 0;
122 <<
"Couldn't select a valid Q^2 after " << iter <<
" iterations";
125 exception.
SetReason(
"Couldn't select kinematics");
131 gQ2 = Q2min + (Q2max-Q2min) * rnd->
RndKine().Rndm();
141 const double t = xsec_max * rnd->
RndKine().Rndm();
142 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 144 <<
"dxsec/dQ2 = " << xsec <<
", rnd = " <<
t;
168 LOG(
"IBD",
pNOTICE) <<
"E = " << E <<
", M = "<< M;
188 const double totxsec = evrec->
XSec();
189 double wght = (vol/totxsec)*xsec;
190 LOG(
"IBD",
pNOTICE) <<
"Kinematics wght = "<< wght;
194 LOG(
"IBD",
pNOTICE) <<
"Current event wght = " << wght;
253 double max_xsec = 0.0;
257 if(rQ2.
min <=0 || rQ2.
max <= rQ2.
min)
return 0.;
261 const double logQ2min = TMath::Log(rQ2.
min);
262 const double logQ2max = TMath::Log(rQ2.
max);
267 double dlogQ2 = (logQ2max - logQ2min) /(N-1);
268 double xseclast = -1;
271 for(
int i=0; i<
N; i++) {
272 double Q2 = TMath::Exp(logQ2min + i * dlogQ2);
275 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 276 LOG(
"IBD",
pDEBUG) <<
"xsec(Q2= " << Q2 <<
") = " << xsec;
278 max_xsec = TMath::Max(xsec, max_xsec);
279 increasing = xsec-xseclast>=0;
287 for(
int ib=0; ib<Nb; ib++) {
288 Q2 = TMath::Exp(TMath::Log(Q2) - dlogQ2);
289 if(Q2 < rQ2.
min)
continue;
292 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 293 LOG(
"IBD",
pDEBUG) <<
"xsec(Q2= " << Q2 <<
") = " << xsec;
295 max_xsec = TMath::Max(xsec, max_xsec);
305 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 307 SLOG(
"IBD",
pDEBUG) <<
"Max xsec in phase space = " << max_xsec;
virtual ~IBDKinematicsGenerator()
virtual double MaxXSec(GHepRecord *evrec) const
void Configure(const Registry &config)
const KPhaseSpace & PhaseSpace(void) const
virtual void SetWeight(double wght)
bool fGenerateUniformly
uniform over allowed phase space + event weight?
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.
int RecoilNucleonPdg(void) const
recoil nucleon pdg
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)
double ComputeMaxXSec(const Interaction *in) const
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...
void ProcessEventRecord(GHepRecord *event_rec) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
void WQ2toXY(double Ev, double M, double W, double Q2, double &x, double &y)
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)
static RunningThreadInfo * Instance(void)
void SetW(double W, bool selected=false)
void SwitchOnFastForward(void)
static PDGLibrary * Instance(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 UInt_t kIAssumeFreeNucleon
double fEMin
min E for which maxxsec is cached - forcing explicit calc.
virtual double XSec(void) const
const InitialState & InitState(void) const
TParticlePDG * Find(int pdgc, bool must_exist=true)
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
virtual void SetDiffXSec(double xsec, KinePhaseSpace_t ps)
Initial State information.