CMS 3D CMS Logo

GaussNoiseProducerFP420 Class Reference

#include <SimRomanPot/SimFP420/interface/GaussNoiseProducerFP420.h>

List of all members.

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 (  )  [inline]

Definition at line 10 of file GaussNoiseProducerFP420.h.

00010 {}

GaussNoiseProducerFP420::~GaussNoiseProducerFP420 (  )  [inline]

Definition at line 11 of file GaussNoiseProducerFP420.h.

00011 {}


Member Function Documentation

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.

References TestMuL1L2Filter_cff::cerr, lat::endl(), i, int, HLT_VtxMuL3::result, and StDecayID::status.

Referenced by GaussNoiseFP420::addNoise().

00022 {
00023   
00024   // estimale mean number of noisy channels with amplidudes above $AdcThreshold$
00025   
00026   // Gauss is centered at 0 with sigma=1
00027   // Gaussian tail probability higher threshold(=5sigma for instance):
00028   gsl_sf_result result;
00029   int status = gsl_sf_erf_Q_e(threshold, &result);
00030   //MP 
00031   //  if (status != 0) throw DetLogicError("GaussNoiseProducerFP420::could not compute gaussian tail probability for the threshold chosen");
00032   if (status != 0) std::cerr<<"GaussNoiseProducerFP420::could not compute gaussian tail probability for the threshold chosen"<<std::endl;
00033   float probabilityLeft = result.val;
00034   
00035   // with known probability higher threshold compute number of noisy channels distributed in Poisson:
00036   float meanNumberOfNoisyChannels = probabilityLeft * NumberOfchannels;
00037   int numberOfNoisyChannels = RandPoisson::shoot(meanNumberOfNoisyChannels);
00038   
00039   // draw noise at random according to Gaussian tail
00040   
00041   // initialise default gsl uniform generator engine
00042   static gsl_rng * mt19937 = gsl_rng_alloc (gsl_rng_mt19937);
00043   
00044   float lowLimit = threshold * noiseRMS;
00045   for (int i = 0; i < numberOfNoisyChannels; i++) {
00046     
00047     // Find a random channel number    
00048     int theChannelNumber = (int) RandFlat::shootInt(NumberOfchannels);
00049     
00050     // Find random noise value: random mt19937 over Gaussian tail above threshold:
00051     float noise = gsl_ran_gaussian_tail(mt19937, lowLimit, noiseRMS);
00052     
00053     // Fill in map
00054     theMap[theChannelNumber] = noise;
00055     
00056   }
00057 }


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:21:09 2009 for CMSSW by  doxygen 1.5.4