|
|
Go to the documentation of this file.
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) {
99 findPedestal(detId, igain, pedestals[igain], widths[igain]);
102 trueRMS[igain] =
std::sqrt(widths[igain] * widths[igain] - 1. / 12.);
109 LSB[igain] = Emax / (
MAXADC * gains[igain]);
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) {
261 ped = (*itped).mean(
gainId);
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 self & getMap() const
const_iterator end() const
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
void findPedestal(const DetId &detId, int gainId, double &pedestal, double &width) const
not yet implemented
const EcalGainRatios * m_gainRatios
void setFullScaleEnergy(double EBscale, double EEscale)
virtual void analogToDigital(CLHEP::HepRandomEngine *, const EcalSamples &clf, EcalDataFrame &df) const
from EcalSamples to EcalDataFrame
const EcalIntercalibConstantsMC * m_intercals
void encode(const EcalSamples &ecalSamples, EcalDataFrame &df, CLHEP::HepRandomEngine *) const
produce the pulse-shape
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
const Noisifier * m_eeCorrNoise[3]
void findGains(const DetId &detId, double theGains[]) const
void setGainRatios(const EcalGainRatios *gainRatios)
bool isSaturated(const Digi &digi, const int &maxADCvalue, int ifirst, int n)
const Noisifier * m_ebCorrNoise[3]
const_iterator find(uint32_t rawId) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
void setPedestals(const EcalPedestals *pedestals)
can be fetched every event from the EventSetup
double fullScaleEnergy(const DetId &did) const
limit on the energy scale due to the electronics range
Log< level::Error, false > LogError
EcalCoder(bool addNoise, bool PreMix1, Noisifier *ebCorrNoise0, Noisifier *eeCorrNoise0=nullptr, Noisifier *ebCorrNoise1=nullptr, Noisifier *eeCorrNoise1=nullptr, Noisifier *ebCorrNoise2=nullptr, Noisifier *eeCorrNoise2=nullptr)
ctor
constexpr uint32_t rawId() const
get the raw id
float EcalIntercalibConstantMC
std::vector< Item >::const_iterator const_iterator
const EcalPedestals * m_peds
void findIntercalibConstant(const DetId &detId, double &icalconst) const
void setIntercalibConstants(const EcalIntercalibConstantsMC *ical)