36 #include "CLHEP/Random/RandFlat.h" 37 #include "CLHEP/Random/RandPoissonQ.h" 62 <<
"Average Cluster Size = " << aveCls <<
" strips" <<
'\n' 63 <<
"RPC Time Resolution = " << resRPC <<
" ns" <<
'\n' 64 <<
"RPC Signal formation time = " << timOff <<
" ns" <<
'\n' 65 <<
"RPC adjacent strip delay = " << dtimCs <<
" ns" <<
'\n' 66 <<
"Electronic Jitter = " << resEle <<
" ns" <<
'\n' 67 <<
"Signal propagation time = " << sspeed <<
" x c" <<
'\n' 68 <<
"Link Board Gate Width = " << lbGate <<
" ns" <<
'\n';
88 double rr_cl = CLHEP::RandFlat::shoot(engine);
90 if (0.0 <= posX && posX < 0.2) {
91 func = clsForDetId[19] * (rr_cl);
94 if (0.2 <= posX && posX < 0.4) {
95 func = clsForDetId[39] * (rr_cl);
98 if (0.4 <= posX && posX < 0.6) {
99 func = clsForDetId[59] * (rr_cl);
102 if (0.6 <= posX && posX < 0.8) {
103 func = clsForDetId[79] * (rr_cl);
106 if (0.8 <= posX && posX < 1.0) {
107 func = clsForDetId[89] * (rr_cl);
111 for (
int i = vectOffset;
i < (vectOffset + 20);
i++) {
113 if (func > clsForDetId[
i]) {
115 }
else if (func < clsForDetId[i]) {
130 double rr_cl = CLHEP::RandFlat::shoot(engine);
131 if (0.0 <= posX && posX < 0.2) {
132 func = (clsMap[1])[(clsMap[1]).size() - 1] * (rr_cl);
133 sum_clsize = clsMap[1];
135 if (0.2 <= posX && posX < 0.4) {
136 func = (clsMap[2])[(clsMap[2]).size() - 1] * (rr_cl);
137 sum_clsize = clsMap[2];
139 if (0.4 <= posX && posX < 0.6) {
140 func = (clsMap[3])[(clsMap[3]).size() - 1] * (rr_cl);
141 sum_clsize = clsMap[3];
143 if (0.6 <= posX && posX < 0.8) {
144 func = (clsMap[4])[(clsMap[4]).size() - 1] * (rr_cl);
145 sum_clsize = clsMap[4];
147 if (0.8 <= posX && posX < 1.0) {
148 func = (clsMap[5])[(clsMap[5]).size() - 1] * (rr_cl);
149 sum_clsize = clsMap[5];
152 for (vector<double>::iterator iter = sum_clsize.begin(); iter != sum_clsize.end(); ++iter) {
154 if (func > (*iter)) {
156 }
else if (func < (*iter)) {
165 CLHEP::HepRandomEngine* engine) {
177 for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin(); _hit != rpcHits.end(); ++_hit) {
178 if (!
eledig && _hit->particleType() == 11)
184 float posX = roll->
strip(_hit->localPosition()) - static_cast<int>(roll->
strip(_hit->localPosition()));
186 std::vector<float> veff = (
getRPCSimSetUp())->getEff(rpcId.rawId());
189 int centralStrip = topology.
channel(entr) + 1;
191 float fire = CLHEP::RandFlat::shoot(engine);
193 if (fire < veff[centralStrip - 1]) {
194 int fstrip = centralStrip;
195 int lstrip = centralStrip;
199 std::vector<int> cls;
200 cls.push_back(centralStrip);
202 for (
int cl = 0;
cl < (clsize - 1) / 2;
cl++) {
203 if (centralStrip -
cl - 1 >= 1) {
204 fstrip = centralStrip -
cl - 1;
205 cls.push_back(fstrip);
207 if (centralStrip +
cl + 1 <= roll->
nstrips()) {
208 lstrip = centralStrip +
cl + 1;
209 cls.push_back(lstrip);
212 if (clsize % 2 == 0) {
217 if (lstrip < roll->nstrips()) {
219 cls.push_back(lstrip);
224 cls.push_back(fstrip);
230 for (std::vector<int>::iterator
i = cls.begin();
i != cls.end();
i++) {
232 if (*
i != centralStrip) {
233 if (CLHEP::RandFlat::shoot(engine) < veff[*
i - 1]) {
234 std::pair<int, int> digi(*
i, time_hit);
240 std::pair<int, int> digi(*
i, time_hit);
258 unsigned int nstrips = roll->
nstrips();
261 if (rpcId.
region() == 0) {
266 area = striplength * (xmax -
xmin);
272 area = striplength * (xmax -
xmin);
275 for (
unsigned int j = 0;
j < vnoise.size(); ++
j) {
289 CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
290 N_hits = randPoissonQ.fire();
293 int time_hit = (
static_cast<int>(CLHEP::RandFlat::shoot(engine, (
nbxing *
gate) / gate))) -
nbxing / 2;
294 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::map< int, std::vector< double > > clsMap
~RPCSimAverageNoiseEffCls() override
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
Container::value_type value_type
std::set< std::pair< int, int > > strips
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
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