Functions
genie::alvarezruso::integrationtools Namespace Reference

Functions

void SG20R (const double a, const double b, const unsigned int n, const unsigned int nsamp, double *x, unsigned int &np, double *w)
 
std::complex< double > RG201D (const double A, const double B, const unsigned int N, const unsigned int nsamp, const std::complex< double > CF[])
 
void RG202D (const double a, const double b, unsigned int n, unsigned int l, unsigned int m, std::vector< std::vector< std::complex< double > > > &cf, const unsigned int nsamp, std::vector< std::complex< double > > &cres)
 
void SG48R (const double a, const double b, const unsigned int n, const unsigned int nsamp, double *x, unsigned int &np, double *w)
 
std::complex< double > RG481D (const double A, const double B, const unsigned int N, const unsigned int nsamp, const std::complex< double > CF[])
 
void RG482D (const double a, const double b, unsigned int n, unsigned int l, unsigned int m, std::vector< std::vector< std::complex< double > > > &cf, const unsigned int nsamp, std::vector< std::complex< double > > &cres)
 
void SGNR (const double a, const double b, const unsigned int n, const unsigned int nsamp, double *x, unsigned int &np, double *w)
 
std::complex< double > RGN1D (const double A, const double B, const unsigned int N, const unsigned int nsamp, const std::complex< double > CF[])
 
void RGN2D (const double a, const double b, unsigned int n, unsigned int l, unsigned int m, std::vector< std::vector< std::complex< double > > > &cf, const unsigned int nsamp, std::vector< std::complex< double > > &cres)
 

Function Documentation

cdouble genie::alvarezruso::integrationtools::RG201D ( const double  A,
const double  B,
const unsigned int  N,
const unsigned int  nsamp,
const std::complex< double >  CF[] 
)

Definition at line 63 of file IntegrationTools.cxx.

References genie::units::A, MECModelEnuComparisons::i, calib::j, and W.

Referenced by RGN1D().

64 {
65  // Gaussian-Legendre integration of the function defined by CF
66  const double W[10] = {.0176140071,.0406014298,.0626720483,.0832767415,.1019301198,.1181945319,.1316886384,.1420961093,.1491729864,.1527533871};
67  cdouble CR(0.0, 0.0);
68  int I1 = -nsamp;
69  int I2, J1, J2;
70  for(unsigned int i = 1; i <= N; ++i)
71  {
72  I1 += nsamp;
73  I2 = I1 + nsamp+1;
74  for(unsigned int j = 1; j <= 10; ++j)
75  {
76  J1 = I1 + j;
77  J2 = I2 - j;
78  CR += W[j-1] * (CF[J1-1]+CF[J2-1]);
79  }
80  }
81  //CRES=CR*0.5*(B-A)/float(N)
82  cdouble CRES = CR*0.5*(B-A)/Double_t(N);
83  return CRES;
84 }
const double j
Definition: BetheBloch.cxx:29
static const double A
Definition: Units.h:82
std::complex< double > cdouble
#define W(x)
void genie::alvarezruso::integrationtools::RG202D ( const double  a,
const double  b,
unsigned int  n,
unsigned int  l,
unsigned int  m,
std::vector< std::vector< std::complex< double > > > &  cf,
const unsigned int  nsamp,
std::vector< std::complex< double > > &  cres 
)

Definition at line 87 of file IntegrationTools.cxx.

References a, MECModelEnuComparisons::i, calib::j, m, getGoodRuns4SAM::n, and w.

Referenced by RGN2D().

