19 m_ebCorrNoise{ebCorrNoise0, ebCorrNoise1}
44 CLHEP::HepRandomEngine* engine)
const {
55 int nSaturatedSamples = 0;
56 double icalconst = 1.;
61 findPedestal(detId, igain, pedestals[igain], widths[igain]);
77 noisy[ig]->
noisify(noiseframe[ig], engine);
81 std::vector<std::vector<int>> adctrace(
nSamples);
85 adctrace[
i].resize(ecalPh2::NGAINS);
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) {
154 ped = (*itped).mean(gainId);
155 width = (*itped).rms(gainId);
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
virtual void analogToDigital(CLHEP::HepRandomEngine *, const EcalSamples &clf, EcalDataFrame_Ph2 &df) const
from EcalSamples to EcalDataFrame_Ph2
const self & getMap() const
constexpr uint32_t rawId() const
get the raw id
double fullScaleEnergy(const DetId &did) const
limit on the energy scale due to the electronics range
void setIntercalibConstants(const EcalIntercalibConstantsMC *ical)
void encode(const EcalSamples &ecalSamples, EcalDataFrame_Ph2 &df, CLHEP::HepRandomEngine *) const
produce the pulse-shape
static constexpr float gains[NGAINS]
void findIntercalibConstant(const DetId &detId, double &icalconst) const
static constexpr double maxEneEB
const Noisifier * m_ebCorrNoise[ecalPh2::NGAINS]
void setFullScaleEnergy(double EBscale)
void setGainRatios(float gainRatios)
const EcalIntercalibConstantsMC * m_intercals
Abs< T >::type abs(const T &t)
constexpr size_t nSamples
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
std::vector< Item >::const_iterator const_iterator
virtual ~EcalLiteDTUCoder()
dtor
const_iterator find(uint32_t rawId) const
void findPedestal(const DetId &detId, int gainId, double &pedestal, double &width) const
const_iterator end() const
float EcalIntercalibConstantMC
void setPedestals(const EcalLiteDTUPedestalsMap *pedestals)
can be fetched every event from the EventSetup
void setSample(int i, EcalLiteDTUSample sam)
EcalLiteDTUCoder(bool addNoise, bool PreMix1, Noisifier *ebCorrNoise0, Noisifier *ebCorrNoise1=nullptr)
ctor
static constexpr unsigned int MAXADC
uint16_t *__restrict__ uint16_t const *__restrict__ adc