00001 #include "Geometry/RPCGeometry/interface/RPCRoll.h" 00002 #include "Geometry/RPCGeometry/interface/RPCRollSpecs.h" 00003 #include "SimMuon/RPCDigitizer/src/RPCSimTriv.h" 00004 #include "Geometry/CommonTopologies/interface/RectangularStripTopology.h" 00005 #include "Geometry/CommonTopologies/interface/TrapezoidalStripTopology.h" 00006 #include "Geometry/RPCGeometry/interface/RPCGeometry.h" 00007 #include "SimMuon/RPCDigitizer/src/RPCSimSetUp.h" 00008 00009 #include "FWCore/ServiceRegistry/interface/Service.h" 00010 #include "FWCore/Utilities/interface/RandomNumberGenerator.h" 00011 #include "FWCore/Utilities/interface/Exception.h" 00012 #include "CLHEP/Random/RandomEngine.h" 00013 #include "CLHEP/Random/RandFlat.h" 00014 #include <cmath> 00015 #include <utility> 00016 #include <map> 00017 00018 //#include "CLHEP/config/CLHEP.h" 00019 #include "CLHEP/Random/Random.h" 00020 #include "CLHEP/Random/RandFlat.h" 00021 #include "CLHEP/Random/RandPoissonQ.h" 00022 00023 00024 RPCSimTriv::RPCSimTriv(const edm::ParameterSet& config) : RPCSim(config){ 00025 00026 rate=config.getParameter<double>("Rate"); 00027 nbxing=config.getParameter<int>("Nbxing"); 00028 gate=config.getParameter<double>("Gate"); 00029 00030 _rpcSync = new RPCSynchronizer(config); 00031 } 00032 00033 void RPCSimTriv::setRandomEngine(CLHEP::HepRandomEngine& eng){ 00034 flatDistribution1 = new CLHEP::RandFlat(eng); 00035 flatDistribution2 = new CLHEP::RandFlat(eng); 00036 poissonDistribution = new CLHEP::RandPoissonQ(eng); 00037 _rpcSync->setRandomEngine(eng); 00038 } 00039 00040 RPCSimTriv::~RPCSimTriv(){ 00041 delete flatDistribution1; 00042 delete flatDistribution2; 00043 delete poissonDistribution; 00044 delete _rpcSync; 00045 } 00046 00047 void 00048 RPCSimTriv::simulate(const RPCRoll* roll, 00049 const edm::PSimHitContainer& rpcHits) 00050 { 00051 00052 //_rpcSync->setRPCSimSetUp(getRPCSimSetUp()); 00053 theRpcDigiSimLinks.clear(); 00054 theDetectorHitMap.clear(); 00055 theRpcDigiSimLinks = RPCDigiSimLinks(roll->id().rawId()); 00056 00057 const Topology& topology=roll->specs()->topology(); 00058 for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin(); 00059 _hit != rpcHits.end(); ++_hit){ 00060 00061 int type = _hit->particleType(); 00062 if (type == 13 || type == -13){ 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 // please keep hit time always 0 for this model 00067 int time_hit = 0; 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 } 00075 } 00076 00077 00078 void RPCSimTriv::simulateNoise(const RPCRoll* roll) 00079 { 00080 // plase keep it empty for this model 00081 return; 00082 } 00083