CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/SimMuon/GEMDigitizer/src/GEMSimTriv.cc

Go to the documentation of this file.
00001 #include "SimMuon/GEMDigitizer/src/GEMSimTriv.h"
00002 #include "SimMuon/GEMDigitizer/src/GEMSimSetUp.h"
00003 #include "SimMuon/GEMDigitizer/src/GEMSynchronizer.h"
00004 
00005 #include "Geometry/GEMGeometry/interface/GEMEtaPartitionSpecs.h"
00006 #include "Geometry/CommonTopologies/interface/TrapezoidalStripTopology.h"
00007 #include "Geometry/GEMGeometry/interface/GEMGeometry.h"
00008 
00009 #include "FWCore/ServiceRegistry/interface/Service.h"
00010 #include "FWCore/Utilities/interface/RandomNumberGenerator.h"
00011 #include "FWCore/Utilities/interface/Exception.h"
00012 
00013 #include "CLHEP/Random/RandomEngine.h"
00014 #include "CLHEP/Random/RandFlat.h"
00015 #include "CLHEP/Random/RandPoissonQ.h"
00016 
00017 #include <cmath>
00018 #include <utility>
00019 #include <map>
00020 
00021 
00022 GEMSimTriv::GEMSimTriv(const edm::ParameterSet& config) :
00023   GEMSim(config)
00024 {
00025   rate_ = config.getParameter<double>("rate");
00026   nbxing_ = config.getParameter<int>("nbxing");
00027   gate_ = config.getParameter<double>("gate");
00028 
00029   sync_ = new GEMSynchronizer(config);
00030 }
00031 
00032 void GEMSimTriv::setRandomEngine(CLHEP::HepRandomEngine& eng)
00033 {
00034   flatDistr1_ = new CLHEP::RandFlat(eng);
00035   flatDistr2_ = new CLHEP::RandFlat(eng);
00036   poissonDistr_ = new CLHEP::RandPoissonQ(eng);
00037   sync_->setRandomEngine(eng);
00038 }
00039 
00040 
00041 GEMSimTriv::~GEMSimTriv()
00042 {
00043   if (flatDistr1_) delete flatDistr1_;
00044   if (flatDistr2_) delete flatDistr2_;
00045   if (poissonDistr_) delete poissonDistr_;
00046   delete sync_;
00047 }
00048 
00049 void GEMSimTriv::simulate(const GEMEtaPartition* roll,
00050                           const edm::PSimHitContainer& simHits)
00051 {
00052   //_gemSync->setGEMSimSetUp(getGEMSimSetUp());
00053   stripDigiSimLinks_.clear();
00054   detectorHitMap_.clear();
00055   stripDigiSimLinks_ = StripDigiSimLinks(roll->id().rawId());
00056 
00057   const Topology& topology = roll->specs()->topology();
00058 
00059   for (const auto & hit: simHits)
00060   {
00061     if (std::abs(hit.particleType()) != 13) continue;
00062 
00063     // Here I hould check if the RPC are up side down;
00064     auto entry = hit.entryPoint();
00065 
00066     //int time_hit = _gemSync->getSimHitBx(&(*_hit));
00067     // please keep hit time always 0 for this model
00068     int time_hit = 0;
00069     std::pair<int, int> digi(topology.channel(entry) + 1, time_hit);
00070 
00071     detectorHitMap_.insert(DetectorHitMap::value_type(digi, &hit));
00072     strips_.insert(digi);
00073   }
00074 }
00075 
00076 
00077 void GEMSimTriv::simulateNoise(const GEMEtaPartition* roll)
00078 {
00079   // please keep it empty for this model
00080   return;
00081 }