CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
RPCSynchronizer Class Reference

#include <RPCSynchronizer.h>

Public Member Functions

double getExactTime () const
 
RPCSimSetUpgetRPCSimSetUp ()
 
int getSimHitBx (const PSimHit *, CLHEP::HepRandomEngine *)
 
int getSimHitBxAndTimingForIRPC (const PSimHit *, CLHEP::HepRandomEngine *)
 
double getSmearedTime () const
 
 RPCSynchronizer (const edm::ParameterSet &config)
 
void setRPCSimSetUp (RPCSimSetUp *simsetup)
 
 ~RPCSynchronizer ()
 

Private Attributes

double cosmicPar
 
bool cosmics
 
double cspeed
 
double dtimCs
 
double irpc_electronics_jitter
 
double irpc_timing_res
 
double lbGate
 
double lbGateNew
 
double LHCGate
 
double resEle
 
double resRPC
 
double sspeed
 
double the_exact_time
 
double the_smeared_time
 
RPCSimSetUptheSimSetUp
 
double timOff
 

Detailed Description

Class for the RPC strip response simulation based on a parametrized model (ORCA-based)

Author
Raffaello Trentadue – INFN Bari

Definition at line 36 of file RPCSynchronizer.h.

Constructor & Destructor Documentation

RPCSynchronizer::RPCSynchronizer ( const edm::ParameterSet config)

Definition at line 34 of file RPCSynchronizer.cc.

References EnergyCorrector::c, GlobalTrackerMuonAlignment_cfi::cosmics, MillePedeFileConverter_cfg::e, and edm::ParameterSet::getParameter().

34  {
35 
36  resRPC = config.getParameter<double>("timeResolution");
37  timOff = config.getParameter<double>("timingRPCOffset");
38  dtimCs = config.getParameter<double>("deltatimeAdjacentStrip");
39  resEle = config.getParameter<double>("timeJitter");
40  sspeed = config.getParameter<double>("signalPropagationSpeed");
41  lbGate = config.getParameter<double>("linkGateWidth");
42  LHCGate = config.getParameter<double>("Gate");
43  cosmics = config.getParameter<bool>("cosmics");
44  irpc_timing_res = config.getParameter<double>("IRPC_time_resolution");
45  irpc_electronics_jitter = config.getParameter<double>("IRPC_electronics_jitter");
46 
47  //"magic" parameter for cosmics
48  cosmicPar=37.62;
49 
50  double c=299792458;// [m/s]
51  //light speed in [cm/ns]
52  cspeed=c*1e+2*1e-9;
53  //signal propagation speed [cm/ns]
54  sspeed=sspeed*cspeed;
55 }
T getParameter(std::string const &) const
double irpc_electronics_jitter
RPCSynchronizer::~RPCSynchronizer ( )

Definition at line 57 of file RPCSynchronizer.cc.

57 {}

Member Function Documentation

double RPCSynchronizer::getExactTime ( ) const
inline

Definition at line 46 of file RPCSynchronizer.h.

46 {return the_exact_time;}
RPCSimSetUp* RPCSynchronizer::getRPCSimSetUp ( )
inline

Definition at line 45 of file RPCSynchronizer.h.

45 { return theSimSetUp; }
RPCSimSetUp * theSimSetUp
int RPCSynchronizer::getSimHitBx ( const PSimHit simhit,
CLHEP::HepRandomEngine *  engine 
)

Definition at line 59 of file RPCSynchronizer.cc.

