GENIEGenerator
Loading...
Searching...
No Matches
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 <c.andreopoulos \at cern.ch> University of Liverpool
Created:\n November 20, 2004
License:\n Copyright (c) 2003-2025, 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::GVldContext ( )

Definition at line 32 of file GVldContext.cxx.

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

References Init().

Referenced by operator<<.

◆ ~GVldContext()

GVldContext::~GVldContext ( )

Definition at line 37 of file GVldContext.cxx.

38{
39
40}

Member Function Documentation

◆ Decode()

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
50 AlgConfigPool * confp = AlgConfigPool::Instance();
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
63 vector<string>::const_iterator field_iter;
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}
#define pINFO
Definition Messenger.h:62
#define pDEBUG
Definition Messenger.h:63
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96
#define pWARN
Definition Messenger.h:60
#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()
Registry * CommonList(const string &file_id, const string &set_name) const
void DecodeENERGY(string encoded_values)
RgDbl GetDouble(RgKey key) const
Definition Registry.cxx:474
string ToUpper(string input)
vector< string > Split(string input, string delim)

References genie::AlgConfigPool::CommonList(), DecodeENERGY(), fEmax, fEmin, genie::Registry::GetDouble(), genie::AlgConfigPool::Instance(), LOG, pDEBUG, pINFO, pWARN, SLOG, genie::utils::str::Split(), and genie::utils::str::ToUpper().

◆ DecodeENERGY()

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}

References fEmax, fEmin, pDEBUG, SLOG, and genie::utils::str::Split().

Referenced by Decode().

◆ Emax()

double genie::GVldContext::Emax ( void ) const
inline

Definition at line 46 of file GVldContext.h.

46{ return fEmax; }

References fEmax.

Referenced by genie::GEVGDriver::CreateSplines(), and genie::GEVGDriver::ValidEnergyRange().

◆ Emin()

double genie::GVldContext::Emin ( void ) const
inline

Definition at line 45 of file GVldContext.h.

45{ return fEmin; }

References fEmin.

Referenced by genie::GEVGDriver::CreateSplines(), and genie::GEVGDriver::ValidEnergyRange().

◆ Init()

void GVldContext::Init ( void )
private

Definition at line 96 of file GVldContext.cxx.

97{
98 fEmin = -1.0;
99 fEmax = -1.0;
100}

References fEmax, and fEmin.

Referenced by GVldContext().

◆ Print()

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}

References fEmax, and fEmin.

Referenced by operator<<.

◆ operator<<

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

References GVldContext(), and Print().

Member Data Documentation

◆ fEmax

double genie::GVldContext::fEmax
private

Definition at line 59 of file GVldContext.h.

Referenced by Decode(), DecodeENERGY(), Emax(), Init(), and Print().

◆ fEmin

double genie::GVldContext::fEmin
private

Definition at line 58 of file GVldContext.h.

Referenced by Decode(), DecodeENERGY(), Emin(), Init(), and Print().


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