GSLXSecFunc.h
Go to the documentation of this file.
1 //_____________________________________________________________________________________
2 /*!
3 
4 \namespace genie::utils::gsl
5 
6 \brief GENIE differential cross section function wrappers for GSL integrators.
7 
8 \author Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>
9  University of Liverpool & STFC Rutherford Appleton Lab
10 
11 \created Sep 01, 2009
12 
13 \cpright Copyright (c) 2003-2019, The GENIE Collaboration
14  For the full text of the license visit http://copyright.genie-mc.org
15  or see $GENIE/LICENSE
16 */
17 //_____________________________________________________________________________________
18 
19 #ifndef _GENIE_XSEC_FUNCTION_GSL_WRAPPERS_H_
20 #define _GENIE_XSEC_FUNCTION_GSL_WRAPPERS_H_
21 
22 #include <Math/IFunction.h>
23 #include <Math/IntegratorMultiDim.h>
24 
25 namespace genie {
26 
27 class XSecAlgorithmI;
28 class Interaction;
29 
30 namespace utils {
31 namespace gsl {
32 
33 //.....................................................................................
34 //
35 // genie::utils::gsl::dXSec_dQ2_E
36 // A 1-D cross section function: dxsec/dQ2 = f(Q2)|(fixed E)
37 //
38 class dXSec_dQ2_E: public ROOT::Math::IBaseFunctionOneDim
39 {
40 public:
41  dXSec_dQ2_E(const XSecAlgorithmI * m, const Interaction * i);
42  ~dXSec_dQ2_E();
43 
44  // ROOT::Math::IBaseFunctionOneDim interface
45  unsigned int NDim (void) const;
46  double DoEval (double xin) const;
47  ROOT::Math::IBaseFunctionOneDim * Clone (void) const;
48 
49 private:
52 };
53 
54 //.....................................................................................
55 //
56 // genie::utils::gsl::dXSec_dy_E
57 // A 1-D cross section function: dxsec/dy = f(y)|(fixed E)
58 //
59 class dXSec_dy_E: public ROOT::Math::IBaseFunctionOneDim
60 {
61 public:
62  dXSec_dy_E(const XSecAlgorithmI * m, const Interaction * i);
63  ~dXSec_dy_E();
64 
65  // ROOT::Math::IBaseFunctionOneDim interface
66  unsigned int NDim (void) const;
67  double DoEval (double xin) const;
68  ROOT::Math::IBaseFunctionOneDim * Clone (void) const;
69 
70 private:
73 };
74 
75 //.....................................................................................
76 //
77 // genie::utils::gsl::d2XSec_dxdy_E
78 // A 2-D cross section function: d2xsec/dxdy = f(x,y)|(fixed E)
79 //
80 class d2XSec_dxdy_E: public ROOT::Math::IBaseFunctionMultiDim
81 {
82 public:
83  d2XSec_dxdy_E(const XSecAlgorithmI * m, const Interaction * i);
84  ~d2XSec_dxdy_E();
85 
86  // ROOT::Math::IBaseFunctionMultiDim interface
87  unsigned int NDim (void) const;
88  double DoEval (const double * xin) const;
89  ROOT::Math::IBaseFunctionMultiDim * Clone (void) const;
90 
91 private:
94 };
95 
96 //.....................................................................................
97 //
98 // genie::utils::gsl::d2XSec_dQ2dy_E
99 // A 2-D cross section function: d2xsec/dQ2dy = f(Q^2,y)|(fixed E)
100 //
101 class d2XSec_dQ2dy_E: public ROOT::Math::IBaseFunctionMultiDim
102 {
103 public:
104  d2XSec_dQ2dy_E(const XSecAlgorithmI * m, const Interaction * i);
105  ~d2XSec_dQ2dy_E();
106 
107  // ROOT::Math::IBaseFunctionMultiDim interface
108  unsigned int NDim (void) const;
109  double DoEval (const double * xin) const;
110  ROOT::Math::IBaseFunctionMultiDim * Clone (void) const;
111 
112 private:
115 };
116 
117 //.....................................................................................
118 //
119 // genie::utils::gsl::d2XSec_dQ2dydt_E
120 // A 3-D cross section function: d3xsec/dQ2dydt = f(Q^2,y,t)|(fixed E)
121 //
122 class d2XSec_dQ2dydt_E: public ROOT::Math::IBaseFunctionMultiDim
123 {
124 public:
125  d2XSec_dQ2dydt_E(const XSecAlgorithmI * m, const Interaction * i);
126  ~d2XSec_dQ2dydt_E();
127 
128  // ROOT::Math::IBaseFunctionMultiDim interface
129  unsigned int NDim (void) const;
130  double DoEval (const double * xin) const;
131  ROOT::Math::IBaseFunctionMultiDim * Clone (void) const;
132 
133 private:
136 };
137 
138 //.....................................................................................
139 //
140 // genie::utils::gsl::d3XSec_dxdydt_E
141 // A 3-D cross section function: d3xsec/dxdydt = f(x,y,t)|(fixed E)
142 //
143 class d3XSec_dxdydt_E: public ROOT::Math::IBaseFunctionMultiDim
144 {
145 public:
146  d3XSec_dxdydt_E(const XSecAlgorithmI * m, const Interaction * i);
147  ~d3XSec_dxdydt_E();
148 
149  // ROOT::Math::IBaseFunctionMultiDim interface
150  unsigned int NDim (void) const;
151  double DoEval (const double * xin) const;
152  ROOT::Math::IBaseFunctionMultiDim * Clone (void) const;
153 
154 private:
157 };
158 
159 //.....................................................................................
160 //
161 // genie::utils::gsl::d2XSec_dWdQ2_E
162 // A 2-D cross section function: d2xsec/dWdQ2 = f(W,Q2)|(fixed E)
163 //
164 class d2XSec_dWdQ2_E: public ROOT::Math::IBaseFunctionMultiDim
165 {
166 public:
167  d2XSec_dWdQ2_E(const XSecAlgorithmI * m, const Interaction * i);
168  ~d2XSec_dWdQ2_E();
169 
170  // ROOT::Math::IBaseFunctionMultiDim interface
171  unsigned int NDim (void) const;
172  double DoEval (const double * xin) const;
173  ROOT::Math::IBaseFunctionMultiDim * Clone (void) const;
174 
175 private:
178 };
179 
180 //.....................................................................................
181 //
182 // genie::utils::gsl::d2XSec_dxdy_Ex
183 // A 1-D cross section function: d2xsec/dxdy = f(y)|(fixed:E,x)
184 //
185 class d2XSec_dxdy_Ex: public ROOT::Math::IBaseFunctionOneDim
186 {
187 public:
188  d2XSec_dxdy_Ex(const XSecAlgorithmI * m, const Interaction * i, double x);
189  ~d2XSec_dxdy_Ex();
190 
191  // ROOT::Math::IBaseFunctionOneDim interface
192  unsigned int NDim (void) const;
193  double DoEval (double xin) const;
194  ROOT::Math::IBaseFunctionOneDim * Clone (void) const;
195 
196 private:
199  double fx;
200 };
201 
202 //.....................................................................................
203 //
204 // genie::utils::gsl::d2XSec_dxdy_Ey
205 // A 1-D cross section function: d2xsec/dxdy = f(x)|(fixed:E,y)
206 //
207 class d2XSec_dxdy_Ey: public ROOT::Math::IBaseFunctionOneDim
208 {
209 public:
210  d2XSec_dxdy_Ey(const XSecAlgorithmI * m, const Interaction * i, double x);
211  ~d2XSec_dxdy_Ey();
212 
213  // ROOT::Math::IBaseFunctionOneDim interface
214  unsigned int NDim (void) const;
215  double DoEval (double xin) const;
216  ROOT::Math::IBaseFunctionOneDim * Clone (void) const;
217 
218 private:
221  double fy;
222 };
223 
224 //.....................................................................................
225 //
226 // genie::utils::gsl::d2XSec_dWdQ2_EW
227 // A 1-D cross section function: d2xsec/dWdQ2= f(Q2)|(fixed:E,W)
228 //
229 class d2XSec_dWdQ2_EW: public ROOT::Math::IBaseFunctionOneDim
230 {
231 public:
232  d2XSec_dWdQ2_EW( const XSecAlgorithmI * m, const Interaction * i, double W);
233  ~d2XSec_dWdQ2_EW();
234 
235  // ROOT::Math::IBaseFunctionOneDim interface
236  unsigned int NDim (void) const;
237  double DoEval (double xin) const;
238  ROOT::Math::IBaseFunctionOneDim * Clone (void) const;
239 
240 private:
243  double fW;
244 };
245 
246 //.....................................................................................
247 //
248 // genie::utils::gsl::d2XSec_dWdQ2_EQ2
249 // A 1-D cross section function: d2xsec/dWdQ2= f(W)|(fixed:E,Q2)
250 //
251 class d2XSec_dWdQ2_EQ2: public ROOT::Math::IBaseFunctionOneDim
252 {
253 public:
254  d2XSec_dWdQ2_EQ2(const XSecAlgorithmI * m, const Interaction * i, double Q2);
255  ~d2XSec_dWdQ2_EQ2();
256 
257  // ROOT::Math::IBaseFunctionOneDim interface
258  unsigned int NDim (void) const;
259  double DoEval (double xin) const;
260  ROOT::Math::IBaseFunctionOneDim * Clone (void) const;
261 
262 private:
265  double fQ2;
266 };
267 
268 //.....................................................................................
269 
270 //.....................................................................................
271 //
272 //
273 //
274 class d5XSecAR : public ROOT::Math::IBaseFunctionMultiDim
275 {
276 public:
277  d5XSecAR(const XSecAlgorithmI * m, const Interaction * i);
278  ~d5XSecAR();
279  // ROOT::Math::IBaseFunctionMultiDim interface
280  unsigned int NDim (void) const;
281  double DoEval (const double * xin) const;
282  ROOT::Math::IBaseFunctionMultiDim * Clone (void) const;
283  void SetFlip(bool b) { flip = b; }
284 
285 private:
288  bool flip;
289 };
290 
291 
292 //.....................................................................................
293 //
294 // genie::utils::gsl::d5Xsec_dEldOmegaldOmegapi
295 // A 5-D cross section function (fixed E_nu)
296 //
297 class d5Xsec_dEldOmegaldOmegapi: public ROOT::Math::IBaseFunctionMultiDim
298 {
299 public:
302 
303  // ROOT::Math::IBaseFunctionMultiDim interface
304  unsigned int NDim (void) const;
305  double DoEval (const double * xin) const;
306  ROOT::Math::IBaseFunctionMultiDim * Clone (void) const;
307 
308 private:
311 };
312 
313 ///.....................................................................................
314 ///
315 /// genie::utils::gsl::d4Xsec_dEldThetaldOmegapi
316 /// A 4-D cross section function (fixed E_nu)
317 /// DANIEL - for the Alvarez-Russo cross-section
318 ///
319 class d4Xsec_dEldThetaldOmegapi: public ROOT::Math::IBaseFunctionMultiDim
320 {
321 public:
324 
325  // ROOT::Math::IBaseFunctionMultiDim interface
326  unsigned int NDim (void) const;
327  double DoEval (const double * xin) const;
328  ROOT::Math::IBaseFunctionMultiDim * Clone (void) const;
329 
330  double GetFactor() const;
331  void SetFactor(double factor);
332 
333 private:
336  double fFactor;
337 };
338 ///.....................................................................................
339 ///
340 /// genie::utils::gsl::d3Xsec_dOmegaldThetapi
341 /// A 3-D cross section function (fixed E_nu)
342 /// Steve Dennis - for the Alvarez-Russo cross-section
343 ///
344 class d3Xsec_dOmegaldThetapi: public ROOT::Math::IBaseFunctionMultiDim
345 {
346 public:
349 
350  // ROOT::Math::IBaseFunctionMultiDim interface
351  unsigned int NDim (void) const;
352  double DoEval (const double * xin) const;
353  d3Xsec_dOmegaldThetapi * Clone (void) const;
354 
355  // Specific to this class
356  void SetE_lep (double E_lepton) const;
357  // Yes, it's a const setter
358  // Needed because DoEval must be const, but dXSec_dElep_AR::DoEval() must call this
359 
360 private:
363  mutable double fElep;
364 };
365 ///.....................................................................................
366 ///
367 /// genie::utils::gsl::dXSec_dElep_AR
368 /// A 1-D cross section function: dxsec/dElep
369 /// Used for Alvarez-Ruso coherent.
370 ///
371 class dXSec_dElep_AR: public ROOT::Math::IBaseFunctionOneDim
372 {
373 public:
374  dXSec_dElep_AR(const XSecAlgorithmI * m, const Interaction * i,
375  string gsl_nd_integrator_type, double gsl_relative_tolerance,
376  unsigned int max_n_calls);
378  ~dXSec_dElep_AR();
379 
380  // ROOT::Math::IBaseFunctionOneDim interface
381  dXSec_dElep_AR * Clone (void) const;
382  double DoEval (double xin) const;
383 
384 private:
387 
389 
390  mutable ROOT::Math::IntegratorMultiDim integrator;
391 
392  double kine_min[3];
393  double kine_max[3];
394 
396  double fGSLRelTol;
397  unsigned int fGSLMaxCalls;
398 };
399 
400 ///.....................................................................................
401 ///
402 /// dXSec_Log_Wrapper
403 /// Redistributes variables over a range to a e^-x distribution.
404 /// Allows the integrator to use a logarithmic series of points while calling uniformly.
405 class dXSec_Log_Wrapper: public ROOT::Math::IBaseFunctionMultiDim
406 {
407  public:
408  dXSec_Log_Wrapper(const ROOT::Math::IBaseFunctionMultiDim * fn,
409  bool * ifLog, double * min, double * maxes);
411 
412  // ROOT::Math::IBaseFunctionMultiDim interface
413  unsigned int NDim (void) const;
414  double DoEval (const double * xin) const;
415  ROOT::Math::IBaseFunctionMultiDim * Clone (void) const;
416 
417  private:
418  const ROOT::Math::IBaseFunctionMultiDim * fFn;
419  bool * fIfLog;
420  double * fMins;
421  double * fMaxes;
422 };
423 
424 } // gsl namespace
425 } // utils namespace
426 } // genie namespace
427 
428 #endif
429 
Cross Section Calculation Interface.
const XSecAlgorithmI * fModel
Definition: GSLXSecFunc.h:71
const XSecAlgorithmI * fModel
Definition: GSLXSecFunc.h:92
const Interaction * fInteraction
Definition: GSLXSecFunc.h:156
dXSec_dQ2_E(const XSecAlgorithmI *m, const Interaction *i)
Definition: GSLXSecFunc.cxx:35
THE MAIN GENIE PROJECT NAMESPACE
Definition: GeneratorBase.h:8
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:991
const Interaction * fInteraction
Definition: GSLXSecFunc.h:220
const XSecAlgorithmI * fModel
Definition: GSLXSecFunc.h:50
const XSecAlgorithmI * fModel
Definition: GSLXSecFunc.h:241
const Interaction * fInteraction
Definition: GSLXSecFunc.h:72
const Interaction * fInteraction
Definition: GSLXSecFunc.h:264
double DoEval(double xin) const
Definition: GSLXSecFunc.cxx:51
const XSecAlgorithmI * fModel
Definition: GSLXSecFunc.h:113
unsigned int NDim(void) const
Definition: GSLXSecFunc.cxx:47
const XSecAlgorithmI * fModel
Definition: GSLXSecFunc.h:197
Summary information for an interaction.
Definition: Interaction.h:56
ROOT::Math::IBaseFunctionOneDim * Clone(void) const
Definition: GSLXSecFunc.cxx:67
const XSecAlgorithmI * fModel
Definition: GSLXSecFunc.h:263
const XSecAlgorithmI * fModel
Definition: GSLXSecFunc.h:176
const XSecAlgorithmI * fModel
Definition: GSLXSecFunc.h:155
const XSecAlgorithmI * fModel
Definition: GSLXSecFunc.h:134
const Interaction * fInteraction
Definition: GSLXSecFunc.h:114
const Interaction * fInteraction
Definition: GSLXSecFunc.h:93
const Interaction * fInteraction
Definition: GSLXSecFunc.h:287
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
const Interaction * fInteraction
Definition: GSLXSecFunc.h:386
const Interaction * fInteraction
Definition: GSLXSecFunc.h:242
const Interaction * fInteraction
Definition: GSLXSecFunc.h:198
const genie::utils::gsl::d3Xsec_dOmegaldThetapi * func
Definition: GSLXSecFunc.h:388
const XSecAlgorithmI * fModel
Definition: GSLXSecFunc.h:286
const XSecAlgorithmI * fModel
Definition: GSLXSecFunc.h:219
const Interaction * fInteraction
Definition: GSLXSecFunc.h:135
const hit & b
Definition: hits.cxx:21
const Interaction * fInteraction
Definition: GSLXSecFunc.h:177
const ROOT::Math::IBaseFunctionMultiDim * fFn
Definition: GSLXSecFunc.h:418
const Interaction * fInteraction
Definition: GSLXSecFunc.h:51
ROOT::Math::IntegratorMultiDim integrator
Definition: GSLXSecFunc.h:390
#define W(x)
const XSecAlgorithmI * fModel
Definition: GSLXSecFunc.h:385