CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
GaussNoiseFP420 Class Reference

#include <GaussNoiseFP420.h>

Inheritance diagram for GaussNoiseFP420:
GNoiseFP420

Public Member Functions

PileUpFP420::signal_map_type addNoise (const PileUpFP420::signal_map_type &) override
 
 GaussNoiseFP420 (int ns, float nrms, float th, bool aNpixel, int verbosity)
 
void setNumPixels (int in)
 
void setThreshold (float in)
 
- Public Member Functions inherited from GNoiseFP420
virtual ~GNoiseFP420 ()
 

Private Attributes

bool addNoisyPixels
 
float noiseRMS
 
int numPixels
 
float threshold
 
int verbosi
 

Detailed Description

Definition at line 7 of file GaussNoiseFP420.h.

Constructor & Destructor Documentation

◆ GaussNoiseFP420()

GaussNoiseFP420::GaussNoiseFP420 ( int  ns,
float  nrms,
float  th,
bool  aNpixel,
int  verbosity 
)

Definition at line 11 of file GaussNoiseFP420.cc.

12  : numPixels(ns), noiseRMS(nrms), threshold(th), addNoisyPixels(aNpixel), verbosi(verbosity) {}

Member Function Documentation

◆ addNoise()

PileUpFP420::signal_map_type GaussNoiseFP420::addNoise ( const PileUpFP420::signal_map_type in)
overridevirtual

Implements GNoiseFP420.

Definition at line 14 of file GaussNoiseFP420.cc.

14  {
16 
17  // Add noise on non-hit pixels
18  std::map<int, float, std::less<int>> generatedNoise;
19 
20  // int numberOfPixels = (numRows * numColumns);// numPixels=numberOfPixels
21 
23  gen.generate(numPixels, threshold, noiseRMS,
24  generatedNoise); // threshold is thePixelThreshold
25 
26  // noise for channels with signal:
27  // ----------------------------
28 
29  for (PileUpFP420::signal_map_type::const_iterator si = in.begin(); si != in.end(); si++) {
30  if (verbosi > 0) {
31  std::cout << " ***GaussNoiseFP420: before noise:" << std::endl;
32  std::cout << " for si->first= " << si->first << " _signal[si->first]= " << _signal[si->first]
33  << " si->second= " << si->second << std::endl;
34  }
35  // define Gaussian noise centered at 0. with sigma = noiseRMS:
36  float noise(CLHEP::RandGauss::shoot(0., noiseRMS));
37  // float noise = CLHEP::RandGaussQ::shoot(0.,theNoiseInElectrons) ;
38  // add noise to each channel with signal:
39  _signal[si->first] = si->second + noise;
40 
41  if (verbosi > 0) {
42  std::cout << " ***GaussNoiseFP420: after noise added = " << noise << std::endl;
43  std::cout << "after noise added the _signal[si->first]= " << _signal[si->first] << std::endl;
44  }
45  }
46 
47  // //
48  if (addNoisyPixels) { // Option to skip noise in non-hit pixels
49  // Noise on the other channels:
50  typedef std::map<int, float, std::less<int>>::iterator MI;
51  for (MI p = generatedNoise.begin(); p != generatedNoise.end(); p++) {
52  if (_signal[(*p).first] == 0) {
53  _signal[(*p).first] += (*p).second;
54  }
55  } // for(MI
56  }
57 
58  // or:
59  // //
60  /*
61  if(addNoisyPixels){ // Option to skip noise in non-hit pixels
62  // Noise on the other channels:
63  typedef std::map<int,float,std::less<int> >::iterator MI;
64  for(MI p = generatedNoise.begin(); p != generatedNoise.end(); p++){
65  int iy = ((*p).first) / numRows;
66  int ix = ((*p).first) - (iy*numRows);
67  // Keep for a while for testing.
68  if( iy < 0 || iy > (numColumns-1) )
69  LogWarning ("Pixel Geometry") << " error in iy " << iy ;
70  if( ix < 0 || ix > (numRows-1) )
71  LogWarning ("Pixel Geometry") << " error in ix " << ix ;
72  int chan = PixelDigi::pixelToChannel(ix, iy);
73  LogDebug ("Pixel Digitizer")<<" Storing noise = " << (*mapI).first << " " <<
74  (*mapI).second
75  << " " << ix << " " << iy << " " << chan ;
76  if(_signal[chan] == 0){
77  _signal[(*p).first] += (*p).second;
78  }//if
79  }//for(MI
80  }
81  */
82  // //
83  // //
84 
85  //
86  return _signal;
87  //
88 }

References addNoisyPixels, gather_cfg::cout, relval_steps::gen(), recoMuon::in, hgchebackDigitizer_cfi::noise, noiseRMS, numPixels, AlCaHLTBitMon_ParallelJobs::p, threshold, and verbosi.

Referenced by FP420DigiMain::run().

◆ setNumPixels()

void GaussNoiseFP420::setNumPixels ( int  in)
inline

Definition at line 12 of file GaussNoiseFP420.h.

12 { numPixels = in; }

References recoMuon::in, and numPixels.

◆ setThreshold()

void GaussNoiseFP420::setThreshold ( float  in)
inline

Definition at line 13 of file GaussNoiseFP420.h.

13 { threshold = in; }

References recoMuon::in, and threshold.

Member Data Documentation

◆ addNoisyPixels

bool GaussNoiseFP420::addNoisyPixels
private

Definition at line 19 of file GaussNoiseFP420.h.

Referenced by addNoise().

◆ noiseRMS

float GaussNoiseFP420::noiseRMS
private

Definition at line 17 of file GaussNoiseFP420.h.

Referenced by addNoise().

◆ numPixels

int GaussNoiseFP420::numPixels
private

Definition at line 16 of file GaussNoiseFP420.h.

Referenced by addNoise(), and setNumPixels().

◆ threshold

float GaussNoiseFP420::threshold
private

Definition at line 18 of file GaussNoiseFP420.h.

Referenced by addNoise(), utils.StatisticalTest::get_status(), and setThreshold().

◆ verbosi

int GaussNoiseFP420::verbosi
private

Definition at line 20 of file GaussNoiseFP420.h.

Referenced by addNoise().

HIPAlignmentAlgorithm_cfi.verbosity
verbosity
Definition: HIPAlignmentAlgorithm_cfi.py:7
GaussNoiseFP420::verbosi
int verbosi
Definition: GaussNoiseFP420.h:20
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
gather_cfg.cout
cout
Definition: gather_cfg.py:144
GaussNoiseFP420::noiseRMS
float noiseRMS
Definition: GaussNoiseFP420.h:17
GaussNoiseProducerFP420
Definition: GaussNoiseProducerFP420.h:6
gen
Definition: PythiaDecays.h:13
GaussNoiseFP420::numPixels
int numPixels
Definition: GaussNoiseFP420.h:16
PileUpFP420::signal_map_type
std::map< int, Amplitude, std::less< int > > signal_map_type
Definition: PileUpFP420.h:13
recoMuon::in
Definition: RecoMuonEnumerators.h:6
GaussNoiseFP420::addNoisyPixels
bool addNoisyPixels
Definition: GaussNoiseFP420.h:19
relval_steps.gen
def gen(fragment, howMuch)
Production test section ####.
Definition: relval_steps.py:500
hgchebackDigitizer_cfi.noise
noise
Definition: hgchebackDigitizer_cfi.py:42
GaussNoiseFP420::threshold
float threshold
Definition: GaussNoiseFP420.h:18