GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DMElectronXSec.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2024, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5 
6 
7  Costas Andreopoulos <c.andreopoulos \at cern.ch>
8  University of Liverpool
9 
10  For the class documentation see the corresponding header file.
11 
12  Important revisions after version 2.0.0 :
13  @ Sep 07, 2009 - CA
14  Integrated with GNU Numerical Library (GSL) via ROOT's MathMore library.
15 
16 */
17 //____________________________________________________________________________
18 
19 #include <TMath.h>
20 #include <Math/IFunction.h>
21 #include <Math/Integrator.h>
22 
23 #include "Framework/Conventions/GBuild.h"
31 
32 using namespace genie;
33 using namespace genie::constants;
34 
35 //____________________________________________________________________________
37 XSecIntegratorI("genie::DMElectronXSec")
38 {
39 
40 }
41 //____________________________________________________________________________
43 XSecIntegratorI("genie::DMElectronXSec", config)
44 {
45 
46 }
47 //____________________________________________________________________________
49 {
50 
51 }
52 //____________________________________________________________________________
54  const XSecAlgorithmI * model, const Interaction * in) const
55 {
56  if(! model->ValidProcess(in) ) return 0.;
57 
58  const KPhaseSpace & kps = in->PhaseSpace();
59  if(!kps.IsAboveThreshold()) {
60  LOG("DMEXSec", pDEBUG) << "*** Below energy threshold";
61  return 0;
62  }
63  Range1D_t yl = kps.Limits(kKVy);
64 
65  LOG("DMEXSec", pDEBUG) << "y = (" << yl.min << ", " << yl.max << ")";
66 
67  Interaction * interaction = new Interaction(*in);
68  interaction->SetBit(kISkipProcessChk);
69  //interaction->SetBit(kISkipKinematicChk);
70 
71  ROOT::Math::IBaseFunctionOneDim * func =
72  new utils::gsl::dXSec_dy_E(model, interaction);
73  ROOT::Math::IntegrationOneDim::Type ig_type =
75  ROOT::Math::Integrator ig(*func,ig_type,1,fGSLRelTol,fGSLMaxEval);
76  double xsec = ig.Integral(yl.min, yl.max) * (1E-38 * units::cm2);
77 
78  //LOG("DMEXSec", pDEBUG) << "*** XSec[ve-] (E=" << E << ") = " << xsec;
79 
80  delete interaction;
81  delete func;
82  return xsec;
83 }
84 //____________________________________________________________________________
85 void DMElectronXSec::Configure(const Registry & config)
86 {
87  Algorithm::Configure(config);
88  this->LoadConfig();
89 }
90 //____________________________________________________________________________
91 void DMElectronXSec::Configure(string config)
92 {
93  Algorithm::Configure(config);
94  this->LoadConfig();
95 }
96 //____________________________________________________________________________
98 {
99  // Get GSL integration type & relative tolerance
100  GetParamDef( "gsl-integration-type", fGSLIntgType, string( "adaptive" ) ) ;
101  GetParamDef( "gsl-relative-tolerance", fGSLRelTol, 0.01 ) ;
102  int max;
103  GetParamDef( "gsl-max-eval", max, 100000 ) ;
104  fGSLMaxEval = (unsigned int) max ;
105 }
106 //____________________________________________________________________________
107 
Cross Section Calculation Interface.
const KPhaseSpace & PhaseSpace(void) const
Definition: Interaction.h:73
void Configure(const Registry &config)
ROOT::Math::IntegrationOneDim::Type Integration1DimTypeFromString(string type)
Definition: GSLUtils.cxx:23
string fGSLIntgType
name of GSL numerical integrator
Cross Section Integrator Interface.
A simple [min,max] interval for doubles.
Definition: Range1.h:42
Range1D_t Limits(KineVar_t kvar) const
Return the kinematical variable limits.
Summary information for an interaction.
Definition: Interaction.h:56
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
static constexpr double cm2
Definition: Units.h:69
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
Kinematical phase space.
Definition: KPhaseSpace.h:33
double func(double x, double y)
virtual bool ValidProcess(const Interaction *i) const =0
Can this cross section algorithm handle the input process?
double max
Definition: Range1.h:53
int fGSLMaxEval
GSL max evaluations.
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:65
double Integrate(const XSecAlgorithmI *model, const Interaction *i) const
XSecIntegratorI interface implementation.
bool IsAboveThreshold(void) const
Checks whether the interaction is above the energy threshold.
double min
Definition: Range1.h:52
bool GetParamDef(const RgKey &name, T &p, const T &def) const
const UInt_t kISkipProcessChk
if set, skip process validity checks
Definition: Interaction.h:47
#define pDEBUG
Definition: Messenger.h:63
double fGSLRelTol
required relative tolerance (error)