TabulatedHadronTensorModelI.h
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3 
4 \class genie::TabulatedHadronTensorModelI
5 
6 \brief Creates hadron tensor objects for cross section calculations
7  using precomputed data tables
8 
9 \author Steven Gardiner <gardiner \at fnal.gov>
10  Fermi National Accelerator Laboratory
11 
12 \created April 26, 2019
13 
14 \cpright Copyright (c) 2003-2019, The GENIE Collaboration
15  For the full text of the license visit http://copyright.genie-mc.org
16  or see $GENIE/LICENSE
17 */
18 //____________________________________________________________________________
19 
20 #ifndef _TABULATED_HADRON_TENSOR_MODEL_H_
21 #define _TABULATED_HADRON_TENSOR_MODEL_H_
22 
23 // standard library includes
24 #include <map>
25 #include <string>
26 #include <vector>
27 
28 // GENIE includes
32 
33 namespace genie {
34 
36 
37 public:
39 
40  // Implementation of Algorithm interface
41  virtual void Configure(const Registry& config);
42  virtual void Configure(std::string config);
43 
44  // Implementation of HadronTensorModelI interface
45  virtual const HadronTensorI* GetTensor(int tensor_pdg, HadronTensorType_t type) const;
46 
47 protected:
48 
52 
53  /// Saves some basic XML config parameters to data members
54  void LoadConfig();
55 
56  /// Looks up the full path when constructing hadron tensor objects that are
57  /// based on a data file
59  bool& ok) const;
60 
61  /// Struct used to provide a unique ID for each tensor object
62  struct HadronTensorID {
64  : target_pdg( pdg ), type( typ ) {}
67 
68  // Less than operator needed for sorting a map of these IDs
69  bool operator<(const HadronTensorID& other) const {
70  return (target_pdg < other.target_pdg)
71  || (target_pdg == other.target_pdg && type < other.type);
72  }
73  };
74 
75  /// If true, logging messages will be issued when a requested hadron tensor
76  /// file cannot be found
78 
79  /// Cache of hadron tensor objects that have been fully loaded into memory
80  ///
81  /// Keys are tensor IDs, values are pointers to hadron tensor objects
82  mutable std::map< HadronTensorID, HadronTensorI* > fTensors;
83 
84  /// Paths to check when searching for hadron tensor data files
85  std::vector<std::string> fDataPaths;
86 
87  /// Create a HadronTensorI object given a particular HadronTensorID
88  const HadronTensorI* BuildTensor( const HadronTensorID& ht_id ) const;
89 
90  /// Loads the basename for a particular hadron tensor file from
91  /// the configuration Registry
92  std::string GetTensorFileBasename( const HadronTensorID& ht_id ) const;
93 
94  /// Parses the hadron tensor file (specified by its full file name,
95  /// including the path) and returns a HadronTensorI* to it
96  virtual HadronTensorI* ParseTensorFile( const std::string& full_file_name ) const = 0;
97 };
98 
99 } // namespace genie
100 
101 #endif // _TABULATED_HADRON_TENSOR_MODEL_H_
static QCString name
Definition: declinfo.cpp:673
std::string GetTensorFileBasename(const HadronTensorID &ht_id) const
std::string FindTensorTableFile(const std::string &basename, bool &ok) const
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
std::string string
Definition: nybbler.cc:12
HadronTensorID(int pdg=0, HadronTensorType_t typ=kHT_Undefined)
virtual void Configure(const Registry &config)
enum genie::HadronTensorType HadronTensorType_t
bool operator<(const HadronTensorID &other) const
virtual const HadronTensorI * GetTensor(int tensor_pdg, HadronTensorType_t type) const
static Config * config
Definition: config.cpp:1054
Abstract interface for an object that computes the elements a hadron tensor . Also computes the contr...
Definition: HadronTensorI.h:53
std::vector< std::string > fDataPaths
Paths to check when searching for hadron tensor data files.
Struct used to provide a unique ID for each tensor object.
void LoadConfig()
Saves some basic XML config parameters to data members.
Creates hadron tensor objects for cross section calculations using precomputed data tables...
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:65
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 HadronTensorI * ParseTensorFile(const std::string &full_file_name) const =0
std::map< HadronTensorID, HadronTensorI * > fTensors