35 #include "CLHEP/Random/RandFlat.h"
36 #include "CLHEP/Random/RandPoissonQ.h"
58 std::cout <<
"Average Cluster Size = " << aveCls <<
" strips" << std::endl;
59 std::cout <<
"RPC Time Resolution = " << resRPC <<
" ns" << std::endl;
60 std::cout <<
"RPC Signal formation time = " << timOff <<
" ns" << std::endl;
61 std::cout <<
"RPC adjacent strip delay = " << dtimCs <<
" ns" << std::endl;
62 std::cout <<
"Electronic Jitter = " << resEle <<
" ns" << std::endl;
63 std::cout <<
"Signal propagation time = " << sspeed <<
" x c" << std::endl;
64 std::cout <<
"Link Board Gate Width = " << lbGate <<
" ns" << std::endl;
80 double rr_cl = CLHEP::RandFlat::shoot(engine);
81 if (0.0 <= posX && posX < 0.2) {
82 func = (clsMap[1])[(clsMap[1]).size() - 1] * (rr_cl);
83 sum_clsize = clsMap[1];
85 if (0.2 <= posX && posX < 0.4) {
86 func = (clsMap[2])[(clsMap[2]).size() - 1] * (rr_cl);
87 sum_clsize = clsMap[2];
89 if (0.4 <= posX && posX < 0.6) {
90 func = (clsMap[3])[(clsMap[3]).size() - 1] * (rr_cl);
91 sum_clsize = clsMap[3];
93 if (0.6 <= posX && posX < 0.8) {
94 func = (clsMap[4])[(clsMap[4]).size() - 1] * (rr_cl);
95 sum_clsize = clsMap[4];
97 if (0.8 <= posX && posX < 1.0) {
98 func = (clsMap[5])[(clsMap[5]).size() - 1] * (rr_cl);
99 sum_clsize = clsMap[5];
102 for (vector<double>::iterator iter = sum_clsize.begin(); iter != sum_clsize.end(); ++iter) {
104 if (func > (*iter)) {
106 }
else if (func < (*iter)) {
115 CLHEP::HepRandomEngine* engine) {
127 for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin(); _hit != rpcHits.end(); ++_hit) {
128 if (_hit->particleType() == 11)
135 float posX = roll->
strip(_hit->localPosition()) - static_cast<int>(roll->
strip(_hit->localPosition()));
137 std::vector<float> veff = (
getRPCSimSetUp())->getEff(rpcId.rawId());
140 int centralStrip = topology.
channel(entr) + 1;
142 float fire = CLHEP::RandFlat::shoot(engine);
144 if (fire < veff[centralStrip - 1]) {
145 int fstrip = centralStrip;
146 int lstrip = centralStrip;
151 int clsize = this->
getClSize(posX, engine);
153 std::vector<int> cls;
154 cls.push_back(centralStrip);
156 for (
int cl = 0;
cl < (clsize - 1) / 2;
cl++) {
157 if (centralStrip -
cl - 1 >= 1) {
158 fstrip = centralStrip -
cl - 1;
159 cls.push_back(fstrip);
161 if (centralStrip +
cl + 1 <= roll->
nstrips()) {
162 lstrip = centralStrip +
cl + 1;
163 cls.push_back(lstrip);
166 if (clsize % 2 == 0) {
171 if (lstrip < roll->nstrips()) {
173 cls.push_back(lstrip);
178 cls.push_back(fstrip);
184 for (std::vector<int>::iterator
i = cls.begin();
i != cls.end();
i++) {
186 if (*
i != centralStrip) {
187 if (CLHEP::RandFlat::shoot(engine) < veff[*
i - 1]) {
188 std::pair<int, int> digi(*
i, time_hit);
194 std::pair<int, int> digi(*
i, time_hit);
213 unsigned int nstrips = roll->
nstrips();
216 if (rpcId.
region() == 0) {
221 area = striplength * (xmax -
xmin);
227 area = striplength * (xmax -
xmin);
230 for (
unsigned int j = 0;
j < vnoise.size(); ++
j) {
244 CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
245 N_hits = randPoissonQ.fire();
248 int time_hit = (
static_cast<int>(CLHEP::RandFlat::shoot(engine, (
nbxing *
gate) / gate))) -
nbxing / 2;
249 std::pair<int, int> digi(
j + 1, time_hit);
float strip(const LocalPoint &lp) const
std::vector< double > sum_clsize
LocalPoint centreOfStrip(int strip) const
LocalPoint localPosition(float strip) const override
int getClSize(float posX, CLHEP::HepRandomEngine *)
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
const RPCRollSpecs * specs() const
int getSimHitBx(const PSimHit *, CLHEP::HepRandomEngine *)
RPCSimAverageNoiseEff(const edm::ParameterSet &config)
float stripLength() const override
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
virtual std::string name()
Container::value_type value_type
std::set< std::pair< int, int > > strips
void simulateNoise(const RPCRoll *, CLHEP::HepRandomEngine *) override
void simulate(const RPCRoll *roll, const edm::PSimHitContainer &rpcHits, CLHEP::HepRandomEngine *) override
const std::map< int, std::vector< double > > & getClsMap()
virtual int channel(const LocalPoint &p) const =0
const Topology & topology() const override
T getParameter(std::string const &) const
tuple config
parse the configuration file
~RPCSimAverageNoiseEff() override
const Topology & topology() const override
RPCSynchronizer * _rpcSync
std::vector< PSimHit > PSimHitContainer
std::map< int, std::vector< double > > clsMap
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.