CMS 3D CMS Logo

RPCSimTriv Class Reference

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

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

Inheritance diagram for RPCSimTriv:

RPCSim

List of all members.

Public Member Functions

 RPCSimTriv (const edm::ParameterSet &config)
void simulate (const RPCRoll *roll, const edm::PSimHitContainer &rpcHits)
void simulateNoise (const RPCRoll *)
 ~RPCSimTriv ()

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 RPCSimTriv.h.


Constructor & Destructor Documentation

RPCSimTriv::RPCSimTriv ( const edm::ParameterSet config  ) 

Definition at line 24 of file RPCSimTriv.cc.

References _rpcSync, Exception, gate, edm::ParameterSet::getParameter(), nbxing, rate, and rndEngine.

00024                                                     : RPCSim(config){
00025 
00026   rate=config.getParameter<double>("Rate");
00027   nbxing=config.getParameter<int>("Nbxing");
00028   gate=config.getParameter<double>("Gate");
00029 
00030   edm::Service<edm::RandomNumberGenerator> rng;
00031   if ( ! rng.isAvailable()) {
00032     throw cms::Exception("Configuration")
00033       << "RPCDigitizer requires the RandomNumberGeneratorService\n"
00034       "which is not present in the configuration file.  You must add the service\n"
00035       "in the configuration file or remove the modules that require it.";
00036   }
00037   _rpcSync = new RPCSynchronizer(config);
00038 
00039   rndEngine = &(rng->getEngine());
00040 }

RPCSimTriv::~RPCSimTriv (  ) 

Definition at line 42 of file RPCSimTriv.cc.

00042 {}


Member Function Documentation

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

Implements RPCSim.

Definition at line 34 of file RPCSimTriv.h.

00034 {};

void RPCSimTriv::simulate ( const RPCRoll roll,
const edm::PSimHitContainer rpcHits 
) [virtual]

Implements RPCSim.

Definition at line 45 of file RPCSimTriv.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().

00047 {
00048 
00049   _rpcSync->setRPCSimSetUp(getRPCSimSetUp());
00050   theRpcDigiSimLinks.clear();
00051   theDetectorHitMap.clear();
00052   theRpcDigiSimLinks = RPCDigiSimLinks(roll->id().rawId());
00053 
00054   const Topology& topology=roll->specs()->topology();
00055   for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
00056        _hit != rpcHits.end(); ++_hit){
00057 
00058     int type = _hit->particleType();
00059     if (type == 13 || type == -13){
00060       // Here I hould check if the RPC are up side down;
00061       const LocalPoint& entr=_hit->entryPoint();
00062       int time_hit = _rpcSync->getSimHitBx(&(*_hit));
00063       std::pair<int, int> digi(topology.channel(entr)+1,
00064                                time_hit);
00065 
00066       theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit)));
00067       strips.insert(digi);
00068     }
00069   }
00070 }

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

Implements RPCSim.

Definition at line 73 of file RPCSimTriv.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.

00074 {
00075 
00076   RPCDetId rpcId = roll->id();
00077   int nstrips = roll->nstrips();
00078   double area = 0.0;
00079   
00080   if ( rpcId.region() == 0 )
00081     {
00082       const RectangularStripTopology* top_ = dynamic_cast<const
00083         RectangularStripTopology*>(&(roll->topology()));
00084       float xmin = (top_->localPosition(0.)).x();
00085       float xmax = (top_->localPosition((float)roll->nstrips())).x();
00086       float striplength = (top_->stripLength());
00087       area = striplength*(xmax-xmin);
00088     }
00089   else
00090     {
00091       const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
00092       float xmin = (top_->localPosition(0.)).x();
00093       float xmax = (top_->localPosition((float)roll->nstrips())).x();
00094       float striplength = (top_->stripLength());
00095       area = striplength*(xmax-xmin);
00096     }
00097   
00098   double ave = rate*nbxing*gate*area*1.0e-9;
00099   poissonDistribution_ = new CLHEP::RandPoissonQ(rndEngine, ave);
00100   N_hits = poissonDistribution_->fire();
00101 
00102   for (int i = 0; i < N_hits; i++ ){
00103 
00104     flatDistribution = new CLHEP::RandFlat(rndEngine, 1, nstrips);
00105     int strip = static_cast<int>(flatDistribution->fire());
00106     int time_hit;
00107 
00108     flatDistribution = new CLHEP::RandFlat(rndEngine, (nbxing*gate)/gate);
00109     time_hit = (static_cast<int>(flatDistribution->fire())) - nbxing/2;
00110     
00111     std::pair<int, int> digi(strip,time_hit);
00112     strips.insert(digi);
00113   }
00114 
00115 }


Member Data Documentation

RPCSynchronizer* RPCSimTriv::_rpcSync [private]

Definition at line 34 of file RPCSimTriv.h.

Referenced by RPCSimTriv(), and simulate().

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

Definition at line 44 of file RPCSimTriv.h.

Referenced by simulateNoise().

double RPCSimTriv::gate [private]

Definition at line 41 of file RPCSimTriv.h.

Referenced by RPCSimTriv(), and simulateNoise().

int RPCSimTriv::N_hits [private]

Definition at line 38 of file RPCSimTriv.h.

Referenced by simulateNoise().

int RPCSimTriv::nbxing [private]

Definition at line 39 of file RPCSimTriv.h.

Referenced by RPCSimTriv(), and simulateNoise().

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

Definition at line 45 of file RPCSimTriv.h.

Referenced by simulateNoise().

double RPCSimTriv::rate [private]

Definition at line 40 of file RPCSimTriv.h.

Referenced by RPCSimTriv(), and simulateNoise().

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

Definition at line 43 of file RPCSimTriv.h.

Referenced by RPCSimTriv(), 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