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

References a, funct::abs(), b, gpuPixelDoublets::cc, HLT_2023v12_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, and geometryCSVtoXML::xx.

Referenced by VVIObjF::VVIObjF().

518  {
519  /* System generated locals */
520  float d__1, d__2, d__3, d__4;
521 
522  // Local variables
523  float f1, f2, f3, u1, u2, x1, x2, u3, u4, x3, ca, cb, cc, fa, fb, ee, ff;
524  int mc;
525  float xa, xb, fx, xx, su4;
526 
527  xa = std::min(a, b);
528  xb = std::max(a, b);
529  fa = func(xa);
530  fb = func(xb);
531  if (fa * fb > 0.f) {
532  rv = (xb - xa) * -2.f;
533  x0 = 0.f;
534  return 1;
535  }
536  mc = 0;
537  L1:
538  x0 = (xa + xb) * 0.5f;
539  rv = x0 - xa;
540  ee = eps * (std::abs(x0) + 1.f);
541  if (rv <= ee) {
542  rv = ee;
543  ff = func(x0);
544  return 0;
545  }
546  f1 = fa;
547  x1 = xa;
548  f2 = fb;
549  x2 = xb;
550  L2:
551  fx = func(x0);
552  ++mc;
553  if (mc > mxf) {
554  rv = (d__1 = xb - xa, fabs(d__1)) * -0.5f;
555  x0 = 0.;
556  return 0;
557  }
558  if (fx * fa > 0.f) {
559  xa = x0;
560  fa = fx;
561  } else {
562  xb = x0;
563  fb = fx;
564  }
565  L3:
566  u1 = f1 - f2;
567  u2 = x1 - x2;
568  u3 = f2 - fx;
569  u4 = x2 - x0;
570  if (u2 == 0.f || u4 == 0.f) {
571  goto L1;
572  }
573  f3 = fx;
574  x3 = x0;
575  u1 /= u2;
576  u2 = u3 / u4;
577  ca = u1 - u2;
578  cb = (x1 + x2) * u2 - (x2 + x0) * u1;
579  cc = (x1 - x0) * f1 - x1 * (ca * x1 + cb);
580  if (ca == 0.f) {
581  if (cb == 0.f) {
582  goto L1;
583  }
584  x0 = -cc / cb;
585  } else {
586  u3 = cb / (ca * 2.f);
587  u4 = u3 * u3 - cc / ca;
588  if (u4 < 0.f) {
589  goto L1;
590  }
591  su4 = std::abs(u4);
592  if (x0 + u3 < 0.f) {
593  su4 = -su4;
594  }
595  x0 = -u3 + su4;
596  }
597  if (x0 < xa || x0 > xb) {
598  goto L1;
599  }
600  // Computing MIN
601  d__3 = (d__1 = x0 - x3, std::abs(d__1));
602  d__4 = (d__2 = x0 - x2, std::abs(d__2));
603  rv = std::min(d__3, d__4);
604  ee = eps * (std::abs(x0) + 1);
605  if (rv > ee) {
606  f1 = f2;
607  x1 = x2;
608  f2 = f3;
609  x2 = x3;
610  goto L2;
611  }
612  fx = func(x0);
613  if (fx == 0.f) {
614  rv = ee;
615  ff = func(x0);
616  return 0;
617  }
618  if (fx * fa < 0.f) {
619  xx = x0 - ee;
620  if (xx <= xa) {
621  rv = ee;
622  ff = func(x0);
623  return 0;
624  }
625  ff = func(xx);
626  fb = ff;
627  xb = xx;
628  } else {
629  xx = x0 + ee;
630  if (xx >= xb) {
631  rv = ee;
632  ff = func(x0);
633  return 0;
634  }
635  ff = func(xx);
636  fa = ff;
637  xa = xx;
638  }
639  if (fx * ff > 0.f) {
640  mc += 2;
641  if (mc > mxf) {
642  rv = (d__1 = xb - xa, std::abs(d__1)) * -0.5f;
643  x0 = 0.f;
644  return 0;
645  }
646  f1 = f3;
647  x1 = x3;
648  f2 = fx;
649  x2 = x0;
650  x0 = xx;
651  fx = ff;
652  goto L3;
653  }
654  /* L4: */
655  rv = ee;
656  ff = func(x0);
657  return 0;
658  } // dzero
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121

◆ expint()

float VVIObjFDetails::expint ( float  x)

Private version of the cosine and sine integral.

Definition at line 372 of file VVIObjF.cc.

References testProducerWithPsetDescEmpty_cfi::a2, b1, b2, testProducerWithPsetDescEmpty_cfi::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().