References GlobalTrackerMuonAlignment_cfi::cosmics, RPCGeometry::dets(), PSimHit::detUnitId(), RPCSimSetUp::getGeometry(), RPCSimSetUp::getTime(), PSimHit::localPosition(), gen::n, alignCSCRings::r, RectangularStripTopology::stripLength(), TrapezoidalStripTopology::stripLength(), PSimHit::timeOfFlight(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by RPCSimSimple::simulate(), RPCSimParam::simulate(), RPCSimAverageNoise::simulate(), RPCSimAverageNoiseEffCls::simulate(), RPCSimAverageNoiseEff::simulate(), RPCSimAverage::simulate(), and RPCSimAsymmetricCls::simulate().

60 {
61  RPCSimSetUp* simsetup = this->getRPCSimSetUp();
62  const RPCGeometry * geometry = simsetup->getGeometry();
63  float timeref = simsetup->getTime(simhit->detUnitId());
64 
65  int bx = -999;
66  LocalPoint simHitPos = simhit->localPosition();
67  float tof = simhit->timeOfFlight();
68 
69  //automatic variable to prevent memory leak
70 
71  float rr_el = CLHEP::RandGaussQ::shoot(engine, 0.,resEle);
72 
73  RPCDetId SimDetId(simhit->detUnitId());
74 
75  const RPCRoll* SimRoll = 0;
76 
77  for(TrackingGeometry::DetContainer::const_iterator it = geometry->dets().begin(); it != geometry->dets().end(); it++){
78 
79  if( dynamic_cast< const RPCChamber* >( *it ) != 0 ){
80 
81  auto ch = dynamic_cast<const RPCChamber* >( *it );
82 
83  std::vector< const RPCRoll*> rollsRaf = (ch->rolls());
84  for(std::vector<const RPCRoll*>::iterator r = rollsRaf.begin();
85  r != rollsRaf.end(); ++r){
86 
87  if((*r)->id() == SimDetId) {
88  SimRoll = &(*(*r));
89  break;
90  }
91  }
92  }
93  }
94 
95  if(SimRoll != 0){
96 
97  float distanceFromEdge = 0;
98  float half_stripL = 0.;
99 
100  if(SimRoll->id().region() == 0){
101  const RectangularStripTopology* top_= dynamic_cast<const RectangularStripTopology*> (&(SimRoll->topology()));
102  half_stripL = top_->stripLength()/2;
103  distanceFromEdge = half_stripL + simHitPos.y();
104  }else{
105  const TrapezoidalStripTopology* top_= dynamic_cast<const TrapezoidalStripTopology*> (&(SimRoll->topology()));
106  half_stripL = top_->stripLength()/2;
107  distanceFromEdge = half_stripL - simHitPos.y();
108  }
109 
110 
111  float prop_time = distanceFromEdge/sspeed;
112 
113  double rr_tim1 = CLHEP::RandGaussQ::shoot(engine, 0.,resRPC);
114  double total_time = tof + prop_time + timOff + rr_tim1 + rr_el;
115 
116  // Bunch crossing assignment
117  double time_differ = 0.;
118 
119  if(cosmics){
120  time_differ = (total_time - (timeref + ((half_stripL/sspeed ) + timOff)))/cosmicPar;
121  }
122  else if(!cosmics){
123  time_differ = total_time - (timeref + ( half_stripL/sspeed ) + timOff);
124  }
125 
126  double inf_time = 0;
127  double sup_time = 0;
128 
129 
130  for(int n = -5; n <= 5; ++n){
131 
132  if(cosmics){
133  inf_time = (-lbGate/2 + n*LHCGate )/cosmicPar;
134  sup_time = ( lbGate/2 + n*LHCGate )/cosmicPar;
135  }
136  else if(!cosmics){
137  inf_time = -lbGate/2 + n*LHCGate;
138  sup_time = lbGate/2 + n*LHCGate;
139  }
140 
141  if(inf_time < time_differ && time_differ < sup_time) {
142  bx = n;
143  break;
144  }
145  }
146  }
147 
148 
149  return bx;
150 }
virtual float stripLength() const
float getTime(uint32_t id)
Definition: RPCSimSetUp.cc:386
T y() const
Definition: PV3DBase.h:63
const RPCGeometry * getGeometry()
Definition: RPCSimSetUp.h:50
float timeOfFlight() const
Definition: PSimHit.h:69
Local3DPoint localPosition() const
Definition: PSimHit.h:44
RPCSimSetUp * getRPCSimSetUp()
virtual const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: RPCGeometry.cc:33
virtual float stripLength() const
det heigth (strip length in the middle)
unsigned int detUnitId() const
Definition: PSimHit.h:93
int RPCSynchronizer::getSimHitBxAndTimingForIRPC ( const PSimHit simhit,
CLHEP::HepRandomEngine *  engine 
)

Definition at line 152 of file RPCSynchronizer.cc.

References GlobalTrackerMuonAlignment_cfi::cosmics, RPCGeometry::dets(), PSimHit::detUnitId(), RPCSimSetUp::getGeometry(), RPCSimSetUp::getTime(), PSimHit::localPosition(), gen::n, alignCSCRings::r, RectangularStripTopology::stripLength(), TrapezoidalStripTopology::stripLength(), PSimHit::timeOfFlight(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by RPCSimModelTiming::simulate().

153 {
154 
155  RPCSimSetUp* simsetup = this->getRPCSimSetUp();
156  const RPCGeometry * geometry = simsetup->getGeometry();
157  float timeref = simsetup->getTime(simhit->detUnitId());
158 
159  int bx = -999;
160  LocalPoint simHitPos = simhit->localPosition();
161  float tof = simhit->timeOfFlight();
162 
163  //automatic variable to prevent memory leak
164 
165  // float rr_el = CLHEP::RandGaussQ::shoot(engine, 0.,resEle);
166  float rr_el = CLHEP::RandGaussQ::shoot(engine, 0., irpc_electronics_jitter);
167 
168  RPCDetId SimDetId(simhit->detUnitId());
169 
170  const RPCRoll* SimRoll = 0;
171 
172  for(TrackingGeometry::DetContainer::const_iterator it = geometry->dets().begin(); it != geometry->dets().end(); it++){
173 
174  if( dynamic_cast< const RPCChamber* >( *it ) != 0 ){
175 
176  auto ch = dynamic_cast<const RPCChamber* >( *it );
177 
178  std::vector< const RPCRoll*> rollsRaf = (ch->rolls());
179  for(std::vector<const RPCRoll*>::iterator r = rollsRaf.begin();
180  r != rollsRaf.end(); ++r){
181 
182  if((*r)->id() == SimDetId) {
183  SimRoll = &(*(*r));
184  break;
185  }
186  }
187  }
188  }
189 
190  if(SimRoll != 0){
191 
192  float distanceFromEdge = 0;
193  float half_stripL = 0.;
194 
195  if(SimRoll->id().region() == 0){
196  const RectangularStripTopology* top_= dynamic_cast<const RectangularStripTopology*> (&(SimRoll->topology()));
197  half_stripL = top_->stripLength()/2;
198  distanceFromEdge = half_stripL + simHitPos.y();
199  }
200  else{
201  const TrapezoidalStripTopology* top_= dynamic_cast<const TrapezoidalStripTopology*> (&(SimRoll->topology()));
202  half_stripL = top_->stripLength()/2;
203  distanceFromEdge = half_stripL - simHitPos.y();
204  }
205 
206 
207  float prop_time = distanceFromEdge/sspeed;
208 
209  // double rr_tim1 = CLHEP::RandGaussQ::shoot(engine, 0.,resRPC);
210  double rr_tim1 = CLHEP::RandGaussQ::shoot(engine, 0., irpc_timing_res);
211 
212  double total_time = tof + prop_time + timOff + rr_tim1 + rr_el;
213 
214 
215  // Bunch crossing assignment
216  double time_differ = 0.;
217 
218  if(cosmics){
219  time_differ = (total_time - (timeref + ((half_stripL/sspeed ) + timOff)))/cosmicPar;
220  }
221  else if(!cosmics){
222  time_differ = total_time - (timeref + ( half_stripL/sspeed ) + timOff);
223  }
224 
225  double exact_total_time = tof + prop_time + timOff;
226  double exact_time_differ = 0.;
227 
228  if(cosmics){
229  exact_time_differ = (exact_total_time - (timeref + ((half_stripL/sspeed ) + timOff)))/cosmicPar;
230  }
231  else if(!cosmics){
232  exact_time_differ = exact_total_time - (timeref + ( half_stripL/sspeed ) + timOff);
233  }
234 
235 
236  double inf_time = 0;
237  double sup_time = 0;
238 
239 
240  for(int n = -5; n <= 5; ++n){
241 
242  if(cosmics){
243  inf_time = (-lbGate/2 + n*LHCGate )/cosmicPar;
244  sup_time = ( lbGate/2 + n*LHCGate )/cosmicPar;
245  }
246  else if(!cosmics){
247  inf_time = -lbGate/2 + n*LHCGate;
248  sup_time = lbGate/2 + n*LHCGate;
249  }
250 
251  if(inf_time < time_differ && time_differ < sup_time) {
252  bx = n;
253  the_exact_time=exact_time_differ;
254  the_smeared_time=time_differ;
255 
256  //cout<<"Debug\t"<<inf_time<<'\t'<<sup_time<<endl;
258  // cout<<"Bingo\t"<<time_differ<<'\t'<<bx<<'\t'<<exact_time_differ<<'\t'<<exact_time_differ-time_differ<<'\t'<<exact_time_differ-bx*25.<<endl;
259  break;
260  }
261  }
262  }
263  return bx;
264 }
virtual float stripLength() const
float getTime(uint32_t id)
Definition: RPCSimSetUp.cc:386
T y() const
Definition: PV3DBase.h:63
const RPCGeometry * getGeometry()
Definition: RPCSimSetUp.h:50
float timeOfFlight() const
Definition: PSimHit.h:69
Local3DPoint localPosition() const
Definition: PSimHit.h:44
RPCSimSetUp * getRPCSimSetUp()
virtual const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: RPCGeometry.cc:33
double irpc_electronics_jitter
virtual float stripLength() const
det heigth (strip length in the middle)
unsigned int detUnitId() const
Definition: PSimHit.h:93
double RPCSynchronizer::getSmearedTime ( ) const
inline

Definition at line 47 of file RPCSynchronizer.h.

Referenced by RPCSimModelTiming::simulate().

47 {return the_smeared_time;}
void RPCSynchronizer::setRPCSimSetUp ( RPCSimSetUp simsetup)
inline

Member Data Documentation

double RPCSynchronizer::cosmicPar
private

Definition at line 58 of file RPCSynchronizer.h.

bool RPCSynchronizer::cosmics
private

Definition at line 60 of file RPCSynchronizer.h.

double RPCSynchronizer::cspeed
private

Definition at line 55 of file RPCSynchronizer.h.

double RPCSynchronizer::dtimCs
private

Definition at line 52 of file RPCSynchronizer.h.

double RPCSynchronizer::irpc_electronics_jitter
private

Definition at line 62 of file RPCSynchronizer.h.

double RPCSynchronizer::irpc_timing_res
private

Definition at line 61 of file RPCSynchronizer.h.

double RPCSynchronizer::lbGate
private

Definition at line 56 of file RPCSynchronizer.h.

double RPCSynchronizer::lbGateNew
private

Definition at line 57 of file RPCSynchronizer.h.

double RPCSynchronizer::LHCGate
private

Definition at line 59 of file RPCSynchronizer.h.

double RPCSynchronizer::resEle
private

Definition at line 53 of file RPCSynchronizer.h.

double RPCSynchronizer::resRPC
private

Definition at line 50 of file RPCSynchronizer.h.

double RPCSynchronizer::sspeed
private

Definition at line 54 of file RPCSynchronizer.h.

double RPCSynchronizer::the_exact_time
private

Definition at line 63 of file RPCSynchronizer.h.

double RPCSynchronizer::the_smeared_time
private

Definition at line 64 of file RPCSynchronizer.h.

RPCSimSetUp* RPCSynchronizer::theSimSetUp
private

Definition at line 65 of file RPCSynchronizer.h.

double RPCSynchronizer::timOff
private

Definition at line 51 of file RPCSynchronizer.h.