1 #include "CLHEP/Units/GlobalPhysicalConstants.h" 18 MIPPerMeV_(1.0 /
pset.getParameter<double>(
"meVPerMIP")),
19 integratedLum_(
pset.getParameter<double>(
"IntegratedLuminosity")),
21 lgadGain_(
pset.getParameter<
std::
string>(
"LGADGainVsFluence")),
22 lgadGainDegradation_(
pset.getParameter<
std::
string>(
"LGADGainDegradation")),
23 applyDegradation_(
pset.getParameter<
bool>(
"applyDegradation")),
24 bxTime_(
pset.getParameter<double>(
"bxTime")),
25 tofDelay_(
pset.getParameter<double>(
"tofDelay")),
37 CLHEP::HepRandomEngine* hre) {
40 std::vector<double> emptyV;
41 std::vector<double>
radius(1);
42 std::vector<double> fluence(1);
43 std::vector<double>
gain(1);
44 std::vector<double> param(2);
45 std::vector<double> momentum(1);
48 const int nchits = hitRefs.size();
49 LogTrace(
"ETLDeviceSim") <<
"Processing " << nchits <<
" SIM hits";
51 for (
int i = 0;
i < nchits; ++
i) {
52 const int hitidx = std::get<0>(hitRefs[
i]);
53 const uint32_t
id = std::get<1>(hitRefs[
i]);
59 <<
"got a DetId that was not ETL: Det = " <<
detId.det() <<
" subDet = " <<
detId.mtdSubDetector();
68 if (thedet ==
nullptr) {
70 <<
") is invalid!" <<
std::dec << std::endl;
75 const float toa = std::get<2>(hitRefs[
i]) +
tofDelay_;
79 momentum[0] =
hit.pabs();
102 const auto& global_point = thedet->
toGlobal(simscaled);
104 radius[0] = global_point.perp();
111 MPV_charge *=
gain[0];
114 double dGapCenter =
TMath::Max(TMath::Abs(simscaled.
x()), TMath::Abs(simscaled.
y()));
116 param[1] = dGapCenter;
119 MPV_charge *=
gain[0];
123 const auto& thepixel = topo.
pixelIndex(simscaled);
124 const uint8_t row =
static_cast<uint8_t
>(thepixel.first);
125 const uint8_t
col =
static_cast<uint8_t
>(thepixel.second);
126 LogTrace(
"ETLDeviceSim") <<
"Processing hit in pixel # " << hitidx <<
" DetId " << etlid.
rawId() <<
" row/col " 127 << (uint32_t)row <<
" " << (uint32_t)
col <<
" inPixel " << topo.
isInPixel(simscaled)
128 <<
" tof " << toa <<
" ene " <<
hit.energyLoss() <<
" MIP " <<
MIPPerMeV_ <<
" gain " 129 <<
gain[0] <<
" charge " <<
charge <<
" MPV " << MPV_charge;
135 const int itime = std::floor(toa /
bxTime_) + 9;
136 if (itime < 0 || itime > 14)
140 if (itime >= (
int)simHitIt->second.hit_info[0].size())
142 (simHitIt->second).hit_info[0][itime] +=
charge;
144 const float tof = toa - (itime - 9) *
bxTime_;
146 if ((simHitIt->second).hit_info[1][itime] == 0. || tof < (simHitIt->second).hit_info[1][itime]) {
147 (simHitIt->second).hit_info[1][itime] = tof;
149 (simHitIt->second).hit_info[2][itime] += MPV_charge;
const MTDGeometry * geom_
const reco::FormulaEvaluator lgadGain_
bool isInPixel(const LocalPoint &p) const
const edm::ESGetToken< MTDGeometry, MTDDigiGeometryRecord > geomToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
virtual const Topology & topology() const
virtual const PixelTopology & specificTopology() const
const reco::FormulaEvaluator MPVKaon_
const bool applyDegradation_
std::unordered_map< MTDCellId, MTDCellInfo > MTDSimHitDataAccumulator
ETLDeviceSim(const edm::ParameterSet &pset, edm::ConsumesCollector iC)
void getEventSetup(const edm::EventSetup &evt)
Detector identifier base class for the MIP Timing Layer.
const reco::FormulaEvaluator MPVMuon_
const reco::FormulaEvaluator MPVElectron_
constexpr NumType convertGeVToMeV(NumType gev)
const reco::FormulaEvaluator fluence_
const MTDGeomDet * idToDet(DetId) const override
Abs< T >::type abs(const T &t)
const float integratedLum_
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
const reco::FormulaEvaluator lgadGainDegradation_
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)
constexpr NumType convertMmToCm(NumType millimeters)
const reco::FormulaEvaluator MPVProton_
constexpr uint32_t rawId() const
get the raw id
Detector identifier class for the Endcap Timing Layer.
static int position[264][3]
std::pair< int, int > pixelIndex(const LocalPoint &p) const
const reco::FormulaEvaluator MPVPion_