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
GEMSynchronizer Class Reference

#include <GEMSynchronizer.h>

Public Member Functions

 GEMSynchronizer (const edm::ParameterSet &config)
 
GEMSimSetUpgetGEMSimSetUp ()
 
int getSimHitBx (const PSimHit *)
 
void setGEMSimSetUp (GEMSimSetUp *simsetup)
 
void setRandomEngine (CLHEP::HepRandomEngine &eng)
 
 ~GEMSynchronizer ()
 

Private Attributes

double averageShapingTime_
 
double bxwidth_
 
bool cosmics_
 
CLHEP::RandGaussQ * gauss1_
 
CLHEP::RandGaussQ * gauss2_
 
int minBunch_
 
double signalPropagationSpeed_
 
GEMSimSetUpsimSetUp_
 
double timeJitter_
 
double timeResolution_
 

Detailed Description

Class for the GEM strip response simulation based on a parametrized model

Author
Vadim Khotilovich

Definition at line 24 of file GEMSynchronizer.h.

Constructor & Destructor Documentation

GEMSynchronizer::GEMSynchronizer ( const edm::ParameterSet config)

Definition at line 19 of file GEMSynchronizer.cc.

References averageShapingTime_, bxwidth_, cosmics_, alignCSCRings::e, edm::ParameterSet::getParameter(), signalPropagationSpeed_, timeJitter_, and timeResolution_.

19  :
20  gauss1_(0), gauss2_(0)
21 {
22  timeResolution_ = config.getParameter<double>("timeResolution");
23  averageShapingTime_ = config.getParameter<double>("averageShapingTime");
24  timeJitter_ = config.getParameter<double>("timeJitter");
25  signalPropagationSpeed_ = config.getParameter<double>("signalPropagationSpeed");
26  cosmics_ = config.getParameter<bool>("cosmics");
27  bxwidth_ = config.getParameter<double>("bxwidth");
28 
29  // signal propagation speed in vacuum in [m/s]
30  const double cspeed = 299792458;
31  // signal propagation speed in material in [cm/ns]
32  signalPropagationSpeed_ = signalPropagationSpeed_ * cspeed * 1e+2 * 1e-9;
33 }
T getParameter(std::string const &) const
CLHEP::RandGaussQ * gauss1_
double signalPropagationSpeed_
double averageShapingTime_
CLHEP::RandGaussQ * gauss2_
GEMSynchronizer::~GEMSynchronizer ( )

Definition at line 43 of file GEMSynchronizer.cc.

References gauss1_, and gauss2_.

44 {
45  if (gauss1_) delete gauss1_;
46  if (gauss2_) delete gauss2_;
47 }
CLHEP::RandGaussQ * gauss1_
CLHEP::RandGaussQ * gauss2_

Member Function Documentation

GEMSimSetUp* GEMSynchronizer::getGEMSimSetUp ( )
inline

Definition at line 36 of file GEMSynchronizer.h.

References simSetUp_.

Referenced by getSimHitBx().

36 { return simSetUp_; }
GEMSimSetUp * simSetUp_
int GEMSynchronizer::getSimHitBx ( const PSimHit simhit)

Definition at line 50 of file GEMSynchronizer.cc.

References averageShapingTime_, bxwidth_, cosmics_, gather_cfg::cout, debug, GEMGeometry::dets(), PSimHit::detUnitId(), edm::hlt::Exception, gauss1_, gauss2_, geometry, getGEMSimSetUp(), GEMSimSetUp::getGeometry(), GEMSimSetUp::getTime(), GEMEtaPartition::id(), PSimHit::localPosition(), signalPropagationSpeed_, timeJitter_, PSimHit::timeOfFlight(), timeResolution_, and PV3DBase< T, PVType, FrameType >::y().

Referenced by GEMSimAverage::simulate().

