CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
RPCSynchronizer Class Reference

#include <RPCSynchronizer.h>

Public Member Functions

RPCSimSetUpgetRPCSimSetUp ()
 
int getSimHitBx (const PSimHit *)
 
 RPCSynchronizer (const edm::ParameterSet &config)
 
void setRandomEngine (CLHEP::HepRandomEngine &eng)
 
void setRPCSimSetUp (RPCSimSetUp *simsetup)
 
 ~RPCSynchronizer ()
 

Private Attributes

double cosmicPar
 
bool cosmics
 
double cspeed
 
double dtimCs
 
CLHEP::RandGaussQ * gauss1
 
CLHEP::RandGaussQ * gauss2
 
double lbGate
 
double lbGateNew
 
double LHCGate
 
double resEle
 
double resRPC
 
double sspeed
 
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 44 of file RPCSynchronizer.h.

Constructor & Destructor Documentation

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

Definition at line 40 of file RPCSynchronizer.cc.

References trackerHits::c, alignCSCRings::e, and edm::ParameterSet::getParameter().

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

Definition at line 68 of file RPCSynchronizer.cc.

68  {
69  delete gauss1;
70  delete gauss2;
71 }
CLHEP::RandGaussQ * gauss1
CLHEP::RandGaussQ * gauss2

Member Function Documentation

RPCSimSetUp* RPCSynchronizer::getRPCSimSetUp ( )
inline

Definition at line 52 of file RPCSynchronizer.h.

References theSimSetUp.

52 { return theSimSetUp; }
RPCSimSetUp * theSimSetUp
int RPCSynchronizer::getSimHitBx ( const PSimHit simhit)

Definition at line 74 of file RPCSynchronizer.cc.

References RPCGeometry::dets(), PSimHit::detUnitId(), geometry, RPCSimSetUp::getGeometry(), RPCSimSetUp::getTime(), PSimHit::localPosition(), n, alignCSCRings::r, RPCChamber::rolls(), PSimHit::timeOfFlight(), and PV3DBase< T, PVType, FrameType >::y().

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

