CMS 3D CMS Logo

RPGaussianTailNoiseAdder.cc
Go to the documentation of this file.
3 #include <iostream>
4 #include "CLHEP/Random/RandGauss.h"
5 #include "CLHEP/Random/RandFlat.h"
6 #include "CLHEP/Random/RandBinomial.h"
7 
8 #include <cmath>
9 
10 using namespace std;
11 
13  int numStrips, double theNoiseInElectrons, double theStripThresholdInE, CLHEP::HepRandomEngine &eng, int verbosity)
14  : numStrips_(numStrips),
15  theNoiseInElectrons(theNoiseInElectrons),
16  theStripThresholdInE(theStripThresholdInE),
17  rndEngine_(eng),
18  verbosity_(verbosity) {
20 }
21 
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 }
HIPAlignmentAlgorithm_cfi.verbosity
verbosity
Definition: HIPAlignmentAlgorithm_cfi.py:7
RPGaussianTailNoiseAdder.h
mps_fire.i
i
Definition: mps_fire.py:428
RPGaussianTailNoiseAdder::verbosity_
int verbosity_
Definition: RPGaussianTailNoiseAdder.h:22
MessageLogger.h
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
RPGaussianTailNoiseAdder::RPGaussianTailNoiseAdder
RPGaussianTailNoiseAdder(int numStrips, double theNoiseInElectrons, double theStripThresholdInE, CLHEP::HepRandomEngine &eng, int verbosity)
Definition: RPGaussianTailNoiseAdder.cc:12
simromanpot::strip_charge_map
std::map< unsigned short, double > strip_charge_map
Definition: RPSimTypes.h:14
RPGaussianTailNoiseAdder::theStripThresholdInE
double theStripThresholdInE
Definition: RPGaussianTailNoiseAdder.h:19
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
RPGaussianTailNoiseAdder::addNoise
simromanpot::strip_charge_map addNoise(const simromanpot::strip_charge_map &theSignal)
Definition: RPGaussianTailNoiseAdder.cc:22
RPGaussianTailNoiseAdder::strips_above_threshold_prob_
double strips_above_threshold_prob_
Definition: RPGaussianTailNoiseAdder.h:20
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
gpuVertexFinder::noise
__shared__ int noise
Definition: gpuFitVertices.h:50
RPGaussianTailNoiseAdder::rndEngine_
CLHEP::HepRandomEngine & rndEngine_
Definition: RPGaussianTailNoiseAdder.h:21
RPGaussianTailNoiseAdder::numStrips_
int numStrips_
Definition: RPGaussianTailNoiseAdder.h:17
std
Definition: JetResolutionObject.h:76
RPGaussianTailNoiseAdder::theNoiseInElectrons
double theNoiseInElectrons
Definition: RPGaussianTailNoiseAdder.h:18
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66