CMS 3D CMS Logo

GEMNoiseModel.cc
Go to the documentation of this file.
6 #include "CLHEP/Random/RandFlat.h"
7 #include "CLHEP/Random/RandPoissonQ.h"
8 #include "CLHEP/Random/RandGaussQ.h"
9 #include <cmath>
10 #include <utility>
11 #include <map>
12 
15  averageNoiseRate_(config.getParameter<double>("averageNoiseRate")),
16  bxWidth_(config.getParameter<double>("bxWidth")),
17  minBunch_(config.getParameter<int>("minBunch")),
18  maxBunch_(config.getParameter<int>("maxBunch")) {}
19 
21 
23  const edm::PSimHitContainer&,
24  CLHEP::HepRandomEngine* engine,
25  Strips& strips_,
26  DetectorHitMap& detectorHitMap_) {
27  const GEMDetId& gemId(roll->id());
28  const int nstrips(roll->nstrips());
29  double trStripArea(0.0);
30  if (gemId.region() == 0) {
31  throw cms::Exception("Geometry") << "GEMNoiseModel::simulate() - this GEM id is from barrel, which cannot happen.";
32  }
33  const GEMStripTopology* top_(dynamic_cast<const GEMStripTopology*>(&(roll->topology())));
34  const float striplength(top_->stripLength());
35  trStripArea = (roll->pitch()) * striplength;
36  float trArea(trStripArea * nstrips);
37  const int nBxing(maxBunch_ - minBunch_ + 1);
38  //simulate intrinsic noise
39  const double aveIntrinsicNoise(averageNoiseRate_ * nBxing * trArea * bxWidth_);
40  CLHEP::RandPoissonQ randPoissonQ(*engine, aveIntrinsicNoise);
41  const int n_intrHits(randPoissonQ.fire());
42 
43  for (int k = 0; k < n_intrHits; k++) {
44  const int centralStrip(static_cast<int>(CLHEP::RandFlat::shoot(engine, 1, nstrips)));
45  const int time_hit(static_cast<int>(CLHEP::RandFlat::shoot(engine, nBxing)) + minBunch_);
46  strips_.emplace(centralStrip, time_hit);
47  }
48  //end simulate intrinsic noise
49 
50  return;
51 }
void simulate(const GEMEtaPartition *, const edm::PSimHitContainer &, CLHEP::HepRandomEngine *, Strips &, DetectorHitMap &) override
GEMNoiseModel(const edm::ParameterSet &)
Definition: config.py:1
GEMDetId id() const
double averageNoiseRate_
Definition: GEMNoiseModel.h:33
float pitch() const
const Topology & topology() const override
std::multimap< std::pair< unsigned int, int >, const PSimHit *, std::less< std::pair< unsigned int, int > > > DetectorHitMap
Definition: GEMDigiModel.h:35
std::set< std::pair< int, int > > Strips
Definition: GEMDigiModel.h:31
int nstrips() const
number of readout strips in partition
std::vector< PSimHit > PSimHitContainer
~GEMNoiseModel() override