36 #include "CLHEP/Random/RandFlat.h" 37 #include "CLHEP/Random/RandPoissonQ.h" 62 std::cout <<
"Average Cluster Size = "<<aveCls<<
" strips"<<std::endl;
63 std::cout <<
"RPC Time Resolution = "<<resRPC<<
" ns"<<std::endl;
64 std::cout <<
"RPC Signal formation time = "<<timOff<<
" ns"<<std::endl;
65 std::cout <<
"RPC adjacent strip delay = "<<dtimCs<<
" ns"<<std::endl;
66 std::cout <<
"Electronic Jitter = "<<resEle<<
" ns"<<std::endl;
67 std::cout <<
"Signal propagation time = "<<sspeed<<
" x c"<<std::endl;
68 std::cout <<
"Link Board Gate Width = "<<lbGate<<
" ns"<<std::endl;
90 double rr_cl = CLHEP::RandFlat::shoot(engine);
91 if(0.0 <= posX && posX < 0.2) {
92 func = (clsMap[1])[(clsMap[1]).size()-1]*(rr_cl);
93 sum_clsize = clsMap[1];
95 if(0.2 <= posX && posX < 0.4) {
96 func = (clsMap[2])[(clsMap[2]).size()-1]*(rr_cl);
97 sum_clsize = clsMap[2];
99 if(0.4 <= posX && posX < 0.6) {
100 func = (clsMap[3])[(clsMap[3]).size()-1]*(rr_cl);
101 sum_clsize = clsMap[3];
103 if(0.6 <= posX && posX < 0.8) {
104 func = (clsMap[4])[(clsMap[4]).size()-1]*(rr_cl);
105 sum_clsize = clsMap[4];
107 if(0.8 <= posX && posX < 1.0) {
108 func = (clsMap[5])[(clsMap[5]).size()-1]*(rr_cl);
109 sum_clsize = clsMap[5];
112 for(vector<double>::iterator iter = sum_clsize.begin();
113 iter != sum_clsize.end(); ++iter){
118 else if(func < (*iter)){
128 CLHEP::HepRandomEngine* engine)
142 for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
143 _hit != rpcHits.end(); ++_hit){
151 float posX = roll->
strip(_hit->localPosition()) - static_cast<int>(roll->
strip(_hit->localPosition()));
153 std::vector<float> veff = (
getRPCSimSetUp())->getEff(rpcId.rawId());
156 int centralStrip = topology.
channel(entr)+1;;
157 float fire = CLHEP::RandFlat::shoot(engine);
159 if (fire < veff[centralStrip-1]) {
161 int fstrip=centralStrip;
162 int lstrip=centralStrip;
167 int clsize = this->
getClSize(posX, engine);
169 std::vector<int> cls;
170 cls.push_back(centralStrip);
172 for (
int cl = 0;
cl < (clsize-1)/2;
cl++){
173 if (centralStrip -
cl -1 >= 1 ){
174 fstrip = centralStrip-
cl-1;
175 cls.push_back(fstrip);
177 if (centralStrip +
cl + 1 <= roll->
nstrips() ){
178 lstrip = centralStrip+
cl+1;
179 cls.push_back(lstrip);
187 if (lstrip < roll->nstrips() ){
189 cls.push_back(lstrip);
194 cls.push_back(fstrip);
200 for (std::vector<int>::iterator
i=cls.begin();
i!=cls.end();
i++){
202 if(*
i != centralStrip){
203 if(CLHEP::RandFlat::shoot(engine) < veff[*
i-1]){
204 std::pair<int, int> digi(*
i,time_hit);
211 std::pair<int, int> digi(*
i,time_hit);
222 CLHEP::HepRandomEngine* engine)
233 unsigned int nstrips = roll->
nstrips();
236 if ( rpcId.
region() == 0 )
243 area = striplength*(xmax-
xmin);
251 area = striplength*(xmax-
xmin);
254 for(
unsigned int j = 0;
j < vnoise.size(); ++
j){
256 if(
j >= nstrips)
break;
270 CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
271 N_hits = randPoissonQ.fire();
275 int time_hit = (
static_cast<int>(CLHEP::RandFlat::shoot(engine, (
nbxing*
gate)/gate))) -
nbxing/2;
276 std::pair<int, int> digi(
j+1,time_hit);
T getParameter(std::string const &) const
float strip(const LocalPoint &lp) const
std::vector< double > sum_clsize
LocalPoint centreOfStrip(int strip) const
const Topology & topology() const
int getClSize(float posX, CLHEP::HepRandomEngine *)
virtual float stripLength() const
CaloTopology const * topology(0)
DetectorHitMap theDetectorHitMap
void setRPCSimSetUp(RPCSimSetUp *simsetup)
RPCSimSetUp * getRPCSimSetUp()
const RPCRollSpecs * specs() const
int getSimHitBx(const PSimHit *, CLHEP::HepRandomEngine *)
RPCSimAverageNoiseEff(const edm::ParameterSet &config)
std::set< std::pair< int, int > > strips
uint32_t rawId() const
get the raw id
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
virtual std::string name()
Container::value_type value_type
void simulateNoise(const RPCRoll *, CLHEP::HepRandomEngine *) override
void simulate(const RPCRoll *roll, const edm::PSimHitContainer &rpcHits, CLHEP::HepRandomEngine *) override
const std::map< int, std::vector< double > > & getClsMap()
virtual int channel(const LocalPoint &p) const =0
virtual LocalPoint localPosition(float strip) const
RPCSynchronizer * _rpcSync
std::vector< PSimHit > PSimHitContainer
std::map< int, std::vector< double > > clsMap
virtual LocalPoint localPosition(float strip) const
virtual float stripLength() const
det heigth (strip length in the middle)
RPCDigiSimLinks theRpcDigiSimLinks
const Topology & topology() const
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.