CMS 3D CMS Logo

List of all members | Public Member Functions
GaussNoiseProducerFP420 Class Reference

#include <GaussNoiseProducerFP420.h>

Public Member Functions

 GaussNoiseProducerFP420 ()
 
void generate (int NumberOfchannels, float threshold, float noiseRMS, std::map< int, float, std::less< int >> &theMap)
 
 ~GaussNoiseProducerFP420 ()
 

Detailed Description

Definition at line 6 of file GaussNoiseProducerFP420.h.

Constructor & Destructor Documentation

◆ GaussNoiseProducerFP420()

GaussNoiseProducerFP420::GaussNoiseProducerFP420 ( )
inline

Definition at line 8 of file GaussNoiseProducerFP420.h.

8 {}

◆ ~GaussNoiseProducerFP420()

GaussNoiseProducerFP420::~GaussNoiseProducerFP420 ( )
inline

Definition at line 9 of file GaussNoiseProducerFP420.h.

9 {}

Member Function Documentation

◆ generate()

void GaussNoiseProducerFP420::generate ( int  NumberOfchannels,
float  threshold,
float  noiseRMS,
std::map< int, float, std::less< int >> &  theMap 
)

Definition at line 18 of file GaussNoiseProducerFP420.cc.

21  {
22  // estimale mean number of noisy channels with amplidudes above $AdcThreshold$
23 
24  // Gauss is centered at 0 with sigma=1
25  // Gaussian tail probability higher threshold(=5sigma for instance):
26  gsl_sf_result result;
27  int status = gsl_sf_erf_Q_e(threshold, &result);
28  // MP
29  // if (status != 0) throw DetLogicError("GaussNoiseProducerFP420::could not
30  // compute gaussian tail probability for the threshold chosen");
31  if (status != 0)
32  std::cerr << "GaussNoiseProducerFP420::could not compute gaussian tail "
33  "probability for the threshold chosen"
34  << std::endl;
35  float probabilityLeft = result.val;
36 
37  // with known probability higher threshold compute number of noisy channels
38  // distributed in Poisson:
39  float meanNumberOfNoisyChannels = probabilityLeft * NumberOfchannels;
40  int numberOfNoisyChannels = CLHEP::RandPoisson::shoot(meanNumberOfNoisyChannels);
41 
42  // draw noise at random according to Gaussian tail
43 
44  // initialise default gsl uniform generator engine
45  static gsl_rng const *const mt19937 = gsl_rng_alloc(gsl_rng_mt19937);
46 
47  float lowLimit = threshold * noiseRMS;
48  for (int i = 0; i < numberOfNoisyChannels; i++) {
49  // Find a random channel number
50  int theChannelNumber = (int)CLHEP::RandFlat::shootInt(NumberOfchannels);
51 
52  // Find random noise value: random mt19937 over Gaussian tail above
53  // threshold:
54  float noise = gsl_ran_gaussian_tail(mt19937, lowLimit, noiseRMS);
55 
56  // Fill in map
57  theMap[theChannelNumber] = noise;
58  }
59 }

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, mps_fire::i, createfilelist::int, gpuVertexFinder::noise, mps_fire::result, mps_update::status, and remoteMonitoring_LED_IterMethod_cfg::threshold.

mps_fire.i
i
Definition: mps_fire.py:428
mps_update.status
status
Definition: mps_update.py:68
createfilelist.int
int
Definition: createfilelist.py:10
gpuVertexFinder::noise
__shared__ int noise
Definition: gpuFitVertices.h:50
mps_fire.result
result
Definition: mps_fire.py:311
remoteMonitoring_LED_IterMethod_cfg.threshold
threshold
Definition: remoteMonitoring_LED_IterMethod_cfg.py:430
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8