34 #include "CLHEP/Random/RandFlat.h" 35 #include "CLHEP/Random/RandPoissonQ.h" 36 #include "CLHEP/Random/RandGaussQ.h" 41 aveEff =
config.getParameter<
double>(
"averageEfficiency");
42 aveCls =
config.getParameter<
double>(
"averageClusterSize");
45 dtimCs =
config.getParameter<
double>(
"deltatimeAdjacentStrip");
47 sspeed =
config.getParameter<
double>(
"signalPropagationSpeed");
55 do_Y =
config.getParameter<
bool>(
"do_Y_coordinate");
61 edm::LogInfo(
"RPC digitizer parameters") <<
"Average Cluster Size = " <<
aveCls <<
" strips";
62 edm::LogInfo(
"RPC digitizer parameters") <<
"RPC Time Resolution = " <<
resRPC <<
" ns";
63 edm::LogInfo(
"RPC digitizer parameters") <<
"RPC Signal formation time = " <<
timOff <<
" ns";
64 edm::LogInfo(
"RPC digitizer parameters") <<
"RPC adjacent strip delay = " <<
dtimCs <<
" ns";
66 edm::LogInfo(
"RPC digitizer parameters") <<
"Signal propagation time = " <<
sspeed <<
" x c";
67 edm::LogInfo(
"RPC digitizer parameters") <<
"Link Board Gate Width = " <<
lbGate <<
" ns";
77 CLHEP::HepRandomEngine* engine) {
88 for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin(); _hit != rpcHits.end(); ++_hit) {
89 if (!
eledig && _hit->particleType() == 11)
97 float posX = roll->
strip(_hit->localPosition()) - static_cast<int>(roll->
strip(_hit->localPosition()));
99 std::vector<float> veff = (
getRPCSimSetUp())->getEff(rpcId.rawId());
102 int centralStrip = topology.
channel(entr) + 1;
104 float fire = CLHEP::RandFlat::shoot(engine);
106 float smearedPositionY = CLHEP::RandGaussQ::shoot(engine, _hit->localPosition().y(),
sigmaY);
108 if (fire < veff[centralStrip - 1]) {
109 int fstrip = centralStrip;
110 int lstrip = centralStrip;
114 std::vector<int> cls;
115 cls.push_back(centralStrip);
117 for (
int cl = 0;
cl < (clsize - 1) / 2;
cl++) {
118 if (centralStrip -
cl - 1 >= 1) {
119 fstrip = centralStrip -
cl - 1;
120 cls.push_back(fstrip);
122 if (centralStrip +
cl + 1 <= roll->
nstrips()) {
123 lstrip = centralStrip +
cl + 1;
124 cls.push_back(lstrip);
127 if (clsize % 2 == 0) {
132 if (lstrip < roll->nstrips()) {
134 cls.push_back(lstrip);
139 cls.push_back(fstrip);
148 for (std::vector<int>::iterator
i = cls.begin();
i != cls.end();
i++) {
149 std::pair<int, int> digi(*
i, time_hit);
155 adigi.
setY(smearedPositionY);
170 unsigned int nstrips = roll->
nstrips();
173 if (rpcId.
region() == 0) {
187 for (
unsigned int j = 0;
j < vnoise.size(); ++
j) {
193 CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
194 N_hits = randPoissonQ.fire();
196 double precise_time = CLHEP::RandFlat::shoot(engine, (
nbxing *
gate) /
gate);
197 int time_hit = (
static_cast<int>(precise_time)) -
nbxing / 2;
202 double positionY = CLHEP::RandFlat::shoot(engine, striplength);
203 positionY -= striplength / 2;
205 adigi.
setY(positionY);
225 double rr_cl = CLHEP::RandFlat::shoot(engine);
248 for (
int i = vectOffset;
i < (vectOffset + 20);
i++) {
263 int leftStrip =
strip - 1;
264 int rightStrip =
strip + 1;
268 if (rightStrip > roll.
nstrips())
271 double deltawL = fabs((roll.
centreOfStrip(leftStrip)).
x() - hit_pos.
x());
272 double deltawR = fabs((roll.
centreOfStrip(rightStrip)).
x() - hit_pos.
x());
274 if (deltawL >= deltawR) {
int LeftRightNeighbour(const RPCRoll &roll, const LocalPoint &hit_pos, int strip)
LocalPoint localPosition(float strip) const override
double getSmearedTime() const
DetectorHitMap theDetectorHitMap
void setRPCSimSetUp(RPCSimSetUp *simsetup)
RPCSimSetUp * getRPCSimSetUp()
std::vector< double > clsForDetId
~RPCSimModelTiming() override
const RPCRollSpecs * specs() const
void simulateNoise(const RPCRoll *, CLHEP::HepRandomEngine *) override
void simulate(const RPCRoll *roll, const edm::PSimHitContainer &rpcHits, CLHEP::HepRandomEngine *) override
float stripLength() const override
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
Container::value_type value_type
std::vector< double > sum_clsize
const std::vector< double > & getCls(uint32_t id)
virtual int channel(const LocalPoint &p) const =0
int getClSize(uint32_t id, float posX, CLHEP::HepRandomEngine *)
const Topology & topology() const override
RPCSimModelTiming(const edm::ParameterSet &config)
Log< level::Info, false > LogInfo
constexpr uint32_t rawId() const
get the raw id
std::set< RPCDigi > irpc_digis
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
const Topology & topology() const override
float strip(const LocalPoint &lp) const
void setDeltaY(double dy)
RPCSynchronizer * _rpcSync
std::vector< PSimHit > PSimHitContainer
float stripLength() const override
det heigth (strip length in the middle)
RPCDigiSimLinks theRpcDigiSimLinks
void setTime(double time)
int getSimHitBxAndTimingForIRPC(const PSimHit *, CLHEP::HepRandomEngine *)
LocalPoint localPosition(float strip) const override
LocalPoint centreOfStrip(int strip) const