372  {
373  // Initialized data
374 
375  const float zero = 0.;
376  const float q2[7] = {
377  .10340013040487, 3.319092135933, 20.449478501379, 41.280784189142, 32.426421069514, 10.041164382905, 1.};
378  const float p3[6] = {
379  -2.3909964453136, -147.98219500504, -254.3763397689, -119.55761038372, -19.630408535939, -.9999999999036};
380  const float q3[6] = {177.60070940351, 530.68509610812, 462.23027156148, 156.81843364539, 21.630408494238, 1.};
381  const float p4[8] = {-8.6693733995107,
382  -549.14226552109,
383  -4210.0161535707,
384  -249301.39345865,
385  -119623.66934925,
386  -22174462.775885,
387  3892804.213112,
388  -391546073.8091};
389  const float q4[8] = {34.171875,
390  -1607.0892658722,
391  35730.029805851,
392  -483547.43616216,
393  4285596.2461175,
394  -24903337.574054,
395  89192576.757561,
396  -165254299.72521};
397  const float a1[8] = {-2.1808638152072,
398  -21.901023385488,
399  9.3081638566217,
400  25.076281129356,
401  -33.184253199722,
402  60.121799083008,
403  -43.253113287813,
404  1.0044310922808};
405  const float b1[8] = {0.,
406  3.9370770185272,
407  300.89264837292,
408  -6.2504116167188,
409  1003.6743951673,
410  14.325673812194,
411  2736.2411988933,
412  .52746885196291};
413  const float a2[8] = {-3.4833465360285,
414  -18.65454548834,
415  -8.2856199414064,
416  -32.34673303054,
417  17.960168876925,
418  1.7565631546961,
419  -1.9502232128966,
420  .99999429607471};
421  const float b2[8] = {0.,
422  69.500065588743,
423  57.283719383732,
424  25.777638423844,
425  760.76114800773,
426  28.951672792514,
427  -3.4394226689987,
428  1.0008386740264};
429  const float a3[6] = {
430  -27.780928934438, -10.10479081576, -9.1483008216736, -5.0223317461851, -3.0000077799358, 1.0000000000704};
431  const float one = 1.;
432  const float b3[6] = {0., 122.39993926823, 2.7276100778779, -7.1897518395045, -2.9990118065262, 1.999999942826};
433  const float two = 2.;
434  const float three = 3.;
435  const float x0 = .37250741078137;
436  const float xl[6] = {-24., -12., -6., 0., 1., 4.};
437  const float p1[5] = {4.293125234321, 39.894153870321, 292.52518866921, 425.69682638592, -434.98143832952};
438  const float q1[5] = {1., 18.899288395003, 150.95038744251, 568.05252718987, 753.58564359843};
439  const float p2[7] = {.43096783946939,
440  6.9052252278444,
441  23.019255939133,
442  24.378408879132,
443  9.0416155694633,
444  .99997957705159,
445  4.656271079751e-7};
446 
447  // Local variables
448  float v, y, ap, bp, aq, dp, bq, dq;
449 
450  if (x <= xl[0]) {
451  ap = a3[0] - x;
452  for (int i__ = 2; i__ <= 5; ++i__) {
453  ap = a3[i__ - 1] - x + b3[i__ - 1] / ap;
454  }
455  y = vdt::fast_expf(-x) / x * (one - (a3[5] + b3[5] / ap) / x);
456  } else if (x <= xl[1]) {
457  ap = a2[0] - x;
458  for (int i__ = 2; i__ <= 7; ++i__) {
459  ap = a2[i__ - 1] - x + b2[i__ - 1] / ap;
460  }
461  y = vdt::fast_expf(-x) / x * (a2[7] + b2[7] / ap);
462  } else if (x <= xl[2]) {
463  ap = a1[0] - x;
464  for (int i__ = 2; i__ <= 7; ++i__) {
465  ap = a1[i__ - 1] - x + b1[i__ - 1] / ap;
466  }
467  y = vdt::fast_expf(-x) / x * (a1[7] + b1[7] / ap);
468  } else if (x < xl[3]) {
469  v = -two * (x / three + one);
470  bp = zero;
471  dp = p4[0];
472  for (int i__ = 2; i__ <= 8; ++i__) {
473  ap = bp;
474  bp = dp;
475  dp = p4[i__ - 1] - ap + v * bp;
476  }
477  bq = zero;
478  dq = q4[0];
479  for (int i__ = 2; i__ <= 8; ++i__) {
480  aq = bq;
481  bq = dq;
482  dq = q4[i__ - 1] - aq + v * bq;
483  }
484  y = -vdt::fast_logf(-x / x0) + (x + x0) * (dp - ap) / (dq - aq);
485  } else if (x == xl[3]) {
486  return zero;
487  } else if (x < xl[4]) {
488  ap = p1[0];
489  aq = q1[0];
490  for (int i__ = 2; i__ <= 5; ++i__) {
491  ap = p1[i__ - 1] + x * ap;
492  aq = q1[i__ - 1] + x * aq;
493  }
494  y = -vdt::fast_logf(x) + ap / aq;
495  } else if (x <= xl[5]) {
496  y = one / x;
497  ap = p2[0];
498  aq = q2[0];
499  for (int i__ = 2; i__ <= 7; ++i__) {
500  ap = p2[i__ - 1] + y * ap;
501  aq = q2[i__ - 1] + y * aq;
502  }
503  y = vdt::fast_expf(-x) * ap / aq;
504  } else {
505  y = one / x;
506  ap = p3[0];
507  aq = q3[0];
508  for (int i__ = 2; i__ <= 6; ++i__) {
509  ap = p3[i__ - 1] + y * ap;
510  aq = q3[i__ - 1] + y * aq;
511  }
512  y = vdt::fast_expf(-x) * y * (one + y * ap / aq);
513  }
514  return y;
515  } // expint
bias2_t b2[25]
Definition: b2.h:9
float fast_expf(float x)
float x
float fast_logf(float x)
static constexpr float b1

◆ sincosint()

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

Definition at line 370 of file VVIObjF.cc.

References sicif(), and x.

Referenced by VVIObjF::VVIObjF().

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