7 #include "CLHEP/Random/RandFlat.h" 8 #include "CLHEP/Random/RandPoissonQ.h" 9 #include "CLHEP/Random/RandGaussQ.h" 10 #include "CLHEP/Units/GlobalPhysicalConstants.h" 18 averageEfficiency_(
config.getParameter<double>(
"averageEfficiency")),
19 averageShapingTime_(
config.getParameter<double>(
"averageShapingTime")),
20 timeResolution_(
config.getParameter<double>(
"timeResolution")),
21 timeJitter_(
config.getParameter<double>(
"timeJitter")),
22 signalPropagationSpeed_(
config.getParameter<double>(
"signalPropagationSpeed")),
23 resolutionX_(
config.getParameter<double>(
"resolutionX")),
26 energyMinCut(28.1
e-09) {}
32 CLHEP::HepRandomEngine* engine,
41 for (
const auto& digi : cluster) {
42 detectorHitMap_.emplace(digi, &
hit);
43 strips_.emplace(digi);
53 float randomJitterTime = CLHEP::RandGaussQ::shoot(engine, 0.,
timeJitter_);
57 throw cms::Exception(
"Geometry") <<
"GEMSignalModel::getSimHitBx() - GEM simhit id does not match any GEM roll id: " 61 if (
roll->id().region() == 0) {
63 <<
"GEMSignalModel::getSimHitBx() - this GEM id is from barrel, which cannot happen: " <<
roll->id() <<
"\n";
65 const int nstrips =
roll->nstrips();
66 float middleStrip = nstrips / 2.;
69 double muRadius =
sqrt(globMiddleRol.
x() * globMiddleRol.
x() + globMiddleRol.
y() * globMiddleRol.
y() +
70 globMiddleRol.
z() * globMiddleRol.
z());
71 double timeCalibrationOffset_ = muRadius /
cspeed;
74 const float halfStripLength(0.5 * top->stripLength());
75 const float distanceFromEdge(halfStripLength - simHitPos.y());
81 const float averagePropagationTime(distanceFromEdge / signalPropagationSpeedTrue);
83 float randomResolutionTime = CLHEP::RandGaussQ::shoot(engine, 0.,
timeResolution_);
84 const float simhitTime(tof +
averageShapingTime_ + randomResolutionTime + averagePropagationTime + randomJitterTime);
85 float referenceTime = 0.;
86 referenceTime = timeCalibrationOffset_ + halfStripLength / signalPropagationSpeedTrue +
averageShapingTime_;
87 const float timeDifference(simhitTime - referenceTime);
89 bx =
static_cast<int>(std::round((timeDifference) / 25.));
92 LogDebug(
"GEMDigiProducer") <<
"checktime " 93 <<
"bx = " <<
bx <<
"\tdeltaT = " << timeDifference <<
"\tsimT = " << simhitTime
94 <<
"\trefT = " << referenceTime <<
"\ttof = " << tof
95 <<
"\tavePropT = " << averagePropagationTime
96 <<
"\taveRefPropT = " << halfStripLength / signalPropagationSpeedTrue <<
"\n";
103 CLHEP::HepRandomEngine* engine) {
108 if (hit_entry.x() < hit_exit.x()) {
109 start_point = hit_entry;
110 end_point = hit_exit;
112 start_point = hit_exit;
113 end_point = hit_entry;
117 float smeared_start_x = start_point.
x() -
std::abs(CLHEP::RandGaussQ::shoot(engine, 0,
resolutionX_));
118 float smeared_end_x = end_point.x() +
std::abs(CLHEP::RandGaussQ::shoot(engine, 0,
resolutionX_));
120 LocalPoint smeared_start_point(smeared_start_x, start_point.y(), start_point.z());
121 LocalPoint smeared_end_point(smeared_end_x, end_point.y(), end_point.z());
123 int cluster_start = top->
channel(smeared_start_point);
124 int cluster_end = top->
channel(smeared_end_point);
126 std::vector<std::pair<int, int> > cluster;
128 cluster.emplace_back(
strip,
bx);
const GEMEtaPartition * etaPartition(GEMDetId id) const
Return a GEMEtaPartition given its id.
unsigned int detUnitId() const
std::vector< std::pair< int, int > > simulateClustering(const GEMStripTopology *, const PSimHit *, const int, CLHEP::HepRandomEngine *)
int channel(const LocalPoint &) const override
double signalPropagationSpeed_
const double energyMinCut
Abs< T >::type abs(const T &t)
void simulate(const GEMEtaPartition *, const edm::PSimHitContainer &, CLHEP::HepRandomEngine *, Strips &, DetectorHitMap &) override
constexpr NumType convertMmToCm(NumType millimeters)
int getSimHitBx(const PSimHit *, CLHEP::HepRandomEngine *)
Local3DPoint localPosition() const
std::multimap< std::pair< unsigned int, int >, const PSimHit *, std::less< std::pair< unsigned int, int > > > DetectorHitMap
std::set< std::pair< int, int > > Strips
const GEMGeometry * geometry_
float timeOfFlight() const
std::vector< PSimHit > PSimHitContainer
~GEMSignalModel() override
double averageShapingTime_
GEMSignalModel(const edm::ParameterSet &)