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";
190 bool file_exists(
const std::string& file_name) {
191 return std::ifstream(file_name.c_str()).good();
232 GetParamDef(
"WarnIfMissing", fWarnIfMissing,
true );
237 std::string path_type;
238 GetParamDef(
"DataPathType", path_type, std::string(
"relative") );
243 std::string data_path;
244 GetParam(
"DataPath", data_path );
247 if ( path_type ==
"relative" ) {
248 data_path = std::string( gSystem->Getenv(
"GENIE") ) +
'/' + data_path;
251 fDataPaths.push_back( data_path );
257 std::map< HadronTensorID, HadronTensorI* >::iterator it;
258 for (it = fTensors.begin(); it != fTensors.end(); ++it) {
272 if ( fTensors.count(temp_id) )
return fTensors.find(temp_id)->second;
277 if ( !ht && fWarnIfMissing ) {
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) {
291 const std::string& path = fDataPaths.at( 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;
307 std::string tensor_file_basename = this->GetTensorFileBasename( tensor_id );
313 std::string full_file_name = FindTensorTableFile(tensor_file_basename,
319 LOG(
"TabulatedHadronTensorModelI",
pINFO) <<
"Loading the hadron"
320 <<
" tensor data file " << full_file_name;
328 fTensors[tensor_id] = temp_ptr;
338 fTensors[tensor_id] = NULL;
340 if ( fWarnIfMissing ) {
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") );
std::string GetTensorFileBasename(const HadronTensorID &ht_id) const
std::string FindTensorTableFile(const std::string &basename, bool &ok) const
virtual void Configure(const Registry &config)
enum genie::HadronTensorType HadronTensorType_t
virtual const HadronTensorI * GetTensor(int tensor_pdg, HadronTensorType_t type) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
virtual void Configure(const Registry &config)
Abstract interface for an object that computes the elements a hadron tensor . Also computes the contr...
Struct used to provide a unique ID for each tensor object.
void LoadConfig()
Saves some basic XML config parameters to data members.
A registry. Provides the container for algorithm configuration parameters.
Creates hadron tensor objects for use in cross section calculations.
const HadronTensorI * BuildTensor(const HadronTensorID &ht_id) const
Create a HadronTensorI object given a particular HadronTensorID.
virtual ~TabulatedHadronTensorModelI()
TabulatedHadronTensorModelI()