5 #include "CLHEP/Random/RandGaussQ.h"
12 debug_(pset.getUntrackedParameter<bool>(
"debug",
false)),
13 bxTime_(pset.getParameter<double>(
"bxTime")),
14 integratedLum_(pset.getParameter<double>(
"IntegratedLuminosity")),
15 fluence_(pset.getParameter<std::
string>(
"FluenceVsRadius")),
16 lgadGain_(pset.getParameter<std::
string>(
"LGADGainVsFluence")),
17 timeRes2_(pset.getParameter<std::
string>(
"TimeResolution2")),
18 adcNbits_(pset.getParameter<uint32_t>(
"adcNbits")),
19 tdcNbits_(pset.getParameter<uint32_t>(
"tdcNbits")),
20 adcSaturation_MIP_(pset.getParameter<double>(
"adcSaturation_MIP")),
21 adcLSB_MIP_(adcSaturation_MIP_ / std::
pow(2., adcNbits_)),
22 adcBitSaturation_(std::
pow(2, adcNbits_) - 1),
23 adcThreshold_MIP_(pset.getParameter<double>(
"adcThreshold_MIP")),
24 toaLSB_ns_(pset.getParameter<double>(
"toaLSB_ns")),
25 tdcBitSaturation_(std::
pow(2, tdcNbits_) - 1) {}
31 CLHEP::HepRandomEngine* hre)
const {
34 std::vector<double> emptyV;
35 std::vector<double>
radius(1);
36 std::vector<double> fluence(1);
37 std::vector<double> gain(1);
39 for (MTDSimHitDataAccumulator::const_iterator it = input.begin(); it != input.end(); it++) {
46 if (thedet ==
nullptr)
47 throw cms::Exception(
"EtlElectronicsSim") <<
"GeographicalID: " << std::hex << geoId.
rawId() <<
" ("
52 const auto& global_point = thedet->
toGlobal(local_point);
54 for (
size_t i = 0;
i < it->second.hit_info[0].size();
i++) {
59 float finalToA = (it->second).hit_info[1][
i];
62 radius[0] = global_point.
perp();
66 throw cms::Exception(
"EtlElectronicsSim") <<
"Null or negative LGAD gain!" << std::endl;
72 finalToA += CLHEP::RandGaussQ::shoot(hre, 0., sigmaToA);
75 const unsigned int ibucket = std::floor(finalToA /
bxTime_);
76 if ((
i + ibucket) >= chargeColl.size())
79 chargeColl[
i + ibucket] += (it->second).hit_info[0][
i];
81 if (toa[
i + ibucket] == 0. || (finalToA - ibucket *
bxTime_) < toa[
i + ibucket])
82 toa[
i + ibucket] = finalToA - ibucket * bxTime_;
87 runTrivialShaper(rawDataFrame, chargeColl, toa, it->first.row_, it->first.column_);
96 const uint8_t
col)
const {
99 for (
int it = 0; it < (int)(chargeColl.size()); it++)
107 for (
int it = 0; it < (int)(chargeColl.size()); it++) {
120 std::ostringstream
msg;
121 dataFrame.
print(msg);
128 if (rawDataFrame.
size() <= itIdx + 2)
133 bool putInEvent(
false);
134 for (
int it = 0; it <
dfSIZE; ++it) {
135 dataFrame.setSample(it, rawDataFrame[itIdx - 2 + it]);
137 putInEvent = rawDataFrame[itIdx - 2 + it].threshold();
Log< level::Info, true > LogVerbatim
const edm::ESGetToken< MTDGeometry, MTDDigiGeometryRecord > geomToken_
static constexpr int dfSIZE
virtual const Topology & topology() const
std::array< MTDSimData_t, nSamples > MTDSimHitData
const float integratedLum_
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
constexpr uint32_t rawId() const
get the raw id
void runTrivialShaper(ETLDataFrame &dataFrame, const mtd::MTDSimHitData &chargeColl, const mtd::MTDSimHitData &toa, const uint8_t row, const uint8_t column) const
void push_back(T const &t)
std::unordered_map< MTDCellId, MTDCellInfo > MTDSimHitDataAccumulator
int size() const
total number of samples in the digi
static std::string const input
const reco::FormulaEvaluator fluence_
virtual float localX(float mpX) const =0
bool getData(T &iHolder) const
void updateOutput(ETLDigiCollection &coll, const ETLDataFrame &rawDataFrame) const
void resize(size_t s)
allow to set size
ETLElectronicsSim(const edm::ParameterSet &pset, edm::ConsumesCollector iC)
ETLDetId geographicalId() const
const MTDGeomDet * idToDet(DetId) const override
void setSample(int i, const S &sample)
const uint32_t adcBitSaturation_
virtual float localY(float mpY) const =0
const uint32_t tdcBitSaturation_
const reco::FormulaEvaluator lgadGain_
void run(const mtd::MTDSimHitDataAccumulator &input, ETLDigiCollection &output, CLHEP::HepRandomEngine *hre) const
void set(bool thr, bool mode, uint16_t toa, uint16_t data, uint8_t row, uint8_t col)
Detector identifier class for the Endcap Timing Layer.
void getEventSetup(const edm::EventSetup &evt)
const reco::FormulaEvaluator timeRes2_
void print(std::ostream &out=std::cout)
Power< A, B >::type pow(const A &a, const B &b)
const MTDGeometry * geom_
uint16_t *__restrict__ uint16_t const *__restrict__ adc
const D & id() const
det id
const float adcThreshold_MIP_