19 m_maxEneEB ( 1668.3 ) ,
20 m_maxEneEE ( 2859.9 ) ,
21 m_addNoise ( addNoise )
83 const unsigned int csize ( caloSamples.
size() ) ;
90 if ( caloSamples[5] > 0. )
LogDebug(
"EcalCoder") <<
"Input caloSample" <<
"\n" << caloSamples;
93 double pedestals[
NGAINS+1];
99 double icalconst = 1. ;
102 for(
unsigned int igain ( 0 ); igain <=
NGAINS ; ++igain )
111 trueRMS[igain] =
std::sqrt( widths[igain]*widths[igain] - 1./12. ) ;
118 if ( igain > 0 ) LSB[igain]= Emax/(
MAXADC*gains[igain]);
140 noisy[0]->
noisify( noiseframe[0] ) ;
141 if( 0 == noisy[1] ) noisy[0]->
noisify( noiseframe[1] ,
142 &noisy[0]->vecgau() ) ;
143 if( 0 == noisy[2] ) noisy[0]->
noisify( noiseframe[2] ,
144 &noisy[0]->vecgau() ) ;
149 bool isSaturated = 0;
151 for(
unsigned int i ( 0 ) ;
i != csize ; ++
i )
153 bool done (
false ) ;
155 if( 0 == wait ) gainId = 1 ;
158 int igain ( gainId - 1 ) ;
168 0 != noisy[igain-1] &&
169 noiseframe[igain-1].isBlank() )
171 noisy[igain-1]->
noisify( noiseframe[igain-1] ,
172 &noisy[0]->vecgau() ) ;
177 const double signal ( pedestals[igain] +
178 caloSamples[
i] /( LSB[igain]*icalconst ) +
179 trueRMS[igain]*noiseframe[igain-1][
i] ) ;
181 const int isignal ( signal ) ;
182 const int tmpadc ( signal - (
double)isignal < 0.5 ?
183 isignal : isignal + 1 ) ;
189 if( tmpadc <= maxADC[igain] )
205 if (igain == gainId) --wait ;
216 if ( gainId == 3 && adc ==
MAXADC )
232 for (
int i = 0 ;
i < caloSamples.
size() ; ++
i)
237 for (
int j =
i+1;
j < hyst &&
j < caloSamples.
size(); ++
j )
250 double&
width )
const
269 ped = (*itped).mean(gainId);
270 width = (*itped).rms(gainId);
300 LogDebug(
"EcalCoder") <<
"Pedestals for " << detId.
rawId() <<
" gain range " << gainId <<
" : \n" <<
"Mean = " << ped <<
" rms = " <<
width;
306 double Gains[] )
const
326 Gains[2] = (*grit).gain6Over1();
327 Gains[1] = Gains[2]*( (*grit).gain12Over6() );
339 double& icalconst )
const
345 if( icalit!=icalMap.
end() )
347 thisconst = (*icalit);
348 if ( icalconst == 0. ) { thisconst = 1.; }
352 edm::LogError(
"EcalCoder") <<
"No intercalib const found for xtal " << detId.
rawId() <<
"! something wrong with EcalIntercalibConstants in your DB? ";
354 icalconst = thisconst;
int adc(sample_type sample)
get the ADC sample (12 bits)
const EcalGainRatios * m_gainRatios
int gainId(sample_type sample)
get the gainId (2 bits)
const self & getMap() const
EcalMGPASample sample(int i) const
void setIntercalibConstants(const EcalIntercalibConstantsMC *ical)
int gainId() const
get the gainId (2 bits)
double fullScaleEnergy(const DetId &did) const
limit on the energy scale due to the electronics range
const EcalIntercalibConstantsMC * m_intercals
const Noisifier * m_ebCorrNoise[3]
uint32_t rawId() const
get the raw id
const Noisifier * m_eeCorrNoise[3]
virtual void analogToDigital(const CaloSamples &clf, EcalDataFrame &df) const
from CaloSamples to EcalDataFrame
void setPedestals(const EcalPedestals *pedestals)
can be fetched every event from the EventSetup
void findGains(const DetId &detId, double theGains[]) const
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
const EcalPedestals * m_peds
void setGainRatios(const EcalGainRatios *gainRatios)
int size() const
get the size
void setFullScaleEnergy(double EBscale, double EEscale)
std::vector< Item >::const_iterator const_iterator
void setSample(int i, EcalMGPASample sam)
const_iterator find(uint32_t rawId) const
const_iterator end() const
float EcalIntercalibConstantMC
DetId id() const
get the (generic) id
void findIntercalibConstant(const DetId &detId, double &icalconst) const
void findPedestal(const DetId &detId, int gainId, double &pedestal, double &width) const
not yet implemented
void encode(const CaloSamples &caloSamples, EcalDataFrame &df) const
produce the pulse-shape
EcalCoder(bool addNoise, Noisifier *ebCorrNoise0, Noisifier *eeCorrNoise0=0, Noisifier *ebCorrNoise1=0, Noisifier *eeCorrNoise1=0, Noisifier *ebCorrNoise2=0, Noisifier *eeCorrNoise2=0)
ctor