CMS 3D CMS Logo

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

#include <GaussianTail.h>

Public Member Functions

 GaussianTail (double sigma=1., double threshold=2.)
 
void setParameters (double sigma, double threshold)
 
double shoot (RandomEngineAndDistribution const *) const
 
 ~GaussianTail ()
 

Private Attributes

double s_
 
double sigma_
 
double ssquare_
 
double threshold_
 

Detailed Description

Definition at line 10 of file GaussianTail.h.

Constructor & Destructor Documentation

◆ GaussianTail()

GaussianTail::GaussianTail ( double  sigma = 1.,
double  threshold = 2. 
)

Definition at line 5 of file GaussianTail.cc.

References s_, sigma_, ssquare_, and threshold_.

5  : sigma_(sigma), threshold_(threshold) {
6  s_ = threshold_ / sigma_;
7  ssquare_ = s_ * s_;
8 }
double threshold_
Definition: GaussianTail.h:24
double sigma_
Definition: GaussianTail.h:23
double ssquare_
Definition: GaussianTail.h:26

◆ ~GaussianTail()

GaussianTail::~GaussianTail ( )

Definition at line 10 of file GaussianTail.cc.

10 { ; }

Member Function Documentation

◆ setParameters()

void GaussianTail::setParameters ( double  sigma,
double  threshold 
)
inline

Definition at line 14 of file GaussianTail.h.

References s_, sigma_, ssquare_, DiMuonV_cfg::threshold, and threshold_.

14  {
15  sigma_ = sigma;
17  s_ = threshold_ / sigma_;
18  ssquare_ = s_ * s_;
19  };
double threshold_
Definition: GaussianTail.h:24
double sigma_
Definition: GaussianTail.h:23
double ssquare_
Definition: GaussianTail.h:26

◆ shoot()

double GaussianTail::shoot ( RandomEngineAndDistribution const *  random) const

Definition at line 12 of file GaussianTail.cc.

References RandomEngineAndDistribution::flatShoot(), RandomEngineAndDistribution::gaussShoot(), dqm-mbProfile::log, s_, sigma_, mathSSE::sqrt(), ssquare_, findQualityFiles::v, and x.

12  {
13  // in the zero suppresion case, s is usually >2
14  if (s_ > 1.) {
15  /* Use the "supertail" deviates from the last two steps
16  * of Marsaglia's rectangle-wedge-tail method, as described
17  * in Knuth, v2, 3rd ed, pp 123-128. (See also exercise 11, p139,
18  * and the solution, p586.)
19  */
20 
21  double u, v, x;
22 
23  do {
24  u = random->flatShoot();
25  do {
26  v = random->flatShoot();
27  } while (v == 0.0);
28  x = std::sqrt(ssquare_ - 2 * std::log(v));
29  } while (x * u > s_);
30  return x * sigma_;
31  } else {
32  /* For small s, use a direct rejection method. The limit s < 1
33  can be adjusted to optimise the overall efficiency
34  */
35 
36  double x;
37 
38  do {
39  x = random->gaussShoot();
40  } while (x < s_);
41  return x * sigma_;
42  }
43 }
T sqrt(T t)
Definition: SSEVec.h:19
double sigma_
Definition: GaussianTail.h:23
double ssquare_
Definition: GaussianTail.h:26

Member Data Documentation

◆ s_

double GaussianTail::s_
private

Definition at line 25 of file GaussianTail.h.

Referenced by GaussianTail(), setParameters(), and shoot().

◆ sigma_

double GaussianTail::sigma_
private

Definition at line 23 of file GaussianTail.h.

Referenced by GaussianTail(), setParameters(), and shoot().

◆ ssquare_

double GaussianTail::ssquare_
private

Definition at line 26 of file GaussianTail.h.

Referenced by GaussianTail(), setParameters(), and shoot().

◆ threshold_

double GaussianTail::threshold_
private

Definition at line 24 of file GaussianTail.h.

Referenced by GaussianTail(), and setParameters().