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) {
28 using namespace geant_units::operators;
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]);
38 if (detId.det() !=
DetId::Forward || detId.mtdSubDetector() != 2) {
40 <<
"got a DetId that was not ETL: Det = " << detId.det() <<
" subDet = " << detId.mtdSubDetector();
49 if (thedet ==
nullptr) {
50 throw cms::Exception(
"ETLDeviceSim") <<
"GeographicalID: " << std::hex << geoId.
rawId() <<
" (" << detId.rawId()
51 <<
") is invalid!" <<
std::dec << std::endl;
56 const float toa = std::get<2>(hitRefs[
i]) +
tofDelay_;
61 const auto& pentry = hit.entryPoint();
69 const auto& thepixel = topo.
pixel(simscaled);
70 const uint8_t row(thepixel.first),
col(thepixel.second);
76 const int itime = std::floor(toa /
bxTime_) + 9;
77 if (itime < 0 || itime > 14)
81 if (itime >= (
int)simHitIt->second.hit_info[0].size())
84 (simHitIt->second).hit_info[0][itime] += charge;
87 const float tof = toa - (itime - 9) *
bxTime_;
89 if ((simHitIt->second).hit_info[1][itime] == 0. || tof < (simHitIt->second).hit_info[1][itime]) {
90 (simHitIt->second).hit_info[1][itime] = tof;
const MTDGeometry * geom_
const edm::ESGetToken< MTDGeometry, MTDDigiGeometryRecord > geomToken_
constexpr uint32_t rawId() const
get the raw id
std::unordered_map< MTDCellId, MTDCellInfo > MTDSimHitDataAccumulator
ETLDeviceSim(const edm::ParameterSet &pset, edm::ConsumesCollector iC)
constexpr NumType convertGeVToMeV(NumType gev)
void getEventSetup(const edm::EventSetup &evt)
Detector identifier base class for the MIP Timing Layer.
bool getData(T &iHolder) const
std::pair< float, float > pixel(const LocalPoint &p) const override
virtual const PixelTopology & specificTopology() const
const MTDGeomDet * idToDet(DetId) const override
bool isInPixel(const LocalPoint &p) const
void getHitsResponse(const std::vector< std::tuple< int, uint32_t, float > > &hitRefs, const edm::Handle< edm::PSimHitContainer > &hits, mtd_digitizer::MTDSimHitDataAccumulator *simHitAccumulator, CLHEP::HepRandomEngine *hre)
Detector identifier class for the Endcap Timing Layer.
constexpr NumType convertMmToCm(NumType millimeters)