28using std::ostringstream;
60 <<
"Getting max. for the rejection method";
66 <<
"Attempting to find a cached max value";
71 <<
"Attempting to compute the max value";
82 LOG(
"Kinematics",
pINFO) <<
"max = " << xsec_max;
88 <<
"Can not generate event kinematics max_xsec<=0)";
98 exception.
SetReason(
"kinematics generation: max_xsec<=0");
106 const Interaction * interaction,
const int nkey)
const
112 double E = this->
Energy(interaction);
113 LOG(
"Kinematics",
pINFO) <<
"E = " << E;
117 <<
"Below minimum energy - Forcing explicit calculation";
127 if( E >= cb->
Spl()->
XMin() && E <= cb->Spl()->XMax()) {
130 <<
"\nInterpolated: max (E=" << E <<
") = " << spl_max_xsec;
134 <<
"Outside spline boundaries - Forcing explicit calculation";
140 double dE = TMath::Min(0.25, 0.05*E);
141 const map<double,double> & fmap = cb->
Map();
142 map<double,double>::const_iterator iter = fmap.lower_bound(E);
143 if(iter != fmap.end()) {
144 if(TMath::Abs(E - iter->first) < dE)
return iter->second;
191 const Interaction * interaction,
double max_xsec,
const int nkey)
const
194 <<
"Adding the computed max value to cache";
197 double E = this->
Energy(interaction);
199 if(max_xsec>0) cb->
AddValues(E,max_xsec);
202 if( cb->
Map().size() > 40 )
207 if( E < cb->Spl()->XMin() || E > cb->
Spl()->
XMax() ) {
225 const Interaction * interaction,
const int nkey)
const
233 string algkey = this->
Id().
Key();
234 string intkey = interaction->
AsString();
235 string key = cache->
CacheBranchKey(algkey, intkey, std::to_string(nkey));
241 LOG(
"Kinematics",
pINFO) <<
"No cache branch found";
242 LOG(
"Kinematics",
pINFO) <<
"Creating cache branch - key = " << key;
247 assert(cache_branch);
253 const Interaction * interaction,
double xsec,
double xsec_max)
const
259 double f = 200*(xsec-xsec_max)/(xsec_max+xsec);
262 <<
"xsec: (curr) = " << xsec
263 <<
" > (max) = " << xsec_max <<
"\n for " << *interaction;
265 <<
"*** Exceeding estimated maximum differential cross section";
269 <<
"xsec: (curr) = " << xsec
270 <<
" > (max) = " << xsec_max <<
"\n for " << *interaction;
272 <<
"*** The fractional deviation of " << f <<
" % was allowed";
279 <<
"Negative cross section for current kinematics!! \n" << *interaction;
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
virtual const AlgId & Id(void) const
Get algorithm ID.
A simple cache branch storing the cached data in a TNtuple.
void CreateSpline(string type="TSpline3")
void AddValues(double x, double y)
const map< double, double > & Map(void) const
string CacheBranchKey(string k0, string k1="", string k2="") const
void AddCacheBranch(string key, CacheBranchI *branch)
static Cache * Instance(void)
CacheBranchI * FindCacheBranch(string key)
finding/adding cache branches
GENIE's GHEP MC event record.
virtual void SetDiffXSec(double xsec, KinePhaseSpace_t ps)
virtual Interaction * Summary(void) const
virtual TBits * EventFlags(void) const
Initial State information.
double ProbeE(RefFrame_t rf) const
Summary information for an interaction.
string AsString(void) const
const InitialState & InitState(void) const
virtual void AssertXSecLimits(const Interaction *in, double xsec, double xsec_max) const
std::vector< string > vInterpolatorTypes
Type of interpolator for each key in a branch.
std::vector< double > vSafetyFactors
MaxXSec -> MaxXSec * fSafetyFactors[nkey].
virtual double FindMaxXSec(const Interaction *in, const int nkey=0) const
~KineGeneratorWithCache()
virtual void CacheMaxXSec(const Interaction *in, double xsec, const int nkey=0) const
double fMaxXSecDiffTolerance
max{100*(xsec-maxxsec)/.5*(xsec+maxxsec)} if xsec>maxxsec
virtual double ComputeMaxXSec(const Interaction *in) const =0
double fEMin
min E for which maxxsec is cached - forcing explicit calc.
double fSafetyFactor
ComputeMaxXSec -> ComputeMaxXSec * fSafetyFactor.
int fNumOfInterpolatorTypes
Number of given interpolators types.
virtual double Energy(const Interaction *in) const
int fNumOfSafetyFactors
Number of given safety factors.
virtual double MaxXSec(GHepRecord *evrec, const int nkey=0) const
virtual CacheBranchFx * AccessCacheBranch(const Interaction *in, const int nkey=0) const
double Evaluate(double x) const
An exception thrown by EventRecordVisitorI when the normal processing sequence has to be disrupted (f...
void SwitchOnFastForward(void)
void SetReason(string reason)
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