CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
VVIObjF Class Reference

#include <VVIObjF.h>

Public Member Functions

float fcn (float x) const
 
void limits (float &xl, float &xu) const
 density (mode=0) or distribution (mode=1) function More...
 
 VVIObjF (float kappa=0.01, float beta2=1., int mode=0)
 Constructor. More...
 

Private Attributes

float a_ [155]
 
float b_ [155]
 
const int mode_
 returns the limits on the non-zero (mode=0) or normalized region (mode=1) More...
 
float omega_
 
float t0_
 
float t1_
 
float t_
 
float x0_
 

Detailed Description

Port of CERNLIB routines vvidis/vviden (G116) to calculate higher quality Vavilov density and distribution functions

Definition at line 24 of file VVIObjF.h.

Constructor & Destructor Documentation

◆ VVIObjF()

VVIObjF::VVIObjF ( float  kappa = 0.01,
float  beta2 = 1.,
int  mode = 0 
)

Constructor.

Constructor Set Vavilov parameters kappa and beta2 and define whether to calculate density fcn or distribution fcn

Parameters
kappa- (input) Vavilov kappa parameter [0.01 (Landau-like) < kappa < 10. (Gaussian-like)]
beta2- (input) Vavilov beta2 parameter (square of particle speed in v/c units)
mode- (input) set to 0 to calculate the density function and to 1 to calculate the distribution function

Definition at line 41 of file VVIObjF.cc.

41  : mode_(mode) {
42  const float xp[9] = {9.29, 2.47, .89, .36, .15, .07, .03, .02, 0.0};
43  const float xq[7] = {.012, .03, .08, .26, .87, 3.83, 11.0};
44  float h_[7];
45  float q, u, x, c1, c2, c3, c4, d1, h4, h5, h6, q2, x1, d, ll, ul, xf1, xf2, rv;
46  int lp, lq, k, l, n;
47 
48  // Make sure that the inputs are reasonable
49 
50  if (kappa < 0.01f)
51  kappa = 0.01f;
52  if (kappa > 10.f)
53  kappa = 10.f;
54  if (beta2 < 0.f)
55  beta2 = 0.f;
56  if (beta2 > 1.f)
57  beta2 = 1.f;
58 
59  float invKappa = 1.f / kappa;
60  h_[4] = 1.f - beta2 * 0.42278433999999998f + (7.6f * invKappa);
61  h_[5] = beta2;
62  h_[6] = 1.f - beta2;
63  h4 = -(7.6f * invKappa) - (beta2 * .57721566f + 1.f);
64  h5 = vdt::fast_logf(kappa);
65  h6 = invKappa;
66  t0_ = (h4 - h_[4] * h5 - (h_[4] + beta2) * (vdt::fast_logf(h_[4]) + VVIObjFDetails::expint(h_[4])) +
67  vdt::fast_expf(-h_[4])) /
68  h_[4];
69 
70  // Set up limits for the root search
71 
72  for (lp = 0; lp < 9; ++lp) {
73  if (kappa >= xp[lp])
74  break;
75  }
76  ll = -float(lp) - 1.5f;
77  for (lq = 0; lq < 7; ++lq) {
78  if (kappa <= xq[lq])
79  break;
80  }
81  ul = lq - 6.5f;
82  auto f2 = [h_](float x) {
83  return h_[4] - x + h_[5] * (vdt::fast_logf(std::abs(x)) + VVIObjFDetails::expint(x)) - h_[6] * vdt::fast_expf(-x);
84  };
85  VVIObjFDetails::dzero(ll, ul, u, rv, 1.e-3f, 100, f2);
86  q = 1. / u;
87  t1_ = h4 * q - h5 - (beta2 * q + 1.f) * (vdt::fast_logf((fabs(u))) + VVIObjFDetails::expint(u)) +
88  vdt::fast_expf(-u) * q;
89  t_ = t1_ - t0_;
90  omega_ = 6.2831853000000004f / t_;
91  h_[0] = kappa * (beta2 * .57721566f + 2.f) + 9.9166128600000008f;
92  if (kappa >= .07) {
93  h_[0] += 6.90775527f;
94  }
95  h_[1] = beta2 * kappa;
96  h_[2] = h6 * omega_;
97  h_[3] = omega_ * 1.5707963250000001f;
98  auto f1 = [h_](float x) { return h_[0] + h_[1] * vdt::fast_logf(h_[2] * x) - h_[3] * x; };
99  VVIObjFDetails::dzero(5.f, 155.f, x0_, rv, 1.e-3f, 100, f1);
100  n = x0_ + 1.;
101  d = vdt::fast_expf(kappa * (beta2 * (.57721566f - h5) + 1.f)) * .31830988654751274f;
102  a_[n - 1] = 0.f;
103  if (mode_ == 0) {
104  a_[n - 1] = omega_ * .31830988654751274f;
105  }
106  q = -1.;
107  q2 = 2.;
108  for (k = 1; k < n; ++k) {
109  l = n - k;
110  x = omega_ * k;
111  x1 = h6 * x;
113  c1 = vdt::fast_logf(x) - c1;
114  vdt::fast_sincosf(x1, c3, c4);
115  xf1 = kappa * (beta2 * c1 - c4) - x * c2;
116  xf2 = x * c1 + kappa * (c3 + beta2 * c2) + t0_ * x;
117  float s, c;
118  vdt::fast_sincosf(xf2, s, c);
119  if (mode_ == 0) {
120  d1 = q * d * omega_ * vdt::fast_expf(xf1);
121  a_[l - 1] = d1 * c;
122  b_[l - 1] = -d1 * s;
123  } else {
124  d1 = q * d * vdt::fast_expf(xf1) / k;
125  a_[l - 1] = d1 * s;
126  b_[l - 1] = d1 * c;
127  a_[n - 1] += q2 * a_[l - 1];
128  }
129  q = -q;
130  q2 = -q2;
131  }
132 
133 } // VVIObjF

