MECHadronTensor.h
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3 
4 \class genie::MECHadronTensor
5 
6 \brief Singleton class to load and store MEC hadron tensor tables,
7  to aid in the implementation (and improve the CPU efficiency of)
8  MEC cross-section models.
9 
10 \author Code contributed by Jackie Schwehr
11  Substantial refactorization by the core GENIE group.
12 
13 \ref Hadron tensors used here are those computed by the following models:
14 
15  J. Nieves, I. Ruiz Simo, M.J. Vicente Vacas,
16  Inclusive quasi-elastic neutrino reactions, PRC 83 (2011) 045501
17 
18 \created September 12, 2014
19 
20 \cpright Copyright (c) 2003-2020, The GENIE Collaboration
21  For the full text of the license visit http://copyright.genie-mc.org
22 */
23 //____________________________________________________________________________
24 
25 #ifndef _MEC_HADRON_TENSOR_H_
26 #define _MEC_HADRON_TENSOR_H_
27 
28 #include <map>
29 #include <vector>
30 #include <string>
31 
32 #ifndef ROOT_Rtypes
33 #include "Rtypes.h"
34 #endif
35 
37 
38 using std::map;
39 using std::vector;
40 using std::string;
41 
42 namespace genie {
43 
45 {
46 public:
47 
48  // ................................................................
49  // MEC hadron tensor type
50  //
51 
52  typedef enum EMECHadronTensorType {
58  }
60 
61  // ................................................................
62  // MEC hadron tensor table
63  //
64 
66  {
67  public:
69  ~MECHadronTensorTable() { /* note: should delete the grids! */ }
70  map<MECHadronTensor::MECHadronTensorType_t, vector<genie::BLI2DNonUnifGrid *> > Table;
71  };
72 
73  // ................................................................
74 
75  static MECHadronTensor * Instance();
76 
77  // method to return whether the targetpdg is in fKnownTargets
78  bool KnownTarget(int targetpdg);
79 
80  // method to return whether the targetpdg is in fKnownTensors
81  bool KnownTensor(int targetpdg);
82 
83  // method to access a specific set of tables
84  const vector<genie::BLI2DNonUnifGrid *> &
86 
87 private:
88 
89  // Ctors & dtor
93 
94  // Self
96 
97  // Load available hadron tensor tables.
98  // NOTES: All tables are loaded by the ctor - Consider loading them on demand.
99  // This will also need to be extended to load tensors for requested model.
100  void LoadTensorTables(int targetpdg);
101 
102  // This map holds all known tensor tables (target PDG code is the key)
103  std::map<int, MECHadronTensorTable> fTargetTensorTables;
104 
105  // List of targets for which we can provide a calculation
106  // some known targets use scale from the tensor table from another target.
107  std::vector<int> fKnownTensors;
108 
109  // that array size 14400 is 120x120. Could go dynamic in the future, or not.
110  void ReadHadTensorqzq0File(string filename, int nwpoints, int nqzpoints, int nq0points, double hadtensor_w_array[][14400]);
111 
112  // singleton cleaner
113  struct Cleaner {
119  }
120  }
121  };
122  friend struct Cleaner;
123 };
124 
125 } // genie namespace
126 
127 #endif // _MEC_HARDRON_TENSOR_H_
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
std::string string
Definition: nybbler.cc:12
static MECHadronTensor * Instance()
enum genie::MECHadronTensor::EMECHadronTensorType MECHadronTensorType_t
struct vector vector
map< MECHadronTensor::MECHadronTensorType_t, vector< genie::BLI2DNonUnifGrid * > > Table
std::vector< int > fKnownTensors
string filename
Definition: train.py:213
const vector< genie::BLI2DNonUnifGrid * > & TensorTable(int targetpdg, MECHadronTensor::MECHadronTensorType_t type)
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
void LoadTensorTables(int targetpdg)
bool KnownTensor(int targetpdg)
std::map< int, MECHadronTensorTable > fTargetTensorTables
bool KnownTarget(int targetpdg)