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 *, CLHEP::HepRandomEngine *)
 
 RPCSynchronizer (const edm::ParameterSet &config)
 
void setRPCSimSetUp (RPCSimSetUp *simsetup)
 
 ~RPCSynchronizer ()
 

Private Attributes

double cosmicPar
 
bool cosmics
 
double cspeed
 
double dtimCs
 
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 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, ecal_dqm_sourceclient-live_cfg::cosmics, alignCSCRings::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 
45  //"magic" parameter for cosmics
46  cosmicPar=37.62;
47 
48  double c=299792458;// [m/s]
49  //light speed in [cm/ns]
50  cspeed=c*1e+2*1e-9;
51  //signal propagation speed [cm/ns]
52  sspeed=sspeed*cspeed;
53 
54 }
T getParameter(std::string const &) const
RPCSynchronizer::~RPCSynchronizer ( )

Definition at line 56 of file RPCSynchronizer.cc.

56  {
57 }

Member Function Documentation

RPCSimSetUp* RPCSynchronizer::getRPCSimSetUp ( )
inline

Definition at line 44 of file RPCSynchronizer.h.

References theSimSetUp.

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

Definition at line 60 of file RPCSynchronizer.cc.

References ecal_dqm_sourceclient-live_cfg::cosmics, RPCGeometry::dets(), PSimHit::detUnitId(), geometry, 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(), RPCSimAsymmetricCls::simulate(), and RPCSimAverage::simulate().

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

Member Data Documentation

double RPCSynchronizer::cosmicPar
private

Definition at line 56 of file RPCSynchronizer.h.

bool RPCSynchronizer::cosmics
private

Definition at line 58 of file RPCSynchronizer.h.

double RPCSynchronizer::cspeed
private

Definition at line 53 of file RPCSynchronizer.h.

double RPCSynchronizer::dtimCs
private

Definition at line 50 of file RPCSynchronizer.h.

double RPCSynchronizer::lbGate
private

Definition at line 54 of file RPCSynchronizer.h.

double RPCSynchronizer::lbGateNew
private

Definition at line 55 of file RPCSynchronizer.h.

double RPCSynchronizer::LHCGate
private

Definition at line 57 of file RPCSynchronizer.h.

double RPCSynchronizer::resEle
private

Definition at line 51 of file RPCSynchronizer.h.

double RPCSynchronizer::resRPC
private

Definition at line 48 of file RPCSynchronizer.h.

double RPCSynchronizer::sspeed
private

Definition at line 52 of file RPCSynchronizer.h.

RPCSimSetUp* RPCSynchronizer::theSimSetUp
private

Definition at line 60 of file RPCSynchronizer.h.

Referenced by getRPCSimSetUp(), and setRPCSimSetUp().

double RPCSynchronizer::timOff
private

Definition at line 49 of file RPCSynchronizer.h.