15 #include "CLHEP/Random/RandomEngine.h"
16 #include "CLHEP/Random/RandFlat.h"
17 #include <CLHEP/Random/RandGaussQ.h>
18 #include <CLHEP/Random/RandFlat.h>
44 #include "CLHEP/Random/Random.h"
45 #include "CLHEP/Random/RandFlat.h"
46 #include "CLHEP/Random/RandPoissonQ.h"
71 std::cout <<
"Average Cluster Size = "<<aveCls<<
" strips"<<std::endl;
72 std::cout <<
"RPC Time Resolution = "<<resRPC<<
" ns"<<std::endl;
73 std::cout <<
"RPC Signal formation time = "<<timOff<<
" ns"<<std::endl;
74 std::cout <<
"RPC adjacent strip delay = "<<dtimCs<<
" ns"<<std::endl;
75 std::cout <<
"Electronic Jitter = "<<resEle<<
" ns"<<std::endl;
76 std::cout <<
"Signal propagation time = "<<sspeed<<
" x c"<<std::endl;
77 std::cout <<
"Link Board Gate Width = "<<lbGate<<
" ns"<<std::endl;
116 if(0.0 <= posX && posX < 0.2) {
117 func = clsForDetId[19]*(rr_cl);
120 if(0.2 <= posX && posX < 0.4) {
121 func = clsForDetId[39]*(rr_cl);
124 if(0.4 <= posX && posX < 0.6) {
125 func = clsForDetId[59]*(rr_cl);
128 if(0.6 <= posX && posX < 0.8) {
129 func = clsForDetId[79]*(rr_cl);
132 if(0.8 <= posX && posX < 1.0) {
133 func = clsForDetId[89]*(rr_cl);
138 for(
int i = vectOffset;
i<(vectOffset+20);
i++){
140 if(func > clsForDetId[
i]){
143 else if(func < clsForDetId[i]){
161 if(0.0 <= posX && posX < 0.2) {
162 func = (clsMap[1])[(clsMap[1]).size()-1]*(rr_cl);
163 sum_clsize = clsMap[1];
165 if(0.2 <= posX && posX < 0.4) {
166 func = (clsMap[2])[(clsMap[2]).size()-1]*(rr_cl);
167 sum_clsize = clsMap[2];
169 if(0.4 <= posX && posX < 0.6) {
170 func = (clsMap[3])[(clsMap[3]).size()-1]*(rr_cl);
171 sum_clsize = clsMap[3];
173 if(0.6 <= posX && posX < 0.8) {
174 func = (clsMap[4])[(clsMap[4]).size()-1]*(rr_cl);
175 sum_clsize = clsMap[4];
177 if(0.8 <= posX && posX < 1.0) {
178 func = (clsMap[5])[(clsMap[5]).size()-1]*(rr_cl);
179 sum_clsize = clsMap[5];
182 for(vector<double>::iterator iter = sum_clsize.begin();
183 iter != sum_clsize.end(); ++iter){
188 else if(func < (*iter)){
211 for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
212 _hit != rpcHits.end(); ++_hit){
214 if(_hit-> particleType() == 11)
continue;
220 float posX = roll->
strip(_hit->localPosition()) - static_cast<int>(roll->
strip(_hit->localPosition()));
222 std::vector<float> veff = (
getRPCSimSetUp())->getEff(rpcId.rawId());
225 int centralStrip = topology.
channel(entr)+1;;
228 if (fire < veff[centralStrip-1]) {
230 int fstrip=centralStrip;
231 int lstrip=centralStrip;
235 if (w < 1.
e-10) w=1.e-10;
237 int clsize = this->
getClSize(rpcId.rawId(),posX);
238 std::vector<int> cls;
239 cls.push_back(centralStrip);
241 for (
int cl = 0;
cl < (clsize-1)/2;
cl++){
242 if (centralStrip -
cl -1 >= 1 ){
243 fstrip = centralStrip-
cl-1;
244 cls.push_back(fstrip);
246 if (centralStrip +
cl + 1 <= roll->
nstrips() ){
247 lstrip = centralStrip+
cl+1;
248 cls.push_back(lstrip);
256 if (lstrip < roll->nstrips() ){
258 cls.push_back(lstrip);
263 cls.push_back(fstrip);
269 for (std::vector<int>::iterator
i=cls.begin();
i!=cls.end();
i++){
271 if(*
i != centralStrip){
273 std::pair<int, int> digi(*
i,time_hit);
280 std::pair<int, int> digi(*
i,time_hit);
301 unsigned int nstrips = roll->
nstrips();
304 if ( rpcId.
region() == 0 )
306 const RectangularStripTopology* top_ =
dynamic_cast<const
307 RectangularStripTopology*
>(&(roll->
topology()));
308 float xmin = (top_->localPosition(0.)).
x();
309 float xmax = (top_->localPosition((
float)roll->
nstrips())).x();
310 float striplength = (top_->stripLength());
311 area = striplength*(xmax-xmin);
315 const TrapezoidalStripTopology* top_=
dynamic_cast<const TrapezoidalStripTopology*
>(&(roll->
topology()));
316 float xmin = (top_->localPosition(0.)).
x();
317 float xmax = (top_->localPosition((
float)roll->
nstrips())).x();
318 float striplength = (top_->stripLength());
319 area = striplength*(xmax-xmin);
322 for(
unsigned int j = 0;
j < vnoise.size(); ++
j){
324 if(
j >= nstrips)
break;
342 std::pair<int, int> digi(
j+1,time_hit);
T getParameter(std::string const &) const
float strip(const LocalPoint &lp) const
LocalPoint centreOfStrip(int strip) const
const Topology & topology() const
CLHEP::RandFlat * flatDistribution2
DetectorHitMap theDetectorHitMap
void setRPCSimSetUp(RPCSimSetUp *simsetup)
RPCSimSetUp * getRPCSimSetUp()
std::vector< double > clsForDetId
const RPCRollSpecs * specs() const
CLHEP::RandFlat * flatDistribution
int getClSize(float posX)
~RPCSimAverageNoiseEffCls()
std::set< std::pair< int, int > > strips
uint32_t rawId() const
get the raw id
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
std::vector< double > sum_clsize
RPCSynchronizer * _rpcSync
const std::vector< double > & getCls(uint32_t id)
const std::map< int, std::vector< double > > & getClsMap()
virtual int channel(const LocalPoint &p) const =0
Container::value_type value_type
int getSimHitBx(const PSimHit *)
CLHEP::RandPoissonQ * poissonDistribution_
std::map< int, std::vector< double > > clsMap
void setRandomEngine(CLHEP::HepRandomEngine &eng)
void setRandomEngine(CLHEP::HepRandomEngine &eng)
void simulate(const RPCRoll *roll, const edm::PSimHitContainer &rpcHits)
RPCSimAverageNoiseEffCls(const edm::ParameterSet &config)
std::vector< PSimHit > PSimHitContainer
RPCDigiSimLinks theRpcDigiSimLinks
void simulateNoise(const RPCRoll *)
const Topology & topology() const
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.