36 #include "CLHEP/Random/RandFlat.h"
37 #include "CLHEP/Random/RandPoissonQ.h"
58 std::cout <<
"Average Cluster Size = "<<aveCls<<
" strips"<<std::endl;
59 std::cout <<
"RPC Time Resolution = "<<resRPC<<
" ns"<<std::endl;
60 std::cout <<
"RPC Signal formation time = "<<timOff<<
" ns"<<std::endl;
61 std::cout <<
"RPC adjacent strip delay = "<<dtimCs<<
" ns"<<std::endl;
62 std::cout <<
"Electronic Jitter = "<<resEle<<
" ns"<<std::endl;
63 std::cout <<
"Signal propagation time = "<<sspeed<<
" x c"<<std::endl;
64 std::cout <<
"Link Board Gate Width = "<<lbGate<<
" ns"<<std::endl;
78 CLHEP::HepRandomEngine* engine)
92 for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
93 _hit != rpcHits.end(); ++_hit){
102 float posX = roll->
strip(_hit->localPosition()) - static_cast<int>(roll->
strip(_hit->localPosition()));
104 std::vector<float> veff = (
getRPCSimSetUp())->getEff(rpcId.rawId());
107 int centralStrip = topology.
channel(entr)+1;;
108 float fire = CLHEP::RandFlat::shoot(engine);
110 if (fire < veff[centralStrip-1]) {
112 int fstrip=centralStrip;
113 int lstrip=centralStrip;
119 int clsize = this->
getClSize(rpcId.rawId(),posX, engine);
120 std::vector<int> cls;
121 cls.push_back(centralStrip);
123 for (
int cl = 0;
cl < (clsize-1)/2;
cl++){
124 if (centralStrip -
cl -1 >= 1 ){
125 fstrip = centralStrip-
cl-1;
126 cls.push_back(fstrip);
128 if (centralStrip +
cl + 1 <= roll->
nstrips() ){
129 lstrip = centralStrip+
cl+1;
130 cls.push_back(lstrip);
138 if (lstrip < roll->nstrips() ){
140 cls.push_back(lstrip);
145 cls.push_back(fstrip);
151 for (std::vector<int>::iterator
i=cls.begin();
i!=cls.end();
i++){
153 if(*
i != centralStrip){
154 if(CLHEP::RandFlat::shoot(engine) < veff[*
i-1]){
155 std::pair<int, int> digi(*
i,time_hit);
165 std::pair<int, int> digi(*
i,time_hit);
178 CLHEP::HepRandomEngine* engine)
191 unsigned int nstrips = roll->
nstrips();
194 if ( rpcId.
region() == 0 )
201 area = striplength*(xmax-
xmin);
209 area = striplength*(xmax-
xmin);
212 for(
unsigned int j = 0;
j < vnoise.size(); ++
j){
214 if(
j >= nstrips)
break;
219 CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
220 N_hits = randPoissonQ.fire();
224 double precise_time = CLHEP::RandFlat::shoot(engine, (
nbxing*
gate)/gate);
225 int time_hit = (
static_cast<int>(precise_time)) -
nbxing/2;
252 double rr_cl = CLHEP::RandFlat::shoot(engine);
254 if(0.0 <= posX && posX < 0.2) {
255 func = clsForDetId[19]*(rr_cl);
258 if(0.2 <= posX && posX < 0.4) {
259 func = clsForDetId[39]*(rr_cl);
262 if(0.4 <= posX && posX < 0.6) {
263 func = clsForDetId[59]*(rr_cl);
266 if(0.6 <= posX && posX < 0.8) {
267 func = clsForDetId[79]*(rr_cl);
270 if(0.8 <= posX && posX < 1.0) {
271 func = clsForDetId[89]*(rr_cl);
276 for(
int i = vectOffset;
i<(vectOffset+20);
i++){
278 if(func > clsForDetId[
i]){
281 else if(func < clsForDetId[i]){
T getParameter(std::string const &) const
float strip(const LocalPoint &lp) const
LocalPoint centreOfStrip(int strip) const
const Topology & topology() const
virtual float stripLength() const
CaloTopology const * topology(0)
DetectorHitMap theDetectorHitMap
void setRPCSimSetUp(RPCSimSetUp *simsetup)
RPCSimSetUp * getRPCSimSetUp()
const RPCRollSpecs * specs() const
std::vector< double > clsForDetId
void simulateNoise(const RPCRoll *, CLHEP::HepRandomEngine *) override
void simulate(const RPCRoll *roll, const edm::PSimHitContainer &rpcHits, CLHEP::HepRandomEngine *) override
uint32_t rawId() const
get the raw id
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
Container::value_type value_type
double getSmearedTime() const
std::vector< double > sum_clsize
const std::vector< double > & getCls(uint32_t id)
virtual int channel(const LocalPoint &p) const =0
int getClSize(uint32_t id, float posX, CLHEP::HepRandomEngine *)
RPCSimModelTiming(const edm::ParameterSet &config)
std::set< RPCDigi > irpc_digis
virtual LocalPoint localPosition(float strip) const
RPCSynchronizer * _rpcSync
std::vector< PSimHit > PSimHitContainer
virtual LocalPoint localPosition(float strip) const
virtual float stripLength() const
det heigth (strip length in the middle)
RPCDigiSimLinks theRpcDigiSimLinks
void setTime(double time)
int getSimHitBxAndTimingForIRPC(const PSimHit *, CLHEP::HepRandomEngine *)
const Topology & topology() const
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.