5 #include "CLHEP/Random/RandGaussQ.h" 12 bxTime_(
pset.getParameter<double>(
"bxTime")),
13 integratedLum_(
pset.getParameter<double>(
"IntegratedLuminosity")),
14 adcNbits_(
pset.getParameter<uint32_t>(
"adcNbits")),
15 tdcNbits_(
pset.getParameter<uint32_t>(
"tdcNbits")),
16 adcSaturation_MIP_(
pset.getParameter<double>(
"adcSaturation_MIP")),
17 adcLSB_MIP_(adcSaturation_MIP_ /
std::
pow(2., adcNbits_)),
18 adcBitSaturation_(
std::
pow(2, adcNbits_) - 1),
19 adcThreshold_MIP_(
pset.getParameter<double>(
"adcThreshold_MIP")),
20 iThreshold_MIP_(
pset.getParameter<double>(
"iThreshold_MIP")),
21 toaLSB_ns_(
pset.getParameter<double>(
"toaLSB_ns")),
22 tdcBitSaturation_(
std::
pow(2, tdcNbits_) - 1),
23 referenceChargeColl_(
pset.getParameter<double>(
"referenceChargeColl")),
24 noiseLevel_(
pset.getParameter<double>(
"noiseLevel")),
25 sigmaDistorsion_(
pset.getParameter<double>(
"sigmaDistorsion")),
26 sigmaTDC_(
pset.getParameter<double>(
"sigmaTDC")),
27 formulaLandauNoise_(
pset.getParameter<
std::
string>(
"formulaLandauNoise")) {}
33 CLHEP::HepRandomEngine* hre)
const {
36 std::vector<double> emptyV;
37 std::vector<double>
radius(1);
38 std::vector<double> fluence(1);
39 std::vector<double> chOverMPV(1);
41 for (MTDSimHitDataAccumulator::const_iterator
it =
input.begin();
it !=
input.end();
it++) {
50 if (thedet ==
nullptr)
51 throw cms::Exception(
"EtlElectronicsSim") <<
"GeographicalID: " << std::hex << geoId.
rawId() <<
" (" 58 for (
size_t i = 0;
i <
it->second.hit_info[0].size();
i++) {
59 if ((
it->second).hit_info[0][
i] == 0) {
65 double finalToA = (
it->second).hit_info[1][
i];
66 double finalToC = (
it->second).hit_info[1][
i];
69 const unsigned int ibucket = std::floor(finalToA /
bxTime_);
70 if ((
i + ibucket) >= chargeColl.size())
74 double SignalToNoise =
83 chOverMPV[0] = (
it->second).hit_info[0][
i] / (
it->second).hit_info[2][
i];
89 double smearing1 = 0.0;
90 double smearing2 = 0.0;
92 if (sigmaToA > 0. && sigmaToC > 0.) {
93 smearing1 = CLHEP::RandGaussQ::shoot(hre, 0., sigmaToA);
94 smearing2 = CLHEP::RandGaussQ::shoot(hre, 0., sigmaToC);
97 finalToA += smearing1;
98 finalToC += smearing1 + smearing2;
104 if (times[0] == 0 && times[1] == 0 && times[2] == 0) {
108 finalToA += times[0];
109 finalToC += times[2];
110 if (finalToA >= finalToC)
112 chargeColl[
i + ibucket] += (
it->second).hit_info[0][
i];
114 if (toa1[
i + ibucket] == 0. || (finalToA - ibucket *
bxTime_) < toa1[
i + ibucket]) {
115 toa1[
i + ibucket] = finalToA - ibucket *
bxTime_;
116 toa2[
i + ibucket] = finalToC - ibucket *
bxTime_;
119 tot[
i + ibucket] = finalToC - finalToA;
133 const uint8_t
col)
const {
136 for (
int it = 0;
it < (
int)(chargeColl.size());
it++) {
143 LogTrace(
"ETLElectronicsSim") <<
"[runTrivialShaper]";
148 for (
int it = 0;
it < (
int)(chargeColl.size());
it++) {
159 newSample.
set(thres,
false, tdc_time1, tdc_time2,
adc, row,
col);
173 std::ostringstream
msg;
182 if (rawDataFrame.
size() <= itIdx + 2)
187 bool putInEvent(
false);
189 dataFrame.setSample(
it, rawDataFrame[itIdx - 2 +
it]);
191 putInEvent = rawDataFrame[itIdx - 2 +
it].threshold();
std::array< float, 3 > timeAtThr(const float scale, const float threshold1, const float threshold2) const
const edm::ESGetToken< MTDGeometry, MTDDigiGeometryRecord > geomToken_
static constexpr int dfSIZE
const reco::FormulaEvaluator formulaLandauNoise_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
void updateOutput(ETLDigiCollection &coll, const ETLDataFrame &rawDataFrame) const
std::array< MTDSimData_t, nSamples > MTDSimHitData
virtual const Topology & topology() const
void push_back(T const &t)
std::unordered_map< MTDCellId, MTDCellInfo > MTDSimHitDataAccumulator
const ETLPulseShape etlPulseShape_
const float referenceChargeColl_
static std::string const input
virtual float localX(float mpX) const =0
int size() const
total number of samples in the digi
void resize(size_t s)
allow to set size
ETLElectronicsSim(const edm::ParameterSet &pset, edm::ConsumesCollector iC)
const D & id() const
det id
const MTDGeomDet * idToDet(DetId) const override
void set(bool thr, bool mode, uint16_t toa, uint16_t tot, uint16_t data, uint8_t row, uint8_t col)
void setSample(int i, const S &sample)
const float sigmaDistorsion_
const uint32_t adcBitSaturation_
virtual float localY(float mpY) const =0
const float iThreshold_MIP_
constexpr uint32_t rawId() const
get the raw id
const uint32_t tdcBitSaturation_
void runTrivialShaper(ETLDataFrame &dataFrame, const mtd::MTDSimHitData &chargeColl, const mtd::MTDSimHitData &toa1, const mtd::MTDSimHitData &toa2, const uint8_t row, const uint8_t column) const
Detector identifier class for the Endcap Timing Layer.
void getEventSetup(const edm::EventSetup &evt)
void run(const mtd::MTDSimHitDataAccumulator &input, ETLDigiCollection &output, CLHEP::HepRandomEngine *hre) const
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 float adcThreshold_MIP_