51 {
52  GEMSimSetUp* simsetup = getGEMSimSetUp();
53  const GEMGeometry * geometry = simsetup->getGeometry();
54  // calibration offset for a particular detector part
55  float calibrationTime = simsetup->getTime(simhit->detUnitId());
56 
57  int bx = -999;
58  LocalPoint simHitPos = simhit->localPosition();
59  float tof = simhit->timeOfFlight();
60  // random Gaussian time correction due to electronics jitter
61  float randomJitterTime = gauss1_->fire(0., timeJitter_);
62 
63  GEMDetId shdetid(simhit->detUnitId());
64 
65  const GEMEtaPartition* shRoll = 0;
66 
67  for(const auto &det: geometry->dets())
68  {
69  if( dynamic_cast< GEMEtaPartition* >( det ) != 0 )
70  {
71  GEMEtaPartition* roll = dynamic_cast< GEMEtaPartition* >( det );
72 
73  if(roll->id() == shdetid)
74  {
75  shRoll = roll;
76  break;
77  }
78  }
79  }
80 
81  if(shRoll != 0)
82  {
83  float distanceFromEdge = 0;
84  float halfStripLength = 0.;
85 
86  if(shRoll->id().region() == 0)
87  {
88  throw cms::Exception("Geometry")
89  << "GEMSynchronizer::getSimHitBx() - this GEM id is from barrel, which cannot happen: "<<shRoll->id()<< "\n";
90  }
91  else
92  {
93  const TrapezoidalStripTopology* top = dynamic_cast<const TrapezoidalStripTopology*> (&(shRoll->topology()));
94  halfStripLength = 0.5 * top->stripLength();
95  distanceFromEdge = halfStripLength - simHitPos.y();
96  }
97 
98  // average time for the signal to propagate from the SimHit to the top of a strip
99  float averagePropagationTime = distanceFromEdge/signalPropagationSpeed_;
100  // random Gaussian time correction due to the finite timing resolution of the detector
101  float randomResolutionTime = gauss2_->fire(0., timeResolution_);
102 
103  float simhitTime = tof + (averageShapingTime_ + randomResolutionTime) + (averagePropagationTime + randomJitterTime);
104  float referenceTime = calibrationTime + halfStripLength/signalPropagationSpeed_ + averageShapingTime_;
105  float timeDifference = cosmics_ ? (simhitTime - referenceTime)/COSMIC_PAR : simhitTime - referenceTime;
106 
107  // assign the bunch crossing
108  bx = static_cast<int>( std::round((timeDifference)/bxwidth_) );
109 
110  // check time
111  const bool debug( false );
112  if (debug)
113  {
114  std::cout<<"checktime "<<bx<<" "<<timeDifference<<" "<<simhitTime<<" "<<referenceTime<<" "<<tof<<" "<<averagePropagationTime<<std::endl;
115  }
116  }
117  return bx;
118 }
CLHEP::RandGaussQ * gauss1_
T y() const
Definition: PV3DBase.h:63
GEMDetId id() const
GEMSimSetUp * getGEMSimSetUp()
double signalPropagationSpeed_
float timeOfFlight() const
Definition: PSimHit.h:69
virtual const DetContainer & dets() const
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: GEMGeometry.cc:25
Local3DPoint localPosition() const
Definition: PSimHit.h:44
double averageShapingTime_
const GEMGeometry * getGeometry()
Definition: GEMSimSetUp.h:43
ESHandle< TrackerGeometry > geometry
CLHEP::RandGaussQ * gauss2_
tuple cout
Definition: gather_cfg.py:121
float getTime(uint32_t id)
Definition: GEMSimSetUp.cc:140
#define debug
Definition: MEtoEDMFormat.h:34
unsigned int detUnitId() const
Definition: PSimHit.h:93
void GEMSynchronizer::setGEMSimSetUp ( GEMSimSetUp simsetup)
inline

Definition at line 34 of file GEMSynchronizer.h.

References simSetUp_.

Referenced by GEMSimAverage::simulate().

34 { simSetUp_ = simsetup; }
GEMSimSetUp * simSetUp_
void GEMSynchronizer::setRandomEngine ( CLHEP::HepRandomEngine &  eng)

Definition at line 36 of file GEMSynchronizer.cc.

References gauss1_, and gauss2_.

Referenced by GEMSimTriv::setRandomEngine(), and GEMSimAverage::setRandomEngine().

37 {
38  gauss1_ = new CLHEP::RandGaussQ(eng);
39  gauss2_ = new CLHEP::RandGaussQ(eng);
40 }
CLHEP::RandGaussQ * gauss1_
CLHEP::RandGaussQ * gauss2_

Member Data Documentation

double GEMSynchronizer::averageShapingTime_
private

Definition at line 43 of file GEMSynchronizer.h.

Referenced by GEMSynchronizer(), and getSimHitBx().

double GEMSynchronizer::bxwidth_
private

Definition at line 47 of file GEMSynchronizer.h.

Referenced by GEMSynchronizer(), and getSimHitBx().

bool GEMSynchronizer::cosmics_
private

Definition at line 46 of file GEMSynchronizer.h.

Referenced by GEMSynchronizer(), and getSimHitBx().

CLHEP::RandGaussQ* GEMSynchronizer::gauss1_
private

Definition at line 50 of file GEMSynchronizer.h.

Referenced by getSimHitBx(), setRandomEngine(), and ~GEMSynchronizer().

CLHEP::RandGaussQ* GEMSynchronizer::gauss2_
private

Definition at line 51 of file GEMSynchronizer.h.

Referenced by getSimHitBx(), setRandomEngine(), and ~GEMSynchronizer().

int GEMSynchronizer::minBunch_
private

Definition at line 48 of file GEMSynchronizer.h.

double GEMSynchronizer::signalPropagationSpeed_
private

Definition at line 45 of file GEMSynchronizer.h.

Referenced by GEMSynchronizer(), and getSimHitBx().

GEMSimSetUp* GEMSynchronizer::simSetUp_
private

Definition at line 53 of file GEMSynchronizer.h.

Referenced by getGEMSimSetUp(), and setGEMSimSetUp().

double GEMSynchronizer::timeJitter_
private

Definition at line 44 of file GEMSynchronizer.h.

Referenced by GEMSynchronizer(), and getSimHitBx().

double GEMSynchronizer::timeResolution_
private

Definition at line 42 of file GEMSynchronizer.h.

Referenced by GEMSynchronizer(), and getSimHitBx().