CMS 3D CMS Logo

RPCSimParam Class Reference

Class for the RPC strip response simulation based on a parametrized model (ORCA-based). More...

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

Inheritance diagram for RPCSimParam:

RPCSim

List of all members.

Public Member Functions

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

Private Member Functions

void init ()

Private Attributes

RPCSynchronizer_rpcSync
double aveCls
double aveEff
double dtimCs
CLHEP::RandFlat * flatDistribution
double gate
double lbGate
int N_hits
int nbxing
CLHEP::RandPoissonQ * poissonDistribution_
double rate
double resEle
double resRPC
CLHEP::HepRandomEngine * rndEngine
bool rpcdigiprint
double sspeed
double timOff


Detailed Description

Class for the RPC strip response simulation based on a parametrized model (ORCA-based).

Author:
Marcello Maggi -- INFN Bari

Definition at line 22 of file RPCSimParam.h.


Constructor & Destructor Documentation

RPCSimParam::RPCSimParam ( const edm::ParameterSet config  ) 

Definition at line 19 of file RPCSimParam.cc.

References _rpcSync, aveCls, aveEff, GenMuonPlsPt100GeV_cfg::cout, dtimCs, lat::endl(), Exception, flatDistribution, gate, edm::ParameterSet::getParameter(), edm::Service< T >::isAvailable(), lbGate, nbxing, rate, resEle, resRPC, rndEngine, rpcdigiprint, sspeed, and timOff.

00019                                                       : RPCSim(config){
00020   aveEff = config.getParameter<double>("averageEfficiency");
00021   aveCls = config.getParameter<double>("averageClusterSize");
00022   resRPC = config.getParameter<double>("timeResolution");
00023   timOff = config.getParameter<double>("timingRPCOffset");
00024   dtimCs = config.getParameter<double>("deltatimeAdjacentStrip");
00025   resEle = config.getParameter<double>("timeJitter");
00026   sspeed = config.getParameter<double>("signalPropagationSpeed");
00027   lbGate = config.getParameter<double>("linkGateWidth");
00028   rpcdigiprint = config.getParameter<bool>("printOutDigitizer");
00029 
00030   rate=config.getParameter<double>("Rate");
00031   nbxing=config.getParameter<int>("Nbxing");
00032   gate=config.getParameter<double>("Gate");
00033 
00034   if (rpcdigiprint) {
00035     std::cout <<"Average Efficiency        = "<<aveEff<<std::endl;
00036     std::cout <<"Average Cluster Size      = "<<aveCls<<" strips"<<std::endl;
00037     std::cout <<"RPC Time Resolution       = "<<resRPC<<" ns"<<std::endl;
00038     std::cout <<"RPC Signal formation time = "<<timOff<<" ns"<<std::endl;
00039     std::cout <<"RPC adjacent strip delay  = "<<dtimCs<<" ns"<<std::endl;
00040     std::cout <<"Electronic Jitter         = "<<resEle<<" ns"<<std::endl;
00041     std::cout <<"Signal propagation time   = "<<sspeed<<" x c"<<std::endl;
00042     std::cout <<"Link Board Gate Width     = "<<lbGate<<" ns"<<std::endl;
00043   }
00044   edm::Service<edm::RandomNumberGenerator> rng;
00045   if ( ! rng.isAvailable()) {
00046     throw cms::Exception("Configuration")
00047       << "RPCDigitizer requires the RandomNumberGeneratorService\n"
00048       "which is not present in the configuration file.  You must add the service\n"
00049       "in the configuration file or remove the modules that require it.";
00050   }
00051   
00052   _rpcSync = new RPCSynchronizer(config);
00053 
00054   rndEngine = &(rng->getEngine());
00055   flatDistribution = new CLHEP::RandFlat(rndEngine);
00056 }

RPCSimParam::~RPCSimParam (  ) 

Definition at line 130 of file RPCSimParam.cc.

00130 {}


Member Function Documentation

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

Implements RPCSim.

Definition at line 34 of file RPCSimParam.h.

00034 {};

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

Implements RPCSim.

Definition at line 60 of file RPCSimParam.cc.

References _rpcSync, aveCls, aveEff, RPCRoll::centreOfStrip(), edm::DetSet< T >::clear(), e, flatDistribution, RPCSim::getRPCSimSetUp(), RPCSynchronizer::getSimHitBx(), i, RPCRoll::id(), funct::log(), RPCRoll::nstrips(), DetId::rawId(), RPCSynchronizer::setRPCSimSetUp(), RPCRoll::specs(), RPCSim::strips, RPCSim::theDetectorHitMap, RPCSim::theRpcDigiSimLinks, RPCRollSpecs::topology(), w, and PV3DBase< T, PVType, FrameType >::x().

