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

◆ dzero()

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 433 of file VVIObjF.cc.

References a, funct::abs(), b, HLT_2022v14_cff::eps, f, DeadROC_duringRun::f1, DeadROC_duringRun::f2, alignCSCRings::ff, EcalMonitorTask_cff::func, multPhiCorr_741_25nsDY_cfi::fx, PixelRegions::L1, PixelRegions::L2, PixelRegions::L3, SiStripPI::max, CaloTowersParam_cfi::mc, SiStripPI::min, testProducerWithPsetDescEmpty_cfi::u1, MetAnalyzer::u2, testProducerWithPsetDescEmpty_cfi::u3, testProducerWithPsetDescEmpty_cfi::x1, testProducerWithPsetDescEmpty_cfi::x2, and geometryCSVtoXML::xx.

Referenced by VVIObjF::VVIObjF().

433  {
434  /* System generated locals */
435  float d__1, d__2, d__3, d__4;
436 
437  // Local variables
438  float f1, f2, f3, u1, u2, x1, x2, u3, u4, x3, ca, cb, cc, fa, fb, ee, ff;
439  int mc;
440  float xa, xb, fx, xx, su4;
441 
442  xa = std::min(a, b);
443  xb = std::max(a, b);
444  fa = func(xa);
445  fb = func(xb);
446  if (fa * fb > 0.f) {
447  rv = (xb - xa) * -2.f;
448  x0 = 0.f;
449  return 1;
450  }
451  mc = 0;
452  L1:
453  x0 = (xa + xb) * 0.5f;
454  rv = x0 - xa;
455  ee = eps * (std::abs(x0) + 1.f);
456  if (rv <= ee) {
457  rv = ee;
458  ff = func(x0);
459  return 0;
460  }
461  f1 = fa;
462  x1 = xa;
463  f2 = fb;
464  x2 = xb;
465  L2:
466  fx = func(x0);
467  ++mc;
468  if (mc > mxf) {
469  rv = (d__1 = xb - xa, fabs(d__1)) * -0.5f;
470  x0 = 0.;
471  return 0;
472  }
473  if (fx * fa > 0.f) {
474  xa = x0;
475  fa = fx;
476  } else {
477  xb = x0;
478  fb = fx;
479  }
480  L3:
481  u1 = f1 - f2;
482  u2 = x1 - x2;
483  u3 = f2 - fx;
484  u4 = x2 - x0;
485  if (u2 == 0.f || u4 == 0.f) {
486  goto L1;
487  }
488  f3 = fx;
489  x3 = x0;
490  u1 /= u2;
491  u2 = u3 / u4;
492  ca = u1 - u2;
493  cb = (x1 + x2) * u2 - (x2 + x0) * u1;
494  cc = (x1 - x0) * f1 - x1 * (ca * x1 + cb);
495  if (ca == 0.f) {
496  if (cb == 0.f) {
497  goto L1;
498  }
499  x0 = -cc / cb;
500  } else {
501  u3 = cb / (ca * 2.f);
502  u4 = u3 * u3 - cc / ca;
503  if (u4 < 0.f) {
504  goto L1;
505  }
506  su4 = std::abs(u4);
507  if (x0 + u3 < 0.f) {
508  su4 = -su4;
509  }
510  x0 = -u3 + su4;
511  }
512  if (x0 < xa || x0 > xb) {
513  goto L1;
514  }
515  // Computing MIN
516  d__3 = (d__1 = x0 - x3, std::abs(d__1));
517  d__4 = (d__2 = x0 - x2, std::abs(d__2));
518  rv = std::min(d__3, d__4);
519  ee = eps * (std::abs(x0) + 1);
520  if (rv > ee) {
521  f1 = f2;
522  x1 = x2;
523  f2 = f3;
524  x2 = x3;
525  goto L2;
526  }
527  fx = func(x0);
528  if (fx == 0.f) {
529  rv = ee;
530  ff = func(x0);
531  return 0;
532  }
533  if (fx * fa < 0.f) {
534  xx = x0 - ee;
535  if (xx <= xa) {
536  rv = ee;
537  ff = func(x0);
538  return 0;
539  }
540  ff = func(xx);
541  fb = ff;
542  xb = xx;
543  } else {
544  xx = x0 + ee;
545  if (xx >= xb) {
546  rv = ee;
547  ff = func(x0);
548  return 0;
549  }
550  ff = func(xx);
551  fa = ff;
552  xa = xx;
553  }
554  if (fx * ff > 0.f) {
555  mc += 2;
556  if (mc > mxf) {
557  rv = (d__1 = xb - xa, std::abs(d__1)) * -0.5f;
558  x0 = 0.f;
559  return 0;
560  }
561  f1 = f3;
562  x1 = x3;
563  f2 = fx;
564  x2 = x0;
565  x0 = xx;
566  fx = ff;
567  goto L3;
568  }
569  /* L4: */
570  rv = ee;
571  ff = func(x0);
572  return 0;
573  } // dzero
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119

