#include <GEMSimAverage.h>
Public Member Functions | |
GEMSimAverage (const edm::ParameterSet &config) | |
void | setRandomEngine (CLHEP::HepRandomEngine &eng) |
void | simulate (const GEMEtaPartition *roll, const edm::PSimHitContainer &rpcHits) |
void | simulateNoise (const GEMEtaPartition *roll) |
~GEMSimAverage () | |
Private Member Functions | |
void | init () |
Private Attributes | |
double | averageEfficiency_ |
double | averageNoiseRate_ |
double | averageShapingTime_ |
double | bxwidth_ |
CLHEP::RandFlat * | flatDistr1_ |
CLHEP::RandFlat * | flatDistr2_ |
int | maxBunch_ |
int | minBunch_ |
CLHEP::RandPoissonQ * | poissonDistr_ |
GEMSynchronizer * | sync_ |
Class for the GEM strip response simulation that extends the Trivial model with average parameters for the GEM efficiency, timing and noise
Definition at line 24 of file GEMSimAverage.h.
GEMSimAverage::GEMSimAverage | ( | const edm::ParameterSet & | config | ) |
Definition at line 22 of file GEMSimAverage.cc.
References averageEfficiency_, averageNoiseRate_, averageShapingTime_, bxwidth_, edm::ParameterSet::getParameter(), maxBunch_, minBunch_, and sync_.
: GEMSim(config) { averageEfficiency_ = config.getParameter<double>("averageEfficiency"); averageShapingTime_ = config.getParameter<double>("averageShapingTime"); averageNoiseRate_ = config.getParameter<double>("averageNoiseRate"); bxwidth_ = config.getParameter<double>("bxwidth"); minBunch_ = config.getParameter<int>("minBunch"); maxBunch_ = config.getParameter<int>("maxBunch"); sync_ = new GEMSynchronizer(config); }
GEMSimAverage::~GEMSimAverage | ( | ) |
Definition at line 44 of file GEMSimAverage.cc.
References flatDistr1_, flatDistr2_, poissonDistr_, and sync_.
{ if (flatDistr1_) delete flatDistr1_; if (flatDistr2_) delete flatDistr2_; if (poissonDistr_) delete poissonDistr_; delete sync_; }
void GEMSimAverage::init | ( | void | ) | [inline, private, virtual] |
void GEMSimAverage::setRandomEngine | ( | CLHEP::HepRandomEngine & | eng | ) | [virtual] |
Implements GEMSim.
Definition at line 35 of file GEMSimAverage.cc.
References flatDistr1_, flatDistr2_, poissonDistr_, GEMSynchronizer::setRandomEngine(), and sync_.
{ flatDistr1_ = new CLHEP::RandFlat(eng); flatDistr2_ = new CLHEP::RandFlat(eng); poissonDistr_ = new CLHEP::RandPoissonQ(eng); sync_->setRandomEngine(eng); }
void GEMSimAverage::simulate | ( | const GEMEtaPartition * | roll, |
const edm::PSimHitContainer & | rpcHits | ||
) | [virtual] |
Implements GEMSim.
Definition at line 52 of file GEMSimAverage.cc.
References abs, averageEfficiency_, edm::DetSet< T >::clear(), GEMSim::detectorHitMap_, flatDistr1_, GEMSim::getGEMSimSetUp(), GEMSynchronizer::getSimHitBx(), GEMEtaPartition::id(), DetId::rawId(), GEMSynchronizer::setGEMSimSetUp(), GEMEtaPartition::specs(), GEMSim::stripDigiSimLinks_, GEMSim::strips_, sync_, and GEMEtaPartitionSpecs::topology().
{ sync_->setGEMSimSetUp(getGEMSimSetUp()); stripDigiSimLinks_.clear(); detectorHitMap_.clear(); stripDigiSimLinks_ = StripDigiSimLinks(roll->id().rawId()); const Topology& topology = roll->specs()->topology(); for (const auto & hit: simHits) { if (std::abs(hit.particleType()) != 13) continue; // Check GEM efficiency if (flatDistr1_->fire(1) > averageEfficiency_) continue; auto entry = hit.entryPoint(); int time_hit = sync_->getSimHitBx(&hit); std::pair<int, int> digi(topology.channel(entry) + 1, time_hit); detectorHitMap_.insert(DetectorHitMap::value_type(digi, &hit)); strips_.insert(digi); } }
void GEMSimAverage::simulateNoise | ( | const GEMEtaPartition * | roll | ) | [virtual] |
Implements GEMSim.
Definition at line 78 of file GEMSimAverage.cc.
References averageNoiseRate_, bxwidth_, Exception, flatDistr1_, flatDistr2_, i, GEMEtaPartition::id(), maxBunch_, minBunch_, GEMEtaPartition::nstrips(), poissonDistr_, GEMDetId::region(), strip(), GEMSim::strips_, GEMEtaPartition::topology(), x, SiStripMonitorClusterAlca_cfi::xmax, and SiStripMonitorClusterAlca_cfi::xmin.
{ GEMDetId gemId = roll->id(); int nstrips = roll->nstrips(); double area = 0.0; if ( gemId.region() == 0 ) { throw cms::Exception("Geometry") << "GEMSynchronizer::simulateNoise() - this GEM id is from barrel, which cannot happen."; } else { const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology())); float xmin = (top_->localPosition(0.)).x(); float xmax = (top_->localPosition((float)roll->nstrips())).x(); float striplength = (top_->stripLength()); area = striplength*(xmax-xmin); } const int nBxing = maxBunch_ - minBunch_ + 1; double averageNoise = averageNoiseRate_ * nBxing * bxwidth_ * area * 1.0e-9; int n_hits = poissonDistr_->fire(averageNoise); for (int i = 0; i < n_hits; i++ ){ int strip = static_cast<int>(flatDistr1_->fire(1,nstrips)); int time_hit = static_cast<int>(flatDistr2_->fire(nBxing)) + minBunch_; std::pair<int, int> digi(strip,time_hit); strips_.insert(digi); } }
double GEMSimAverage::averageEfficiency_ [private] |
Definition at line 43 of file GEMSimAverage.h.
Referenced by GEMSimAverage(), and simulate().
double GEMSimAverage::averageNoiseRate_ [private] |
Definition at line 45 of file GEMSimAverage.h.
Referenced by GEMSimAverage(), and simulateNoise().
double GEMSimAverage::averageShapingTime_ [private] |
Definition at line 44 of file GEMSimAverage.h.
Referenced by GEMSimAverage().
double GEMSimAverage::bxwidth_ [private] |
Definition at line 46 of file GEMSimAverage.h.
Referenced by GEMSimAverage(), and simulateNoise().
CLHEP::RandFlat* GEMSimAverage::flatDistr1_ [private] |
Definition at line 51 of file GEMSimAverage.h.
Referenced by setRandomEngine(), simulate(), simulateNoise(), and ~GEMSimAverage().
CLHEP::RandFlat* GEMSimAverage::flatDistr2_ [private] |
Definition at line 52 of file GEMSimAverage.h.
Referenced by setRandomEngine(), simulateNoise(), and ~GEMSimAverage().
int GEMSimAverage::maxBunch_ [private] |
Definition at line 48 of file GEMSimAverage.h.
Referenced by GEMSimAverage(), and simulateNoise().
int GEMSimAverage::minBunch_ [private] |
Definition at line 47 of file GEMSimAverage.h.
Referenced by GEMSimAverage(), and simulateNoise().
CLHEP::RandPoissonQ* GEMSimAverage::poissonDistr_ [private] |
Definition at line 53 of file GEMSimAverage.h.
Referenced by setRandomEngine(), simulateNoise(), and ~GEMSimAverage().
GEMSynchronizer* GEMSimAverage::sync_ [private] |
Definition at line 42 of file GEMSimAverage.h.
Referenced by GEMSimAverage(), setRandomEngine(), simulate(), and ~GEMSimAverage().