CMS 3D CMS Logo

RPCSimSimple Class Reference

Class for the RPC strip response simulation based on a very simple model. More...

#include <SimMuon/RPCDigitizer/src/RPCSimSimple.h>

Inheritance diagram for RPCSimSimple:

RPCSim

List of all members.

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


Detailed Description

Class for the RPC strip response simulation based on a very simple model.

Author:
Marcello Maggi -- INFN Bari

Definition at line 21 of file RPCSimSimple.h.


Constructor & Destructor Documentation

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 (  ) 

Definition at line 76 of file RPCSimSimple.cc.

00076 {}


Member Function Documentation

void RPCSimSimple::init ( void   )  [inline, private, virtual]

Implements RPCSim.

Definition at line 33 of file RPCSimSimple.h.

00033 {};

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 }

void RPCSimSimple::simulateNoise ( const RPCRoll roll  )  [virtual]

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 }


Member Data Documentation

RPCSynchronizer* RPCSimSimple::_rpcSync [private]

Definition at line 33 of file RPCSimSimple.h.

Referenced by RPCSimSimple(), and simulate().

CLHEP::RandFlat* RPCSimSimple::flatDistribution [private]

Definition at line 42 of file RPCSimSimple.h.

Referenced by RPCSimSimple(), and simulateNoise().

double RPCSimSimple::gate [private]

Definition at line 39 of file RPCSimSimple.h.

Referenced by RPCSimSimple(), and simulateNoise().

int RPCSimSimple::N_hits [private]

Definition at line 36 of file RPCSimSimple.h.

Referenced by simulateNoise().

int RPCSimSimple::nbxing [private]

Definition at line 37 of file RPCSimSimple.h.

Referenced by RPCSimSimple(), and simulateNoise().

CLHEP::RandPoissonQ* RPCSimSimple::poissonDistribution_ [private]

Definition at line 43 of file RPCSimSimple.h.

Referenced by simulateNoise().

double RPCSimSimple::rate [private]

Definition at line 38 of file RPCSimSimple.h.

Referenced by RPCSimSimple(), and simulateNoise().

CLHEP::HepRandomEngine* RPCSimSimple::rndEngine [private]

Definition at line 41 of file RPCSimSimple.h.

Referenced by RPCSimSimple(), and simulateNoise().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:31:12 2009 for CMSSW by  doxygen 1.5.4