22 #include "CLHEP/Random/RandGaussQ.h"
35 resRPC =
config.getParameter<
double>(
"timeResolution");
36 timOff =
config.getParameter<
double>(
"timingRPCOffset");
37 dtimCs =
config.getParameter<
double>(
"deltatimeAdjacentStrip");
38 resEle =
config.getParameter<
double>(
"timeJitter");
39 sspeed =
config.getParameter<
double>(
"signalPropagationSpeed");
40 lbGate =
config.getParameter<
double>(
"linkGateWidth");
41 LHCGate =
config.getParameter<
double>(
"Gate");
43 irpc_timing_res =
config.getParameter<
double>(
"IRPC_time_resolution");
44 irpc_electronics_jitter =
config.getParameter<
double>(
"IRPC_electronics_jitter");
51 cspeed =
c * 1
e+2 * 1
e-9;
53 sspeed = sspeed * cspeed;
69 float rr_el = CLHEP::RandGaussQ::shoot(engine, 0., resEle);
73 const RPCRoll* SimRoll =
nullptr;
75 for (TrackingGeometry::DetContainer::const_iterator it =
geometry->dets().begin(); it !=
geometry->dets().end();
77 if (dynamic_cast<const RPCChamber*>(*it) !=
nullptr) {
78 auto ch = dynamic_cast<const RPCChamber*>(*it);
80 std::vector<const RPCRoll*> rollsRaf = (ch->rolls());
81 for (std::vector<const RPCRoll*>::iterator
r = rollsRaf.begin();
r != rollsRaf.end(); ++
r) {
82 if ((*r)->id() == SimDetId) {
90 if (SimRoll !=
nullptr) {
91 float distanceFromEdge = 0;
92 float half_stripL = 0.;
94 if (SimRoll->id().region() == 0) {
97 distanceFromEdge = half_stripL + simHitPos.
y();
101 distanceFromEdge = half_stripL - simHitPos.
y();
104 float prop_time = distanceFromEdge / sspeed;
106 double rr_tim1 = CLHEP::RandGaussQ::shoot(engine, 0., resRPC);
107 double total_time = tof + prop_time + timOff + rr_tim1 + rr_el;
110 double time_differ = 0.;
113 time_differ = (total_time - (timeref + ((half_stripL / sspeed) + timOff))) / cosmicPar;
115 time_differ = total_time - (timeref + (half_stripL / sspeed) + timOff);
123 inf_time = (-lbGate / 2 +
n * LHCGate) / cosmicPar;
124 sup_time = (lbGate / 2 +
n * LHCGate) / cosmicPar;
126 inf_time = -lbGate / 2 +
n * LHCGate;
127 sup_time = lbGate / 2 +
n * LHCGate;
130 if (inf_time < time_differ && time_differ < sup_time) {
152 float rr_el = CLHEP::RandGaussQ::shoot(engine, 0., irpc_electronics_jitter);
156 const RPCRoll* SimRoll =
nullptr;
158 for (TrackingGeometry::DetContainer::const_iterator it =
geometry->dets().begin(); it !=
geometry->dets().end();
160 if (dynamic_cast<const RPCChamber*>(*it) !=
nullptr) {
161 auto ch = dynamic_cast<const RPCChamber*>(*it);
163 std::vector<const RPCRoll*> rollsRaf = (ch->rolls());
164 for (std::vector<const RPCRoll*>::iterator
r = rollsRaf.begin();
r != rollsRaf.end(); ++
r) {
165 if ((*r)->id() == SimDetId) {
173 if (SimRoll !=
nullptr) {
174 float distanceFromEdge = 0;
175 float half_stripL = 0.;
177 if (SimRoll->id().region() == 0) {
180 distanceFromEdge = half_stripL + simHitPos.
y();
184 distanceFromEdge = half_stripL - simHitPos.
y();
187 float prop_time = distanceFromEdge / sspeed;
190 double rr_tim1 = CLHEP::RandGaussQ::shoot(engine, 0., irpc_timing_res);
192 double total_time = tof + prop_time + timOff + rr_tim1 + rr_el;
195 double time_differ = 0.;
198 time_differ = (total_time - (timeref + ((half_stripL / sspeed) + timOff))) / cosmicPar;
200 time_differ = total_time - (timeref + (half_stripL / sspeed) + timOff);
203 double exact_total_time = tof + prop_time + timOff;
204 double exact_time_differ = 0.;
207 exact_time_differ = (exact_total_time - (timeref + ((half_stripL / sspeed) + timOff))) / cosmicPar;
209 exact_time_differ = exact_total_time - (timeref + (half_stripL / sspeed) + timOff);
217 inf_time = (-lbGate / 2 +
n * LHCGate) / cosmicPar;
218 sup_time = (lbGate / 2 +
n * LHCGate) / cosmicPar;
220 inf_time = -lbGate / 2 +
n * LHCGate;
221 sup_time = lbGate / 2 +
n * LHCGate;
224 if (inf_time < time_differ && time_differ < sup_time) {
226 the_exact_time = exact_time_differ;
227 the_smeared_time = time_differ;