23 m_maxEneEB ( 1668.3 ) ,
24 m_maxEneEE ( 2859.9 ) ,
25 m_addNoise ( addNoise ) ,
103 const unsigned int csize ( ecalSamples.
size() ) ;
106 DetId detId = ecalSamples.
id();
110 if ( ecalSamples[5] > 0. )
LogDebug(
"EcalCoder") <<
"Input caloSample" <<
"\n" << ecalSamples;
113 double pedestals[
NGAINS+1];
119 double icalconst = 1. ;
122 for(
unsigned int igain ( 0 ); igain <=
NGAINS ; ++igain )
131 trueRMS[igain] =
std::sqrt( widths[igain]*widths[igain] - 1./12. ) ;
138 if ( igain > 0 ) LSB[igain]= Emax/(
MAXADC*gains[igain]);
160 noisy[0]->
noisify( noiseframe[0] ) ;
161 if( 0 == noisy[1] ) noisy[0]->
noisify( noiseframe[1] ,
162 &noisy[0]->vecgau() ) ;
163 if( 0 == noisy[2] ) noisy[0]->
noisify( noiseframe[2] ,
164 &noisy[0]->vecgau() ) ;
174 for(
unsigned int i ( 0 ) ;
i != csize ; ++
i )
176 bool done (
false ) ;
178 if( 0 == wait ) gainId = 1 ;
181 int igain ( gainId - 1 ) ;
191 0 != noisy[igain-1] &&
192 noiseframe[igain-1].isBlank() )
194 noisy[igain-1]->
noisify( noiseframe[igain-1] ,
195 &noisy[0]->vecgau() ) ;
204 const double asignal ( pedestals[igain] +
205 ecalSamples[
i] /( LSB[igain]*icalconst ) +
206 trueRMS[igain]*noiseframe[igain-1][
i] ) ;
211 const double asignal (
212 ecalSamples[
i] /( LSB[igain]*icalconst ) );
219 const int isignal ( signal ) ;
220 const int tmpadc ( signal - (
double)isignal < 0.5 ?
221 isignal : isignal + 1 ) ;
227 if( tmpadc <= maxADC[igain] )
243 if (igain == gainId) --wait ;
254 if ( gainId == 3 && adc ==
MAXADC )
270 for (
unsigned int i = 0 ;
i < ecalSamples.
size() ; ++
i)
274 unsigned int hyst =
i+1+2;
275 for (
unsigned int j =
i+1;
j < hyst &&
j < ecalSamples.
size(); ++
j )
288 double&
width )
const
307 ped = (*itped).mean(gainId);
308 width = (*itped).rms(gainId);
338 LogDebug(
"EcalCoder") <<
"Pedestals for " << detId.
rawId() <<
" gain range " << gainId <<
" : \n" <<
"Mean = " << ped <<
" rms = " <<
width;
344 double Gains[] )
const
364 Gains[2] = (*grit).gain6Over1();
365 Gains[1] = Gains[2]*( (*grit).gain12Over6() );
377 double& icalconst )
const
383 if( icalit!=icalMap.
end() )
385 thisconst = (*icalit);
386 if ( icalconst == 0. ) { thisconst = 1.; }
390 edm::LogError(
"EcalCoder") <<
"No intercalib const found for xtal " << detId.
rawId() <<
"! something wrong with EcalIntercalibConstants in your DB? ";
392 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]
void setPedestals(const EcalPedestals *pedestals)
can be fetched every event from the EventSetup
virtual void analogToDigital(const EcalSamples &clf, EcalDataFrame &df) const
from EcalSamples to EcalDataFrame
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)
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)
void setSample(int i, EcalMGPASample sam)
const_iterator find(uint32_t rawId) const
const_iterator end() const
float EcalIntercalibConstantMC
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 EcalSamples &ecalSamples, EcalDataFrame &df) const
produce the pulse-shape
EcalCoder(bool addNoise, bool PreMix1, Noisifier *ebCorrNoise0, Noisifier *eeCorrNoise0=0, Noisifier *ebCorrNoise1=0, Noisifier *eeCorrNoise1=0, Noisifier *ebCorrNoise2=0, Noisifier *eeCorrNoise2=0)
ctor