Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
genie::GVldContext Class Reference

Validity Context for an Event Generator. More...

#include <GVldContext.h>

Public Member Functions

 GVldContext ()
 
 ~GVldContext ()
 
void Decode (string encoded_values)
 
double Emin (void) const
 
double Emax (void) const
 
void Print (ostream &stream) const
 

Private Member Functions

void Init (void)
 
void DecodeENERGY (string encoded_values)
 

Private Attributes

double fEmin
 
double fEmax
 

Friends

ostream & operator<< (ostream &stream, const GVldContext &vldc)
 

Detailed Description

Validity Context for an Event Generator.

Author
Costas Andreopoulos <constantinos.andreopoulos cern.ch> University of Liverpool & STFC Rutherford Appleton Laboratory

November 20, 2004

Copyright (c) 2003-2020, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 37 of file GVldContext.h.

Constructor & Destructor Documentation

GVldContext::GVldContext ( )

Definition at line 32 of file GVldContext.cxx.

33 {
34  this->Init();
35 }
GVldContext::~GVldContext ( )

Definition at line 37 of file GVldContext.cxx.

38 {
39 
40 }

Member Function Documentation

void GVldContext::Decode ( string  encoded_values)

Definition at line 42 of file GVldContext.cxx.

43 {
44 //Example:
45 // energy:0-100;
46 
47  string vldc = utils::str::ToUpper(encoded_vld_context);
48 
49  // set defauts for missing entries
51  const Registry * gc = confp->CommonList("Param", "Validation");
52 
53  if(vldc.find("ENERGY") == string::npos) {
54  fEmin = gc->GetDouble("GVLD-Emin");
55  fEmax = gc->GetDouble("GVLD-Emax");
56  }
57 
58  LOG("VldContext", pDEBUG) << "Validity context: " << vldc;
59 
60  vector<string> fields = utils::str::Split(vldc, ";");
61  if(fields.size()==0) return;
62 
64 
65  for(field_iter = fields.begin(); field_iter != fields.end(); ++field_iter){
66 
67  string curr_field = *field_iter;
68  SLOG("VldContext", pINFO) << " ************ " << curr_field;
69  if(curr_field.size()==0) continue;
70 
71  vector<string> curr_fieldv = utils::str::Split(curr_field, ":");
72  assert(curr_fieldv.size() == 2);
73 
74  string name = curr_fieldv[0];
75  string values = curr_fieldv[1];
76 
77  //-- send the string to an appropriate decoder
78  if (name.find("ENERGY") != string::npos) DecodeENERGY (values);
79  else {
80  SLOG("VldContext", pWARN)
81  << "**** Unknown field named: " << name << " in vld context";
82  }
83  }
84 }
static QCString name
Definition: declinfo.cpp:673
A singleton class holding all configuration registries built while parsing all loaded XML configurati...
Definition: AlgConfigPool.h:40
intermediate_table::const_iterator const_iterator
RgDbl GetDouble(RgKey key) const
Definition: Registry.cxx:474
Registry * CommonList(const string &file_id, const string &set_name) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
void DecodeENERGY(string encoded_values)
Definition: GVldContext.cxx:86
#define pINFO
Definition: Messenger.h:62
Q_UINT16 values[128]
#define pWARN
Definition: Messenger.h:60
vector< string > Split(string input, string delim)
Definition: StringUtils.cxx:36
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:65
string ToUpper(string input)
Definition: StringUtils.cxx:92
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
Definition: Messenger.h:84
static AlgConfigPool * Instance()
#define pDEBUG
Definition: Messenger.h:63
void GVldContext::DecodeENERGY ( string  encoded_values)
private

Definition at line 86 of file GVldContext.cxx.

87 {
88  SLOG("VldContext", pDEBUG) << "Decoding energy range: " << encoded_energy;
89 
90  vector<string> energy = utils::str::Split(encoded_energy, "-");
91  assert (energy.size() == 2);
92  fEmin = atof( energy[0].c_str() );
93  fEmax = atof( energy[1].c_str() );
94 }
vector< string > Split(string input, string delim)
Definition: StringUtils.cxx:36
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
Definition: Messenger.h:84
#define pDEBUG
Definition: Messenger.h:63
double genie::GVldContext::Emax ( void  ) const
inline

Definition at line 46 of file GVldContext.h.

46 { return fEmax; }
double genie::GVldContext::Emin ( void  ) const
inline

Definition at line 45 of file GVldContext.h.

45 { return fEmin; }
void GVldContext::Init ( void  )
private

Definition at line 96 of file GVldContext.cxx.

97 {
98  fEmin = -1.0;
99  fEmax = -1.0;
100 }
void GVldContext::Print ( ostream &  stream) const

Definition at line 102 of file GVldContext.cxx.

103 {
104  stream << "Energy range:..." << "[" << fEmin << ", " << fEmax << "]";
105  stream << "\n";
106 }

Friends And Related Function Documentation

ostream& operator<< ( ostream &  stream,
const GVldContext vldc 
)
friend

Definition at line 25 of file GVldContext.cxx.

26  {
27  vldc.Print(stream);
28  return stream;
29  }
void Print(ostream &stream) const

Member Data Documentation

double genie::GVldContext::fEmax
private

Definition at line 59 of file GVldContext.h.

double genie::GVldContext::fEmin
private

Definition at line 58 of file GVldContext.h.


The documentation for this class was generated from the following files: