CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ( double  sigma = 1.,
double  threshold = 2. 
)

Definition at line 5 of file GaussianTail.cc.

References s_, sigma_, ssquare_, and threshold_.

5  :
6  sigma_(sigma),
8 {
10  ssquare_ = s_ * s_;
11 }
double threshold_
Definition: GaussianTail.h:27
double sigma_
Definition: GaussianTail.h:26
double ssquare_
Definition: GaussianTail.h:29
GaussianTail::~GaussianTail ( )

Definition at line 13 of file GaussianTail.cc.

14 {
15  ;
16 }

Member Function Documentation

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

Definition at line 15 of file GaussianTail.h.

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

16  {
17  sigma_= sigma;
20  ssquare_ = s_ * s_;
21  };
double threshold_
Definition: GaussianTail.h:27
double sigma_
Definition: GaussianTail.h:26
double ssquare_
Definition: GaussianTail.h:29
double GaussianTail::shoot ( RandomEngineAndDistribution const *  random) const

Definition at line 18 of file GaussianTail.cc.

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

Referenced by EcalPreshowerRecHitsMaker::noisifySubdet(), HcalRecHitsMaker::noisifySubdet(), EcalBarrelRecHitsMaker::randomNoisifier(), and EcalEndcapRecHitsMaker::randomNoisifier().

19 {
20  // in the zero suppresion case, s is usually >2
21  if(s_>1.)
22  {
23  /* Use the "supertail" deviates from the last two steps
24  * of Marsaglia's rectangle-wedge-tail method, as described
25  * in Knuth, v2, 3rd ed, pp 123-128. (See also exercise 11, p139,
26  * and the solution, p586.)
27  */
28 
29  double u, v, x;
30 
31  do
32  {
33  u = random->flatShoot();
34  do
35  {
36  v = random->flatShoot();
37  }
38  while (v == 0.0);
39  x = std::sqrt (ssquare_ - 2 * std::log (v));
40  }
41  while (x * u > s_);
42  return x * sigma_;
43  }
44  else
45  {
46  /* For small s, use a direct rejection method. The limit s < 1
47  can be adjusted to optimise the overall efficiency
48  */
49 
50  double x;
51 
52  do
53  {
54  x = random->gaussShoot();
55  }
56  while (x < s_);
57  return x * sigma_;
58  }
59 }
static std::vector< std::string > checklist log
TRandom random
Definition: MVATrainer.cc:138
T sqrt(T t)
Definition: SSEVec.h:48
double sigma_
Definition: GaussianTail.h:26
double ssquare_
Definition: GaussianTail.h:29
Definition: DDAxes.h:10

Member Data Documentation

double GaussianTail::s_
private

Definition at line 28 of file GaussianTail.h.

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

double GaussianTail::sigma_
private

Definition at line 26 of file GaussianTail.h.

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

double GaussianTail::ssquare_
private

Definition at line 29 of file GaussianTail.h.

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

double GaussianTail::threshold_
private

Definition at line 27 of file GaussianTail.h.

Referenced by GaussianTail(), and setParameters().