19 m_ebCorrNoise{ebCorrNoise0, ebCorrNoise1}
44 CLHEP::HepRandomEngine* engine)
const {
55 int nSaturatedSamples = 0;
56 double icalconst = 1.;
77 noisy[ig]->
noisify(noiseframe[ig], engine);
81 std::vector<std::vector<int>> adctrace(
nSamples);
89 adctrace[
i][igain] = -1;
98 asignal = pedestals[igain] + ecalSamples[
i] / (LSB[igain] * icalconst) + trueRMS[igain] * noiseframe[igain][
i];
104 asignal = ecalSamples[
i] / (LSB[igain] * icalconst);
106 int isignal = asignal;
108 unsigned int adc = asignal - (double)isignal < 0.5 ? isignal : isignal + 1;
112 if (nSaturatedSamples == 0)
113 firstSaturatedSample[igain] =
i;
116 adctrace[
i][igain] =
adc;
118 if (nSaturatedSamples == 0) {
129 int previousSaturatedSamples = 5;
130 int nextSaturatedSamples = 10;
131 int startingLowerGainSample = 0;
132 int endingLowerGainSample = (firstSaturatedSample[0] + nextSaturatedSamples + (nSaturatedSamples));
134 if (nSaturatedSamples != 0 and (firstSaturatedSample[0] - previousSaturatedSamples) < 0) {
135 startingLowerGainSample = 0;
137 startingLowerGainSample = (firstSaturatedSample[0] - previousSaturatedSamples);
142 if (nSaturatedSamples != 0 and
j >= startingLowerGainSample and
j < endingLowerGainSample) {
156 LogDebug(
"EcalLiteDTUCoder") <<
"Pedestals for " <<
detId.rawId() <<
" gain range " <<
gainId <<
" : \n" 157 <<
"Mean = " <<
ped <<
" rms = " <<
width;
159 LogDebug(
"EcalLiteDTUCoder") <<
"Pedestals not found, put default values (ped: 12; width: 2.5) \n";
170 if (icalit != icalMap.
end()) {
171 thisconst = (*icalit);
173 LogDebug(
"EcalLiteDTUCoder") <<
"Intercalib Constant not found, put default value \n";
180 icalconst = thisconst;
const EcalLiteDTUPedestalsMap * m_peds
static constexpr unsigned int NGAINS
void encode(const EcalSamples &ecalSamples, EcalDataFrame_Ph2 &df, CLHEP::HepRandomEngine *) const
produce the pulse-shape
void setIntercalibConstants(const EcalIntercalibConstantsMC *ical)
static constexpr double maxEneEB
const Noisifier * m_ebCorrNoise[ecalPh2::NGAINS]
double fullScaleEnergy(const DetId &did) const
limit on the energy scale due to the electronics range
void setFullScaleEnergy(double EBscale)
void setGainRatios(float gainRatios)
const EcalIntercalibConstantsMC * m_intercals
Abs< T >::type abs(const T &t)
static constexpr const float * gains
const_iterator find(uint32_t rawId) const
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
void findPedestal(const DetId &detId, int gainId, double &pedestal, double &width) const
std::vector< Item >::const_iterator const_iterator
void findIntercalibConstant(const DetId &detId, double &icalconst) const
virtual void analogToDigital(CLHEP::HepRandomEngine *, const EcalSamples &clf, EcalDataFrame_Ph2 &df) const
from EcalSamples to EcalDataFrame_Ph2
virtual ~EcalLiteDTUCoder()
dtor
const self & getMap() const
const_iterator end() const
float EcalIntercalibConstantMC
void setPedestals(const EcalLiteDTUPedestalsMap *pedestals)
can be fetched every event from the EventSetup
EcalLiteDTUCoder(bool addNoise, bool PreMix1, Noisifier *ebCorrNoise0, Noisifier *ebCorrNoise1=nullptr)
ctor
static constexpr unsigned int MAXADC
uint16_t *__restrict__ uint16_t const *__restrict__ adc