00062 {
00063   _rpcSync->setRPCSimSetUp(getRPCSimSetUp());
00064   theRpcDigiSimLinks.clear();
00065   theDetectorHitMap.clear();
00066   theRpcDigiSimLinks = RPCDigiSimLinks(roll->id().rawId());
00067 
00068   const Topology& topology=roll->specs()->topology();
00069 
00070   for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
00071        _hit != rpcHits.end(); ++_hit){
00072 
00073     // Here I hould check if the RPC are up side down;
00074     const LocalPoint& entr=_hit->entryPoint();
00075     int time_hit = _rpcSync->getSimHitBx(&(*_hit));
00076 
00077     // Effinciecy
00078     float eff = flatDistribution->fire(1);
00079     if (eff < aveEff) {
00080 
00081       int centralStrip = topology.channel(entr)+1;  
00082       int fstrip=centralStrip;
00083       int lstrip=centralStrip;
00084       // Compute the cluster size
00085       double w = flatDistribution->fire(1);
00086       if (w < 1.e-10) w=1.e-10;
00087       int clsize = static_cast<int>( -1.*aveCls*log(w)+1.);
00088       std::vector<int> cls;
00089       cls.push_back(centralStrip);
00090       if (clsize > 1){
00091         for (int cl = 0; cl < (clsize-1)/2; cl++)
00092           if (centralStrip - cl -1 >= 1  ){
00093             fstrip = centralStrip-cl-1;
00094             cls.push_back(fstrip);
00095           }
00096         for (int cl = 0; cl < (clsize-1)/2; cl++)
00097           if (centralStrip + cl + 1 <= roll->nstrips() ){
00098             lstrip = centralStrip+cl+1;
00099             cls.push_back(lstrip);
00100           }
00101         if (clsize%2 == 0 ){
00102           // insert the last strip according to the 
00103           // simhit position in the central strip 
00104           double deltaw=roll->centreOfStrip(centralStrip).x()-entr.x();
00105           if (deltaw<0.) {
00106             if (lstrip < roll->nstrips() ){
00107               lstrip++;
00108               cls.push_back(lstrip);
00109             }
00110           }else{
00111             if (fstrip > 1 ){
00112               fstrip--;
00113               cls.push_back(fstrip);
00114             }
00115           }
00116         }
00117       }
00118 
00119       for (std::vector<int>::iterator i=cls.begin(); i!=cls.end();i++){
00120         // Check the timing of the adjacent strip
00121         std::pair<unsigned int, int> digi(*i,time_hit);
00122 
00123         theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit)));
00124         strips.insert(digi);
00125       }
00126     }
00127   }
00128 }

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

Implements RPCSim.

Definition at line 132 of file RPCSimParam.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.

00133 {
00134 
00135   RPCDetId rpcId = roll->id();
00136   int nstrips = roll->nstrips();
00137   double area = 0.0;
00138   
00139   if ( rpcId.region() == 0 )
00140     {
00141       const RectangularStripTopology* top_ = dynamic_cast<const
00142         RectangularStripTopology*>(&(roll->topology()));
00143       float xmin = (top_->localPosition(0.)).x();
00144       float xmax = (top_->localPosition((float)roll->nstrips())).x();
00145       float striplength = (top_->stripLength());
00146       area = striplength*(xmax-xmin);
00147     }
00148   else
00149     {
00150       const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
00151       float xmin = (top_->localPosition(0.)).x();
00152       float xmax = (top_->localPosition((float)roll->nstrips())).x();
00153       float striplength = (top_->stripLength());
00154       area = striplength*(xmax-xmin);
00155     }
00156   
00157   double ave = rate*nbxing*gate*area*1.0e-9;
00158   poissonDistribution_ = new CLHEP::RandPoissonQ(rndEngine, ave);
00159   N_hits = poissonDistribution_->fire();
00160 
00161   for (int i = 0; i < N_hits; i++ ){
00162 
00163     flatDistribution = new CLHEP::RandFlat(rndEngine, 1, nstrips);
00164     int strip = static_cast<int>(flatDistribution->fire());
00165     int time_hit;
00166 
00167     flatDistribution = new CLHEP::RandFlat(rndEngine, (nbxing*gate)/gate);
00168     time_hit = (static_cast<int>(flatDistribution->fire())) - nbxing/2;
00169     
00170     std::pair<int, int> digi(strip,time_hit);
00171     strips.insert(digi);
00172   }
00173 
00174 }


Member Data Documentation

RPCSynchronizer* RPCSimParam::_rpcSync [private]

Definition at line 51 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulate().

double RPCSimParam::aveCls [private]

Definition at line 37 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulate().

double RPCSimParam::aveEff [private]

Definition at line 34 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulate().

double RPCSimParam::dtimCs [private]

Definition at line 40 of file RPCSimParam.h.

Referenced by RPCSimParam().

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

Definition at line 54 of file RPCSimParam.h.

Referenced by RPCSimParam(), simulate(), and simulateNoise().

double RPCSimParam::gate [private]

Definition at line 49 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulateNoise().

double RPCSimParam::lbGate [private]

Definition at line 43 of file RPCSimParam.h.

Referenced by RPCSimParam().

int RPCSimParam::N_hits [private]

Definition at line 46 of file RPCSimParam.h.

Referenced by simulateNoise().

int RPCSimParam::nbxing [private]

Definition at line 47 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulateNoise().

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

Definition at line 55 of file RPCSimParam.h.

Referenced by simulateNoise().

double RPCSimParam::rate [private]

Definition at line 48 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulateNoise().

double RPCSimParam::resEle [private]

Definition at line 41 of file RPCSimParam.h.

Referenced by RPCSimParam().

double RPCSimParam::resRPC [private]

Definition at line 38 of file RPCSimParam.h.

Referenced by RPCSimParam().

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

Definition at line 53 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulateNoise().

bool RPCSimParam::rpcdigiprint [private]

Definition at line 44 of file RPCSimParam.h.

Referenced by RPCSimParam().

double RPCSimParam::sspeed [private]

Definition at line 42 of file RPCSimParam.h.

Referenced by RPCSimParam().

double RPCSimParam::timOff [private]

Definition at line 39 of file RPCSimParam.h.

Referenced by RPCSimParam().


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