![]() |
![]() |
#include <SimRomanPot/SimFP420/interface/GaussNoiseFP420.h>
Public Member Functions | |
PileUpFP420::signal_map_type | addNoise (PileUpFP420::signal_map_type) |
GaussNoiseFP420 (int ns, float nrms, float th, bool aNpixel) | |
void | setNumPixels (int in) |
void | setThreshold (float in) |
Private Attributes | |
bool | addNoisyPixels |
float | noiseRMS |
int | numPixels |
float | threshold |
Definition at line 7 of file GaussNoiseFP420.h.
Definition at line 12 of file GaussNoiseFP420.cc.
00012 : 00013 numPixels(ns), noiseRMS(nrms), threshold(th), addNoisyPixels(aNpixel){}
PileUpFP420::signal_map_type GaussNoiseFP420::addNoise | ( | PileUpFP420::signal_map_type | in | ) | [virtual] |
Implements GNoiseFP420.
Definition at line 17 of file GaussNoiseFP420.cc.
References addNoisyPixels, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), GaussNoiseProducerFP420::generate(), noiseRMS, numPixels, p, and threshold.
Referenced by FP420DigiMain::run().
00017 { 00018 00019 PileUpFP420::signal_map_type _signal; 00020 00021 // Add noise on non-hit pixels 00022 map<int,float,less<int> > generatedNoise; 00023 00024 // int numberOfPixels = (numRows * numColumns);// numPixels=numberOfPixels 00025 00026 00027 GaussNoiseProducerFP420 gen; 00028 gen.generate(numPixels,threshold,noiseRMS,generatedNoise);// threshold is thePixelThreshold 00029 00030 // noise for channels with signal: 00031 // ---------------------------- 00032 00033 for (PileUpFP420::signal_map_type::const_iterator si = in.begin(); 00034 si != in.end() ; si++){ 00035 00036 #ifdef mydigidebug7 00037 std::cout << " ***GaussNoiseFP420: before noise:" << std::endl; 00038 std::cout << " for si->first= " << si->first << " _signal[si->first]= " << _signal[si->first] << " si->second= " << si->second << std::endl; 00039 #endif 00040 // define Gaussian noise centered at 0. with sigma = noiseRMS: 00041 float noise( RandGauss::shoot(0.,noiseRMS) ); 00042 // float noise = RandGaussQ::shoot(0.,theNoiseInElectrons) ; 00043 // add noise to each channel with signal: 00044 _signal[si->first] = si->second + noise; 00045 00046 #ifdef mydigidebug7 00047 std::cout << " ***GaussNoiseFP420: after noise added = " << noise << std::endl; 00048 std::cout << "after noise added the _signal[si->first]= " << _signal[si->first] << std::endl; 00049 #endif 00050 } 00051 00052 // // 00053 if(addNoisyPixels){ // Option to skip noise in non-hit pixels 00054 // Noise on the other channels: 00055 typedef map<int,float,less<int> >::iterator MI; 00056 for(MI p = generatedNoise.begin(); p != generatedNoise.end(); p++){ 00057 if(_signal[(*p).first] == 0) { 00058 _signal[(*p).first] += (*p).second; 00059 } 00060 }//for(MI 00061 } 00062 00063 // or: 00064 // // 00065 /* 00066 if(addNoisyPixels){ // Option to skip noise in non-hit pixels 00067 // Noise on the other channels: 00068 typedef map<int,float,less<int> >::iterator MI; 00069 for(MI p = generatedNoise.begin(); p != generatedNoise.end(); p++){ 00070 int iy = ((*p).first) / numRows; 00071 int ix = ((*p).first) - (iy*numRows); 00072 // Keep for a while for testing. 00073 if( iy < 0 || iy > (numColumns-1) ) 00074 LogWarning ("Pixel Geometry") << " error in iy " << iy ; 00075 if( ix < 0 || ix > (numRows-1) ) 00076 LogWarning ("Pixel Geometry") << " error in ix " << ix ; 00077 int chan = PixelDigi::pixelToChannel(ix, iy); 00078 LogDebug ("Pixel Digitizer")<<" Storing noise = " << (*mapI).first << " " << (*mapI).second 00079 << " " << ix << " " << iy << " " << chan ; 00080 if(_signal[chan] == 0){ 00081 _signal[(*p).first] += (*p).second; 00082 }//if 00083 }//for(MI 00084 } 00085 */ 00086 // // 00087 // // 00088 00089 00090 // 00091 return _signal; 00092 // 00093 }
void GaussNoiseFP420::setThreshold | ( | float | in | ) | [inline] |
bool GaussNoiseFP420::addNoisyPixels [private] |
float GaussNoiseFP420::noiseRMS [private] |
int GaussNoiseFP420::numPixels [private] |
float GaussNoiseFP420::threshold [private] |