XSecSplineList.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2020, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5 
6  Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
7  University of Liverpool & STFC Rutherford Appleton Laboratory
8 */
9 //____________________________________________________________________________
10 
11 #include <fenv.h> //provides: int feenableexcept(int excepts);
12 #include <cmath> //provides: std::isnan()
13 
14 #include <fstream>
15 #include <cstdlib>
16 
17 #include "libxml/parser.h"
18 #include "libxml/xmlmemory.h"
19 #include "libxml/xmlreader.h"
20 
21 #include <TMath.h>
22 #include <TLorentzVector.h>
23 
26 #include "Framework/Conventions/GBuild.h"
33 
34 using std::ofstream;
35 using std::endl;
36 
37 namespace genie {
38 
39 //____________________________________________________________________________
40 ostream & operator << (ostream & stream, const XSecSplineList & list)
41 {
42  list.Print(stream);
43  return stream;
44 }
45 //____________________________________________________________________________
47 //____________________________________________________________________________
49 {
50  fInstance = 0;
51  fCurrentTune = "";
52  fUseLogE = true;
53  fNKnots = 100;
54  fEmin = 0.01; // GeV
55  fEmax = 100.00; // GeV
56 }
57 //____________________________________________________________________________
59 {
60 // Clean up.
61 
62  map<string, map<string, Spline *> >::iterator mm_iter = fSplineMap.begin();
63  for( ; mm_iter != fSplineMap.end(); ++mm_iter) {
64  // loop over splines for given tune
65  map<string, Spline *> & spl_map_curr_tune = mm_iter->second;
66  map<string, Spline *>::iterator m_iter = spl_map_curr_tune.begin();
67  for( ; m_iter != spl_map_curr_tune.end(); ++m_iter) {
68  Spline * spline = m_iter->second;
69  delete spline;
70  spline = 0;
71  }
72  spl_map_curr_tune.clear();
73  }
74  fSplineMap.clear();
75  fInstance = 0;
76 }
77 //____________________________________________________________________________
79 {
80  if(fInstance == 0) {
81  static XSecSplineList::Cleaner cleaner;
84  }
85  return fInstance;
86 }
87 //____________________________________________________________________________
89  const XSecAlgorithmI * alg, const Interaction * interaction) const
90 {
91  string key = this->BuildSplineKey(alg,interaction);
92  return this->SplineExists(key);
93 }
94 //____________________________________________________________________________
96 {
97 
98  if ( fCurrentTune.size() == 0 ) {
99  SLOG("XSecSplLst", pERROR) << "Spline requested while CurrentTune not set" ;
100  return false ;
101  }
102 
103  SLOG("XSecSplLst", pDEBUG)
104  << "Checking for spline: " << key << " in tune: " << fCurrentTune;
105 
106  map<string, map<string, Spline *> >::const_iterator //
107  mm_iter = fSplineMap.find(fCurrentTune);
108  if(mm_iter == fSplineMap.end()) {
109  SLOG("XSecSplLst", pWARN)
110  << "No splines for tune " << fCurrentTune << " were found!";
111  return false;
112  }
113  const map<string, Spline *> & spl_map_curr_tune = mm_iter->second;
114  bool exists = (spl_map_curr_tune.count(key) == 1);
115  SLOG("XSecSplLst", pDEBUG)
116  << "Spline found?...." << utils::print::BoolAsYNString(exists);
117  return exists;
118 }
119 //____________________________________________________________________________
121  const XSecAlgorithmI * alg, const Interaction * interaction) const
122 {
123  string key = this->BuildSplineKey(alg,interaction);
124  return this->GetSpline(key);
125 }
126 //____________________________________________________________________________
127 const Spline * XSecSplineList::GetSpline(string key) const
128 {
129 
130  if ( fCurrentTune.size() == 0 ) {
131  SLOG("XSecSplLst", pFATAL) << "Spline requested while CurrentTune not set" ;
132  exit(0) ;
133  }
134 
135  SLOG("XSecSplLst", pDEBUG)
136  << "Getting spline: " << key << " in tune: " << fCurrentTune;
137 
138  map<string, map<string, Spline *> >::const_iterator //\/
139  mm_iter = fSplineMap.find(fCurrentTune);
140  if(mm_iter == fSplineMap.end()) {
141  SLOG("XSecSplLst", pWARN)
142  << "No splines for tune " << fCurrentTune << " were found!";
143  return 0;
144  }
145  const map<string, Spline *> & spl_map_curr_tune = mm_iter->second;
147  m_iter = spl_map_curr_tune.find(key);
148  if(m_iter == spl_map_curr_tune.end()) {
149  SLOG("XSecSplLst", pWARN)
150  << "Couldn't find spline: " << key << " in tune: " << fCurrentTune;
151  return 0;
152  }
153  return m_iter->second;
154 }
155 //____________________________________________________________________________
157  const Interaction * interaction, int nknots, double e_min, double e_max)
158 {
159 // Build a cross section spline for the input interaction using the input
160 // cross section algorithm and store in the list.
161 // For building this specific entry of the spline list, the user is allowed
162 // to override the list-wide nknots,e_min,e_max
163 
164  // FE_ALL_EXCEPT FE_INEXACT FE_UNDERFLOW
165  // FE_DIVBYZERO FE_INVALID FE_OVERFLO
166  // rwh -- uncomment to catch NaN
167  // feenableexcept(FE_DIVBYZERO|FE_INVALID|FE_OVERFLOW);
168 
169  double xsec[nknots];
170  double E [nknots];
171 
172  SLOG("XSecSplLst", pNOTICE)
173  << "Creating cross section spline using the algorithm: " << *alg;
174 
175  string key = this->BuildSplineKey(alg,interaction);
176 
177  // If any of the nknots,e_min,e_max was not set or its value is not acceptable
178  // use the list values
179  //
180  if (e_min < 0.) e_min = this->Emin();
181  if (e_max < 0.) e_max = this->Emax();
182  if (nknots <= 2) nknots = this->NKnots();
183  assert( e_min < e_max );
184 
185  // Distribute the knots in the energy range (e_min,e_max) :
186  // - Will use 5 knots linearly spaced below the energy thresholds so that the
187  // spline behaves correctly in (e_min,Ethr)
188  // - Place 1 knot exactly on the input interaction threshold
189  // - Place the remaining n-6 knots spaced either linearly or logarithmically
190  // above the input interaction threshold
191  // The above scheme schanges appropriately if Ethr<e_min (i.e. no knots
192  // are computed below threshold)
193  //
194  double Ethr = interaction->PhaseSpace().Threshold();
195  SLOG("XSecSplLst", pNOTICE)
196  << "Energy threshold for current interaction = " << Ethr << " GeV";
197 
198  int nkb = (Ethr>e_min) ? 5 : 0; // number of knots < threshold
199  int nka = nknots-nkb; // number of knots >= threshold
200 
201  // knots < energy threshold
202  double dEb = (Ethr>e_min) ? (Ethr - e_min) / nkb : 0;
203  for(int i=0; i<nkb; i++) {
204  E[i] = e_min + i*dEb;
205  }
206  // knots >= energy threshold
207  double E0 = TMath::Max(Ethr,e_min);
208  double dEa = 0;
209  if(this->UseLogE())
210  dEa = (TMath::Log10(e_max) - TMath::Log10(E0)) /(nka-1);
211  else
212  dEa = (e_max-E0) /(nka-1);
213 
214  for(int i=0; i<nka; i++) {
215  if(this->UseLogE())
216  E[i+nkb] = TMath::Power(10., TMath::Log10(E0) + i * dEa);
217  else
218  E[i+nkb] = E0 + i * dEa;
219  }
220  // force last point to avoid floating point cumulative slew
221  E[nknots-1] = e_max;
222 
223  // Compute cross sections for the input interaction at the selected
224  // set of energies
225  //
226  double pr_mass = interaction->InitStatePtr()->Probe()->Mass();
227  for (int i = 0; i < nknots; i++) {
228  TLorentzVector p4(0,0,E[i],E[i]);
229  if (pr_mass > 0.) {
230  double pz = TMath::Max(0.,E[i]*E[i] - pr_mass*pr_mass);
231  pz = TMath::Sqrt(pz);
232  p4.SetPz(pz);
233  }
234  interaction->InitStatePtr()->SetProbeP4(p4);
235  xsec[i] = alg->Integral(interaction);
236  SLOG("XSecSplLst", pNOTICE)
237  << "xsec(E = " << E[i] << ") = "
238  << (1E+38/units::cm2)*xsec[i] << " x 1E-38 cm^2";
239  if ( std::isnan(xsec[i]) ) {
240  // this sometimes happens near threshold, warn and move on
241  SLOG("XSecSplLst", pWARN)
242  << "xsec(E = " << E[i] << ") = "
243  << (1E+38/units::cm2)*xsec[i] << " x 1E-38 cm^2"
244  << " : converting NaN to 0.0";
245  xsec[i] = 0.0;
246  }
247 
248  }
249 
250  // Warn about odd case of decreasing cross section
251  // but allow for small variation due to integration errors
252  const double eps_xsec = 1.0e-5;
253  const double xsec_scale = (1.0-eps_xsec);
254  if ( xsec[nknots-1] < xsec[nknots-2]*xsec_scale ) {
255  SLOG("XSecSplLst", pWARN)
256  << "Last point oddity: " << key << " has "
257  << " xsec[nknots-1] " << xsec[nknots-1] << " < "
258  << " xsec[nknots-2] " << xsec[nknots-2];
259  }
260 
261  // Build
262  //
263  Spline * spline = new Spline(nknots, E, xsec);
264 
265  // Save
266  //
267  map<string, map<string, Spline *> >::iterator //\/
268  mm_iter = fSplineMap.find(fCurrentTune);
269  if(mm_iter == fSplineMap.end()) {
270  map<string, Spline *> spl_map_curr_tune;
271  fSplineMap.insert( map<string, map<string, Spline *> >::value_type(
272  fCurrentTune, spl_map_curr_tune) );
273  mm_iter = fSplineMap.find(fCurrentTune);
274  }
275  map<string, Spline *> & spl_map_curr_tune = mm_iter->second;
276  spl_map_curr_tune.insert( map<string, Spline *>::value_type(key, spline) );
277 }
278 //____________________________________________________________________________
280 {
281  map<string, map<string, Spline *> >::const_iterator //
282  mm_iter = fSplineMap.find(fCurrentTune);
283  if(mm_iter == fSplineMap.end()) {
284  SLOG("XSecSplLst", pWARN)
285  << "No splines for tune " << fCurrentTune << " were found!";
286  return 0;
287  }
288  const map<string, Spline *> & spl_map_curr_tune = mm_iter->second;
289  return (int) spl_map_curr_tune.size();
290 }
291 //____________________________________________________________________________
292 bool XSecSplineList::IsEmpty(void) const
293 {
294  int n = this->NSplines();
295  return (n == 0);
296 }
297 //____________________________________________________________________________
299 {
300  fUseLogE = on;
301 }
302 //____________________________________________________________________________
304 {
305  fNKnots = nk;
306  if(fNKnots<10) fNKnots = 10; // minimum acceptable number of knots
307 }
308 //____________________________________________________________________________
309 void XSecSplineList::SetMinE(double Ev)
310 {
311  if(Ev>0) fEmin = Ev;
312 }
313 //____________________________________________________________________________
314 void XSecSplineList::SetMaxE(double Ev)
315 {
316  if(Ev>0) fEmax = Ev;
317 }
318 //____________________________________________________________________________
319 void XSecSplineList::SaveAsXml(const string & filename, bool save_init) const
320 {
321 //! Save XSecSplineList to XML file
322 
323  SLOG("XSecSplLst", pNOTICE)
324  << "Saving XSecSplineList as XML in file: " << filename;
325 
326  ofstream outxml(filename.c_str());
327  if(!outxml.is_open()) {
328  SLOG("XSecSplLst", pERROR) << "Couldn't create file = " << filename;
329  return;
330  }
331  outxml << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
332  outxml << endl << endl;
333  outxml << "<!-- generated by genie::XSecSplineList::SaveSplineList() -->";
334  outxml << endl << endl;
335 
336  int uselog = (fUseLogE ? 1 : 0);
337  outxml << "<genie_xsec_spline_list "
338  << "version=\"3.00\" uselog=\"" << uselog << "\">";
339  outxml << endl << endl;
340 
341  // loop over tunes
342  map<string, map<string, Spline *> >::const_iterator //\/
343  mm_iter = fSplineMap.begin();
344  for( ; mm_iter != fSplineMap.end(); ++mm_iter) {
345 
346  string tune_name = mm_iter->first;
347  outxml << " <genie_tune name=\"" << tune_name << "\">";
348  outxml << endl << endl;
349 
350  // loop over splines for given tune
351  const map<string, Spline *> & spl_map_curr_tune = mm_iter->second;
353  m_iter = spl_map_curr_tune.begin();
354  for( ; m_iter != spl_map_curr_tune.end(); ++m_iter) {
355  string key = m_iter->first;
356 
357  // If current spline is from the initial loaded set,
358  // look-up input option to decide whether to write out in
359  // new output file or not
360  bool from_init_set = false;
361  map<string, set<string> >::const_iterator //\/
362  it = fLoadedSplineSet.find(tune_name);
363  if(it != fLoadedSplineSet.end()) {
364  const set<string> & init_set_curr_tune = it->second;
365  from_init_set = (init_set_curr_tune.count(key) == 1);
366  }
367  if(from_init_set && !save_init) continue;
368 
369  // Add current spline to output file
370  Spline * spline = m_iter->second;
371  spline->SaveAsXml(outxml,"E","xsec", key);
372  }//spline loop
373 
374  outxml << " </genie_tune>" << endl;
375  }//tune loop
376 
377  outxml << "</genie_xsec_spline_list>" << endl;
378 
379  outxml.close();
380 }
381 //____________________________________________________________________________
383 {
384 //! Load XSecSplineList from ROOT file. If keep = true, then the loaded splines
385 //! are added to the existing list. If false, then the existing list is reset
386 //! before loading the splines.
387 
388  SLOG("XSecSplLst", pNOTICE)
389  << "Loading splines from: " << filename;
390  SLOG("XSecSplLst", pINFO)
391  << "Option to keep pre-existing splines is switched "
392  << ( (keep) ? "ON" : "OFF" );
393 
394  if(!keep) fSplineMap.clear();
395 
396  const int kNodeTypeStartElement = 1;
397  const int kNodeTypeEndElement = 15;
398  const int kKnotX = 0;
399  const int kKnotY = 1;
400 
401  xmlTextReaderPtr reader;
402 
403  int ret = 0, val_type = -1, iknot = 0, nknots = 0;
404  double * E = 0, * xsec = 0;
405  string spline_name = "";
406  string temp_tune ;
407 
408  reader = xmlNewTextReaderFilename(filename.c_str());
409  if (reader != NULL) {
410  ret = xmlTextReaderRead(reader);
411  while (ret == 1) {
412  xmlChar * name = xmlTextReaderName (reader);
413  xmlChar * value = xmlTextReaderValue (reader);
414  int type = xmlTextReaderNodeType (reader);
415  int depth = xmlTextReaderDepth (reader);
416 
417  if(depth==0 && type==kNodeTypeStartElement) {
418  LOG("XSecSplLst", pDEBUG) << "Root element = " << name;
419  if(xmlStrcmp(name, (const xmlChar *) "genie_xsec_spline_list")) {
420  LOG("XSecSplLst", pERROR)
421  << "\nXML doc. has invalid root element! [filename: " << filename << "]";
422  return kXmlInvalidRoot;
423  }
424 
425  xmlChar * xvrs = xmlTextReaderGetAttribute(reader,(const xmlChar*)"version");
426  xmlChar * xinlog = xmlTextReaderGetAttribute(reader,(const xmlChar*)"uselog");
427  string svrs = utils::str::TrimSpaces((const char *)xvrs);
428  string sinlog = utils::str::TrimSpaces((const char *)xinlog);
429 
430  LOG("XSecSplLst", pNOTICE)
431  << "Input x-section spline XML file format version: " << svrs;
432 
433  if (atoi(sinlog.c_str()) == 1) this->SetLogE(true);
434  else this->SetLogE(false);
435 
436  xmlFree(xvrs);
437  xmlFree(xinlog);
438  }
439 
440  if( (!xmlStrcmp(name, (const xmlChar *) "genie_tune")) && type==kNodeTypeStartElement) {
441  xmlChar * xtune = xmlTextReaderGetAttribute(reader,(const xmlChar*)"name");
442  temp_tune = utils::str::TrimSpaces((const char *)xtune);
443  SLOG("XSecSplLst", pNOTICE) << "Loading x-section splines for GENIE tune: " << temp_tune;
444  xmlFree(xtune);
445  }
446 
447  if( (!xmlStrcmp(name, (const xmlChar *) "spline")) && type==kNodeTypeStartElement) {
448  xmlChar * xname = xmlTextReaderGetAttribute(reader,(const xmlChar*)"name");
449  xmlChar * xnkn = xmlTextReaderGetAttribute(reader,(const xmlChar*)"nknots");
450  string sname = utils::str::TrimSpaces((const char *)xname);
451  string snkn = utils::str::TrimSpaces((const char *)xnkn);
452 
453  spline_name = sname;
454  SLOG("XSecSplLst", pNOTICE) << "Loading spline: " << spline_name;
455 
456  nknots = atoi( snkn.c_str() );
457  iknot=0;
458  E = new double[nknots];
459  xsec = new double[nknots];
460 
461  xmlFree(xname);
462  xmlFree(xnkn);
463  }
464 
465  if( (!xmlStrcmp(name, (const xmlChar *) "E")) && type==kNodeTypeStartElement) { val_type = kKnotX; }
466  if( (!xmlStrcmp(name, (const xmlChar *) "xsec")) && type==kNodeTypeStartElement) { val_type = kKnotY; }
467 
468  if( (!xmlStrcmp(name, (const xmlChar *) "#text")) && depth==5) {
469  if (val_type==kKnotX) E [iknot] = atof((const char *)value);
470  else if (val_type==kKnotY) xsec[iknot] = atof((const char *)value);
471  }
472  if( (!xmlStrcmp(name, (const xmlChar *) "knot")) && type==kNodeTypeEndElement) {
473  iknot++;
474  }
475  if( (!xmlStrcmp(name, (const xmlChar *) "spline")) && type==kNodeTypeEndElement) {
476 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
477  LOG("XSecSplLst", pINFO) << "Done with current spline";
478  for(int i=0; i<nknots; i++) {
479  LOG("XSecSplLst", pINFO) << "xsec[E = " << E[i] << "] = " << xsec[i];
480  }
481 #endif
482  // done looping over knots - build the spline
483  Spline * spline = new Spline(nknots, E, xsec);
484  delete [] E;
485  delete [] xsec;
486 
487  // insert the spline to the map
488  map<string, map<string, Spline *> >::iterator //\/
489  mm_iter = fSplineMap.find( temp_tune );
490  if(mm_iter == fSplineMap.end()) {
491  map<string, Spline *> spl_map_curr_tune;
492  fSplineMap.insert( map<string, map<string, Spline *> >::value_type(
493  temp_tune, spl_map_curr_tune) );
494  mm_iter = fSplineMap.find( temp_tune );
495  }
496  map<string, Spline *> & spl_map_curr_tune = mm_iter->second;
497  spl_map_curr_tune.insert(
498  map<string, Spline *>::value_type(spline_name, spline) );
499  fLoadedSplineSet[temp_tune].insert(spline_name);
500  }
501  xmlFree(name);
502  xmlFree(value);
503  ret = xmlTextReaderRead(reader);
504  }
505  xmlFreeTextReader(reader);
506  if (ret != 0) {
507  LOG("XSecSplLst", pERROR)
508  << "\nXML file could not be parsed! [filename: " << filename << "]";
509  return kXmlNotParsed;
510  }
511  } else {
512  LOG("XSecSplLst", pERROR)
513  << "\nXML file could not be found! [filename: " << filename << "]";
514  }
515 
516  return kXmlOK;
517 }
518 //____________________________________________________________________________
520  const XSecAlgorithmI * alg, const Interaction * interaction) const
521 {
522  if(!alg) {
523  LOG("XSecSplLst", pWARN)
524  << "Null XSecAlgorithmI - Returning empty spline key";
525  return "";
526  }
527 
528  if(!interaction) {
529  LOG("XSecSplLst", pWARN)
530  << "Null Interaction - Returning empty spline key";
531  return "";
532  }
533 
534  string alg_name = alg->Id().Name();
535  string param_set = alg->Id().Config();
536  string intkey = interaction->AsString();
537 
538  string key = alg_name + "/" + param_set + "/" + intkey;
539 
540  return key;
541 }
542 //____________________________________________________________________________
543 const vector<string> * XSecSplineList::GetSplineKeys(void) const
544 {
545  map<string, map<string, Spline *> >::const_iterator //\/
546  mm_iter = fSplineMap.find(fCurrentTune);
547  if(mm_iter == fSplineMap.end()) {
548  SLOG("XSecSplLst", pWARN)
549  << "No splines for tune " << fCurrentTune << " were found!";
550  return 0;
551  }
552  const map<string, Spline *> & spl_map_curr_tune = mm_iter->second;
553  vector<string> * keyv = new vector<string>(spl_map_curr_tune.size());
554  unsigned int i=0;
555  map<string, Spline *>::const_iterator m_iter = spl_map_curr_tune.begin();
556  for( ; m_iter != spl_map_curr_tune.end(); ++m_iter) {
557  string key = m_iter->first;
558  (*keyv)[i++]=key;
559  }
560  return keyv;
561 }
562 //____________________________________________________________________________
563 void XSecSplineList::Print(ostream & stream) const
564 {
565  stream << "\n ******************* XSecSplineList *************************";
566  stream << "\n [-] Options:";
567  stream << "\n |";
568  stream << "\n |-----o UseLogE..................." << fUseLogE;
569  stream << "\n |-----o Spline Emin..............." << fEmin;
570  stream << "\n |-----o Spline Emax..............." << fEmax;
571  stream << "\n |-----o Spline NKnots............." << fNKnots;
572  stream << "\n |";
573 
574  map<string, map<string, Spline *> >::const_iterator mm_iter;
575  for(mm_iter = fSplineMap.begin(); mm_iter != fSplineMap.end(); ++mm_iter) {
576 
577  string curr_tune = mm_iter->first;
578  stream << "\n [-] Available x-section splines for tune: " << curr_tune ;
579  stream << "\n |";
580 
581  const map<string, Spline *> & spl_map_curr_tune = mm_iter->second;
582  map<string, Spline *>::const_iterator m_iter = spl_map_curr_tune.begin();
583  for( ; m_iter != spl_map_curr_tune.end(); ++m_iter) {
584  string key = m_iter->first;
585  stream << "\n |-----o " << key;
586  }
587  stream << "\n";
588  }
589 }
590 //___________________________________________________________________________
591 
592 } // genie namespace
static QCString name
Definition: declinfo.cpp:673
Cross Section Calculation Interface.
intermediate_table::iterator iterator
const KPhaseSpace & PhaseSpace(void) const
Definition: Interaction.h:73
string BuildSplineKey(const XSecAlgorithmI *alg, const Interaction *i) const
void SetProbeP4(const TLorentzVector &P4)
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
#define pERROR
Definition: Messenger.h:59
bool UseLogE(void) const
void CreateSpline(const XSecAlgorithmI *alg, const Interaction *i, int nknots=-1, double e_min=-1, double e_max=-1)
const vector< string > * GetSplineKeys(void) const
double Threshold(void) const
Energy threshold.
Definition: KPhaseSpace.cxx:80
bool SplineExists(const XSecAlgorithmI *alg, const Interaction *i) const
string BoolAsYNString(bool b)
Definition: PrintUtils.cxx:108
A numeric analysis tool class for interpolating 1-D functions.
Definition: Spline.h:46
#define pFATAL
Definition: Messenger.h:56
void SetMinE(double Ev)
set default minimum energy for xsec splines
TParticlePDG * Probe(void) const
intermediate_table::const_iterator const_iterator
map< string, set< string > > fLoadedSplineSet
tune -> { set of initialy loaded splines }
int NSplines(void) const
static XSecSplineList * Instance()
string filename
Definition: train.py:213
string AsString(void) const
bool exists(std::string path)
Summary information for an interaction.
Definition: Interaction.h:56
void Print(ostream &stream) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
bool IsEmpty(void) const
string Name(void) const
Definition: AlgId.h:44
def key(type, name=None)
Definition: graph.py:13
double Emin(void) const
static constexpr double cm2
Definition: Units.h:69
void SetNKnots(int nk)
set default number of knots for building the spline
std::void_t< T > n
virtual double Integral(const Interaction *i) const =0
#define pINFO
Definition: Messenger.h:62
map< string, map< string, Spline * > > fSplineMap
tune -> { xsec_alg/xsec_config/interaction -> Spline }
int NKnots(void) const
string fCurrentTune
The `active&#39; tune, out the many that can co-exist.
void SaveAsXml(const string &filename, bool save_init=true) const
#define pWARN
Definition: Messenger.h:60
string TrimSpaces(string input)
Definition: StringUtils.cxx:18
double Emax(void) const
void SaveAsXml(string filename, string xtag, string ytag, string name="") const
Definition: Spline.cxx:412
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:97
static XSecSplineList * fInstance
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
E
Definition: 018_def.c:13
void SetLogE(bool on)
set opt to build splines as f(E) or as f(logE)
InitialState * InitStatePtr(void) const
Definition: Interaction.h:74
#define pNOTICE
Definition: Messenger.h:61
void SetMaxE(double Ev)
set default maximum energy for xsec splines
enum genie::EXmlParseStatus XmlParserStatus_t
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
Definition: Messenger.h:84
const Spline * GetSpline(const XSecAlgorithmI *alg, const Interaction *i) const
List of cross section vs energy splines.
XmlParserStatus_t LoadFromXml(const string &filename, bool keep=false)
QTextStream & endl(QTextStream &s)
#define pDEBUG
Definition: Messenger.h:63
string Config(void) const
Definition: AlgId.h:45