90 {
91  // This is a fast integrator based on a Gauss-Legendre method. This only support two-dimensional integration
92  n = 2; l = 0; m = 3;
93 
94  static const double w[10] = {.0176140071,.0406014298,.0626720483,.0832767415,.1019301198,.1181945319,.1316886384,.1420961093,.1491729864,.1527533871};
95 
96  std::vector<cdouble> cr(4, cdouble(0.0,0.0));
97 
98  int i1 = -nsamp;
99  int i2;
100  int j1;
101  int j2;
102 
103  for(unsigned int i = 0; i != n; ++i)
104  {
105  i1 += nsamp;
106  i2 = i1 + nsamp-1;
107  for(unsigned int j = 0; j != 10; ++j)
108  {
109  j1 = i1 + j;
110  j2 = i2 - j;
111 
112  for(unsigned int ll = l; ll <= m; ++ll)
113  {
114  cr[ll] += w[j] * ( cf[ll][j1] + cf[ll][j2] );
115  }
116  }
117  }
118 
119  for(unsigned int i = 0; i != 4; ++i)
120  {
121  cres[i] = cr[i] * 0.5 * (b-a) / static_cast<double>(n);
122  }
123 }
std::complex< double > cdouble
const double a
const double j
Definition: BetheBloch.cxx:29
const hit & b
Definition: hits.cxx:21
Float_t w
Definition: plot.C:20
cdouble genie::alvarezruso::integrationtools::RG481D ( const double  A,
const double  B,
const unsigned int  N,
const unsigned int  nsamp,
const std::complex< double >  CF[] 
)

Definition at line 160 of file IntegrationTools.cxx.

References genie::units::A, MECModelEnuComparisons::i, calib::j, and W.

Referenced by RGN1D().

161 {
162  // Gaussian-Legendre integration of the function defined by CF
163  static const double W[24] = {0.0031533460, 0.0073275539, 0.0114772345, 0.0155793157, 0.0196161604,
164  0.0235707608, 0.0274265097, 0.0311672278, 0.0347772225, 0.0382413510, 0.0415450829, 0.0446745608,
165  0.0476166584, 0.0503590355, 0.0528901894, 0.0551995036, 0.0572772921, 0.0591148396, 0.0607044391,
166  0.0620394231, 0.0631141922, 0.0639242385, 0.0644661644, 0.0647376968 };
167  cdouble CR(0.0, 0.0);
168  int I1 = -nsamp;
169  int I2, J1, J2;
170  for(unsigned int i = 1; i <= N; ++i)
171  {
172  I1 += nsamp;
173  I2 = I1 + nsamp+1;
174  for(unsigned int j = 1; j <= 24; ++j)
175  {
176  J1 = I1 + j;
177  J2 = I2 - j;
178  CR += W[j-1] * (CF[J1-1]+CF[J2-1]);
179  }
180  }
181  //CRES=CR*0.5*(B-A)/float(N)
182  cdouble CRES = CR*0.5*(B-A)/Double_t(N);
183  return CRES;
184 }
const double j
Definition: BetheBloch.cxx:29
static const double A
Definition: Units.h:82
std::complex< double > cdouble
#define W(x)
void genie::alvarezruso::integrationtools::RG482D ( const double  a,
const double  b,
unsigned int  n,
unsigned int  l,
unsigned int  m,
std::vector< std::vector< std::complex< double > > > &  cf,
const unsigned int  nsamp,
std::vector< std::complex< double > > &  cres 
)

Definition at line 187 of file IntegrationTools.cxx.

References a, MECModelEnuComparisons::i, calib::j, m, getGoodRuns4SAM::n, and w.

Referenced by RGN2D().

