34 #include "CLHEP/Random/RandFlat.h" 35 #include "CLHEP/Random/RandPoissonQ.h" 40 aveEff =
config.getParameter<
double>(
"averageEfficiency");
41 aveCls =
config.getParameter<
double>(
"averageClusterSize");
44 dtimCs =
config.getParameter<
double>(
"deltatimeAdjacentStrip");
46 sspeed =
config.getParameter<
double>(
"signalPropagationSpeed");
57 std::cout <<
"Average Cluster Size = " <<
aveCls <<
" strips" << std::endl;
59 std::cout <<
"RPC Signal formation time = " <<
timOff <<
" ns" << std::endl;
60 std::cout <<
"RPC adjacent strip delay = " <<
dtimCs <<
" ns" << std::endl;
62 std::cout <<
"Signal propagation time = " <<
sspeed <<
" x c" << std::endl;
63 std::cout <<
"Link Board Gate Width = " <<
lbGate <<
" ns" << std::endl;
79 double rr_cl = CLHEP::RandFlat::shoot(engine);
103 if (
func > (*iter)) {
105 }
else if (
func < (*iter)) {
114 CLHEP::HepRandomEngine* engine) {
126 for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin(); _hit != rpcHits.end(); ++_hit) {
127 if (_hit->particleType() == 11)
134 float posX =
roll->strip(_hit->localPosition()) - static_cast<int>(
roll->strip(_hit->localPosition()));
136 std::vector<float> veff = (
getRPCSimSetUp())->getEff(rpcId.rawId());
139 int centralStrip = topology.
channel(entr) + 1;
141 float fire = CLHEP::RandFlat::shoot(engine);
143 if (fire < veff[centralStrip - 1]) {
144 int fstrip = centralStrip;
145 int lstrip = centralStrip;
150 int clsize = this->
getClSize(posX, engine);
152 std::vector<int> cls;
153 cls.push_back(centralStrip);
155 for (
int cl = 0;
cl < (clsize - 1) / 2;
cl++) {
156 if (centralStrip -
cl - 1 >= 1) {
157 fstrip = centralStrip -
cl - 1;
158 cls.push_back(fstrip);
160 if (centralStrip +
cl + 1 <=
roll->nstrips()) {
161 lstrip = centralStrip +
cl + 1;
162 cls.push_back(lstrip);
165 if (clsize % 2 == 0) {
168 double deltaw =
roll->centreOfStrip(centralStrip).x() - entr.
x();
170 if (lstrip < roll->nstrips()) {
172 cls.push_back(lstrip);
177 cls.push_back(fstrip);
183 for (std::vector<int>::iterator
i = cls.begin();
i != cls.end();
i++) {
185 if (*
i != centralStrip) {
186 if (CLHEP::RandFlat::shoot(engine) < veff[*
i - 1]) {
187 std::pair<int, int> digi(*
i, time_hit);
193 std::pair<int, int> digi(*
i, time_hit);
212 unsigned int nstrips =
roll->nstrips();
215 if (rpcId.
region() == 0) {
229 for (
unsigned int j = 0;
j < vnoise.size(); ++
j) {
243 CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
244 N_hits = randPoissonQ.fire();
247 int time_hit = (
static_cast<int>(CLHEP::RandFlat::shoot(engine, (
nbxing *
gate) /
gate))) -
nbxing / 2;
248 std::pair<int, int> digi(
j + 1, time_hit);
std::vector< double > sum_clsize
LocalPoint localPosition(float strip) const override
int getClSize(float posX, CLHEP::HepRandomEngine *)
DetectorHitMap theDetectorHitMap
void setRPCSimSetUp(RPCSimSetUp *simsetup)
RPCSimSetUp * getRPCSimSetUp()
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
constexpr uint32_t rawId() const
get the raw id
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
~RPCSimAverageNoiseEff() 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