33 #include "CLHEP/Random/RandFlat.h"
34 #include "CLHEP/Random/RandPoissonQ.h"
55 std::cout <<
"Average Cluster Size = " << aveCls <<
" strips" << std::endl;
56 std::cout <<
"RPC Time Resolution = " << resRPC <<
" ns" << std::endl;
57 std::cout <<
"RPC Signal formation time = " << timOff <<
" ns" << std::endl;
58 std::cout <<
"RPC adjacent strip delay = " << dtimCs <<
" ns" << std::endl;
59 std::cout <<
"Electronic Jitter = " << resEle <<
" ns" << std::endl;
60 std::cout <<
"Signal propagation time = " << sspeed <<
" x c" << std::endl;
61 std::cout <<
"Link Board Gate Width = " << lbGate <<
" ns" << std::endl;
77 double rr_cl = CLHEP::RandFlat::shoot(engine);
78 if (0.0 <= posX && posX < 0.2) {
79 func = (clsMap[1])[(clsMap[1]).size() - 1] * (rr_cl);
80 sum_clsize = clsMap[1];
82 if (0.2 <= posX && posX < 0.4) {
83 func = (clsMap[2])[(clsMap[2]).size() - 1] * (rr_cl);
84 sum_clsize = clsMap[2];
86 if (0.4 <= posX && posX < 0.6) {
87 func = (clsMap[3])[(clsMap[3]).size() - 1] * (rr_cl);
88 sum_clsize = clsMap[3];
90 if (0.6 <= posX && posX < 0.8) {
91 func = (clsMap[4])[(clsMap[4]).size() - 1] * (rr_cl);
92 sum_clsize = clsMap[4];
94 if (0.8 <= posX && posX < 1.0) {
95 func = (clsMap[5])[(clsMap[5]).size() - 1] * (rr_cl);
96 sum_clsize = clsMap[5];
99 for (vector<double>::iterator iter = sum_clsize.begin(); iter != sum_clsize.end(); ++iter) {
101 if (func > (*iter)) {
103 }
else if (func < (*iter)) {
112 CLHEP::HepRandomEngine* engine) {
120 for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin(); _hit != rpcHits.end(); ++_hit) {
124 float posX = roll->
strip(_hit->localPosition()) - static_cast<int>(roll->
strip(_hit->localPosition()));
128 if (CLHEP::RandFlat::shoot(engine) <
aveEff) {
129 int centralStrip = topology.channel(entr) + 1;
130 int fstrip = centralStrip;
131 int lstrip = centralStrip;
135 int clsize = this->
getClSize(posX, engine);
137 std::vector<int> cls;
138 cls.push_back(centralStrip);
140 for (
int cl = 0;
cl < (clsize - 1) / 2;
cl++) {
141 if (centralStrip -
cl - 1 >= 1) {
142 fstrip = centralStrip -
cl - 1;
143 cls.push_back(fstrip);
145 if (centralStrip +
cl + 1 <= roll->
nstrips()) {
146 lstrip = centralStrip +
cl + 1;
147 cls.push_back(lstrip);
150 if (clsize % 2 == 0) {
155 if (lstrip < roll->nstrips()) {
157 cls.push_back(lstrip);
162 cls.push_back(fstrip);
168 for (std::vector<int>::iterator
i = cls.begin();
i != cls.end();
i++) {
170 std::pair<int, int> digi(*
i, time_hit);
182 unsigned int nstrips = roll->
nstrips();
186 if (rpcId.
region() == 0) {
191 area = striplength * (xmax -
xmin);
197 area = striplength * (xmax -
xmin);
199 for (
unsigned int j = 0;
j < vnoise.size(); ++
j) {
204 CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
205 N_hits = randPoissonQ.fire();
208 int time_hit = (
static_cast<int>(CLHEP::RandFlat::shoot(engine, (
nbxing *
gate) / gate))) -
nbxing / 2;
209 std::pair<int, int> digi(
j + 1, time_hit);
float strip(const LocalPoint &lp) const
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::map< int, std::vector< double > > clsMap
const RPCRollSpecs * specs() const
int getSimHitBx(const PSimHit *, CLHEP::HepRandomEngine *)
int getClSize(float posX, CLHEP::HepRandomEngine *)
float stripLength() const override
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
Container::value_type value_type
std::set< std::pair< int, int > > strips
void simulateNoise(const RPCRoll *, CLHEP::HepRandomEngine *) override
const std::map< int, std::vector< double > > & getClsMap()
void simulate(const RPCRoll *roll, const edm::PSimHitContainer &rpcHits, CLHEP::HepRandomEngine *) override
RPCSimAverageNoise(const edm::ParameterSet &config)
const Topology & topology() const override
~RPCSimAverageNoise() override
T getParameter(std::string const &) const
RPCSynchronizer * _rpcSync
tuple config
parse the configuration file
const Topology & topology() const override
std::vector< PSimHit > PSimHitContainer
float stripLength() const override
det heigth (strip length in the middle)
RPCDigiSimLinks theRpcDigiSimLinks
LocalPoint localPosition(float strip) const override
std::vector< double > sum_clsize
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.