#include <RPCSimAverageNoiseEffCls.h>
Public Member Functions | |
int | getClSize (float posX) |
int | getClSize (uint32_t id, float posX) |
RPCSimAverageNoiseEffCls (const edm::ParameterSet &config) | |
void | setRandomEngine (CLHEP::HepRandomEngine &eng) |
void | simulate (const RPCRoll *roll, const edm::PSimHitContainer &rpcHits) |
void | simulateNoise (const RPCRoll *) |
~RPCSimAverageNoiseEffCls () | |
Private Member Functions | |
void | init () |
Private Attributes | |
RPCSynchronizer * | _rpcSync |
double | aveCls |
double | aveEff |
std::vector< double > | clsForDetId |
std::map< int, std::vector < double > > | clsMap |
double | dtimCs |
CLHEP::RandFlat * | flatDistribution |
CLHEP::RandFlat * | flatDistribution2 |
double | frate |
double | gate |
std::ifstream * | infile |
double | lbGate |
int | N_hits |
int | nbxing |
CLHEP::RandPoissonQ * | poissonDistribution_ |
double | rate |
double | resEle |
double | resRPC |
bool | rpcdigiprint |
double | sspeed |
std::vector< double > | sum_clsize |
double | timOff |
Definition at line 31 of file RPCSimAverageNoiseEffCls.h.
RPCSimAverageNoiseEffCls::RPCSimAverageNoiseEffCls | ( | const edm::ParameterSet & | config | ) |
Definition at line 50 of file RPCSimAverageNoiseEffCls.cc.
References _rpcSync, aveCls, aveEff, gather_cfg::cout, dtimCs, frate, 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"); frate=config.getParameter<double>("Frate"); 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); }
RPCSimAverageNoiseEffCls::~RPCSimAverageNoiseEffCls | ( | ) |
Definition at line 91 of file RPCSimAverageNoiseEffCls.cc.
References _rpcSync, flatDistribution, flatDistribution2, and poissonDistribution_.
{ //Deleting the distribution defined in the constructor delete flatDistribution; delete flatDistribution2; delete poissonDistribution_; delete _rpcSync; }
int RPCSimAverageNoiseEffCls::getClSize | ( | float | posX | ) |
Definition at line 150 of file RPCSimAverageNoiseEffCls.cc.
References clsMap, flatDistribution, RPCSimSetUp::getClsMap(), RPCSim::getRPCSimSetUp(), min, and sum_clsize.
Referenced by simulate().
{ std::map< int, std::vector<double> > clsMap = getRPCSimSetUp()->getClsMap(); int cnt = 1; int min = 1; double func=0.0; std::vector<double> sum_clsize; double rr_cl = flatDistribution->fire(1); if(0.0 <= posX && posX < 0.2) { func = (clsMap[1])[(clsMap[1]).size()-1]*(rr_cl); sum_clsize = clsMap[1]; } if(0.2 <= posX && posX < 0.4) { func = (clsMap[2])[(clsMap[2]).size()-1]*(rr_cl); sum_clsize = clsMap[2]; } if(0.4 <= posX && posX < 0.6) { func = (clsMap[3])[(clsMap[3]).size()-1]*(rr_cl); sum_clsize = clsMap[3]; } if(0.6 <= posX && posX < 0.8) { func = (clsMap[4])[(clsMap[4]).size()-1]*(rr_cl); sum_clsize = clsMap[4]; } if(0.8 <= posX && posX < 1.0) { func = (clsMap[5])[(clsMap[5]).size()-1]*(rr_cl); sum_clsize = clsMap[5]; } for(vector<double>::iterator iter = sum_clsize.begin(); iter != sum_clsize.end(); ++iter){ cnt++; if(func > (*iter)){ min = cnt; } else if(func < (*iter)){ break; } } return min; }
int RPCSimAverageNoiseEffCls::getClSize | ( | uint32_t | id, |
float | posX | ||
) |
Definition at line 101 of file RPCSimAverageNoiseEffCls.cc.
References clsForDetId, flatDistribution, RPCSimSetUp::getCls(), RPCSim::getRPCSimSetUp(), i, min, and sum_clsize.
{ std::vector<double> clsForDetId = getRPCSimSetUp()->getCls(id); int cnt = 1; int min = 1; double func=0.0; std::vector<double> sum_clsize; sum_clsize.clear(); sum_clsize = clsForDetId; int vectOffset(0); double rr_cl = flatDistribution->fire(1); if(0.0 <= posX && posX < 0.2) { func = clsForDetId[19]*(rr_cl); vectOffset = 0; } if(0.2 <= posX && posX < 0.4) { func = clsForDetId[39]*(rr_cl); vectOffset = 20; } if(0.4 <= posX && posX < 0.6) { func = clsForDetId[59]*(rr_cl); vectOffset = 40; } if(0.6 <= posX && posX < 0.8) { func = clsForDetId[79]*(rr_cl); vectOffset = 60; } if(0.8 <= posX && posX < 1.0) { func = clsForDetId[89]*(rr_cl); vectOffset = 80; } for(int i = vectOffset; i<(vectOffset+20); i++){ cnt++; if(func > clsForDetId[i]){ min = cnt; } else if(func < clsForDetId[i]){ break; } } return min; }
void RPCSimAverageNoiseEffCls::init | ( | void | ) | [inline, private, virtual] |
void RPCSimAverageNoiseEffCls::setRandomEngine | ( | CLHEP::HepRandomEngine & | eng | ) | [virtual] |
Implements RPCSim.
Definition at line 84 of file RPCSimAverageNoiseEffCls.cc.
References _rpcSync, flatDistribution, flatDistribution2, poissonDistribution_, and RPCSynchronizer::setRandomEngine().
{ flatDistribution = new CLHEP::RandFlat(eng); flatDistribution2 = new CLHEP::RandFlat(eng); poissonDistribution_ = new CLHEP::RandPoissonQ(eng); _rpcSync->setRandomEngine(eng); }
void RPCSimAverageNoiseEffCls::simulate | ( | const RPCRoll * | roll, |
const edm::PSimHitContainer & | rpcHits | ||
) | [virtual] |
Implements RPCSim.
Definition at line 196 of file RPCSimAverageNoiseEffCls.cc.
References _rpcSync, RPCRoll::centreOfStrip(), Topology::channel(), edm::DetSet< T >::clear(), alignCSCRings::e, flatDistribution, getClSize(), RPCSim::getRPCSimSetUp(), RPCSynchronizer::getSimHitBx(), i, RPCRoll::id(), RPCRoll::nstrips(), DetId::rawId(), RPCSynchronizer::setRPCSimSetUp(), RPCRoll::specs(), RPCRoll::strip(), RPCSim::strips, RPCSim::theDetectorHitMap, RPCSim::theRpcDigiSimLinks, RPCRollSpecs::topology(), w(), and PV3DBase< T, PVType, FrameType >::x().
{ _rpcSync->setRPCSimSetUp(getRPCSimSetUp()); theRpcDigiSimLinks.clear(); theDetectorHitMap.clear(); theRpcDigiSimLinks = RPCDigiSimLinks(roll->id().rawId()); RPCDetId rpcId = roll->id(); RPCGeomServ RPCname(rpcId); //std::string nameRoll = RPCname.name(); const Topology& topology=roll->specs()->topology(); for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin(); _hit != rpcHits.end(); ++_hit){ if(_hit-> particleType() == 11) continue; // Here I hould check if the RPC are up side down; const LocalPoint& entr=_hit->entryPoint(); int time_hit = _rpcSync->getSimHitBx(&(*_hit)); float posX = roll->strip(_hit->localPosition()) - static_cast<int>(roll->strip(_hit->localPosition())); std::vector<float> veff = (getRPCSimSetUp())->getEff(rpcId.rawId()); // Effinciecy int centralStrip = topology.channel(entr)+1;; float fire = flatDistribution->fire(1); if (fire < veff[centralStrip-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 = this->getClSize(posX); // This is for one and the same cls for all the chambers int clsize = this->getClSize(rpcId.rawId(),posX); // This is for cluster size chamber by chamber 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); } 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 if(*i != centralStrip){ if(flatDistribution->fire(1) < veff[*i-1]){ std::pair<int, int> digi(*i,time_hit); strips.insert(digi); theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit))); } } else { std::pair<int, int> digi(*i,time_hit); theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit))); strips.insert(digi); } } } } }
void RPCSimAverageNoiseEffCls::simulateNoise | ( | const RPCRoll * | roll | ) | [virtual] |
Implements RPCSim.
Definition at line 290 of file RPCSimAverageNoiseEffCls.cc.
References compareJSON::const, flatDistribution2, frate, gate, RPCSim::getRPCSimSetUp(), i, RPCRoll::id(), j, N_hits, nbxing, RPCRoll::nstrips(), poissonDistribution_, DetId::rawId(), RPCDetId::region(), RPCSim::strips, RPCRoll::topology(), and x.
{ RPCDetId rpcId = roll->id(); RPCGeomServ RPCname(rpcId); //std::string nameRoll = RPCname.name(); std::vector<float> vnoise = (getRPCSimSetUp())->getNoise(rpcId.rawId()); std::vector<float> veff = (getRPCSimSetUp())->getEff(rpcId.rawId()); unsigned 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); } for(unsigned int j = 0; j < vnoise.size(); ++j){ if(j >= nstrips) break; // The efficiency of 0% does not imply on the noise rate. // If the strip is masked the noise rate should be 0 Hz/cm^2 // if(veff[j] == 0) continue; // double ave = vnoise[j]*nbxing*gate*area*1.0e-9*frate; // The vnoise is the noise rate per strip, so we shout multiply not // by the chamber area, // but the strip area which is area/((float)roll->nstrips())); double ave = vnoise[j]*nbxing*gate*area*1.0e-9*frate/((float)roll->nstrips()); N_hits = poissonDistribution_->fire(ave); for (int i = 0; i < N_hits; i++ ){ int time_hit = (static_cast<int>(flatDistribution2->fire((nbxing*gate)/gate))) - nbxing/2; std::pair<int, int> digi(j+1,time_hit); strips.insert(digi); } } }
Definition at line 71 of file RPCSimAverageNoiseEffCls.h.
Referenced by RPCSimAverageNoiseEffCls(), setRandomEngine(), simulate(), and ~RPCSimAverageNoiseEffCls().
double RPCSimAverageNoiseEffCls::aveCls [private] |
Definition at line 51 of file RPCSimAverageNoiseEffCls.h.
Referenced by RPCSimAverageNoiseEffCls().
double RPCSimAverageNoiseEffCls::aveEff [private] |
Definition at line 48 of file RPCSimAverageNoiseEffCls.h.
Referenced by RPCSimAverageNoiseEffCls().
std::vector<double> RPCSimAverageNoiseEffCls::clsForDetId [private] |
Definition at line 68 of file RPCSimAverageNoiseEffCls.h.
Referenced by getClSize().
std::map< int, std::vector<double> > RPCSimAverageNoiseEffCls::clsMap [private] |
Definition at line 66 of file RPCSimAverageNoiseEffCls.h.
Referenced by getClSize().
double RPCSimAverageNoiseEffCls::dtimCs [private] |
Definition at line 54 of file RPCSimAverageNoiseEffCls.h.
Referenced by RPCSimAverageNoiseEffCls().
CLHEP::RandFlat* RPCSimAverageNoiseEffCls::flatDistribution [private] |
Definition at line 75 of file RPCSimAverageNoiseEffCls.h.
Referenced by getClSize(), setRandomEngine(), simulate(), and ~RPCSimAverageNoiseEffCls().
CLHEP::RandFlat* RPCSimAverageNoiseEffCls::flatDistribution2 [private] |
Definition at line 78 of file RPCSimAverageNoiseEffCls.h.
Referenced by setRandomEngine(), simulateNoise(), and ~RPCSimAverageNoiseEffCls().
double RPCSimAverageNoiseEffCls::frate [private] |
Definition at line 64 of file RPCSimAverageNoiseEffCls.h.
Referenced by RPCSimAverageNoiseEffCls(), and simulateNoise().
double RPCSimAverageNoiseEffCls::gate [private] |
Definition at line 63 of file RPCSimAverageNoiseEffCls.h.
Referenced by RPCSimAverageNoiseEffCls(), and simulateNoise().
std::ifstream* RPCSimAverageNoiseEffCls::infile [private] |
Definition at line 69 of file RPCSimAverageNoiseEffCls.h.
double RPCSimAverageNoiseEffCls::lbGate [private] |
Definition at line 57 of file RPCSimAverageNoiseEffCls.h.
Referenced by RPCSimAverageNoiseEffCls().
int RPCSimAverageNoiseEffCls::N_hits [private] |
Definition at line 60 of file RPCSimAverageNoiseEffCls.h.
Referenced by simulateNoise().
int RPCSimAverageNoiseEffCls::nbxing [private] |
Definition at line 61 of file RPCSimAverageNoiseEffCls.h.
Referenced by RPCSimAverageNoiseEffCls(), and simulateNoise().
CLHEP::RandPoissonQ* RPCSimAverageNoiseEffCls::poissonDistribution_ [private] |
Definition at line 79 of file RPCSimAverageNoiseEffCls.h.
Referenced by setRandomEngine(), simulateNoise(), and ~RPCSimAverageNoiseEffCls().
double RPCSimAverageNoiseEffCls::rate [private] |
Definition at line 62 of file RPCSimAverageNoiseEffCls.h.
Referenced by RPCSimAverageNoiseEffCls().
double RPCSimAverageNoiseEffCls::resEle [private] |
Definition at line 55 of file RPCSimAverageNoiseEffCls.h.
Referenced by RPCSimAverageNoiseEffCls().
double RPCSimAverageNoiseEffCls::resRPC [private] |
Definition at line 52 of file RPCSimAverageNoiseEffCls.h.
Referenced by RPCSimAverageNoiseEffCls().
bool RPCSimAverageNoiseEffCls::rpcdigiprint [private] |
Definition at line 58 of file RPCSimAverageNoiseEffCls.h.
Referenced by RPCSimAverageNoiseEffCls().
double RPCSimAverageNoiseEffCls::sspeed [private] |
Definition at line 56 of file RPCSimAverageNoiseEffCls.h.
Referenced by RPCSimAverageNoiseEffCls().
std::vector<double> RPCSimAverageNoiseEffCls::sum_clsize [private] |
Definition at line 67 of file RPCSimAverageNoiseEffCls.h.
Referenced by getClSize().
double RPCSimAverageNoiseEffCls::timOff [private] |
Definition at line 53 of file RPCSimAverageNoiseEffCls.h.
Referenced by RPCSimAverageNoiseEffCls().