#include <SimMuon/RPCDigitizer/src/RPCSimSimple.h>
Public Member Functions | |
RPCSimSimple (const edm::ParameterSet &config) | |
void | simulate (const RPCRoll *roll, const edm::PSimHitContainer &rpcHits) |
void | simulateNoise (const RPCRoll *) |
~RPCSimSimple () | |
Private Member Functions | |
void | init () |
Private Attributes | |
RPCSynchronizer * | _rpcSync |
CLHEP::RandFlat * | flatDistribution |
double | gate |
int | N_hits |
int | nbxing |
CLHEP::RandPoissonQ * | poissonDistribution_ |
double | rate |
CLHEP::HepRandomEngine * | rndEngine |
Definition at line 21 of file RPCSimSimple.h.
RPCSimSimple::RPCSimSimple | ( | const edm::ParameterSet & | config | ) |
Definition at line 28 of file RPCSimSimple.cc.
References _rpcSync, Exception, flatDistribution, gate, edm::ParameterSet::getParameter(), nbxing, rate, and rndEngine.
00028 : RPCSim(config){ 00029 00030 rate=config.getParameter<double>("Rate"); 00031 nbxing=config.getParameter<int>("Nbxing"); 00032 gate=config.getParameter<double>("Gate"); 00033 00034 edm::Service<edm::RandomNumberGenerator> rng; 00035 if ( ! rng.isAvailable()) { 00036 throw cms::Exception("Configuration") 00037 << "RPCDigitizer requires the RandomNumberGeneratorService\n" 00038 "which is not present in the configuration file. You must add the service\n" 00039 "in the configuration file or remove the modules that require it."; 00040 } 00041 00042 _rpcSync = new RPCSynchronizer(config); 00043 00044 rndEngine = &(rng->getEngine()); 00045 flatDistribution = new CLHEP::RandFlat(rndEngine); 00046 00047 }
RPCSimSimple::~RPCSimSimple | ( | ) |
void RPCSimSimple::simulate | ( | const RPCRoll * | roll, | |
const edm::PSimHitContainer & | rpcHits | |||
) | [virtual] |
Implements RPCSim.
Definition at line 50 of file RPCSimSimple.cc.
References _rpcSync, edm::DetSet< T >::clear(), RPCSim::getRPCSimSetUp(), RPCSynchronizer::getSimHitBx(), RPCRoll::id(), DetId::rawId(), RPCSynchronizer::setRPCSimSetUp(), RPCRoll::specs(), RPCSim::strips, RPCSim::theDetectorHitMap, RPCSim::theRpcDigiSimLinks, and RPCRollSpecs::topology().
00052 { 00053 _rpcSync->setRPCSimSetUp(getRPCSimSetUp()); 00054 theRpcDigiSimLinks.clear(); 00055 theDetectorHitMap.clear(); 00056 theRpcDigiSimLinks = RPCDigiSimLinks(roll->id().rawId()); 00057 00058 const Topology& topology=roll->specs()->topology(); 00059 for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin(); 00060 _hit != rpcHits.end(); ++_hit){ 00061 00062 00063 // Here I hould check if the RPC are up side down; 00064 const LocalPoint& entr=_hit->entryPoint(); 00065 int time_hit = _rpcSync->getSimHitBx(&(*_hit)); 00066 // const LocalPoint& exit=_hit->exitPoint(); 00067 00068 std::pair<int, int> digi(topology.channel(entr)+1, 00069 time_hit); 00070 00071 theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit))); 00072 strips.insert(digi); 00073 } 00074 }
Implements RPCSim.
Definition at line 78 of file RPCSimSimple.cc.
References flatDistribution, gate, i, RPCRoll::id(), TrapezoidalStripTopology::localPosition(), RectangularStripTopology::localPosition(), N_hits, nbxing, RPCRoll::nstrips(), poissonDistribution_, rate, RPCDetId::region(), rndEngine, strip(), RectangularStripTopology::stripLength(), TrapezoidalStripTopology::stripLength(), RPCSim::strips, RPCRoll::topology(), and x.
00079 { 00080 00081 RPCDetId rpcId = roll->id(); 00082 int nstrips = roll->nstrips(); 00083 double area = 0.0; 00084 00085 if ( rpcId.region() == 0 ) 00086 { 00087 const RectangularStripTopology* top_ = dynamic_cast<const 00088 RectangularStripTopology*>(&(roll->topology())); 00089 float xmin = (top_->localPosition(0.)).x(); 00090 float xmax = (top_->localPosition((float)roll->nstrips())).x(); 00091 float striplength = (top_->stripLength()); 00092 area = striplength*(xmax-xmin); 00093 } 00094 else 00095 { 00096 const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology())); 00097 float xmin = (top_->localPosition(0.)).x(); 00098 float xmax = (top_->localPosition((float)roll->nstrips())).x(); 00099 float striplength = (top_->stripLength()); 00100 area = striplength*(xmax-xmin); 00101 } 00102 00103 double ave = rate*nbxing*gate*area*1.0e-9; 00104 poissonDistribution_ = new CLHEP::RandPoissonQ(rndEngine, ave); 00105 N_hits = poissonDistribution_->fire(); 00106 00107 for (int i = 0; i < N_hits; i++ ){ 00108 00109 flatDistribution = new CLHEP::RandFlat(rndEngine, 1, nstrips); 00110 int strip = static_cast<int>(flatDistribution->fire()); 00111 int time_hit; 00112 00113 flatDistribution = new CLHEP::RandFlat(rndEngine, (nbxing*gate)/gate); 00114 time_hit = (static_cast<int>(flatDistribution->fire())) - nbxing/2; 00115 00116 std::pair<int, int> digi(strip,time_hit); 00117 strips.insert(digi); 00118 } 00119 00120 }
RPCSynchronizer* RPCSimSimple::_rpcSync [private] |
CLHEP::RandFlat* RPCSimSimple::flatDistribution [private] |
double RPCSimSimple::gate [private] |
int RPCSimSimple::N_hits [private] |
int RPCSimSimple::nbxing [private] |
CLHEP::RandPoissonQ* RPCSimSimple::poissonDistribution_ [private] |
double RPCSimSimple::rate [private] |
CLHEP::HepRandomEngine* RPCSimSimple::rndEngine [private] |