34 #include "CLHEP/Random/RandFlat.h" 35 #include "CLHEP/Random/RandPoissonQ.h" 42 aveEff =
config.getParameter<
double>(
"averageEfficiency");
43 aveCls =
config.getParameter<
double>(
"averageClusterSize");
46 dtimCs =
config.getParameter<
double>(
"deltatimeAdjacentStrip");
48 sspeed =
config.getParameter<
double>(
"signalPropagationSpeed");
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);
109 for (
int i = vectOffset;
i < (vectOffset + 20);
i++) {
128 double rr_cl = CLHEP::RandFlat::shoot(engine);
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;
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) {
213 double deltaw =
roll->centreOfStrip(centralStrip).x() - entr.
x();
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) {
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);
int getClSize(float posX, CLHEP::HepRandomEngine *)
LocalPoint localPosition(float strip) const override
DetectorHitMap theDetectorHitMap
void setRPCSimSetUp(RPCSimSetUp *simsetup)
RPCSimSetUp * getRPCSimSetUp()
std::vector< double > clsForDetId
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
Log< level::Info, false > LogInfo
constexpr uint32_t rawId() const
get the raw id
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
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