190 {
191  // This is a fast integrator based on a Gauss-Legendre method. This only support two-dimensional integration
192  n = 2; l = 0; m = 3;
193 
194  static const double w[24] = {0.0031533460, 0.0073275539, 0.0114772345, 0.0155793157, 0.0196161604,
195  0.0235707608, 0.0274265097, 0.0311672278, 0.0347772225, 0.0382413510, 0.0415450829, 0.0446745608,
196  0.0476166584, 0.0503590355, 0.0528901894, 0.0551995036, 0.0572772921, 0.0591148396, 0.0607044391,
197  0.0620394231, 0.0631141922, 0.0639242385, 0.0644661644, 0.0647376968 };
198 
199  std::vector<cdouble> cr(4, cdouble(0.0,0.0));
200 
201  int i1 = -nsamp;
202  int i2;
203  int j1;
204  int j2;
205 
206  for(unsigned int i = 0; i != n; ++i)
207  {
208  i1 += nsamp;
209  i2 = i1 + nsamp-1;
210  for(unsigned int j = 0; j != 24; ++j)
211  {
212  j1 = i1 + j;
213  j2 = i2 - j;
214 
215  for(unsigned int ll = l; ll <= m; ++ll)
216  {
217  cr[ll] += w[j] * ( cf[ll][j1] + cf[ll][j2] );
218  }
219  }
220  }
221 
222  for(unsigned int i = 0; i != 4; ++i)
223  {
224  cres[i] = cr[i] * 0.5 * (b-a) / static_cast<double>(n);
225  }
226 }
std::complex< double > cdouble
const double a
const double j
Definition: BetheBloch.cxx:29
const hit & b
Definition: hits.cxx:21
Float_t w
Definition: plot.C:20
cdouble genie::alvarezruso::integrationtools::RGN1D ( const double  A,
const double  B,
const unsigned int  N,
const unsigned int  nsamp,
const std::complex< double >  CF[] 
)

Definition at line 245 of file IntegrationTools.cxx.

References om::cerr, allTimeWatchdog::endl, exit(), RG201D(), and RG481D().

Referenced by genie::alvarezruso::AREikonalSolution::Element().

246 {
247  if (nsamp==20) {
248  return integrationtools::RG201D(A, B, N, nsamp, CF);
249  }
250  else if (nsamp==48) {
251  return integrationtools::RG481D(A, B, N, nsamp, CF);
252  }
253  else {
254  std::cerr<<"IntegrationTools/RGN1D >> Unsupported nuclear sampling: "<<nsamp<<std::endl;
255  exit(-1);
256  }
257 }
std::complex< double > RG201D(const double A, const double B, const unsigned int N, const unsigned int nsamp, const std::complex< double > CF[])
OStream cerr
Definition: OStream.cxx:7
static const double A
Definition: Units.h:82
exit(0)
std::complex< double > RG481D(const double A, const double B, const unsigned int N, const unsigned int nsamp, const std::complex< double > CF[])
void genie::alvarezruso::integrationtools::RGN2D ( const double  a,
const double  b,
unsigned int  n,
unsigned int  l,
unsigned int  m,
std::vector< std::vector< std::complex< double > > > &  cf,
const unsigned int  nsamp,
std::vector< std::complex< double > > &  cres 
)

Definition at line 259 of file IntegrationTools.cxx.

References om::cerr, allTimeWatchdog::endl, exit(), RG202D(), and RG482D().

Referenced by genie::alvarezruso::AlvarezRusoCOHPiPDXSec::NuclearCurrent().

262 {
263  if (nsamp==20) {
264  integrationtools::RG202D(a, b, n, l, m, cf, nsamp, cres);
265  }
266  else if (nsamp==48) {
267  integrationtools::RG482D(a, b, n, l, m, cf, nsamp, cres);
268  }
269  else {
270  std::cerr<<"IntegrationTools/RGN2D >> Unsupported nuclear sampling: "<<nsamp<<std::endl;
271  exit(-1);
272  }
273 }
OStream cerr
Definition: OStream.cxx:7
const double a
exit(0)
const hit & b
Definition: hits.cxx:21
void RG202D(const double a, const double b, unsigned int n, unsigned int l, unsigned int m, std::vector< std::vector< std::complex< double > > > &cf, const unsigned int nsamp, std::vector< std::complex< double > > &cres)
void RG482D(const double a, const double b, unsigned int n, unsigned int l, unsigned int m, std::vector< std::vector< std::complex< double > > > &cf, const unsigned int nsamp, std::vector< std::complex< double > > &cres)
void genie::alvarezruso::integrationtools::SG20R ( const double  a,
const double  b,
const unsigned int  n,
const unsigned int  nsamp,
double *  x,
unsigned int np,
double *  w 
)

Definition at line 34 of file IntegrationTools.cxx.

References a, MECModelEnuComparisons::i, calib::j, getGoodRuns4SAM::n, and submit_syst::y.

Referenced by SGNR().

