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;
94 double rr_cl = CLHEP::RandFlat::shoot(engine);
96 if(0.0 <= posX && posX < 0.2) {
97 func = clsForDetId[19]*(rr_cl);
100 if(0.2 <= posX && posX < 0.4) {
101 func = clsForDetId[39]*(rr_cl);
104 if(0.4 <= posX && posX < 0.6) {
105 func = clsForDetId[59]*(rr_cl);
108 if(0.6 <= posX && posX < 0.8) {
109 func = clsForDetId[79]*(rr_cl);
112 if(0.8 <= posX && posX < 1.0) {
113 func = clsForDetId[89]*(rr_cl);
118 for(
int i = vectOffset;
i<(vectOffset+20);
i++){
120 if(func > clsForDetId[
i]){
123 else if(func < clsForDetId[i]){
140 double rr_cl = CLHEP::RandFlat::shoot(engine);
141 if(0.0 <= posX && posX < 0.2) {
142 func = (clsMap[1])[(clsMap[1]).size()-1]*(rr_cl);
143 sum_clsize = clsMap[1];
145 if(0.2 <= posX && posX < 0.4) {
146 func = (clsMap[2])[(clsMap[2]).size()-1]*(rr_cl);
147 sum_clsize = clsMap[2];
149 if(0.4 <= posX && posX < 0.6) {
150 func = (clsMap[3])[(clsMap[3]).size()-1]*(rr_cl);
151 sum_clsize = clsMap[3];
153 if(0.6 <= posX && posX < 0.8) {
154 func = (clsMap[4])[(clsMap[4]).size()-1]*(rr_cl);
155 sum_clsize = clsMap[4];
157 if(0.8 <= posX && posX < 1.0) {
158 func = (clsMap[5])[(clsMap[5]).size()-1]*(rr_cl);
159 sum_clsize = clsMap[5];
162 for(vector<double>::iterator iter = sum_clsize.begin();
163 iter != sum_clsize.end(); ++iter){
168 else if(func < (*iter)){
178 CLHEP::HepRandomEngine* engine)
191 for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
192 _hit != rpcHits.end(); ++_hit){
199 float posX = roll->
strip(_hit->localPosition()) - static_cast<int>(roll->
strip(_hit->localPosition()));
201 std::vector<float> veff = (
getRPCSimSetUp())->getEff(rpcId.rawId());
204 int centralStrip = topology.
channel(entr)+1;;
205 float fire = CLHEP::RandFlat::shoot(engine);
207 if (fire < veff[centralStrip-1]) {
209 int fstrip=centralStrip;
210 int lstrip=centralStrip;
217 std::vector<int> cls;
218 cls.push_back(centralStrip);
220 for (
int cl = 0;
cl < (clsize-1)/2;
cl++){
221 if (centralStrip -
cl -1 >= 1 ){
222 fstrip = centralStrip-
cl-1;
223 cls.push_back(fstrip);
225 if (centralStrip +
cl + 1 <= roll->
nstrips() ){
226 lstrip = centralStrip+
cl+1;
227 cls.push_back(lstrip);
235 if (lstrip < roll->nstrips() ){
237 cls.push_back(lstrip);
242 cls.push_back(fstrip);
248 for (std::vector<int>::iterator
i=cls.begin();
i!=cls.end();
i++){
250 if(*
i != centralStrip){
251 if(CLHEP::RandFlat::shoot(engine) < veff[*
i-1]){
252 std::pair<int, int> digi(*
i,time_hit);
259 std::pair<int, int> digi(*
i,time_hit);
270 CLHEP::HepRandomEngine* engine)
281 unsigned int nstrips = roll->
nstrips();
284 if ( rpcId.
region() == 0 )
291 area = striplength*(xmax-
xmin);
299 area = striplength*(xmax-
xmin);
302 for(
unsigned int j = 0;
j < vnoise.size(); ++
j){
304 if(
j >= nstrips)
break;
317 CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
318 N_hits = randPoissonQ.fire();
322 int time_hit = (
static_cast<int>(CLHEP::RandFlat::shoot(engine, (
nbxing*
gate)/gate))) -
nbxing/2;
323 std::pair<int, int> digi(
j+1,time_hit);
T getParameter(std::string const &) const
float strip(const LocalPoint &lp) const
int getClSize(float posX, CLHEP::HepRandomEngine *)
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()
std::vector< double > clsForDetId
const RPCRollSpecs * specs() const
int getSimHitBx(const PSimHit *, CLHEP::HepRandomEngine *)
~RPCSimAverageNoiseEffCls()
std::set< std::pair< int, int > > strips
uint32_t rawId() const
get the raw id
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
Container::value_type value_type
void simulate(const RPCRoll *roll, const edm::PSimHitContainer &rpcHits, CLHEP::HepRandomEngine *) override
std::vector< double > sum_clsize
RPCSynchronizer * _rpcSync
void simulateNoise(const RPCRoll *, CLHEP::HepRandomEngine *) override
const std::vector< double > & getCls(uint32_t id)
const std::map< int, std::vector< double > > & getClsMap()
virtual int channel(const LocalPoint &p) const =0
std::map< int, std::vector< double > > clsMap
virtual LocalPoint localPosition(float strip) const
RPCSimAverageNoiseEffCls(const edm::ParameterSet &config)
std::vector< PSimHit > PSimHitContainer
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.