4 #include "CLHEP/Random/RandGaussQ.h" 9 debug_( pset.getUntrackedParameter<
bool>(
"debug",
false) ),
10 bxTime_(pset.getParameter<double>(
"bxTime") ),
11 sigmaEta_( pset.getParameter<
std::
string>(
"etaResolution") ),
12 adcNbits_( pset.getParameter<uint32_t>(
"adcNbits") ),
13 tdcNbits_( pset.getParameter<uint32_t>(
"tdcNbits") ),
14 adcSaturation_MIP_( pset.getParameter<double>(
"adcSaturation_MIP") ),
15 adcLSB_MIP_( adcSaturation_MIP_/
std::
pow(2.,adcNbits_) ),
16 adcThreshold_MIP_( pset.getParameter<double>(
"adcThreshold_MIP") ),
17 toaLSB_ns_( pset.getParameter<double>(
"toaLSB_ns") ) {
23 CLHEP::HepRandomEngine *hre)
const {
28 std::vector<double> emptyV;
29 std::vector<double>
eta(1);
31 for(MTDSimHitDataAccumulator::const_iterator it=input.begin();
37 for(
size_t i=0;
i<it->second.hit_info[0].size();
i++) {
42 float finalToA = (it->second).hit_info[1][
i];
50 finalToA += CLHEP::RandGaussQ::shoot(hre, 0., sigmaToA);
53 const unsigned int ibucket = std::floor( finalToA/
bxTime_ );
54 if ( (
i+ibucket) >= chargeColl.size() )
continue;
56 chargeColl[
i+ibucket] += (it->second).hit_info[0][
i];
58 if ( toa[
i+ibucket] == 0. || (finalToA-ibucket*
bxTime_) < toa[
i+ibucket] )
59 toa[
i+ibucket] = finalToA - ibucket*bxTime_;
65 runTrivialShaper(rawDataFrame,chargeColl,toa, it->first.row_, it->first.column_);
76 const uint8_t row,
const uint8_t
col)
const {
79 for(
int it=0; it<(
int)(chargeColl.size()); it++) debug |= (chargeColl[it]>adcThreshold_fC_);
82 if(debug)
edm::LogVerbatim(
"ETLElectronicsSim") <<
"[runTrivialShaper]" << std::endl;
85 for(
int it=0; it<(
int)(chargeColl.size()); it++)
89 const uint32_t tdc_time=std::floor( toa[it] /
toaLSB_ns_ );
98 std::ostringstream
msg;
107 if(rawDataFrame.
size()<=itIdx+2)
return;
111 bool putInEvent(
false);
112 for(
int it=0;it<
dfSIZE; ++it) {
113 dataFrame.setSample(it, rawDataFrame[itIdx-2+it]);
114 if(it==2) putInEvent = rawDataFrame[itIdx-2+it].threshold();
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)
ETLElectronicsSim(const edm::ParameterSet &pset)
std::unordered_map< MTDCellId, MTDCellInfo > MTDSimHitDataAccumulator
int size() const
total number of samples in the digi
std::array< MTDSimData_t, nSamples > MTDSimHitData
static std::string const input
const reco::FormulaEvaluator sigmaEta_
void updateOutput(ETLDigiCollection &coll, const ETLDataFrame &rawDataFrame) const
void resize(size_t s)
allow to set size
void setSample(int i, const S &sample)
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
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)
const float adcSaturation_MIP_
void print(std::ostream &out=std::cout)
Power< A, B >::type pow(const A &a, const B &b)
const D & id() const
det id
const float adcThreshold_MIP_