34 #include "CLHEP/Random/RandFlat.h"
35 #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;
84 double rr_cl = CLHEP::RandFlat::shoot(engine);
85 if(0.0 <= posX && posX < 0.2) {
86 func = (clsMap[1])[(clsMap[1]).size()-1]*(rr_cl);
87 sum_clsize = clsMap[1];
89 if(0.2 <= posX && posX < 0.4) {
90 func = (clsMap[2])[(clsMap[2]).size()-1]*(rr_cl);
91 sum_clsize = clsMap[2];
93 if(0.4 <= posX && posX < 0.6) {
94 func = (clsMap[3])[(clsMap[3]).size()-1]*(rr_cl);
95 sum_clsize = clsMap[3];
97 if(0.6 <= posX && posX < 0.8) {
98 func = (clsMap[4])[(clsMap[4]).size()-1]*(rr_cl);
99 sum_clsize = clsMap[4];
101 if(0.8 <= posX && posX < 1.0) {
102 func = (clsMap[5])[(clsMap[5]).size()-1]*(rr_cl);
103 sum_clsize = clsMap[5];
106 for(vector<double>::iterator
iter = sum_clsize.begin();
112 else if(func < (*
iter)){
123 CLHEP::HepRandomEngine* engine)
132 for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
133 _hit != rpcHits.end(); ++_hit){
140 float posX = roll->
strip(_hit->localPosition()) - static_cast<int>(roll->
strip(_hit->localPosition()));
145 if (CLHEP::RandFlat::shoot(engine) <
aveEff) {
147 int centralStrip = topology.channel(entr)+1;
148 int fstrip=centralStrip;
149 int lstrip=centralStrip;
151 double w = CLHEP::RandFlat::shoot(engine);
152 if (w < 1.
e-10) w=1.e-10;
153 int clsize = this->
getClSize(posX, engine);
155 std::vector<int> cls;
156 cls.push_back(centralStrip);
158 for (
int cl = 0;
cl < (clsize-1)/2;
cl++)
159 if (centralStrip -
cl -1 >= 1 ){
160 fstrip = centralStrip-
cl-1;
161 cls.push_back(fstrip);
163 for (
int cl = 0;
cl < (clsize-1)/2;
cl++)
164 if (centralStrip +
cl + 1 <= roll->
nstrips() ){
165 lstrip = centralStrip+
cl+1;
166 cls.push_back(lstrip);
173 if (lstrip < roll->nstrips() ){
175 cls.push_back(lstrip);
180 cls.push_back(fstrip);
186 for (std::vector<int>::iterator
i=cls.begin();
i!=cls.end();
i++){
188 std::pair<int, int> digi(*
i,time_hit);
197 CLHEP::HepRandomEngine* engine)
204 if ( rpcId.
region() == 0 )
206 const RectangularStripTopology* top_ =
dynamic_cast<const
207 RectangularStripTopology*
>(&(roll->
topology()));
208 float xmin = (top_->localPosition(0.)).
x();
209 float xmax = (top_->localPosition((
float)roll->
nstrips())).x();
210 float striplength = (top_->stripLength());
211 area = striplength*(xmax-
xmin);
215 const TrapezoidalStripTopology* top_=
dynamic_cast<const TrapezoidalStripTopology*
>(&(roll->
topology()));
216 float xmin = (top_->localPosition(0.)).
x();
217 float xmax = (top_->localPosition((
float)roll->
nstrips())).x();
218 float striplength = (top_->stripLength());
219 area = striplength*(xmax-
xmin);
224 CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
225 N_hits = randPoissonQ.fire();
228 int strip =
static_cast<int>(CLHEP::RandFlat::shoot(engine, 1, nstrips));
230 time_hit = (
static_cast<int>(CLHEP::RandFlat::shoot(engine, (
nbxing*
gate)/gate))) -
nbxing/2;
231 std::pair<int, int> digi(strip,time_hit);
T getParameter(std::string const &) const
std::vector< double > sum_clsize
float strip(const LocalPoint &lp) const
void simulateNoise(const RPCRoll *, CLHEP::HepRandomEngine *) override
LocalPoint centreOfStrip(int strip) const
const Topology & topology() const
int getClSize(float posX, CLHEP::HepRandomEngine *)
CaloTopology const * topology(0)
DetectorHitMap theDetectorHitMap
void setRPCSimSetUp(RPCSimSetUp *simsetup)
RPCSimSetUp * getRPCSimSetUp()
void simulate(const RPCRoll *roll, const edm::PSimHitContainer &rpcHits, CLHEP::HepRandomEngine *) override
const RPCRollSpecs * specs() const
int getSimHitBx(const PSimHit *, CLHEP::HepRandomEngine *)
std::set< std::pair< int, int > > strips
uint32_t rawId() const
get the raw id
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
const std::map< int, std::vector< double > > & getClsMap()
Container::value_type value_type
RPCSynchronizer * _rpcSync
RPCSimAverage(const edm::ParameterSet &config)
std::vector< PSimHit > PSimHitContainer
RPCDigiSimLinks theRpcDigiSimLinks
std::map< int, std::vector< double > > clsMap
const Topology & topology() const
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.