CMS 3D CMS Logo

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

#include <RPGaussianTailNoiseAdder.h>

Public Member Functions

simromanpot::strip_charge_map addNoise (const simromanpot::strip_charge_map &theSignal)
 
 RPGaussianTailNoiseAdder (int numStrips, double theNoiseInElectrons, double theStripThresholdInE, CLHEP::HepRandomEngine &eng, int verbosity)
 

Private Attributes

int numStrips_
 
CLHEP::HepRandomEngine & rndEngine_
 
double strips_above_threshold_prob_
 
double theNoiseInElectrons
 
double theStripThresholdInE
 
int verbosity_
 

Detailed Description

Definition at line 7 of file RPGaussianTailNoiseAdder.h.

Constructor & Destructor Documentation

◆ RPGaussianTailNoiseAdder()

RPGaussianTailNoiseAdder::RPGaussianTailNoiseAdder ( int  numStrips,
double  theNoiseInElectrons,
double  theStripThresholdInE,
CLHEP::HepRandomEngine &  eng,
int  verbosity 
)

Member Function Documentation

◆ addNoise()

simromanpot::strip_charge_map RPGaussianTailNoiseAdder::addNoise ( const simromanpot::strip_charge_map theSignal)

Definition at line 22 of file RPGaussianTailNoiseAdder.cc.

References mps_fire::i, dqmiolumiharvest::j, hgchebackDigitizer_cfi::noise, numStrips_, rndEngine_, digitizers_cfi::strip, strips_above_threshold_prob_, theNoiseInElectrons, theStripThresholdInE, and verbosity_.

22  {
23  simromanpot::strip_charge_map the_strip_charge_map;
24 
25  // noise on strips with signal:
26  for (simromanpot::strip_charge_map::const_iterator i = theSignal.begin(); i != theSignal.end(); ++i) {
27  double noise = CLHEP::RandGauss::shoot(&(rndEngine_), 0.0, theNoiseInElectrons);
28  the_strip_charge_map[i->first] = i->second + noise;
29  if (verbosity_)
30  edm::LogInfo("RPDigiProducer") << "noise added to signal strips: " << noise << "\n";
31  }
32 
33  // noise on the other strips
34  int strips_no_above_threshold =
35  CLHEP::RandBinomial::shoot(&(rndEngine_), (long)numStrips_, strips_above_threshold_prob_);
36 
37  for (int j = 0; j < strips_no_above_threshold; j++) {
38  int strip = CLHEP::RandFlat::shootInt(&(rndEngine_), numStrips_);
39  if (the_strip_charge_map[strip] == 0) {
40  the_strip_charge_map[strip] = 2 * theStripThresholdInE;
41  //only binary decision later, no need to simulate the noise precisely,
42  //enough to know that it exceeds the threshold
43  if (verbosity_)
44  edm::LogInfo("RPDigiProducer") << "nonsignal strips noise :" << strip << " " << the_strip_charge_map[strip]
45  << "\n";
46  }
47  }
48 
49  return the_strip_charge_map;
50 }
Log< level::Info, false > LogInfo
std::map< unsigned short, double > strip_charge_map
Definition: RPSimTypes.h:14
CLHEP::HepRandomEngine & rndEngine_

Member Data Documentation

◆ numStrips_

int RPGaussianTailNoiseAdder::numStrips_
private

Definition at line 17 of file RPGaussianTailNoiseAdder.h.

Referenced by addNoise().

◆ rndEngine_

CLHEP::HepRandomEngine& RPGaussianTailNoiseAdder::rndEngine_
private

Definition at line 21 of file RPGaussianTailNoiseAdder.h.

Referenced by addNoise().

◆ strips_above_threshold_prob_

double RPGaussianTailNoiseAdder::strips_above_threshold_prob_
private

Definition at line 20 of file RPGaussianTailNoiseAdder.h.

Referenced by addNoise(), and RPGaussianTailNoiseAdder().

◆ theNoiseInElectrons

double RPGaussianTailNoiseAdder::theNoiseInElectrons
private

Definition at line 18 of file RPGaussianTailNoiseAdder.h.

Referenced by addNoise(), and RPGaussianTailNoiseAdder().

◆ theStripThresholdInE

double RPGaussianTailNoiseAdder::theStripThresholdInE
private

Definition at line 19 of file RPGaussianTailNoiseAdder.h.

Referenced by addNoise(), and RPGaussianTailNoiseAdder().

◆ verbosity_

int RPGaussianTailNoiseAdder::verbosity_
private

Definition at line 22 of file RPGaussianTailNoiseAdder.h.

Referenced by addNoise().