◆ expint()

float VVIObjFDetails::expint ( float  x)

Private version of the cosine and sine integral.

Definition at line 287 of file VVIObjF.cc.

References testProducerWithPsetDescEmpty_cfi::a2, b1, b2, b3, Calorimetry_cff::dp, myMath::fast_expf(), myMath::fast_logf(), SiPixelPI::one, LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, chargedHadronTrackResolutionFilter_cfi::p3, SiPixelPI::two, findQualityFiles::v, x, and SiPixelPI::zero.

Referenced by VVIObjF::VVIObjF().

287  {
288  // Initialized data
289 
290  const float zero = 0.;
291  const float q2[7] = {
292  .10340013040487, 3.319092135933, 20.449478501379, 41.280784189142, 32.426421069514, 10.041164382905, 1.};
293  const float p3[6] = {
294  -2.3909964453136, -147.98219500504, -254.3763397689, -119.55761038372, -19.630408535939, -.9999999999036};
295  const float q3[6] = {177.60070940351, 530.68509610812, 462.23027156148, 156.81843364539, 21.630408494238, 1.};
296  const float p4[8] = {-8.6693733995107,
297  -549.14226552109,
298  -4210.0161535707,
299  -249301.39345865,
300  -119623.66934925,
301  -22174462.775885,
302  3892804.213112,
303  -391546073.8091};
304  const float q4[8] = {34.171875,
305  -1607.0892658722,
306  35730.029805851,
307  -483547.43616216,
308  4285596.2461175,
309  -24903337.574054,
310  89192576.757561,
311  -165254299.72521};
312  const float a1[8] = {-2.1808638152072,
313  -21.901023385488,
314  9.3081638566217,
315  25.076281129356,
316  -33.184253199722,
317  60.121799083008,
318  -43.253113287813,
319  1.0044310922808};
320  const float b1[8] = {0.,
321  3.9370770185272,
322  300.89264837292,
323  -6.2504116167188,
324  1003.6743951673,
325  14.325673812194,
326  2736.2411988933,
327  .52746885196291};
328  const float a2[8] = {-3.4833465360285,
329  -18.65454548834,
330  -8.2856199414064,
331  -32.34673303054,
332  17.960168876925,
333  1.7565631546961,
334  -1.9502232128966,
335  .99999429607471};
336  const float b2[8] = {0.,
337  69.500065588743,
338  57.283719383732,
339  25.777638423844,
340  760.76114800773,
341  28.951672792514,
342  -3.4394226689987,
343  1.0008386740264};
344  const float a3[6] = {
345  -27.780928934438, -10.10479081576, -9.1483008216736, -5.0223317461851, -3.0000077799358, 1.0000000000704};
346  const float one = 1.;
347  const float b3[6] = {0., 122.39993926823, 2.7276100778779, -7.1897518395045, -2.9990118065262, 1.999999942826};
348  const float two = 2.;
349  const float three = 3.;
350  const float x0 = .37250741078137;
351  const float xl[6] = {-24., -12., -6., 0., 1., 4.};
352  const float p1[5] = {4.293125234321, 39.894153870321, 292.52518866921, 425.69682638592, -434.98143832952};
353  const float q1[5] = {1., 18.899288395003, 150.95038744251, 568.05252718987, 753.58564359843};
354  const float p2[7] = {.43096783946939,
355  6.9052252278444,
356  23.019255939133,
357  24.378408879132,
358  9.0416155694633,
359  .99997957705159,
360  4.656271079751e-7};
361 
362  // Local variables
363  float v, y, ap, bp, aq, dp, bq, dq;
364 
365  if (x <= xl[0]) {
366  ap = a3[0] - x;
367  for (int i__ = 2; i__ <= 5; ++i__) {
368  ap = a3[i__ - 1] - x + b3[i__ - 1] / ap;
369  }
370  y = vdt::fast_expf(-x) / x * (one - (a3[5] + b3[5] / ap) / x);
371  } else if (x <= xl[1]) {
372  ap = a2[0] - x;
373  for (int i__ = 2; i__ <= 7; ++i__) {
374  ap = a2[i__ - 1] - x + b2[i__ - 1] / ap;
375  }
376  y = vdt::fast_expf(-x) / x * (a2[7] + b2[7] / ap);
377  } else if (x <= xl[2]) {
378  ap = a1[0] - x;
379  for (int i__ = 2; i__ <= 7; ++i__) {
380  ap = a1[i__ - 1] - x + b1[i__ - 1] / ap;
381  }
382  y = vdt::fast_expf(-x) / x * (a1[7] + b1[7] / ap);
383  } else if (x < xl[3]) {
384  v = -two * (x / three + one);
385  bp = zero;
386  dp = p4[0];
387  for (int i__ = 2; i__ <= 8; ++i__) {
388  ap = bp;
389  bp = dp;
390  dp = p4[i__ - 1] - ap + v * bp;
391  }
392  bq = zero;
393  dq = q4[0];
394  for (int i__ = 2; i__ <= 8; ++i__) {
395  aq = bq;
396  bq = dq;
397  dq = q4[i__ - 1] - aq + v * bq;
398  }
399  y = -vdt::fast_logf(-x / x0) + (x + x0) * (dp - ap) / (dq - aq);
400  } else if (x == xl[3]) {
401  return zero;
402  } else if (x < xl[4]) {
403  ap = p1[0];
404  aq = q1[0];
405  for (int i__ = 2; i__ <= 5; ++i__) {
406  ap = p1[i__ - 1] + x * ap;
407  aq = q1[i__ - 1] + x * aq;
408  }
409  y = -vdt::fast_logf(x) + ap / aq;
410  } else if (x <= xl[5]) {
411  y = one / x;
412  ap = p2[0];
413  aq = q2[0];
414  for (int i__ = 2; i__ <= 7; ++i__) {
415  ap = p2[i__ - 1] + y * ap;
416  aq = q2[i__ - 1] + y * aq;
417  }
418  y = vdt::fast_expf(-x) * ap / aq;
419  } else {
420  y = one / x;
421  ap = p3[0];
422  aq = q3[0];
423  for (int i__ = 2; i__ <= 6; ++i__) {
424  ap = p3[i__ - 1] + y * ap;
425  aq = q3[i__ - 1] + y * aq;
426  }
427  y = vdt::fast_expf(-x) * y * (one + y * ap / aq);
428  }
429  return y;
430  } // expint
weight_default_t b3[10]
Definition: b3.h:9
weight_default_t b1[25]
Definition: b1.h:9
weight_default_t b2[10]
Definition: b2.h:9
float fast_expf(float x)
float x
float fast_logf(float x)

◆ sincosint()

void VVIObjFDetails::sincosint ( float  x,
float &  sint,
float &  cint 
)

Definition at line 285 of file VVIObjF.cc.

References sicif(), and x.

Referenced by VVIObjF::VVIObjF().

285 { sicif(x, sint, cint); }
float x
int sicif(float xx, float &si, float &ci)
Definition: sicif.h:219