20 #include "CLHEP/Random/RandGaussQ.h" 33 resRPC =
config.getParameter<
double>(
"timeResolution");
34 timOff =
config.getParameter<
double>(
"timingRPCOffset");
35 dtimCs =
config.getParameter<
double>(
"deltatimeAdjacentStrip");
36 resEle =
config.getParameter<
double>(
"timeJitter");
37 sspeed =
config.getParameter<
double>(
"signalPropagationSpeed");
38 lbGate =
config.getParameter<
double>(
"linkGateWidth");
39 LHCGate =
config.getParameter<
double>(
"Gate");
41 irpc_timing_res =
config.getParameter<
double>(
"IRPC_time_resolution");
42 irpc_electronics_jitter =
config.getParameter<
double>(
"IRPC_electronics_jitter");
49 cspeed =
c * 1
e+2 * 1
e-9;
51 sspeed = sspeed * cspeed;
67 float rr_el = CLHEP::RandGaussQ::shoot(engine, 0., resEle);
71 const RPCRoll* SimRoll =
nullptr;
73 for (TrackingGeometry::DetContainer::const_iterator
it =
geometry->dets().begin();
it !=
geometry->dets().end();
75 if (dynamic_cast<const RPCChamber*>(*
it) !=
nullptr) {
76 auto ch =
dynamic_cast<const RPCChamber*
>(*it);
78 std::vector<const RPCRoll*> rollsRaf = (ch->rolls());
79 for (std::vector<const RPCRoll*>::iterator r = rollsRaf.begin(); r != rollsRaf.end(); ++r) {
80 if ((*r)->id() == SimDetId) {
88 if (SimRoll !=
nullptr) {
89 float distanceFromEdge = 0;
90 float half_stripL = 0.;
92 if (SimRoll->id().region() == 0) {
95 distanceFromEdge = half_stripL + simHitPos.
y();
99 distanceFromEdge = half_stripL - simHitPos.
y();
102 float prop_time = distanceFromEdge / sspeed;
104 double rr_tim1 = CLHEP::RandGaussQ::shoot(engine, 0., resRPC);
105 double total_time = tof + prop_time + timOff + rr_tim1 + rr_el;
108 double time_differ = 0.;
111 time_differ = (total_time - (timeref + ((half_stripL / sspeed) + timOff))) / cosmicPar;
113 time_differ = total_time - (timeref + (half_stripL / sspeed) + timOff);
121 inf_time = (-lbGate / 2 +
n * LHCGate) / cosmicPar;
122 sup_time = (lbGate / 2 +
n * LHCGate) / cosmicPar;
124 inf_time = -lbGate / 2 +
n * LHCGate;
125 sup_time = lbGate / 2 +
n * LHCGate;
128 if (inf_time < time_differ && time_differ < sup_time) {
150 float rr_el = CLHEP::RandGaussQ::shoot(engine, 0., irpc_electronics_jitter);
154 const RPCRoll* SimRoll =
nullptr;
156 for (TrackingGeometry::DetContainer::const_iterator
it =
geometry->dets().begin();
it !=
geometry->dets().end();
158 if (dynamic_cast<const RPCChamber*>(*
it) !=
nullptr) {
159 auto ch =
dynamic_cast<const RPCChamber*
>(*it);
161 std::vector<const RPCRoll*> rollsRaf = (ch->rolls());
162 for (std::vector<const RPCRoll*>::iterator r = rollsRaf.begin(); r != rollsRaf.end(); ++r) {
163 if ((*r)->id() == SimDetId) {
171 if (SimRoll !=
nullptr) {
172 float distanceFromEdge = 0;
173 float half_stripL = 0.;
175 if (SimRoll->id().region() == 0) {
178 distanceFromEdge = half_stripL + simHitPos.
y();
182 distanceFromEdge = half_stripL - simHitPos.
y();
185 float prop_time = distanceFromEdge / sspeed;
188 double rr_tim1 = CLHEP::RandGaussQ::shoot(engine, 0., irpc_timing_res);
190 double total_time = tof + prop_time + timOff + rr_tim1 + rr_el;
193 double time_differ = 0.;
196 time_differ = (total_time - (timeref + ((half_stripL / sspeed) + timOff))) / cosmicPar;
198 time_differ = total_time - (timeref + (half_stripL / sspeed) + timOff);
201 double exact_total_time = tof + prop_time + timOff;
202 double exact_time_differ = 0.;
205 exact_time_differ = (exact_total_time - (timeref + ((half_stripL / sspeed) + timOff))) / cosmicPar;
207 exact_time_differ = exact_total_time - (timeref + (half_stripL / sspeed) + timOff);
215 inf_time = (-lbGate / 2 +
n * LHCGate) / cosmicPar;
216 sup_time = (lbGate / 2 +
n * LHCGate) / cosmicPar;
218 inf_time = -lbGate / 2 +
n * LHCGate;
219 sup_time = lbGate / 2 +
n * LHCGate;
222 if (inf_time < time_differ && time_differ < sup_time) {
224 the_exact_time = exact_time_differ;
225 the_smeared_time = time_differ;
unsigned int detUnitId() const
float getTime(uint32_t id)
RPCSynchronizer(const edm::ParameterSet &config)
int getSimHitBx(const PSimHit *, CLHEP::HepRandomEngine *)
float stripLength() const override
const RPCGeometry * getGeometry()
Local3DPoint localPosition() const
float timeOfFlight() const
float stripLength() const override
det heigth (strip length in the middle)
int getSimHitBxAndTimingForIRPC(const PSimHit *, CLHEP::HepRandomEngine *)