G4DarkBreM  v2.1.0
Geant4 Dark Bremmstrahlung from MadGraph
ElementXsecInterpolation.h
1 #ifndef G4DarkBREM_ELEMENTXSECINTERPOLATION_H
2 #define G4DarkBREM_ELEMENTXSECINTERPOLATION_H
3 
4 #include <memory>
5 
7 
8 namespace g4db {
9 
20  public:
29 
33  ElementXsecInterpolation(std::shared_ptr<PrototypeModel> model)
34  : model_{model} {}
35 
51  G4double get(G4double energy, G4double A, G4double Z);
52 
58  void stream(std::ostream& o) const;
59 
67  friend std::ostream& operator<<(std::ostream& o,
68  const ElementXsecInterpolation c) {
69  c.stream(o);
70  return o;
71  }
72 
73  private:
78  class SampleSet {
79  public:
90  SampleSet(const std::vector<double>& init_x,
91  const std::vector<double>& init_y);
92 
97  const double& min() const;
98 
103  const double& max() const;
104 
115  void prepend(double x, double y);
116 
127  void append(double x, double y);
128 
144  double interpolate(double x) const;
145 
159  void dump(std::ostream& o, int z, double kinematic_min) const;
160 
161  private:
163  std::vector<double> x_;
165  std::vector<double> y_;
166  };
167 
168  private:
170  std::map<int, SampleSet> the_samples_;
171 
173  std::shared_ptr<PrototypeModel> model_;
174 
175 }; // ElementXsecInterpolation
176 
177 } // namespace g4db
178 
179 #endif
Class providing a prototype model for dark brem.
A sample set is two parallel vectors limited to operate for our interpolation goal.
Definition: ElementXsecInterpolation.h:78
SampleSet(const std::vector< double > &init_x, const std::vector< double > &init_y)
Initialize the sample set with the two input vectors.
Definition: ElementXsecInterpolation.cxx:94
void append(double x, double y)
append the sample set with the input point
Definition: ElementXsecInterpolation.cxx:114
const double & min() const
Get the minimum x currently in sample set.
Definition: ElementXsecInterpolation.cxx:100
void prepend(double x, double y)
prepend the sample set with the input point
Definition: ElementXsecInterpolation.cxx:108
std::vector< double > x_
x points
Definition: ElementXsecInterpolation.h:163
std::vector< double > y_
y points
Definition: ElementXsecInterpolation.h:165
double interpolate(double x) const
Calculate an interpolation for the point x.
Definition: ElementXsecInterpolation.cxx:120
const double & max() const
Get the maximum x currently in sample set.
Definition: ElementXsecInterpolation.cxx:104
void dump(std::ostream &o, int z, double kinematic_min) const
Dump our sample points to the input stream.
Definition: ElementXsecInterpolation.cxx:143
Interpolation of cross sections by element.
Definition: ElementXsecInterpolation.h:19
void stream(std::ostream &o) const
Stream the table of sample points into the output stream.
Definition: ElementXsecInterpolation.cxx:83
std::map< int, SampleSet > the_samples_
each element has its own set of sample points
Definition: ElementXsecInterpolation.h:170
G4double get(G4double energy, G4double A, G4double Z)
Get the value of the cross section for the input variables.
Definition: ElementXsecInterpolation.cxx:7
friend std::ostream & operator<<(std::ostream &o, const ElementXsecInterpolation c)
Overload the streaming operator for ease.
Definition: ElementXsecInterpolation.h:67
std::shared_ptr< PrototypeModel > model_
shared pointer to the model for calculating cross sections
Definition: ElementXsecInterpolation.h:173
ElementXsecInterpolation()=default
Default constructor.
ElementXsecInterpolation(std::shared_ptr< PrototypeModel > model)
Constructor with a model to calculate the cross section.
Definition: ElementXsecInterpolation.h:33
G4DarkBreM internal namespace.
Definition: ElementXsecCache.cxx:3