75 {
76 
77  RPCSimSetUp* simsetup = this->getRPCSimSetUp();
78  const RPCGeometry * geometry = simsetup->getGeometry();
79  float timeref = simsetup->getTime(simhit->detUnitId());
80 
81  int bx = -999;
82  LocalPoint simHitPos = simhit->localPosition();
83  float tof = simhit->timeOfFlight();
84 
85  //automatic variable to prevent memory leak
86 
87  float rr_el = gauss1->fire(0.,resEle);
88 
89  RPCDetId SimDetId(simhit->detUnitId());
90 
91  const RPCRoll* SimRoll = 0;
92 
93  for(TrackingGeometry::DetContainer::const_iterator it = geometry->dets().begin(); it != geometry->dets().end(); it++){
94 
95  if( dynamic_cast< RPCChamber* >( *it ) != 0 ){
96 
97  RPCChamber* ch = dynamic_cast< RPCChamber* >( *it );
98 
99  std::vector< const RPCRoll*> rollsRaf = (ch->rolls());
100  for(std::vector<const RPCRoll*>::iterator r = rollsRaf.begin();
101  r != rollsRaf.end(); ++r){
102 
103  if((*r)->id() == SimDetId) {
104  SimRoll = &(*(*r));
105  break;
106  }
107  }
108  }
109  }
110 
111  if(SimRoll != 0){
112 
113  float distanceFromEdge = 0;
114  float half_stripL = 0.;
115 
116  if(SimRoll->id().region() == 0){
117  const RectangularStripTopology* top_= dynamic_cast<const RectangularStripTopology*> (&(SimRoll->topology()));
118  half_stripL = top_->stripLength()/2;
119  distanceFromEdge = half_stripL + simHitPos.y();
120  }else{
121  const TrapezoidalStripTopology* top_= dynamic_cast<const TrapezoidalStripTopology*> (&(SimRoll->topology()));
122  half_stripL = top_->stripLength()/2;
123  distanceFromEdge = half_stripL - simHitPos.y();
124  }
125 
126 
127  float prop_time = distanceFromEdge/sspeed;
128 
129  double rr_tim1 = gauss2->fire(0.,resRPC);
130  double total_time = tof + prop_time + timOff + rr_tim1 + rr_el;
131 
132  // Bunch crossing assignment
133  double time_differ = 0.;
134 
135  if(cosmics){
136  time_differ = (total_time - (timeref + ((half_stripL/sspeed ) + timOff)))/cosmicPar;
137  }
138  else if(!cosmics){
139  time_differ = total_time - (timeref + ( half_stripL/sspeed ) + timOff);
140  }
141 
142  double inf_time = 0;
143  double sup_time = 0;
144 
145 
146  for(int n = -5; n <= 5; ++n){
147 
148  if(cosmics){
149  inf_time = (-lbGate/2 + n*LHCGate )/cosmicPar;
150  sup_time = ( lbGate/2 + n*LHCGate )/cosmicPar;
151  }
152  else if(!cosmics){
153  inf_time = -lbGate/2 + n*LHCGate;
154  sup_time = lbGate/2 + n*LHCGate;
155  }
156 
157  if(inf_time < time_differ && time_differ < sup_time) {
158  bx = n;
159  break;
160  }
161  }
162  }
163 
164 
165  return bx;
166 }
CLHEP::RandGaussQ * gauss1
float getTime(uint32_t id)
Definition: RPCSimSetUp.cc:184
T y() const
Definition: PV3DBase.h:63
const RPCGeometry * getGeometry()
Definition: RPCSimSetUp.h:48
float timeOfFlight() const
Definition: PSimHit.h:69
Local3DPoint localPosition() const
Definition: PSimHit.h:44
RPCSimSetUp * getRPCSimSetUp()
const std::vector< const RPCRoll * > & rolls() const
Return the Rolls.
Definition: RPCChamber.cc:68
virtual const DetContainer & dets() const
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: RPCGeometry.cc:33
CLHEP::RandGaussQ * gauss2
ESHandle< TrackerGeometry > geometry
unsigned int detUnitId() const
Definition: PSimHit.h:93
void RPCSynchronizer::setRandomEngine ( CLHEP::HepRandomEngine &  eng)
void RPCSynchronizer::setRPCSimSetUp ( RPCSimSetUp simsetup)
inline

Member Data Documentation

double RPCSynchronizer::cosmicPar
private

Definition at line 66 of file RPCSynchronizer.h.

bool RPCSynchronizer::cosmics
private

Definition at line 68 of file RPCSynchronizer.h.

double RPCSynchronizer::cspeed
private

Definition at line 63 of file RPCSynchronizer.h.

double RPCSynchronizer::dtimCs
private

Definition at line 60 of file RPCSynchronizer.h.

CLHEP::RandGaussQ* RPCSynchronizer::gauss1
private

Definition at line 70 of file RPCSynchronizer.h.

CLHEP::RandGaussQ* RPCSynchronizer::gauss2
private

Definition at line 71 of file RPCSynchronizer.h.

double RPCSynchronizer::lbGate
private

Definition at line 64 of file RPCSynchronizer.h.

double RPCSynchronizer::lbGateNew
private

Definition at line 65 of file RPCSynchronizer.h.

double RPCSynchronizer::LHCGate
private

Definition at line 67 of file RPCSynchronizer.h.

double RPCSynchronizer::resEle
private

Definition at line 61 of file RPCSynchronizer.h.

double RPCSynchronizer::resRPC
private

Definition at line 58 of file RPCSynchronizer.h.

double RPCSynchronizer::sspeed
private

Definition at line 62 of file RPCSynchronizer.h.

RPCSimSetUp* RPCSynchronizer::theSimSetUp
private

Definition at line 72 of file RPCSynchronizer.h.

Referenced by getRPCSimSetUp(), and setRPCSimSetUp().

double RPCSynchronizer::timOff
private

Definition at line 59 of file RPCSynchronizer.h.