36 #include "CLHEP/Random/RandFlat.h" 37 #include "CLHEP/Random/RandPoissonQ.h" 38 #include "CLHEP/Random/RandGaussQ.h" 63 edm::LogInfo(
"RPC digitizer parameters") <<
"Average Cluster Size = "<<aveCls<<
" strips";
64 edm::LogInfo(
"RPC digitizer parameters") <<
"RPC Time Resolution = "<<resRPC<<
" ns";
65 edm::LogInfo(
"RPC digitizer parameters") <<
"RPC Signal formation time = "<<timOff<<
" ns";
66 edm::LogInfo(
"RPC digitizer parameters") <<
"RPC adjacent strip delay = "<<dtimCs<<
" ns";
67 edm::LogInfo(
"RPC digitizer parameters") <<
"Electronic Jitter = "<<resEle<<
" ns";
68 edm::LogInfo(
"RPC digitizer parameters") <<
"Signal propagation time = "<<sspeed<<
" x c";
69 edm::LogInfo(
"RPC digitizer parameters") <<
"Link Board Gate Width = "<<lbGate<<
" ns";
83 CLHEP::HepRandomEngine* engine)
96 for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
97 _hit != rpcHits.end(); ++_hit){
106 float posX = roll->
strip(_hit->localPosition()) - static_cast<int>(roll->
strip(_hit->localPosition()));
108 std::vector<float> veff = (
getRPCSimSetUp())->getEff(rpcId.rawId());
111 int centralStrip = topology.
channel(entr)+1;;
112 float fire = CLHEP::RandFlat::shoot(engine);
114 float smearedPositionY = CLHEP::RandGaussQ::shoot(engine,_hit->localPosition().y(),
sigmaY);
116 if (fire < veff[centralStrip-1]) {
118 int fstrip=centralStrip;
119 int lstrip=centralStrip;
123 std::vector<int> cls;
124 cls.push_back(centralStrip);
126 for (
int cl = 0;
cl < (clsize-1)/2;
cl++){
127 if (centralStrip -
cl -1 >= 1 ){
128 fstrip = centralStrip-
cl-1;
129 cls.push_back(fstrip);
131 if (centralStrip +
cl + 1 <= roll->
nstrips() ){
132 lstrip = centralStrip+
cl+1;
133 cls.push_back(lstrip);
141 if (lstrip < roll->nstrips() ){
143 cls.push_back(lstrip);
148 cls.push_back(fstrip);
154 for (std::vector<int>::iterator
i=cls.begin();
i!=cls.end();
i++){
156 if(*
i != centralStrip){
157 if(CLHEP::RandFlat::shoot(engine) < veff[*
i-1]){
158 std::pair<int, int> digi(*
i,time_hit);
165 adigi.
setY(smearedPositionY);
174 std::pair<int, int> digi(*
i,time_hit);
181 adigi.
setY(smearedPositionY);
193 CLHEP::HepRandomEngine* engine)
199 unsigned int nstrips = roll->
nstrips();
202 if ( rpcId.
region() == 0 )
209 area = striplength*(xmax-
xmin);
217 area = striplength*(xmax-
xmin);
220 for(
unsigned int j = 0;
j < vnoise.size(); ++
j){
222 if(
j >= nstrips)
break;
227 CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
228 N_hits = randPoissonQ.fire();
232 double precise_time = CLHEP::RandFlat::shoot(engine, (
nbxing*
gate)/gate);
233 int time_hit = (
static_cast<int>(precise_time)) -
nbxing/2;
239 double positionY = CLHEP::RandFlat::shoot(engine,striplength);
240 positionY-=striplength/2;
242 adigi.
setY(positionY);
265 double rr_cl = CLHEP::RandFlat::shoot(engine);
267 if(0.0 <= posX && posX < 0.2) {
268 func = clsForDetId[19]*(rr_cl);
271 if(0.2 <= posX && posX < 0.4) {
272 func = clsForDetId[39]*(rr_cl);
275 if(0.4 <= posX && posX < 0.6) {
276 func = clsForDetId[59]*(rr_cl);
279 if(0.6 <= posX && posX < 0.8) {
280 func = clsForDetId[79]*(rr_cl);
283 if(0.8 <= posX && posX < 1.0) {
284 func = clsForDetId[89]*(rr_cl);
289 for(
int i = vectOffset;
i<(vectOffset+20);
i++){
291 if(func > clsForDetId[
i]){
294 else if(func < clsForDetId[i]){
306 int leftStrip = strip-1;
307 int rightStrip = strip+1;
311 if( rightStrip > roll.
nstrips())
314 double deltawL = fabs((roll.
centreOfStrip(leftStrip)).
x()-hit_pos.
x());
315 double deltawR = fabs((roll.
centreOfStrip(rightStrip)).
x()-hit_pos.
x());
317 if(deltawL>=deltawR){
T getParameter(std::string const &) const
float strip(const LocalPoint &lp) const
int LeftRightNeighbour(const RPCRoll &roll, const LocalPoint &hit_pos, int strip)
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
void setDeltaY(double dy)
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.