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