References a_, funct::abs(), b_, c, alignmentValidation::c1, ztail::d, d1, VVIObjFDetails::dzero(), MillePedeFileConverter_cfg::e, VVIObjFDetails::expint(), f, DeadROC_duringRun::f1, DeadROC_duringRun::f2, myMath::fast_expf(), myMath::fast_logf(), dqmMemoryStats::float, dqmdumpme::k, kappa, cmsLHEtoEOSManager::l, mode_, dqmiodumpmetadata::n, omega_, submitPVResolutionJobs::q, q2, alignCSCRings::s, VVIObjFDetails::sincosint(), t0_, t1_, t_, x, x0_, and testProducerWithPsetDescEmpty_cfi::x1.

Member Function Documentation

◆ fcn()

float VVIObjF::fcn ( float  x) const

Vavilov function method Returns density fcn (mode=0) or distribution fcn (mode=1)

Parameters
x- (input) Argument of function [typically defined as (Q-mpv)/sigma]

Definition at line 141 of file VVIObjF.cc.

141  {
142  // Local variables
143 
144  float f, u, y, a0, a1;
145  float a2 = 0.;
146  float b1, b0, b2, cof;
147  int k, n, n1;
148 
149  n = x0_;
150  if (x < t0_) {
151  f = 0.f;
152  } else if (x <= t1_) {
153  y = x - t0_;
154  u = omega_ * y - 3.141592653589793f;
155  float su, cu;
156  vdt::fast_sincosf(u, su, cu);
157  cof = cu * 2.f;
158  a1 = 0.;
159  a0 = a_[0];
160  n1 = n + 1;
161  for (k = 2; k <= n1; ++k) {
162  a2 = a1;
163  a1 = a0;
164  a0 = a_[k - 1] + cof * a1 - a2;
165  }
166  b1 = 0.;
167  b0 = b_[0];
168  for (k = 2; k <= n; ++k) {
169  b2 = b1;
170  b1 = b0;
171  b0 = b_[k - 1] + cof * b1 - b2;
172  }
173  f = (a0 - a2) * .5f + b0 * su;
174  if (mode_ != 0) {
175  f += y / t_;
176  }
177  } else {
178  f = 0.f;
179  if (mode_ != 0) {
180  f = 1.f;
181  }
182  }
183  return f;
184 } // fcn

References a0, testProducerWithPsetDescEmpty_cfi::a2, a_, b0, b1, b2, b_, f, dqmdumpme::k, mode_, dqmiodumpmetadata::n, omega_, t0_, t1_, t_, x, x0_, and y.

Referenced by SiPixelTemplateReco::PixelTempReco1D(), and SiPixelTemplateReco2D::PixelTempReco2D().

◆ limits()

void VVIObjF::limits ( float &  xl,
float &  xu 
) const

density (mode=0) or distribution (mode=1) function

Vavilov limits method

