GENIEGenerator
Loading...
Searching...
No Matches
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 Liang Liu <liangliu \at fnal.gov>
11 Fermi National Accelerator Laboratory
12
13\created April 26, 2019
14
15\cpright Copyright (c) 2003-2025, The GENIE Collaboration
16 For the full text of the license visit http://copyright.genie-mc.org
17 or see $GENIE/LICENSE
18
19*/
20//____________________________________________________________________________
21
22#ifndef _TABULATED_HADRON_TENSOR_MODEL_H_
23#define _TABULATED_HADRON_TENSOR_MODEL_H_
24
25// standard library includes
26#include <map>
27#include <string>
28#include <vector>
29
30// GENIE includes
34
35namespace genie {
36
38
39public:
41
42 // Implementation of Algorithm interface
43 virtual void Configure(const Registry& config);
44 virtual void Configure(std::string config);
45
46 // Implementation of HadronTensorModelI interface
47 virtual const HadronTensorI* GetTensor(int tensor_pdg, HadronTensorType_t type) const;
48
49protected:
50
52 TabulatedHadronTensorModelI(std::string name);
53 TabulatedHadronTensorModelI(std::string name, std::string config);
54
55 /// Saves some basic XML config parameters to data members
56 void LoadConfig();
57
58 /// Looks up the full path when constructing hadron tensor objects that are
59 /// based on a data file
60 std::string FindTensorTableFile(const std::string& basename,
61 bool& ok) const;
62
63 /// Struct used to provide a unique ID for each tensor object
69
70 // Less than operator needed for sorting a map of these IDs
71 bool operator<(const HadronTensorID& other) const {
72 return (target_pdg < other.target_pdg)
73 || (target_pdg == other.target_pdg && type < other.type);
74 }
75 };
76
77 /// If true, logging messages will be issued when a requested hadron tensor
78 /// file cannot be found
80
81 /// Cache of hadron tensor objects that have been fully loaded into memory
82 ///
83 /// Keys are tensor IDs, values are pointers to hadron tensor objects
84 mutable std::map< HadronTensorID, HadronTensorI* > fTensors;
85
86 /// Paths to check when searching for hadron tensor data files
87 std::vector<std::string> fDataPaths;
88
89 /// Create a HadronTensorI object given a particular HadronTensorID
90 const HadronTensorI* BuildTensor( const HadronTensorID& ht_id ) const;
91
92 /// Loads the basename for a particular hadron tensor file from
93 /// the configuration Registry
94 std::string GetTensorFileBasename( const HadronTensorID& ht_id ) const;
95
96 /// Parses the hadron tensor file (specified by its full file name,
97 /// including the path) and returns a HadronTensorI* to it
98 virtual HadronTensorI* ParseTensorFile( const std::string& full_file_name ) const = 0;
99};
100
101} // namespace genie
102
103#endif // _TABULATED_HADRON_TENSOR_MODEL_H_
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.
Definition Registry.h:65
std::string GetTensorFileBasename(const HadronTensorID &ht_id) const
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
virtual const HadronTensorI * GetTensor(int tensor_pdg, HadronTensorType_t type) const
virtual HadronTensorI * ParseTensorFile(const std::string &full_file_name) const =0
Utilities for improving the code readability when using PDG codes.
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25
@ kHT_Undefined
enum genie::HadronTensorType HadronTensorType_t
Struct used to provide a unique ID for each tensor object.
HadronTensorID(int pdg=0, HadronTensorType_t typ=kHT_Undefined)