36 #include "CLHEP/Random/RandFlat.h" 37 #include "CLHEP/Random/RandPoissonQ.h" 38 #include "CLHEP/Random/RandGaussQ.h" 63 edm::LogInfo(
"RPC digitizer parameters") <<
"Average Cluster Size = " << aveCls <<
" strips";
64 edm::LogInfo(
"RPC digitizer parameters") <<
"RPC Time Resolution = " << resRPC <<
" ns";
65 edm::LogInfo(
"RPC digitizer parameters") <<
"RPC Signal formation time = " << timOff <<
" ns";
66 edm::LogInfo(
"RPC digitizer parameters") <<
"RPC adjacent strip delay = " << dtimCs <<
" ns";
67 edm::LogInfo(
"RPC digitizer parameters") <<
"Electronic Jitter = " << resEle <<
" ns";
68 edm::LogInfo(
"RPC digitizer parameters") <<
"Signal propagation time = " << sspeed <<
" x c";
69 edm::LogInfo(
"RPC digitizer parameters") <<
"Link Board Gate Width = " << lbGate <<
" ns";
79 CLHEP::HepRandomEngine* engine) {
90 for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin(); _hit != rpcHits.end(); ++_hit) {
91 if (!
eledig && _hit->particleType() == 11)
99 float posX = roll->
strip(_hit->localPosition()) - static_cast<int>(roll->
strip(_hit->localPosition()));
101 std::vector<float> veff = (
getRPCSimSetUp())->getEff(rpcId.rawId());
104 int centralStrip = topology.
channel(entr) + 1;
106 float fire = CLHEP::RandFlat::shoot(engine);
108 float smearedPositionY = CLHEP::RandGaussQ::shoot(engine, _hit->localPosition().y(),
sigmaY);
110 if (fire < veff[centralStrip - 1]) {
111 int fstrip = centralStrip;
112 int lstrip = centralStrip;
116 std::vector<int> cls;
117 cls.push_back(centralStrip);
119 for (
int cl = 0;
cl < (clsize - 1) / 2;
cl++) {
120 if (centralStrip -
cl - 1 >= 1) {
121 fstrip = centralStrip -
cl - 1;
122 cls.push_back(fstrip);
124 if (centralStrip +
cl + 1 <= roll->
nstrips()) {
125 lstrip = centralStrip +
cl + 1;
126 cls.push_back(lstrip);
129 if (clsize % 2 == 0) {
134 if (lstrip < roll->nstrips()) {
136 cls.push_back(lstrip);
141 cls.push_back(fstrip);
150 for (std::vector<int>::iterator
i = cls.begin();
i != cls.end();
i++) {
151 std::pair<int, int> digi(*
i, time_hit);
157 adigi.
setY(smearedPositionY);
172 unsigned int nstrips = roll->
nstrips();
175 if (rpcId.
region() == 0) {
180 area = striplength * (xmax -
xmin);
186 area = striplength * (xmax -
xmin);
189 for (
unsigned int j = 0;
j < vnoise.size(); ++
j) {
195 CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
196 N_hits = randPoissonQ.fire();
198 double precise_time = CLHEP::RandFlat::shoot(engine, (
nbxing *
gate) / gate);
199 int time_hit = (
static_cast<int>(precise_time)) -
nbxing / 2;
204 double positionY = CLHEP::RandFlat::shoot(engine, striplength);
205 positionY -= striplength / 2;
207 adigi.
setY(positionY);
227 double rr_cl = CLHEP::RandFlat::shoot(engine);
229 if (0.0 <= posX && posX < 0.2) {
230 func = clsForDetId[19] * (rr_cl);
233 if (0.2 <= posX && posX < 0.4) {
234 func = clsForDetId[39] * (rr_cl);
237 if (0.4 <= posX && posX < 0.6) {
238 func = clsForDetId[59] * (rr_cl);
241 if (0.6 <= posX && posX < 0.8) {
242 func = clsForDetId[79] * (rr_cl);
245 if (0.8 <= posX && posX < 1.0) {
246 func = clsForDetId[89] * (rr_cl);
250 for (
int i = vectOffset;
i < (vectOffset + 20);
i++) {
252 if (func > clsForDetId[
i]) {
254 }
else if (func < clsForDetId[i]) {
265 int leftStrip = strip - 1;
266 int rightStrip = strip + 1;
270 if (rightStrip > roll.
nstrips())
273 double deltawL = fabs((roll.
centreOfStrip(leftStrip)).
x() - hit_pos.
x());
274 double deltawR = fabs((roll.
centreOfStrip(rightStrip)).
x() - hit_pos.
x());
276 if (deltawL >= deltawR) {
T getParameter(std::string const &) const
float strip(const LocalPoint &lp) const
const Topology & topology() const override
int LeftRightNeighbour(const RPCRoll &roll, const LocalPoint &hit_pos, int strip)
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()
const RPCRollSpecs * specs() const
std::vector< double > clsForDetId
const Topology & topology() const override
~RPCSimModelTiming() override
void simulateNoise(const RPCRoll *, CLHEP::HepRandomEngine *) override
void simulate(const RPCRoll *roll, const edm::PSimHitContainer &rpcHits, CLHEP::HepRandomEngine *) override
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
Container::value_type value_type
double getSmearedTime() const
std::vector< double > sum_clsize
const std::vector< double > & getCls(uint32_t id)
float stripLength() const override
det heigth (strip length in the middle)
virtual int channel(const LocalPoint &p) const =0
int getClSize(uint32_t id, float posX, CLHEP::HepRandomEngine *)
RPCSimModelTiming(const edm::ParameterSet &config)
std::set< RPCDigi > irpc_digis
void setDeltaY(double dy)
RPCSynchronizer * _rpcSync
std::vector< PSimHit > PSimHitContainer
RPCDigiSimLinks theRpcDigiSimLinks
void setTime(double time)
int getSimHitBxAndTimingForIRPC(const PSimHit *, CLHEP::HepRandomEngine *)
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
float stripLength() const override