G4DarkBreM v2.2.2
Geant4 Dark Bremmstrahlung from MadGraph
Loading...
Searching...
No Matches
ElementXsecCache.h
1#ifndef G4DarkBREM_ELEMENTXSECCACHE_H
2#define G4DarkBREM_ELEMENTXSECCACHE_H
3
4#include <memory>
5
7
8namespace g4db {
9
18 public:
25 ElementXsecCache() = default;
26
30 ElementXsecCache(std::shared_ptr<PrototypeModel> model) : model_{model} {}
31
44 G4double get(G4double energy, G4double A, G4double Z);
45
51 void stream(std::ostream& o) const;
52
60 friend std::ostream& operator<<(std::ostream& o, const ElementXsecCache c) {
61 c.stream(o);
62 return o;
63 }
64
65 private:
67 typedef unsigned long int key_t;
68
70 static const key_t MAX_A{1000};
71
73 static const key_t MAX_E{1500000};
74
90 key_t computeKey(G4double energy, G4double A, G4double Z) const;
91
92 private:
94 std::map<key_t, G4double> the_cache_;
95
97 std::shared_ptr<PrototypeModel> model_;
98
99}; // ElementXsecCache
100
101} // namespace g4db
102
103#endif
Class providing a prototype model for dark brem.
The cache of already computed cross sections.
Definition ElementXsecCache.h:17
std::shared_ptr< PrototypeModel > model_
shared pointer to the model for calculating cross sections
Definition ElementXsecCache.h:97
static const key_t MAX_E
The maximum value for energy [MeV].
Definition ElementXsecCache.h:73
friend std::ostream & operator<<(std::ostream &o, const ElementXsecCache c)
Overload the streaming operator for ease.
Definition ElementXsecCache.h:60
G4double get(G4double energy, G4double A, G4double Z)
Get the value of the cross section for the input variables and calculate the cross section if it wasn...
Definition ElementXsecCache.cxx:5
key_t computeKey(G4double energy, G4double A, G4double Z) const
Compute a key for the cache map Generating a unique key after making the energy [MeV] an integer.
Definition ElementXsecCache.cxx:33
void stream(std::ostream &o) const
Stream the entire table into the output stream.
Definition ElementXsecCache.cxx:18
std::map< key_t, G4double > the_cache_
the actual map from cache keys to calculated cross sections
Definition ElementXsecCache.h:94
static const key_t MAX_A
The maximum value of A.
Definition ElementXsecCache.h:70
ElementXsecCache(std::shared_ptr< PrototypeModel > model)
Constructor with a model to calculate the cross section.
Definition ElementXsecCache.h:30
ElementXsecCache()=default
Default constructor.
unsigned long int key_t
The type for the key we use in the cache.
Definition ElementXsecCache.h:67
G4DarkBreM internal namespace.
Definition ElementXsecCache.cxx:3