6 #include "CalibFormats/CaloObjects/interface/CaloTSamplesBase.icc" 21 m_gainRatios(nullptr),
76 const unsigned int csize(ecalSamples.
size());
82 if (ecalSamples[5] > 0.)
83 LogDebug(
"EcalCoder") <<
"Input caloSample" 88 double pedestals[
NGAINS + 1];
92 double trueRMS[
NGAINS + 1];
94 double icalconst = 1.;
97 for (
unsigned int igain(0); igain <=
NGAINS; ++igain) {
102 trueRMS[igain] =
std::sqrt(widths[igain] * widths[igain] - 1. / 12.);
123 noisy[0]->
noisify(noiseframe[0], engine);
124 if (
nullptr == noisy[1])
125 noisy[0]->
noisify(noiseframe[1], engine,
126 &noisy[0]->vecgau());
127 if (
nullptr == noisy[2])
128 noisy[0]->
noisify(noiseframe[2], engine,
129 &noisy[0]->vecgau());
138 for (
unsigned int i(0);
i != csize; ++
i) {
154 nullptr != noisy[igain - 1] &&
155 noiseframe[igain - 1].isBlank())
157 noisy[igain - 1]->
noisify(noiseframe[igain - 1], engine, &noisy[0]->vecgau());
165 const double asignal(pedestals[igain] + ecalSamples[
i] / (LSB[igain] * icalconst) +
166 trueRMS[igain] * noiseframe[igain - 1][
i]);
171 const double asignal(ecalSamples[
i] * 1000.);
173 }
else if (igain == 2) {
174 const double asignal(ecalSamples[
i] / (LSB[1] * icalconst));
176 }
else if (igain == 3) {
177 const double asignal(ecalSamples[
i] / (LSB[2] * icalconst));
180 const double asignal(ecalSamples[
i] / (LSB[3] * icalconst));
191 const int isignal(signal);
192 const int tmpadc(signal - (
double)isignal < 0.5 ? isignal : isignal + 1);
198 if (tmpadc <= maxADC[igain]) {
202 }
while (!
done && igain < 3);
232 for (
unsigned int i = 0;
i < ecalSamples.
size(); ++
i) {
233 if (
df.sample(
i).gainId() == 0) {
234 unsigned int hyst =
i + 1 + 2;
235 for (
unsigned int j =
i + 1;
j < hyst &&
j < ecalSamples.
size(); ++
j) {
265 edm::LogError(
"EcalCoder") <<
"Could not find pedestal for " <<
detId.rawId() <<
" among the " 292 LogDebug(
"EcalCoder") <<
"Pedestals for " <<
detId.rawId() <<
" gain range " <<
gainId <<
" : \n" 293 <<
"Mean = " <<
ped <<
" rms = " <<
width;
315 Gains[2] = (*grit).gain6Over1();
316 Gains[1] = Gains[2] * ((*grit).gain12Over6());
319 edm::LogError(
"EcalCoder") <<
"Could not find gain ratios for " <<
detId.rawId() <<
" among the " 329 if (icalit != icalMap.
end()) {
330 thisconst = (*icalit);
331 if (icalconst == 0.) {
336 <<
"! something wrong with EcalIntercalibConstants in your DB? ";
338 icalconst = thisconst;
const EcalGainRatios * m_gainRatios
double fullScaleEnergy(const DetId &did) const
limit on the energy scale due to the electronics range
virtual void analogToDigital(CLHEP::HepRandomEngine *, const EcalSamples &clf, EcalDataFrame &df) const
from EcalSamples to EcalDataFrame
void encode(const EcalSamples &ecalSamples, EcalDataFrame &df, CLHEP::HepRandomEngine *) const
produce the pulse-shape
void setIntercalibConstants(const EcalIntercalibConstantsMC *ical)
void findIntercalibConstant(const DetId &detId, double &icalconst) const
Log< level::Error, false > LogError
const EcalIntercalibConstantsMC * m_intercals
const Noisifier * m_ebCorrNoise[3]
const Noisifier * m_eeCorrNoise[3]
void findPedestal(const DetId &detId, int gainId, double &pedestal, double &width) const
not yet implemented
void setPedestals(const EcalPedestals *pedestals)
can be fetched every event from the EventSetup
const_iterator find(uint32_t rawId) const
void findGains(const DetId &detId, double theGains[]) const
const EcalPedestals * m_peds
void setGainRatios(const EcalGainRatios *gainRatios)
constexpr float gains[NGAINS]
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
void setFullScaleEnergy(double EBscale, double EEscale)
std::vector< Item >::const_iterator const_iterator
bool isSaturated(const Digi &digi, const int &maxADCvalue, int ifirst, int n)
const self & getMap() const
const_iterator end() const
float EcalIntercalibConstantMC
uint16_t *__restrict__ uint16_t const *__restrict__ adc
EcalCoder(bool addNoise, bool PreMix1, Noisifier *ebCorrNoise0, Noisifier *eeCorrNoise0=nullptr, Noisifier *ebCorrNoise1=nullptr, Noisifier *eeCorrNoise1=nullptr, Noisifier *ebCorrNoise2=nullptr, Noisifier *eeCorrNoise2=nullptr)
ctor