34 #include "CLHEP/Random/RandFlat.h" 35 #include "CLHEP/Random/RandPoissonQ.h" 56 std::cout <<
"Average Cluster Size = " << aveCls <<
" strips" << std::endl;
57 std::cout <<
"RPC Time Resolution = " << resRPC <<
" ns" << std::endl;
58 std::cout <<
"RPC Signal formation time = " << timOff <<
" ns" << std::endl;
59 std::cout <<
"RPC adjacent strip delay = " << dtimCs <<
" ns" << std::endl;
60 std::cout <<
"Electronic Jitter = " << resEle <<
" ns" << std::endl;
61 std::cout <<
"Signal propagation time = " << sspeed <<
" x c" << std::endl;
62 std::cout <<
"Link Board Gate Width = " << lbGate <<
" ns" << std::endl;
78 double rr_cl = CLHEP::RandFlat::shoot(engine);
79 if (0.0 <= posX && posX < 0.2) {
80 func = (clsMap[1])[(clsMap[1]).size() - 1] * (rr_cl);
81 sum_clsize = clsMap[1];
83 if (0.2 <= posX && posX < 0.4) {
84 func = (clsMap[2])[(clsMap[2]).size() - 1] * (rr_cl);
85 sum_clsize = clsMap[2];
87 if (0.4 <= posX && posX < 0.6) {
88 func = (clsMap[3])[(clsMap[3]).size() - 1] * (rr_cl);
89 sum_clsize = clsMap[3];
91 if (0.6 <= posX && posX < 0.8) {
92 func = (clsMap[4])[(clsMap[4]).size() - 1] * (rr_cl);
93 sum_clsize = clsMap[4];
95 if (0.8 <= posX && posX < 1.0) {
96 func = (clsMap[5])[(clsMap[5]).size() - 1] * (rr_cl);
97 sum_clsize = clsMap[5];
100 for (vector<double>::iterator iter = sum_clsize.begin(); iter != sum_clsize.end(); ++iter) {
102 if (func > (*iter)) {
104 }
else if (func < (*iter)) {
113 CLHEP::HepRandomEngine* engine) {
121 for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin(); _hit != rpcHits.end(); ++_hit) {
125 float posX = roll->
strip(_hit->localPosition()) - static_cast<int>(roll->
strip(_hit->localPosition()));
129 if (CLHEP::RandFlat::shoot(engine) <
aveEff) {
130 int centralStrip = topology.channel(entr) + 1;
131 int fstrip = centralStrip;
132 int lstrip = centralStrip;
136 int clsize = this->
getClSize(posX, engine);
138 std::vector<int> cls;
139 cls.push_back(centralStrip);
141 for (
int cl = 0;
cl < (clsize - 1) / 2;
cl++) {
142 if (centralStrip -
cl - 1 >= 1) {
143 fstrip = centralStrip -
cl - 1;
144 cls.push_back(fstrip);
146 if (centralStrip +
cl + 1 <= roll->
nstrips()) {
147 lstrip = centralStrip +
cl + 1;
148 cls.push_back(lstrip);
151 if (clsize % 2 == 0) {
156 if (lstrip < roll->nstrips()) {
158 cls.push_back(lstrip);
163 cls.push_back(fstrip);
169 for (std::vector<int>::iterator
i = cls.begin();
i != cls.end();
i++) {
171 std::pair<int, int> digi(*
i, time_hit);
183 unsigned int nstrips = roll->
nstrips();
187 if (rpcId.
region() == 0) {
192 area = striplength * (xmax -
xmin);
198 area = striplength * (xmax -
xmin);
200 for (
unsigned int j = 0;
j < vnoise.size(); ++
j) {
205 CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
206 N_hits = randPoissonQ.fire();
209 int time_hit = (
static_cast<int>(CLHEP::RandFlat::shoot(engine, (
nbxing *
gate) / gate))) -
nbxing / 2;
210 std::pair<int, int> digi(
j + 1, time_hit);
T getParameter(std::string const &) const
float strip(const LocalPoint &lp) const
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::map< int, std::vector< double > > clsMap
const RPCRollSpecs * specs() const
const Topology & topology() const override
int getSimHitBx(const PSimHit *, CLHEP::HepRandomEngine *)
int getClSize(float posX, CLHEP::HepRandomEngine *)
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()
float stripLength() const override
det heigth (strip length in the middle)
void simulate(const RPCRoll *roll, const edm::PSimHitContainer &rpcHits, CLHEP::HepRandomEngine *) override
RPCSimAverageNoise(const edm::ParameterSet &config)
~RPCSimAverageNoise() override
RPCSynchronizer * _rpcSync
std::vector< PSimHit > PSimHitContainer
RPCDigiSimLinks theRpcDigiSimLinks
std::vector< double > sum_clsize
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
float stripLength() const override