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 (const RandomEngine *engine, double sigma=1., double threshold=2.)
 
void setParameters (double sigma, double threshold)
 
double shoot () const
 
 ~GaussianTail ()
 

Private Attributes

const RandomEnginerandom
 
double s_
 
double sigma_
 
double ssquare_
 
double threshold_
 

Detailed Description

Definition at line 10 of file GaussianTail.h.

Constructor & Destructor Documentation

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

Definition at line 5 of file GaussianTail.cc.

References s_, sigma_, ssquare_, and threshold_.

6  :
7  random(engine),
8  sigma_(sigma),
10 {
12  ssquare_ = s_ * s_;
13 }
double threshold_
Definition: GaussianTail.h:30
const RandomEngine * random
Definition: GaussianTail.h:27
double sigma_
Definition: GaussianTail.h:29
double ssquare_
Definition: GaussianTail.h:32
GaussianTail::~GaussianTail ( )

Definition at line 15 of file GaussianTail.cc.

16 {
17  ;
18 }

Member Function Documentation

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

Definition at line 16 of file GaussianTail.h.

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

17  {
18  sigma_= sigma;
21  ssquare_ = s_ * s_;
22  };
double threshold_
Definition: GaussianTail.h:30
double sigma_
Definition: GaussianTail.h:29
double ssquare_
Definition: GaussianTail.h:32
double GaussianTail::shoot ( ) const

Definition at line 20 of file GaussianTail.cc.

References RandomEngine::flatShoot(), RandomEngine::gaussShoot(), create_public_lumi_plots::log, random, s_, sigma_, mathSSE::sqrt(), ssquare_, v, and vdt::x.

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

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

Member Data Documentation

const RandomEngine* GaussianTail::random
private

Definition at line 27 of file GaussianTail.h.

Referenced by shoot().

double GaussianTail::s_
private

Definition at line 31 of file GaussianTail.h.

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

double GaussianTail::sigma_
private

Definition at line 29 of file GaussianTail.h.

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

double GaussianTail::ssquare_
private

Definition at line 32 of file GaussianTail.h.

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

double GaussianTail::threshold_
private

Definition at line 30 of file GaussianTail.h.

Referenced by GaussianTail(), and setParameters().