#include <RPCSimParam.h>
Public Member Functions | |
RPCSimParam (const edm::ParameterSet &config) | |
void | setRandomEngine (CLHEP::HepRandomEngine &eng) |
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 * | flatDistribution1 |
CLHEP::RandFlat * | flatDistribution2 |
CLHEP::RandFlat * | flatDistribution_ |
double | gate |
double | lbGate |
int | N_hits |
int | nbxing |
CLHEP::RandPoissonQ * | poissonDistribution |
double | rate |
double | resEle |
double | resRPC |
bool | rpcdigiprint |
double | sspeed |
double | timOff |
Class for the RPC strip response simulation based on a parametrized model (ORCA-based)
Definition at line 22 of file RPCSimParam.h.
RPCSimParam::RPCSimParam | ( | const edm::ParameterSet & | config | ) |
Definition at line 19 of file RPCSimParam.cc.
References _rpcSync, aveCls, aveEff, gather_cfg::cout, dtimCs, gate, edm::ParameterSet::getParameter(), lbGate, nbxing, rate, resEle, resRPC, rpcdigiprint, sspeed, and timOff.
: RPCSim(config){ aveEff = config.getParameter<double>("averageEfficiency"); aveCls = config.getParameter<double>("averageClusterSize"); resRPC = config.getParameter<double>("timeResolution"); timOff = config.getParameter<double>("timingRPCOffset"); dtimCs = config.getParameter<double>("deltatimeAdjacentStrip"); resEle = config.getParameter<double>("timeJitter"); sspeed = config.getParameter<double>("signalPropagationSpeed"); lbGate = config.getParameter<double>("linkGateWidth"); rpcdigiprint = config.getParameter<bool>("printOutDigitizer"); rate=config.getParameter<double>("Rate"); nbxing=config.getParameter<int>("Nbxing"); gate=config.getParameter<double>("Gate"); if (rpcdigiprint) { std::cout <<"Average Efficiency = "<<aveEff<<std::endl; std::cout <<"Average Cluster Size = "<<aveCls<<" strips"<<std::endl; std::cout <<"RPC Time Resolution = "<<resRPC<<" ns"<<std::endl; std::cout <<"RPC Signal formation time = "<<timOff<<" ns"<<std::endl; std::cout <<"RPC adjacent strip delay = "<<dtimCs<<" ns"<<std::endl; std::cout <<"Electronic Jitter = "<<resEle<<" ns"<<std::endl; std::cout <<"Signal propagation time = "<<sspeed<<" x c"<<std::endl; std::cout <<"Link Board Gate Width = "<<lbGate<<" ns"<<std::endl; } _rpcSync = new RPCSynchronizer(config); }
RPCSimParam::~RPCSimParam | ( | ) |
Definition at line 57 of file RPCSimParam.cc.
References _rpcSync, flatDistribution1, flatDistribution2, flatDistribution_, and poissonDistribution.
{ delete flatDistribution_; delete flatDistribution1; delete flatDistribution2; delete poissonDistribution; delete _rpcSync; }
void RPCSimParam::init | ( | void | ) | [inline, private, virtual] |
void RPCSimParam::setRandomEngine | ( | CLHEP::HepRandomEngine & | eng | ) | [virtual] |
Implements RPCSim.
Definition at line 48 of file RPCSimParam.cc.
References _rpcSync, flatDistribution1, flatDistribution2, flatDistribution_, poissonDistribution, and RPCSynchronizer::setRandomEngine().
{ flatDistribution_ = new CLHEP::RandFlat(eng); flatDistribution1 = new CLHEP::RandFlat(eng); flatDistribution2 = new CLHEP::RandFlat(eng); poissonDistribution = new CLHEP::RandPoissonQ(eng); _rpcSync->setRandomEngine(eng); }
void RPCSimParam::simulate | ( | const RPCRoll * | roll, |
const edm::PSimHitContainer & | rpcHits | ||
) | [virtual] |
Implements RPCSim.
Definition at line 67 of file RPCSimParam.cc.
References _rpcSync, aveCls, aveEff, RPCRoll::centreOfStrip(), edm::DetSet< T >::clear(), 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(), and PV3DBase< T, PVType, FrameType >::x().
{ _rpcSync->setRPCSimSetUp(getRPCSimSetUp()); theRpcDigiSimLinks.clear(); theDetectorHitMap.clear(); theRpcDigiSimLinks = RPCDigiSimLinks(roll->id().rawId()); const Topology& topology=roll->specs()->topology(); for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin(); _hit != rpcHits.end(); ++_hit){ // Here I hould check if the RPC are up side down; const LocalPoint& entr=_hit->entryPoint(); int time_hit = _rpcSync->getSimHitBx(&(*_hit)); // Effinciecy float eff = flatDistribution_->fire(1); if (eff < aveEff) { int centralStrip = topology.channel(entr)+1; int fstrip=centralStrip; int lstrip=centralStrip; // Compute the cluster size double w = flatDistribution_->fire(1); if (w < 1.e-10) w=1.e-10; int clsize = static_cast<int>( -1.*aveCls*log(w)+1.); std::vector<int> cls; cls.push_back(centralStrip); if (clsize > 1){ for (int cl = 0; cl < (clsize-1)/2; cl++) if (centralStrip - cl -1 >= 1 ){ fstrip = centralStrip-cl-1; cls.push_back(fstrip); } for (int cl = 0; cl < (clsize-1)/2; cl++) if (centralStrip + cl + 1 <= roll->nstrips() ){ lstrip = centralStrip+cl+1; cls.push_back(lstrip); } if (clsize%2 == 0 ){ // insert the last strip according to the // simhit position in the central strip double deltaw=roll->centreOfStrip(centralStrip).x()-entr.x(); if (deltaw<0.) { if (lstrip < roll->nstrips() ){ lstrip++; cls.push_back(lstrip); } }else{ if (fstrip > 1 ){ fstrip--; cls.push_back(fstrip); } } } } for (std::vector<int>::iterator i=cls.begin(); i!=cls.end();i++){ // Check the timing of the adjacent strip std::pair<unsigned int, int> digi(*i,time_hit); theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit))); strips.insert(digi); } } } }
void RPCSimParam::simulateNoise | ( | const RPCRoll * | roll | ) | [virtual] |
Implements RPCSim.
Definition at line 138 of file RPCSimParam.cc.
References compareJSON::const, flatDistribution1, flatDistribution2, gate, i, RPCRoll::id(), TrapezoidalStripTopology::localPosition(), RectangularStripTopology::localPosition(), N_hits, nbxing, RPCRoll::nstrips(), poissonDistribution, rate, RPCDetId::region(), strip(), RectangularStripTopology::stripLength(), TrapezoidalStripTopology::stripLength(), RPCSim::strips, RPCRoll::topology(), and x.
{ RPCDetId rpcId = roll->id(); int nstrips = roll->nstrips(); double area = 0.0; if ( rpcId.region() == 0 ) { const RectangularStripTopology* top_ = dynamic_cast<const RectangularStripTopology*>(&(roll->topology())); float xmin = (top_->localPosition(0.)).x(); float xmax = (top_->localPosition((float)roll->nstrips())).x(); float striplength = (top_->stripLength()); area = striplength*(xmax-xmin); } else { const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology())); float xmin = (top_->localPosition(0.)).x(); float xmax = (top_->localPosition((float)roll->nstrips())).x(); float striplength = (top_->stripLength()); area = striplength*(xmax-xmin); } double ave = rate*nbxing*gate*area*1.0e-9; N_hits = poissonDistribution->fire(ave); for (int i = 0; i < N_hits; i++ ){ int strip = static_cast<int>(flatDistribution1->fire(1,nstrips)); int time_hit; time_hit = (static_cast<int>(flatDistribution2->fire((nbxing*gate)/gate))) - nbxing/2; std::pair<int, int> digi(strip,time_hit); strips.insert(digi); } }
RPCSynchronizer* RPCSimParam::_rpcSync [private] |
Definition at line 53 of file RPCSimParam.h.
Referenced by RPCSimParam(), setRandomEngine(), simulate(), and ~RPCSimParam().
double RPCSimParam::aveCls [private] |
Definition at line 39 of file RPCSimParam.h.
Referenced by RPCSimParam(), and simulate().
double RPCSimParam::aveEff [private] |
Definition at line 36 of file RPCSimParam.h.
Referenced by RPCSimParam(), and simulate().
double RPCSimParam::dtimCs [private] |
Definition at line 42 of file RPCSimParam.h.
Referenced by RPCSimParam().
CLHEP::RandFlat* RPCSimParam::flatDistribution1 [private] |
Definition at line 57 of file RPCSimParam.h.
Referenced by setRandomEngine(), simulateNoise(), and ~RPCSimParam().
CLHEP::RandFlat* RPCSimParam::flatDistribution2 [private] |
Definition at line 58 of file RPCSimParam.h.
Referenced by setRandomEngine(), simulateNoise(), and ~RPCSimParam().
CLHEP::RandFlat* RPCSimParam::flatDistribution_ [private] |
Definition at line 56 of file RPCSimParam.h.
Referenced by setRandomEngine(), simulate(), and ~RPCSimParam().
double RPCSimParam::gate [private] |
Definition at line 51 of file RPCSimParam.h.
Referenced by RPCSimParam(), and simulateNoise().
double RPCSimParam::lbGate [private] |
Definition at line 45 of file RPCSimParam.h.
Referenced by RPCSimParam().
int RPCSimParam::N_hits [private] |
Definition at line 48 of file RPCSimParam.h.
Referenced by simulateNoise().
int RPCSimParam::nbxing [private] |
Definition at line 49 of file RPCSimParam.h.
Referenced by RPCSimParam(), and simulateNoise().
CLHEP::RandPoissonQ* RPCSimParam::poissonDistribution [private] |
Definition at line 59 of file RPCSimParam.h.
Referenced by setRandomEngine(), simulateNoise(), and ~RPCSimParam().
double RPCSimParam::rate [private] |
Definition at line 50 of file RPCSimParam.h.
Referenced by RPCSimParam(), and simulateNoise().
double RPCSimParam::resEle [private] |
Definition at line 43 of file RPCSimParam.h.
Referenced by RPCSimParam().
double RPCSimParam::resRPC [private] |
Definition at line 40 of file RPCSimParam.h.
Referenced by RPCSimParam().
bool RPCSimParam::rpcdigiprint [private] |
Definition at line 46 of file RPCSimParam.h.
Referenced by RPCSimParam().
double RPCSimParam::sspeed [private] |
Definition at line 44 of file RPCSimParam.h.
Referenced by RPCSimParam().
double RPCSimParam::timOff [private] |
Definition at line 41 of file RPCSimParam.h.
Referenced by RPCSimParam().