38 else if (str ==
"MEC_Fullpn")
40 else if (str ==
"MEC_DeltaAll")
42 else if (str ==
"MEC_Deltapn")
44 else if (str ==
"MEC_EM")
46 else if (str ==
"MEC_EM_pn")
48 else if (str ==
"MEC_EM_pp")
50 else if (str ==
"MEC_EM_wImag")
52 else if (str ==
"QE_EM")
54 else if (str ==
"QE_EM_proton")
56 else if (str ==
"QE_EM_neutron")
58 else if (str ==
"MEC_FullAll_Param")
60 else if (str ==
"MEC_FullAll_wImag")
62 else if (str ==
"QE_Full")
65 else if (str ==
"QE_CRPA_Low")
67 else if (str ==
"QE_CRPA_Medium")
69 else if (str ==
"QE_CRPA_High")
72 else if (str ==
"QE_CRPA_anu_Low")
74 else if (str ==
"QE_CRPA_anu_Medium")
76 else if (str ==
"QE_CRPA_anu_High")
79 else if (str ==
"QE_HF_Low")
81 else if (str ==
"QE_HF_Medium")
83 else if (str ==
"QE_HF_High")
86 else if (str ==
"QE_HF_anu_Low")
88 else if (str ==
"QE_HF_anu_Medium")
90 else if (str ==
"QE_HF_anu_High")
94 else if (str ==
"QE_CRPAPW_Low")
96 else if (str ==
"QE_CRPAPW_Medium")
98 else if (str ==
"QE_CRPAPW_High")
101 else if (str ==
"QE_CRPAPW_anu_Low")
103 else if (str ==
"QE_CRPAPW_anu_Medium")
105 else if (str ==
"QE_CRPAPW_anu_High")
108 else if (str ==
"QE_HFPW_Low")
110 else if (str ==
"QE_HFPW_Medium")
112 else if (str ==
"QE_HFPW_High")
115 else if (str ==
"QE_HFPW_anu_Low")
117 else if (str ==
"QE_HFPW_anu_Medium")
119 else if (str ==
"QE_HFPW_anu_High")
122 else if (str ==
"QE_SuSABlend")
124 else if (str ==
"QE_SuSABlend_anu")
186 else return "Undefined";
191 return std::ifstream(file_name.c_str()).good();
237 std::string path_type;
238 GetParamDef(
"DataPathType", path_type, std::string(
"relative") );
243 std::string data_path;
247 if ( path_type ==
"relative" ) {
248 data_path = std::string( gSystem->Getenv(
"GENIE") ) +
'/' + data_path;
257 std::map< HadronTensorID, HadronTensorI* >::iterator it;
278 LOG(
"TabulatedHadronTensorModelI",
pWARN) <<
"Unable to create a hadron tensor"
280 <<
" and hadron tensor type " << temp_id.
type;
288 const std::string& basename,
bool& ok)
const
290 for (
size_t p = 0; p <
fDataPaths.size(); ++p) {
292 std::string full_name = path +
'/' + basename;
293 if ( file_exists(full_name) )
return full_name;
298 return std::string();
305 bool tensor_ok =
true;
319 LOG(
"TabulatedHadronTensorModelI",
pINFO) <<
"Loading the hadron"
320 <<
" tensor data file " << full_file_name;
341 LOG(
"TabulatedHadronTensorModelI",
pERROR) <<
"The hadron tensor data file \""
342 << full_file_name <<
"\" requested for target pdg = "
343 << tensor_id.
target_pdg <<
" and hadron tensor type "
344 << tensor_id.
type <<
" could not be found.";
357 std::string tgt_string;
358 std::stringstream ss;
360 tgt_string = ss.str();
362 RgKey key = tensor_type_to_string( ht_id.
type ) +
"@Pdg="
365 std::string basename;
366 GetParamDef( key, basename, std::string(
"TENSOR_FILE_NOT_FOUND") );
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
virtual void Configure(const Registry &config)
bool GetParamDef(const RgKey &name, T &p, const T &def) const
Abstract interface for an object that computes the elements a hadron tensor . Also computes the contr...
A registry. Provides the container for algorithm configuration parameters.
std::string GetTensorFileBasename(const HadronTensorID &ht_id) const
virtual ~TabulatedHadronTensorModelI()
const HadronTensorI * BuildTensor(const HadronTensorID &ht_id) const
Create a HadronTensorI object given a particular HadronTensorID.
std::map< HadronTensorID, HadronTensorI * > fTensors
void LoadConfig()
Saves some basic XML config parameters to data members.
std::vector< std::string > fDataPaths
Paths to check when searching for hadron tensor data files.
virtual void Configure(const Registry &config)
std::string FindTensorTableFile(const std::string &basename, bool &ok) const
TabulatedHadronTensorModelI()
virtual const HadronTensorI * GetTensor(int tensor_pdg, HadronTensorType_t type) const
virtual HadronTensorI * ParseTensorFile(const std::string &full_file_name) const =0
bool file_exists(const std::string &file_name)
Returns true if a given file exists and is accessible, or false otherwise.
genie::HadronTensorType_t string_to_tensor_type(const std::string &str, bool &ok)
std::string tensor_type_to_string(genie::HadronTensorType_t htt)
Converts a genie::HadronTensorType_t value to a string.
THE MAIN GENIE PROJECT NAMESPACE
@ kHT_QE_CRPAPW_anu_Medium
enum genie::HadronTensorType HadronTensorType_t
Struct used to provide a unique ID for each tensor object.