34 #include "CLHEP/Random/RandFlat.h"
35 #include "CLHEP/Random/RandPoissonQ.h"
60 <<
"Average Cluster Size = " << aveCls <<
" strips" <<
'\n'
61 <<
"RPC Time Resolution = " << resRPC <<
" ns" <<
'\n'
62 <<
"RPC Signal formation time = " << timOff <<
" ns" <<
'\n'
63 <<
"RPC adjacent strip delay = " << dtimCs <<
" ns" <<
'\n'
64 <<
"Electronic Jitter = " << resEle <<
" ns" <<
'\n'
65 <<
"Signal propagation time = " << sspeed <<
" x c" <<
'\n'
66 <<
"Link Board Gate Width = " << lbGate <<
" ns" <<
'\n';
86 double rr_cl = CLHEP::RandFlat::shoot(engine);
88 if (0.0 <= posX && posX < 0.2) {
89 func = clsForDetId[19] * (rr_cl);
92 if (0.2 <= posX && posX < 0.4) {
93 func = clsForDetId[39] * (rr_cl);
96 if (0.4 <= posX && posX < 0.6) {
97 func = clsForDetId[59] * (rr_cl);
100 if (0.6 <= posX && posX < 0.8) {
101 func = clsForDetId[79] * (rr_cl);
104 if (0.8 <= posX && posX < 1.0) {
105 func = clsForDetId[89] * (rr_cl);
109 for (
int i = vectOffset;
i < (vectOffset + 20);
i++) {
111 if (func > clsForDetId[
i]) {
113 }
else if (func < clsForDetId[i]) {
128 double rr_cl = CLHEP::RandFlat::shoot(engine);
129 if (0.0 <= posX && posX < 0.2) {
130 func = (clsMap[1])[(clsMap[1]).size() - 1] * (rr_cl);
131 sum_clsize = clsMap[1];
133 if (0.2 <= posX && posX < 0.4) {
134 func = (clsMap[2])[(clsMap[2]).size() - 1] * (rr_cl);
135 sum_clsize = clsMap[2];
137 if (0.4 <= posX && posX < 0.6) {
138 func = (clsMap[3])[(clsMap[3]).size() - 1] * (rr_cl);
139 sum_clsize = clsMap[3];
141 if (0.6 <= posX && posX < 0.8) {
142 func = (clsMap[4])[(clsMap[4]).size() - 1] * (rr_cl);
143 sum_clsize = clsMap[4];
145 if (0.8 <= posX && posX < 1.0) {
146 func = (clsMap[5])[(clsMap[5]).size() - 1] * (rr_cl);
147 sum_clsize = clsMap[5];
150 for (vector<double>::iterator iter = sum_clsize.begin(); iter != sum_clsize.end(); ++iter) {
152 if (func > (*iter)) {
154 }
else if (func < (*iter)) {
163 CLHEP::HepRandomEngine* engine) {
175 for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin(); _hit != rpcHits.end(); ++_hit) {
176 if (!
eledig && _hit->particleType() == 11)
182 float posX = roll->
strip(_hit->localPosition()) - static_cast<int>(roll->
strip(_hit->localPosition()));
184 std::vector<float> veff = (
getRPCSimSetUp())->getEff(rpcId.rawId());
187 int centralStrip = topology.
channel(entr) + 1;
189 float fire = CLHEP::RandFlat::shoot(engine);
191 if (fire < veff[centralStrip - 1]) {
192 int fstrip = centralStrip;
193 int lstrip = centralStrip;
196 int clsize = this->
getClSize(rpcId.rawId(), posX, engine);
197 std::vector<int> cls;
198 cls.push_back(centralStrip);
200 for (
int cl = 0;
cl < (clsize - 1) / 2;
cl++) {
201 if (centralStrip -
cl - 1 >= 1) {
202 fstrip = centralStrip -
cl - 1;
203 cls.push_back(fstrip);
205 if (centralStrip +
cl + 1 <= roll->
nstrips()) {
206 lstrip = centralStrip +
cl + 1;
207 cls.push_back(lstrip);
210 if (clsize % 2 == 0) {
215 if (lstrip < roll->nstrips()) {
217 cls.push_back(lstrip);
222 cls.push_back(fstrip);
228 for (std::vector<int>::iterator
i = cls.begin();
i != cls.end();
i++) {
230 if (*
i != centralStrip) {
231 if (CLHEP::RandFlat::shoot(engine) < veff[*
i - 1]) {
232 std::pair<int, int> digi(*
i, time_hit);
238 std::pair<int, int> digi(*
i, time_hit);
256 unsigned int nstrips = roll->
nstrips();
259 if (rpcId.
region() == 0) {
264 area = striplength * (xmax -
xmin);
270 area = striplength * (xmax -
xmin);
273 for (
unsigned int j = 0;
j < vnoise.size(); ++
j) {
287 CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
288 N_hits = randPoissonQ.fire();
291 int time_hit = (
static_cast<int>(CLHEP::RandFlat::shoot(engine, (
nbxing *
gate) / gate))) -
nbxing / 2;
292 std::pair<int, int> digi(
j + 1, time_hit);
float strip(const LocalPoint &lp) const
int getClSize(float posX, CLHEP::HepRandomEngine *)
LocalPoint centreOfStrip(int strip) const
LocalPoint localPosition(float strip) const override
DetectorHitMap theDetectorHitMap
void setRPCSimSetUp(RPCSimSetUp *simsetup)
constexpr uint32_t rawId() const
get the raw id
RPCSimSetUp * getRPCSimSetUp()
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t Func __host__ __device__ V int Func func
std::vector< double > clsForDetId
const RPCRollSpecs * specs() const
int getSimHitBx(const PSimHit *, CLHEP::HepRandomEngine *)
float stripLength() const override
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()
virtual int channel(const LocalPoint &p) const =0
const Topology & topology() const override
Log< level::Info, false > LogInfo
T getParameter(std::string const &) const
tuple config
parse the configuration file
const Topology & topology() const override
RPCSimAverageNoiseEffCls(const edm::ParameterSet &config)
std::vector< PSimHit > PSimHitContainer
float stripLength() const override
det heigth (strip length in the middle)
RPCDigiSimLinks theRpcDigiSimLinks
LocalPoint localPosition(float strip) const override
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.