21 #include "CLHEP/Random/RandGaussQ.h"
34 resRPC =
config.getParameter<
double>(
"timeResolution");
35 timOff =
config.getParameter<
double>(
"timingRPCOffset");
36 dtimCs =
config.getParameter<
double>(
"deltatimeAdjacentStrip");
37 resEle =
config.getParameter<
double>(
"timeJitter");
38 sspeed =
config.getParameter<
double>(
"signalPropagationSpeed");
39 lbGate =
config.getParameter<
double>(
"linkGateWidth");
40 LHCGate =
config.getParameter<
double>(
"Gate");
42 irpc_timing_res =
config.getParameter<
double>(
"IRPC_time_resolution");
43 irpc_electronics_jitter =
config.getParameter<
double>(
"IRPC_electronics_jitter");
50 cspeed =
c * 1
e+2 * 1
e-9;
52 sspeed = sspeed * cspeed;
68 float rr_el = CLHEP::RandGaussQ::shoot(engine, 0., resEle);
72 const RPCRoll* SimRoll =
nullptr;
74 for (TrackingGeometry::DetContainer::const_iterator it =
geometry->dets().begin(); it !=
geometry->dets().end();
76 if (dynamic_cast<const RPCChamber*>(*it) !=
nullptr) {
77 auto ch = dynamic_cast<const RPCChamber*>(*it);
79 std::vector<const RPCRoll*> rollsRaf = (ch->rolls());
80 for (std::vector<const RPCRoll*>::iterator
r = rollsRaf.begin();
r != rollsRaf.end(); ++
r) {
81 if ((*r)->id() == SimDetId) {
89 if (SimRoll !=
nullptr) {
90 float distanceFromEdge = 0;
91 float half_stripL = 0.;
93 if (SimRoll->id().region() == 0) {
96 distanceFromEdge = half_stripL + simHitPos.
y();
100 distanceFromEdge = half_stripL - simHitPos.
y();
103 float prop_time = distanceFromEdge / sspeed;
105 double rr_tim1 = CLHEP::RandGaussQ::shoot(engine, 0., resRPC);
106 double total_time = tof + prop_time + timOff + rr_tim1 + rr_el;
109 double time_differ = 0.;
112 time_differ = (total_time - (timeref + ((half_stripL / sspeed) + timOff))) / cosmicPar;
114 time_differ = total_time - (timeref + (half_stripL / sspeed) + timOff);
122 inf_time = (-lbGate / 2 +
n * LHCGate) / cosmicPar;
123 sup_time = (lbGate / 2 +
n * LHCGate) / cosmicPar;
125 inf_time = -lbGate / 2 +
n * LHCGate;
126 sup_time = lbGate / 2 +
n * LHCGate;
129 if (inf_time < time_differ && time_differ < sup_time) {
151 float rr_el = CLHEP::RandGaussQ::shoot(engine, 0., irpc_electronics_jitter);
155 const RPCRoll* SimRoll =
nullptr;
157 for (TrackingGeometry::DetContainer::const_iterator it =
geometry->dets().begin(); it !=
geometry->dets().end();
159 if (dynamic_cast<const RPCChamber*>(*it) !=
nullptr) {
160 auto ch = dynamic_cast<const RPCChamber*>(*it);
162 std::vector<const RPCRoll*> rollsRaf = (ch->rolls());
163 for (std::vector<const RPCRoll*>::iterator
r = rollsRaf.begin();
r != rollsRaf.end(); ++
r) {
164 if ((*r)->id() == SimDetId) {
172 if (SimRoll !=
nullptr) {
173 float distanceFromEdge = 0;
174 float half_stripL = 0.;
176 if (SimRoll->id().region() == 0) {
179 distanceFromEdge = half_stripL + simHitPos.
y();
183 distanceFromEdge = half_stripL - simHitPos.
y();
186 float prop_time = distanceFromEdge / sspeed;
189 double rr_tim1 = CLHEP::RandGaussQ::shoot(engine, 0., irpc_timing_res);
191 double total_time = tof + prop_time + timOff + rr_tim1 + rr_el;
194 double time_differ = 0.;
197 time_differ = (total_time - (timeref + ((half_stripL / sspeed) + timOff))) / cosmicPar;
199 time_differ = total_time - (timeref + (half_stripL / sspeed) + timOff);
202 double exact_total_time = tof + prop_time + timOff;
203 double exact_time_differ = 0.;
206 exact_time_differ = (exact_total_time - (timeref + ((half_stripL / sspeed) + timOff))) / cosmicPar;
208 exact_time_differ = exact_total_time - (timeref + (half_stripL / sspeed) + timOff);
216 inf_time = (-lbGate / 2 +
n * LHCGate) / cosmicPar;
217 sup_time = (lbGate / 2 +
n * LHCGate) / cosmicPar;
219 inf_time = -lbGate / 2 +
n * LHCGate;
220 sup_time = lbGate / 2 +
n * LHCGate;
223 if (inf_time < time_differ && time_differ < sup_time) {
225 the_exact_time = exact_time_differ;
226 the_smeared_time = time_differ;