CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
sistripvvi::VVIObj Class Reference

#include <VVIObj.h>

Public Member Functions

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

Private Attributes

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

Detailed Description

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

Definition at line 25 of file VVIObj.h.

Constructor & Destructor Documentation

◆ VVIObj()

VVIObj::VVIObj ( double  kappa = 0.01,
double  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 49 of file VVIObj.cc.

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

References a_, b_, alignmentValidation::c1, funct::cos(), ztail::d, d1, sistripvvi::VVIObjDetails::dzero(), MillePedeFileConverter_cfg::e, JetChargeProducer_cfi::exp, sistripvvi::VVIObjDetails::expint(), sistripvvi::VVIObjDetails::f1(), sistripvvi::VVIObjDetails::f2(), dqmdumpme::k, kappa, cmsLHEtoEOSManager::l, dqm-mbProfile::log, mode_, dqmiodumpmetadata::n, omega_, submitPVResolutionJobs::q, q2, funct::sin(), sistripvvi::VVIObjDetails::sincosint(), t0_, t1_, t_, x0_, and testProducerWithPsetDescEmpty_cfi::x1.

Member Function Documentation

◆ fcn()

double VVIObj::fcn ( double  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 142 of file VVIObj.cc.

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

References a0, testProducerWithPsetDescEmpty_cfi::a2, a_, b0, b1, b2, b_, funct::cos(), f, dqmdumpme::k, mode_, dqmiodumpmetadata::n, omega_, funct::sin(), t0_, t1_, t_, and x0_.

◆ limits()

void VVIObj::limits ( double &  xl,
double &  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 191 of file VVIObj.cc.

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

References t0_, and t1_.

Member Data Documentation

◆ a_

double sistripvvi::VVIObj::a_[155]
private

Definition at line 42 of file VVIObj.h.

Referenced by fcn(), and VVIObj().

◆ b_

double sistripvvi::VVIObj::b_[155]
private

Definition at line 43 of file VVIObj.h.

Referenced by fcn(), and VVIObj().

◆ mode_

const int sistripvvi::VVIObj::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 36 of file VVIObj.h.

Referenced by fcn(), and VVIObj().

◆ omega_

double sistripvvi::VVIObj::omega_
private

Definition at line 40 of file VVIObj.h.

Referenced by fcn(), and VVIObj().

◆ t0_

double sistripvvi::VVIObj::t0_
private

Definition at line 37 of file VVIObj.h.

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

◆ t1_

double sistripvvi::VVIObj::t1_
private

Definition at line 38 of file VVIObj.h.

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

◆ t_

double sistripvvi::VVIObj::t_
private

Definition at line 39 of file VVIObj.h.

Referenced by fcn(), and VVIObj().

◆ x0_

double sistripvvi::VVIObj::x0_
private

Definition at line 41 of file VVIObj.h.

Referenced by fcn(), and VVIObj().

sistripvvi::VVIObjDetails::expint
double expint(double x)
Private version of the sine integral.
Definition: VVIObj.cc:490
sistripvvi::VVIObj::a_
double a_[155]
Definition: VVIObj.h:42
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
sistripvvi::VVIObj::mode_
const int mode_
returns the limits on the non-zero (mode=0) or normalized region (mode=1)
Definition: VVIObj.h:36
sistripvvi::VVIObj::t1_
double t1_
Definition: VVIObj.h:38
b2
static constexpr float b2
Definition: L1EGammaCrystalsEmulatorProducer.cc:83
sistripvvi::VVIObj::t0_
double t0_
Definition: VVIObj.h:37
testProducerWithPsetDescEmpty_cfi.a2
a2
Definition: testProducerWithPsetDescEmpty_cfi.py:35
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
b1
static constexpr float b1
Definition: L1EGammaCrystalsEmulatorProducer.cc:83
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
dqmdumpme.k
k
Definition: dqmdumpme.py:60
q2
double q2[4]
Definition: TauolaWrapper.h:88
sistripvvi::VVIObj::x0_
double x0_
Definition: VVIObj.h:41
sistripvvi::VVIObj::t_
double t_
Definition: VVIObj.h:39
alignmentValidation.c1
c1
do drawing
Definition: alignmentValidation.py:1025
sistripvvi::VVIObjDetails::dzero
int dzero(double a, double b, double &x0, double &rv, double eps, int mxf, F func)
Definition: VVIObj.cc:637
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
b0
static constexpr float b0
Definition: L1EGammaCrystalsEmulatorProducer.cc:83
sistripvvi::VVIObjDetails::f2
double f2(double x, double const *h_)
Definition: VVIObj.cc:34
sistripvvi::VVIObj::omega_
double omega_
Definition: VVIObj.h:40
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
genVertex_cff.x
x
Definition: genVertex_cff.py:12
detailsBasic3DVector::y
float float y
Definition: extBasic3DVector.h:14
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
ztail.d
d
Definition: ztail.py:151
kappa
static const G4double kappa
Definition: UrbanMscModel93.cc:35
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
sistripvvi::VVIObjDetails::f1
double f1(double x, double const *h_)
Private version of the exponential integral.
Definition: VVIObj.cc:33
sistripvvi::VVIObjDetails::sincosint
void sincosint(double x, double &sint, double &cint)
Definition: VVIObj.cc:369
sistripvvi::VVIObj::b_
double b_[155]
Definition: VVIObj.h:43
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