27 using std::ostringstream;
31 using namespace genie;
46 fKnownTensors.push_back(1000140280);
48 fKnownTensors.push_back(1000280560);
49 fKnownTensors.push_back(1000561120);
50 fKnownTensors.push_back(1001042080);
63 for( ; it!=fKnownTensors.end(); ++it) {
64 this->LoadTensorTables(*it);
73 for( ; it!=fKnownTensors.end(); ++it) {
91 LOG(
"MECHadronTensor",
pDEBUG) <<
"Late initialization";
101 if(std::count(fKnownTensors.begin(), fKnownTensors.end(), targetpdg)!=0) {
111 if(Arequest >= 9 || (Arequest == 4 && Zrequest == 2)){
119 return std::count(fKnownTensors.begin(), fKnownTensors.end(), targetpdg)!=0;
122 const vector<genie::BLI2DNonUnifGrid *> &
125 return fTargetTensorTables[targetpdg].Table[
type];
135 const int nq0points = 120;
136 const int nqzpoints = 120;
137 const int nq0qzpoints = nq0points*nqzpoints;
138 double arraystep = 0.01;
143 string tensorLocation =
string(
"/data/evgen/mectensor/nieves");
144 string tensorFileStart =
"HadTensor120-Nieves-";
145 string tensorFileEnd =
"-20150210.dat";
147 if(!KnownTarget(targetpdg)){
149 <<
"No MEC tensor table for target with PDG code: " 156 string data_dir =
string(gSystem->Getenv(
"GENIE")) + tensorLocation;
159 double hadtensor_q0_array[nq0points];
160 double hadtensor_qz_array[nqzpoints];
161 double hadtensor_w_array[nwpoints][nq0qzpoints];
165 for (
int a = 0;
a < nq0points;
a++){
166 hadtensor_q0_array[
a]=double(
a+1)*arraystep;
170 for (
int a = 0;
a < nqzpoints;
a++){
171 hadtensor_qz_array[
a]=double(
a+1)*arraystep;
175 std::map<MECHadronTensor::MECHadronTensorType_t, std::string> tensorTypeNames;
182 for(
int tensorType = 0;
186 ostringstream datafile;
187 datafile << data_dir <<
"/" << tensorFileStart << targetpdg <<
"-" 193 <<
"Asserting that file " << datafile.str().c_str() <<
" exists...";
194 assert (! gSystem->AccessPathName(datafile.str().c_str()));
197 ReadHadTensorqzq0File(
198 datafile.str(), nwpoints, nqzpoints, nq0points, hadtensor_w_array
202 for (
int i = 0; i < nwpoints; i++){
215 fTargetTensorTables[targetpdg].Table[
222 string filename,
int nwpoints,
int nqzpoints,
int nq0points,
223 double hadtensor_w_array[][14400])
226 std::ifstream tensor_stream(filename.c_str(), ios::in);
229 if(!tensor_stream.good()){
235 for (
int ij = 0; ij < (nqzpoints*nq0points); ij++){
236 for (
int k = 0;
k < nwpoints;
k++) {
237 tensor_stream >> temp;
238 hadtensor_w_array[
k][ij]=temp;
THE MAIN GENIE PROJECT NAMESPACE
static MECHadronTensor * Instance()
enum genie::MECHadronTensor::EMECHadronTensorType MECHadronTensorType_t
int IonPdgCodeToA(int pdgc)
map< MECHadronTensor::MECHadronTensorType_t, vector< genie::BLI2DNonUnifGrid * > > Table
const vector< genie::BLI2DNonUnifGrid * > & TensorTable(int targetpdg, MECHadronTensor::MECHadronTensorType_t type)
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Singleton class to load and store MEC hadron tensor tables, to aid in the implementation (and improve...
void ReadHadTensorqzq0File(string filename, int nwpoints, int nqzpoints, int nq0points, double hadtensor_w_array[][14400])
static MECHadronTensor * fgInstance
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
void DummyMethodAndSilentCompiler()
void LoadTensorTables(int targetpdg)
bool KnownTensor(int targetpdg)
int IonPdgCodeToZ(int pdgc)
bool KnownTarget(int targetpdg)
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...