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 bx0filter_(
config.getParameter<
bool>(
"bx0filter")),
24 resolutionX_(
config.getParameter<double>(
"resolutionX")),
27 energyMinCut(28.1
e-09) {}
33 CLHEP::HepRandomEngine* engine,
44 for (
const auto& digi : cluster) {
45 detectorHitMap_.emplace(digi, &
hit);
46 strips_.emplace(digi);
56 float randomJitterTime = CLHEP::RandGaussQ::shoot(engine, 0.,
timeJitter_);
60 throw cms::Exception(
"Geometry") <<
"GEMSignalModel::getSimHitBx() - GEM simhit id does not match any GEM roll id: " 64 if (
roll->id().region() == 0) {
66 <<
"GEMSignalModel::getSimHitBx() - this GEM id is from barrel, which cannot happen: " <<
roll->id() <<
"\n";
68 const int nstrips =
roll->nstrips();
69 float middleStrip = nstrips / 2.;
72 double muRadius =
sqrt(globMiddleRol.
x() * globMiddleRol.
x() + globMiddleRol.
y() * globMiddleRol.
y() +
73 globMiddleRol.
z() * globMiddleRol.
z());
74 double timeCalibrationOffset_ = muRadius /
cspeed;
77 const float halfStripLength(0.5 * top->stripLength());
78 const float distanceFromEdge(halfStripLength - simHitPos.y());
84 const float averagePropagationTime(distanceFromEdge / signalPropagationSpeedTrue);
86 float randomResolutionTime = CLHEP::RandGaussQ::shoot(engine, 0.,
timeResolution_);
87 const float simhitTime(tof +
averageShapingTime_ + randomResolutionTime + averagePropagationTime + randomJitterTime);
88 float referenceTime = 0.;
89 referenceTime = timeCalibrationOffset_ + halfStripLength / signalPropagationSpeedTrue +
averageShapingTime_;
90 const float timeDifference(simhitTime - referenceTime);
92 bx =
static_cast<int>(std::round((timeDifference) / 25.));
95 LogDebug(
"GEMDigiProducer") <<
"checktime " 96 <<
"bx = " <<
bx <<
"\tdeltaT = " << timeDifference <<
"\tsimT = " << simhitTime
97 <<
"\trefT = " << referenceTime <<
"\ttof = " << tof
98 <<
"\tavePropT = " << averagePropagationTime
99 <<
"\taveRefPropT = " << halfStripLength / signalPropagationSpeedTrue <<
"\n";
106 CLHEP::HepRandomEngine* engine) {
111 if (hit_entry.x() < hit_exit.x()) {
112 start_point = hit_entry;
113 end_point = hit_exit;
115 start_point = hit_exit;
116 end_point = hit_entry;
120 float smeared_start_x = start_point.
x() -
std::abs(CLHEP::RandGaussQ::shoot(engine, 0,
resolutionX_));
121 float smeared_end_x = end_point.x() +
std::abs(CLHEP::RandGaussQ::shoot(engine, 0,
resolutionX_));
123 LocalPoint smeared_start_point(smeared_start_x, start_point.y(), start_point.z());
124 LocalPoint smeared_end_point(smeared_end_x, end_point.y(), end_point.z());
126 int cluster_start = top->
channel(smeared_start_point);
127 int cluster_end = top->
channel(smeared_end_point);
129 std::vector<std::pair<int, int> > cluster;
131 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 &)