Parameters
xl- (output) Smallest value of the argument for the density and the beginning of the normalized region for the distribution
xu- (output) Largest value of the argument for the density and the end of the normalized region for the distribution

Definition at line 192 of file VVIObjF.cc.

192  {
193  xl = t0_;
194  xu = t1_;
195  return;
196 } // limits

References t0_, and t1_.

Member Data Documentation

◆ a_

float VVIObjF::a_[155]
private

Definition at line 41 of file VVIObjF.h.

Referenced by fcn(), and VVIObjF().

◆ b_

float VVIObjF::b_[155]
private

Definition at line 42 of file VVIObjF.h.

Referenced by fcn(), and VVIObjF().

◆ mode_

const int VVIObjF::mode_
private

returns the limits on the non-zero (mode=0) or normalized region (mode=1)

set to 0 to calculate the density function and to 1 to calculate the distribution function

Definition at line 35 of file VVIObjF.h.

Referenced by fcn(), and VVIObjF().

◆ omega_

float VVIObjF::omega_
private

Definition at line 39 of file VVIObjF.h.

Referenced by fcn(), and VVIObjF().

◆ t0_

float VVIObjF::t0_
private

Definition at line 36 of file VVIObjF.h.

Referenced by fcn(), limits(), and VVIObjF().

◆ t1_

float VVIObjF::t1_
private

Definition at line 37 of file VVIObjF.h.

Referenced by fcn(), limits(), and VVIObjF().

◆ t_

float VVIObjF::t_
private

Definition at line 38 of file VVIObjF.h.

Referenced by fcn(), and VVIObjF().

◆ x0_

float VVIObjF::x0_
private

Definition at line 40 of file VVIObjF.h.

Referenced by fcn(), and VVIObjF().

DDAxes::y
VVIObjF::mode_
const int mode_
returns the limits on the non-zero (mode=0) or normalized region (mode=1)
Definition: VVIObjF.h:35
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
VVIObjFDetails::sincosint
void sincosint(float x, float &sint, float &cint)
Definition: VVIObjF.cc:200
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
VVIObjF::t0_
float t0_
Definition: VVIObjF.h:36
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
VVIObjF::omega_
float omega_
Definition: VVIObjF.h:39
VVIObjF::x0_
float x0_
Definition: VVIObjF.h:40
DDAxes::x
b2
static constexpr float b2
Definition: L1EGammaCrystalsEmulatorProducer.cc:83
VVIObjFDetails::expint
float expint(float x)
Private version of the cosine and sine integral.
Definition: VVIObjF.cc:202
testProducerWithPsetDescEmpty_cfi.a2
a2
Definition: testProducerWithPsetDescEmpty_cfi.py:35
VVIObjF::a_
float a_[155]
Definition: VVIObjF.h:41
b1
static constexpr float b1
Definition: L1EGammaCrystalsEmulatorProducer.cc:83
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
alignCSCRings.s
s
Definition: alignCSCRings.py:92
VVIObjF::t1_
float t1_
Definition: VVIObjF.h:37
myMath::fast_expf
float fast_expf(float x)
Definition: EcalUncalibRecHitRatioMethodAlgo.h:27
myMath::fast_logf
float fast_logf(float x)
Definition: EcalUncalibRecHitRatioMethodAlgo.h:28
dqmdumpme.k
k
Definition: dqmdumpme.py:60
q2
double q2[4]
Definition: TauolaWrapper.h:88
DeadROC_duringRun.f2
f2
Definition: DeadROC_duringRun.py:220
alignmentValidation.c1
c1
do drawing
Definition: alignmentValidation.py:1025
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
b0
static constexpr float b0
Definition: L1EGammaCrystalsEmulatorProducer.cc:83
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
VVIObjF::b_
float b_[155]
Definition: VVIObjF.h:42
VVIObjF::t_
float t_
Definition: VVIObjF.h:38
VVIObjFDetails::dzero
int dzero(float a, float b, float &x0, float &rv, float eps, int mxf, F func)
Private version of the exponential integral.
Definition: VVIObjF.cc:348
ztail.d
d
Definition: ztail.py:151
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
kappa
static const G4double kappa
Definition: UrbanMscModel93.cc:35
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
DeadROC_duringRun.f1
f1
Definition: DeadROC_duringRun.py:219
a0
static constexpr float a0
Definition: L1EGammaCrystalsEmulatorProducer.cc:82
d1
static constexpr float d1
Definition: L1EGammaCrystalsEmulatorProducer.cc:85
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37