CMS 3D CMS Logo

Functions
VVIObjFDetails Namespace Reference

Functions

template<typename F >
int dzero (float a, float b, float &x0, float &rv, float eps, int mxf, F func)
 Private version of the exponential integral. More...
 
float expint (float x)
 Private version of the cosine and sine integral. More...
 
void sincosint (float x, float &sint, float &cint)
 

Function Documentation

template<typename F >
int VVIObjFDetails::dzero ( float  a,
float  b,
float &  x0,
float &  rv,
float  eps,
int  mxf,
F  func 
)

Private version of the exponential integral.

Definition at line 321 of file VVIObjF.cc.

References funct::abs(), f, connectstrParser::f1, connectstrParser::f2, connectstrParser::f3, benchmark_cfg::fa, benchmark_cfg::fb, alignCSCRings::ff, RecoEcal_EventContent_cff::func, hpstanc_transforms::max, CaloTowersParam_cfi::mc, min(), MetAnalyzer::u1, MetAnalyzer::u2, and geometryCSVtoXML::xx.

Referenced by VVIObjF::VVIObjF().

322  {
323  /* System generated locals */
324  float d__1, d__2, d__3, d__4;
325 
326  // Local variables
327  float f1, f2, f3, u1, u2, x1, x2, u3, u4, x3, ca, cb, cc, fa, fb, ee, ff;
328  int mc;
329  float xa, xb, fx, xx, su4;
330 
331  xa = std::min(a,b);
332  xb = std::max(a,b);
333  fa = func(xa);
334  fb = func(xb);
335  if (fa * fb > 0.f) {
336  rv = (xb - xa) * -2.f;
337  x0 = 0.f;
338  return 1;
339  }
340  mc = 0;
341  L1:
342  x0 = (xa + xb) * 0.5f;
343  rv = x0 - xa;
344  ee = eps * (std::abs(x0) + 1.f);
345  if (rv <= ee) {
346  rv = ee;
347  ff = func(x0);
348  return 0;
349  }
350  f1 = fa;
351  x1 = xa;
352  f2 = fb;
353  x2 = xb;
354  L2:
355  fx = func(x0);
356  ++mc;
357  if (mc > mxf) {
358  rv = (d__1 = xb - xa, fabs(d__1)) * -0.5f;
359  x0 = 0.;
360  return 0;
361  }
362  if (fx * fa > 0.f) {
363  xa = x0;
364  fa = fx;
365  } else {
366  xb = x0;
367  fb = fx;
368  }
369  L3:
370  u1 = f1 - f2;
371  u2 = x1 - x2;
372  u3 = f2 - fx;
373  u4 = x2 - x0;
374  if (u2 == 0.f || u4 == 0.f) {goto L1;}
375  f3 = fx;
376  x3 = x0;
377  u1 /= u2;
378  u2 = u3 / u4;
379  ca = u1 - u2;
380  cb = (x1 + x2) * u2 - (x2 + x0) * u1;
381  cc = (x1 - x0) * f1 - x1 * (ca * x1 + cb);
382  if (ca == 0.f) {
383  if (cb == 0.f) {goto L1;}
384  x0 = -cc / cb;
385  } else {
386  u3 = cb / (ca * 2.f);
387  u4 = u3 * u3 - cc / ca;
388  if (u4 < 0.f) {goto L1;}
389  su4 = std::abs(u4);
390  if (x0 + u3 < 0.f) {su4 = -su4;}
391  x0 = -u3 + su4;
392  }
393  if (x0 < xa || x0 > xb) {goto L1;}
394  // Computing MIN
395  d__3 = (d__1 = x0 - x3, std::abs(d__1));
396  d__4 = (d__2 = x0 - x2, std::abs(d__2));
397  rv = std::min(d__3,d__4);
398  ee = eps * (std::abs(x0) + 1);
399  if (rv > ee) {
400  f1 = f2;
401  x1 = x2;
402  f2 = f3;
403  x2 = x3;
404  goto L2;
405  }
406  fx = func(x0);
407  if (fx == 0.f) {
408  rv = ee;
409  ff = func(x0);
410  return 0;
411  }
412  if (fx * fa < 0.f) {
413  xx = x0 - ee;
414  if (xx <= xa) {
415  rv = ee;
416  ff = func(x0);
417  return 0;
418  }
419  ff = func(xx);
420  fb = ff;
421  xb = xx;
422  } else {
423  xx = x0 + ee;
424  if (xx >= xb) {
425  rv = ee;
426  ff = func(x0);
427  return 0;
428  }
429  ff = func(xx);
430  fa = ff;
431  xa = xx;
432  }
433  if (fx * ff > 0.f) {
434  mc += 2;
435  if (mc > mxf) {
436  rv = (d__1 = xb - xa, std::abs(d__1)) * -0.5f;
437  x0 = 0.f;
438  return 0;
439  }
440  f1 = f3;
441  x1 = x3;
442  f2 = fx;
443  x2 = x0;
444  x0 = xx;
445  fx = ff;
446  goto L3;
447  }
448  /* L4: */
449  rv = ee;
450  ff = func(x0);
451  return 0;
452  } // dzero
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
T min(T a, T b)
Definition: MathUtil.h:58
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
float VVIObjFDetails::expint ( float  x)