36 {
37  static const double y[10] = {.9931285991, .9639719272, .9122344282, .8391169718, .7463319064, .6360536807, .5108670019, .3737060887, .2277858511, .0765265211 };
38  np = 20 * n;
39  double dint = (b - a) / double(n);
40  double delt = dint * 0.5;
41  double orig = a - delt;
42  int i1 = -nsamp;
43  int i2, j1, j2;
44  double dorig;
45  for(unsigned int i = 1; i <= n; i++)
46  {
47  orig += dint;
48  dorig = orig + orig;
49  i1 += nsamp;
50  i2 = i1 + nsamp+1;
51  for(unsigned int j = 1; j <= 10; j++)
52  {
53  j1 = i1 + j;
54  j2 = i2 - j;
55  x[j1-1] = orig - delt * y[j-1];
56  x[j2-1] = dorig - x[j1-1];
57  }
58  }
59 }
const double a
const double j
Definition: BetheBloch.cxx:29
const hit & b
Definition: hits.cxx:21
void genie::alvarezruso::integrationtools::SG48R ( const double  a,
const double  b,
const unsigned int  n,
const unsigned int  nsamp,
double *  x,
unsigned int np,
double *  w 
)

Definition at line 129 of file IntegrationTools.cxx.

References a, MECModelEnuComparisons::i, calib::j, getGoodRuns4SAM::n, and submit_syst::y.

Referenced by SGNR().

131 {
132  static const double y[24] = {0.9987710072, 0.9935301722, 0.9841245873, 0.9705915925, 0.9529877031,
133  0.9313866907, 0.9058791367, 0.8765720202, 0.8435882616, 0.8070662040, 0.7671590325, 0.7240341309,
134  0.6778723796, 0.6288673967, 0.5772247260, 0.5231609747, 0.4669029047, 0.4086864819, 0.3487558862,
135  0.2873624873, 0.2247637903, 0.1612223560, 0.0970046992, 0.0323801709};
136  np = 48 * n;
137  double dint = (b - a) / double(n);
138  double delt = dint * 0.5;
139  double orig = a - delt;
140  int i1 = -nsamp;
141  int i2, j1, j2;
142  double dorig;
143  for(unsigned int i = 1; i <= n; i++)
144  {
145  orig += dint;
146  dorig = orig + orig;
147  i1 += nsamp;
148  i2 = i1 + nsamp+1;
149  for(unsigned int j = 1; j <= 24; j++)
150  {
151  j1 = i1 + j;
152  j2 = i2 - j;
153  x[j1-1] = orig - delt * y[j-1];
154  x[j2-1] = dorig - x[j1-1];
155  }
156  }
157 }
const double a
const double j
Definition: BetheBloch.cxx:29
const hit & b
Definition: hits.cxx:21
void genie::alvarezruso::integrationtools::SGNR ( const double  a,
const double  b,
const unsigned int  n,
const unsigned int  nsamp,
double *  x,
unsigned int np,
double *  w 
)

Definition at line 230 of file IntegrationTools.cxx.

References om::cerr, allTimeWatchdog::endl, exit(), SG20R(), and SG48R().

Referenced by genie::alvarezruso::AREikonalSolution::Element(), and genie::alvarezruso::ARSampledNucleus::FillSamplePoints().

232 {
233  if (nsamp==20) {
234  integrationtools::SG20R(a, b, n, nsamp, x, np, w);
235  }
236  else if (nsamp==48) {
237  integrationtools::SG48R(a, b, n, nsamp, x, np, w);
238  }
239  else {
240  std::cerr<<"IntegrationTools/SGNR >> Unsupported nuclear sampling: "<<nsamp<<std::endl;
241  exit(-1);
242  }
243 }
void SG20R(const double a, const double b, const unsigned int n, const unsigned int nsamp, double *x, unsigned int &np, double *w)
OStream cerr
Definition: OStream.cxx:7
const double a
void SG48R(const double a, const double b, const unsigned int n, const unsigned int nsamp, double *x, unsigned int &np, double *w)
exit(0)
const hit & b
Definition: hits.cxx:21
Float_t w
Definition: plot.C:20