1 #include "CLHEP/Units/GlobalPhysicalConstants.h"
18 MIPPerMeV_(1.0 /
pset.getParameter<double>(
"meVPerMIP")),
19 bxTime_(
pset.getParameter<double>(
"bxTime")),
20 tofDelay_(
pset.getParameter<double>(
"tofDelay")) {}
27 CLHEP::HepRandomEngine* hre) {
31 const int nchits = hitRefs.size();
32 for (
int i = 0;
i < nchits; ++
i) {
33 const int hitidx = std::get<0>(hitRefs[
i]);
34 const uint32_t
id = std::get<1>(hitRefs[
i]);
40 <<
"got a DetId that was not ETL: Det = " << detId.
det() <<
" subDet = " << detId.
mtdSubDetector();
49 if (thedet ==
nullptr) {
51 <<
") is invalid!" <<
std::dec << std::endl;
53 const ProxyMTDTopology& topoproxy = static_cast<const ProxyMTDTopology&>(thedet->topology());
56 const float toa = std::get<2>(hitRefs[
i]) +
tofDelay_;
61 const auto& pentry =
hit.entryPoint();
64 const auto& thepixel = topo.pixel(simscaled);
67 const int ixbin =
int(thepixel.first);
68 const int iybin =
int(thepixel.second);
69 const float fractionX = thepixel.first - ixbin;
70 const float fractionY = thepixel.second - iybin;
71 if ((fractionX > 1.0 - topo.gapxInterpadFrac() || fractionX < topo.gapxInterpadFrac()) ||
72 (ixbin == 0 && fractionX < topo.gapxBorderFrac()) ||
73 (ixbin == topo.nrows() - 1 && fractionX > 1.0 - topo.gapxBorderFrac()))
75 if ((fractionY > 1.0 - topo.gapyInterpadFrac() || fractionY < topo.gapyInterpadFrac()) ||
76 (iybin == 0 && fractionY < topo.gapyBorderFrac()) ||
77 (iybin == topo.ncolumns() - 1 && fractionY > 1.0 - topo.gapyBorderFrac()))
79 const uint8_t row(thepixel.first),
col(thepixel.second);
85 const int itime = std::floor(toa /
bxTime_) + 9;
86 if (itime < 0 || itime > 14)
90 if (itime >= (
int)simHitIt->second.hit_info[0].size())
93 (simHitIt->second).hit_info[0][itime] +=
charge;
96 const float tof = toa - (itime - 9) *
bxTime_;
98 if ((simHitIt->second).hit_info[1][itime] == 0. || tof < (simHitIt->second).hit_info[1][itime]) {
99 (simHitIt->second).hit_info[1][itime] = tof;