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 digitizeOnlyMuons_(
config.getParameter<
bool>(
"digitizeOnlyMuons")),
24 resolutionX_(
config.getParameter<double>(
"resolutionX")),
28 elecMomCut1(1.96
e-03),
30 elecEffLowCoeff(1.7
e-05),
31 elecEffLowParam0(2.1),
32 elecEffMidCoeff(1.34),
33 elecEffMidParam0(-5.75
e-01),
34 elecEffMidParam1(7.96
e-01) {}
40 CLHEP::HepRandomEngine* engine,
43 bool digiMuon =
false;
44 bool digiElec =
false;
50 double partMom =
hit.pabs();
51 double checkMuonEff = CLHEP::RandFlat::shoot(engine, 0., 1.);
52 double checkElecEff = CLHEP::RandFlat::shoot(engine, 0., 1.);
64 if (checkElecEff < elecEff)
67 if (!(digiMuon || digiElec))
71 for (
const auto& digi : cluster) {
72 detectorHitMap_.emplace(digi, &
hit);
73 strips_.emplace(digi);
83 float randomJitterTime = CLHEP::RandGaussQ::shoot(engine, 0.,
timeJitter_);
87 throw cms::Exception(
"Geometry") <<
"GEMSignalModel::getSimHitBx() - GEM simhit id does not match any GEM roll id: "
91 if (roll->id().region() == 0) {
93 <<
"GEMSignalModel::getSimHitBx() - this GEM id is from barrel, which cannot happen: " << roll->id() <<
"\n";
95 const int nstrips = roll->nstrips();
96 float middleStrip = nstrips / 2.;
97 const LocalPoint& middleOfRoll = roll->centreOfStrip(middleStrip);
98 const GlobalPoint& globMiddleRol = roll->toGlobal(middleOfRoll);
99 double muRadius =
sqrt(globMiddleRol.
x() * globMiddleRol.
x() + globMiddleRol.
y() * globMiddleRol.
y() +
100 globMiddleRol.
z() * globMiddleRol.
z());
101 double timeCalibrationOffset_ = muRadius /
cspeed;
103 const GEMStripTopology* top(dynamic_cast<const GEMStripTopology*>(&(roll->topology())));
104 const float halfStripLength(0.5 * top->stripLength());
105 const float distanceFromEdge(halfStripLength - simHitPos.y());
111 const float averagePropagationTime(distanceFromEdge / signalPropagationSpeedTrue);
113 float randomResolutionTime = CLHEP::RandGaussQ::shoot(engine, 0.,
timeResolution_);
114 const float simhitTime(tof +
averageShapingTime_ + randomResolutionTime + averagePropagationTime + randomJitterTime);
115 float referenceTime = 0.;
116 referenceTime = timeCalibrationOffset_ + halfStripLength / signalPropagationSpeedTrue +
averageShapingTime_;
117 const float timeDifference(simhitTime - referenceTime);
119 bx = static_cast<int>(std::round((timeDifference) / 25.));
122 LogDebug(
"GEMDigiProducer") <<
"checktime "
123 <<
"bx = " <<
bx <<
"\tdeltaT = " << timeDifference <<
"\tsimT = " << simhitTime
124 <<
"\trefT = " << referenceTime <<
"\ttof = " << tof
125 <<
"\tavePropT = " << averagePropagationTime
126 <<
"\taveRefPropT = " << halfStripLength / signalPropagationSpeedTrue <<
"\n";
133 CLHEP::HepRandomEngine* engine) {
138 if (hit_entry.x() < hit_exit.x()) {
139 start_point = hit_entry;
140 end_point = hit_exit;
142 start_point = hit_exit;
143 end_point = hit_entry;
147 float smeared_start_x = start_point.
x() -
std::abs(CLHEP::RandGaussQ::shoot(engine, 0,
resolutionX_));
148 float smeared_end_x = end_point.x() +
std::abs(CLHEP::RandGaussQ::shoot(engine, 0,
resolutionX_));
150 LocalPoint smeared_start_point(smeared_start_x, start_point.y(), start_point.z());
151 LocalPoint smeared_end_point(smeared_end_x, end_point.y(), end_point.z());
153 int cluster_start = top->
channel(smeared_start_point);
154 int cluster_end = top->
channel(smeared_end_point);
156 std::vector<std::pair<int, int> > cluster;
158 cluster.emplace_back(
strip,
bx);