36 #include "CLHEP/Random/RandFlat.h" 37 #include "CLHEP/Random/RandPoissonQ.h" 65 <<
"Average Cluster Size = "<<aveCls<<
" strips"<<
'\n' 66 <<
"RPC Time Resolution = "<<resRPC<<
" ns"<<
'\n' 67 <<
"RPC Signal formation time = "<<timOff<<
" ns"<<
'\n' 68 <<
"RPC adjacent strip delay = "<<dtimCs<<
" ns"<<
'\n' 69 <<
"Electronic Jitter = "<<resEle<<
" ns"<<
'\n' 70 <<
"Signal propagation time = "<<sspeed<<
" x c"<<
'\n' 71 <<
"Link Board Gate Width = "<<lbGate<<
" ns"<<
'\n';
97 double rr_cl = CLHEP::RandFlat::shoot(engine);
99 if(0.0 <= posX && posX < 0.2) {
100 func = clsForDetId[19]*(rr_cl);
103 if(0.2 <= posX && posX < 0.4) {
104 func = clsForDetId[39]*(rr_cl);
107 if(0.4 <= posX && posX < 0.6) {
108 func = clsForDetId[59]*(rr_cl);
111 if(0.6 <= posX && posX < 0.8) {
112 func = clsForDetId[79]*(rr_cl);
115 if(0.8 <= posX && posX < 1.0) {
116 func = clsForDetId[89]*(rr_cl);
121 for(
int i = vectOffset;
i<(vectOffset+20);
i++){
123 if(func > clsForDetId[
i]){
126 else if(func < clsForDetId[i]){
143 double rr_cl = CLHEP::RandFlat::shoot(engine);
144 if(0.0 <= posX && posX < 0.2) {
145 func = (clsMap[1])[(clsMap[1]).size()-1]*(rr_cl);
146 sum_clsize = clsMap[1];
148 if(0.2 <= posX && posX < 0.4) {
149 func = (clsMap[2])[(clsMap[2]).size()-1]*(rr_cl);
150 sum_clsize = clsMap[2];
152 if(0.4 <= posX && posX < 0.6) {
153 func = (clsMap[3])[(clsMap[3]).size()-1]*(rr_cl);
154 sum_clsize = clsMap[3];
156 if(0.6 <= posX && posX < 0.8) {
157 func = (clsMap[4])[(clsMap[4]).size()-1]*(rr_cl);
158 sum_clsize = clsMap[4];
160 if(0.8 <= posX && posX < 1.0) {
161 func = (clsMap[5])[(clsMap[5]).size()-1]*(rr_cl);
162 sum_clsize = clsMap[5];
165 for(vector<double>::iterator iter = sum_clsize.begin();
166 iter != sum_clsize.end(); ++iter){
171 else if(func < (*iter)){
181 CLHEP::HepRandomEngine* engine)
194 for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
195 _hit != rpcHits.end(); ++_hit){
202 float posX = roll->
strip(_hit->localPosition()) - static_cast<int>(roll->
strip(_hit->localPosition()));
204 std::vector<float> veff = (
getRPCSimSetUp())->getEff(rpcId.rawId());
207 int centralStrip = topology.
channel(entr)+1;;
208 float fire = CLHEP::RandFlat::shoot(engine);
210 if (fire < veff[centralStrip-1]) {
212 int fstrip=centralStrip;
213 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)
280 unsigned int nstrips = roll->
nstrips();
283 if ( rpcId.
region() == 0 )
290 area = striplength*(xmax-
xmin);
298 area = striplength*(xmax-
xmin);
301 for(
unsigned int j = 0; j < vnoise.size(); ++j){
303 if(j >= nstrips)
break;
316 CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
317 N_hits = randPoissonQ.fire();
321 int time_hit = (
static_cast<int>(CLHEP::RandFlat::shoot(engine, (
nbxing*
gate)/gate))) -
nbxing/2;
322 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 *)
const Topology & topology() const override
LocalPoint centreOfStrip(int strip) const
LocalPoint localPosition(float strip) const override
CaloTopology const * topology(0)
DetectorHitMap theDetectorHitMap
void setRPCSimSetUp(RPCSimSetUp *simsetup)
constexpr uint32_t rawId() const
get the raw id
LocalPoint localPosition(float strip) const override
RPCSimSetUp * getRPCSimSetUp()
std::vector< double > clsForDetId
const RPCRollSpecs * specs() const
const Topology & topology() const override
int getSimHitBx(const PSimHit *, CLHEP::HepRandomEngine *)
std::set< std::pair< int, int > > strips
~RPCSimAverageNoiseEffCls() override
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()
float stripLength() const override
det heigth (strip length in the middle)
virtual int channel(const LocalPoint &p) const =0
std::map< int, std::vector< double > > clsMap
RPCSimAverageNoiseEffCls(const edm::ParameterSet &config)
std::vector< PSimHit > PSimHitContainer
RPCDigiSimLinks theRpcDigiSimLinks
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
float stripLength() const override