17 #include <TLorentzVector.h>
35 using std::setprecision;
37 using std::ostringstream;
38 using namespace genie;
64 <<
"\n*** NULL InteractionGeneratorMap! Can't select interaction";
67 if(igmap->size() <= 0) {
69 <<
"\n*** Empty InteractionGeneratorMap! Can't select interaction";
79 vector<double> xseclist(ilst.size());
81 string istate = ilst[0]->InitState().AsString();
83 msg <<
"Selecting an interaction for the given initial state = "
84 << istate <<
" at E = " << p4.E() <<
" GeV";
89 <<
"Computing xsecs for all relevant modeled interactions:";
92 InteractionList::const_iterator intliter = ilst.begin();
94 ostringstream xsec_table_printout;
97 <<
" |" << setfill(
'-') << setw(112) <<
"|" << endl
98 <<
" | " << setfill(
' ') << setw(80) <<
"interaction"
99 <<
" | cross-section (1E-38*cm^2) |" << endl
100 <<
" |" << setfill(
'-') << setw(112) <<
"|" << endl;
102 for( ; intliter != ilst.end(); ++intliter) {
108 <<
"Computing xsec for: \n " << interaction->
AsString();
117 bool spline_computed = xssl->
SplineExists(xsec_alg, interaction);
118 bool eval = fUseSplines && spline_computed;
123 if(TMath::IsNaN(E)) {
132 xsec = xsec_alg->
Integral(interaction);
134 TMath::Max(0., xsec);
142 <<
" | " << setfill(
' ') << setw(80) << interaction->
AsString()
146 xseclist[i++] = xsec;
152 <<
" |" << setfill(
'-') << setw(112) <<
"|" << endl;
155 <<
"\n" << xsec_table_printout.str();
160 <<
"Selecting an entry from the Interaction List";
162 for(
unsigned int iint = 0; iint < xseclist.size(); iint++) {
163 xsec_sum += xseclist[iint];
164 xseclist[iint] = xsec_sum;
167 <<
"Sum{xsec}(0->" << iint <<
") = " << xsec_sum;
170 double R = xsec_sum * rnd->
RndISel().Rndm();
173 <<
"Generating Rndm (0. -> max = " << xsec_sum <<
") = " << R;
175 for(
unsigned int iint = 0; iint < xseclist.size(); iint++) {
178 <<
"Sum{xsec}(0->" << iint <<
") = " << xseclist[iint];
180 if( R < xseclist[iint] ) {
186 double xsec_pedestal = (iint > 0) ? xseclist[iint-1] : 0.;
187 double xsec = xseclist[iint] - xsec_pedestal;
191 <<
"Selected interaction: " << selected_interaction->
AsString();
201 LOG(
"IntSel",
pERROR) <<
"Could not select interaction";
Cross Section Calculation Interface.
virtual void SetXSec(double xsec)
EventRecord * SelectInteraction(const InteractionGeneratorMap *igmp, const TLorentzVector &p4) const
implement the InteractionSelectorI interface
void SetProbeP4(const TLorentzVector &P4)
PhysInteractionSelector()
static RandomGen * Instance()
Access instance.
const EventGeneratorI * FindGenerator(const Interaction *in) const
bool SplineExists(const XSecAlgorithmI *alg, const Interaction *i) const
A numeric analysis tool class for interpolating 1-D functions.
static XSecSplineList * Instance()
double Evaluate(double x) const
#define BLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending no additional information.
bool ClosestKnotValueIsZero(double x, Option_t *opt="-+") const
A singleton holding random number generator classes. All random number generation in GENIE should tak...
string AsString(void) const
virtual void AttachSummary(Interaction *interaction)
void LoadConfigData(void)
Summary information for an interaction.
An Interaction -> EventGeneratorI associative container. The container is being built for the loaded ...
void Configure(const Registry &config)
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
static constexpr double cm2
A class encapsulating an enumeration of interaction types (EM, Weak-CC, Weak-NC) and scattering types...
virtual void Configure(const Registry &config)
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
Defines the InteractionSelectorI interface to be implemented by algorithms selecting interactions to ...
const InteractionList & GetInteractionList(void) const
A registry. Provides the container for algorithm configuration parameters.
virtual const XSecAlgorithmI * CrossSectionAlg(void) const =0
A vector of Interaction objects.
InitialState * InitStatePtr(void) const
string PrintFramedMesg(string mesg, unsigned int nl=1, const char f='*')
TRandom3 & RndISel(void) const
rnd number generator used by interaction selectors
const InitialState & InitState(void) const
const ProcessInfo & ProcInfo(void) const
~PhysInteractionSelector()
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
const Spline * GetSpline(const XSecAlgorithmI *alg, const Interaction *i) const
List of cross section vs energy splines.
double ProbeE(RefFrame_t rf) const
virtual double Integral(const Interaction *i) const =0
Initial State information.