Private version of the cosine and sine integral.

Definition at line 198 of file VVIObjF.cc.

References reco::dp, myMath::fast_expf(), myMath::fast_logf(), p1, p2, p3, p4, q1, q2, findQualityFiles::v, x, and y.

Referenced by VVIObjF::VVIObjF().

198  {
199 
200  // Initialized data
201 
202  const float zero = 0.;
203  const float q2[7] = { .10340013040487,3.319092135933,
204  20.449478501379,41.280784189142,32.426421069514,10.041164382905,
205  1. };
206  const float p3[6] = { -2.3909964453136,-147.98219500504,
207  -254.3763397689,-119.55761038372,-19.630408535939,-.9999999999036
208  };
209  const float q3[6] = { 177.60070940351,530.68509610812,
210  462.23027156148,156.81843364539,21.630408494238,1. };
211  const float p4[8] = { -8.6693733995107,-549.14226552109,
212  -4210.0161535707,-249301.39345865,-119623.66934925,
213  -22174462.775885,3892804.213112,-391546073.8091 };
214  const float q4[8] = { 34.171875,-1607.0892658722,35730.029805851,
215  -483547.43616216,4285596.2461175,-24903337.574054,89192576.757561,
216  -165254299.72521 };
217  const float a1[8] = { -2.1808638152072,-21.901023385488,
218  9.3081638566217,25.076281129356,-33.184253199722,60.121799083008,
219  -43.253113287813,1.0044310922808 };
220  const float b1[8] = { 0.,3.9370770185272,300.89264837292,
221  -6.2504116167188,1003.6743951673,14.325673812194,2736.2411988933,
222  .52746885196291 };
223  const float a2[8] = { -3.4833465360285,-18.65454548834,
224  -8.2856199414064,-32.34673303054,17.960168876925,1.7565631546961,
225  -1.9502232128966,.99999429607471 };
226  const float b2[8] = { 0.,69.500065588743,57.283719383732,
227  25.777638423844,760.76114800773,28.951672792514,-3.4394226689987,
228  1.0008386740264 };
229  const float a3[6] = { -27.780928934438,-10.10479081576,
230  -9.1483008216736,-5.0223317461851,-3.0000077799358,
231  1.0000000000704 };
232  const float one = 1.;
233  const float b3[6] = { 0.,122.39993926823,2.7276100778779,
234  -7.1897518395045,-2.9990118065262,1.999999942826 };
235  const float two = 2.;
236  const float three = 3.;
237  const float x0 = .37250741078137;
238  const float xl[6] = { -24.,-12.,-6.,0.,1.,4. };
239  const float p1[5] = { 4.293125234321,39.894153870321,
240  292.52518866921,425.69682638592,-434.98143832952 };
241  const float q1[5] = { 1.,18.899288395003,150.95038744251,
242  568.05252718987,753.58564359843 };
243  const float p2[7] = { .43096783946939,6.9052252278444,
244  23.019255939133,24.378408879132,9.0416155694633,.99997957705159,
245  4.656271079751e-7 };
246 
247  // Local variables
248  float v, y, ap, bp, aq, dp, bq, dq;
249 
250  if (x <= xl[0]) {
251  ap = a3[0] - x;
252  for ( int i__ = 2; i__ <= 5; ++i__) {
253  ap = a3[i__ - 1] - x + b3[i__ - 1] / ap;
254  }
255  y = vdt::fast_expf(-x) / x * (one - (a3[5] + b3[5] / ap) / x);
256  } else if (x <= xl[1]) {
257  ap = a2[0] - x;
258  for ( int i__ = 2; i__ <= 7; ++i__) {
259  ap = a2[i__ - 1] - x + b2[i__ - 1] / ap;
260  }
261  y = vdt::fast_expf(-x) / x * (a2[7] + b2[7] / ap);
262  } else if (x <= xl[2]) {
263  ap = a1[0] - x;
264  for ( int i__ = 2; i__ <= 7; ++i__) {
265  ap = a1[i__ - 1] - x + b1[i__ - 1] / ap;
266  }
267  y = vdt::fast_expf(-x) / x * (a1[7] + b1[7] / ap);
268  } else if (x < xl[3]) {
269  v = -two * (x / three + one);
270  bp = zero;
271  dp = p4[0];
272  for ( int i__ = 2; i__ <= 8; ++i__) {
273  ap = bp;
274  bp = dp;
275  dp = p4[i__ - 1] - ap + v * bp;
276  }
277  bq = zero;
278  dq = q4[0];
279  for ( int i__ = 2; i__ <= 8; ++i__) {
280  aq = bq;
281  bq = dq;
282  dq = q4[i__ - 1] - aq + v * bq;
283  }
284  y = -vdt::fast_logf(-x / x0) + (x + x0) * (dp - ap) / (dq - aq);
285  } else if (x == xl[3]) {
286  return zero;
287  } else if (x < xl[4]) {
288  ap = p1[0];
289  aq = q1[0];
290  for ( int i__ = 2; i__ <= 5; ++i__) {
291  ap = p1[i__ - 1] + x * ap;
292  aq = q1[i__ - 1] + x * aq;
293  }
294  y = -vdt::fast_logf(x) + ap / aq;
295  } else if (x <= xl[5]) {
296  y = one / x;
297  ap = p2[0];
298  aq = q2[0];
299  for ( int i__ = 2; i__ <= 7; ++i__) {
300  ap = p2[i__ - 1] + y * ap;
301  aq = q2[i__ - 1] + y * aq;
302  }
303  y = vdt::fast_expf(-x) * ap / aq;
304  } else {
305  y = one / x;
306  ap = p3[0];
307  aq = q3[0];
308  for ( int i__ = 2; i__ <= 6; ++i__) {
309  ap = p3[i__ - 1] + y * ap;
310  aq = q3[i__ - 1] + y * aq;
311  }
312  y = vdt::fast_expf(-x) * y * (one + y * ap / aq);
313  }
314  return y;
315  } // expint
double q2[4]
Definition: TauolaWrapper.h:88
T x() const
Cartesian x coordinate.
double p4[4]
Definition: TauolaWrapper.h:92
double p2[4]
Definition: TauolaWrapper.h:90
double q1[4]
Definition: TauolaWrapper.h:87
auto dp
Definition: deltaR.h:22
double p1[4]
Definition: TauolaWrapper.h:89
float fast_expf(float x)
float fast_logf(float x)
double p3[4]
Definition: TauolaWrapper.h:91
void VVIObjFDetails::sincosint ( float  x,
float &  sint,
float &  cint 
)

Definition at line 193 of file VVIObjF.cc.

References sicif().

Referenced by VVIObjF::VVIObjF().

193  {
194  sicif(x,sint,cint);
195  }
T x() const
Cartesian x coordinate.
int sicif(float xx, float &si, float &ci)
Definition: sicif.h:227