22 m_maxEneEB ( 1668.3 ) ,
23 m_maxEneEE ( 2859.9 ) ,
24 m_addNoise ( addNoise )
101 const unsigned int csize ( ecalSamples.
size() ) ;
104 DetId detId = ecalSamples.
id();
108 if ( ecalSamples[5] > 0. )
LogDebug(
"EcalCoder") <<
"Input caloSample" <<
"\n" << ecalSamples;
111 double pedestals[
NGAINS+1];
117 double icalconst = 1. ;
120 for(
unsigned int igain ( 0 ); igain <=
NGAINS ; ++igain )
129 trueRMS[igain] =
std::sqrt( widths[igain]*widths[igain] - 1./12. ) ;
136 if ( igain > 0 ) LSB[igain]= Emax/(
MAXADC*gains[igain]);
158 noisy[0]->
noisify( noiseframe[0] ) ;
159 if( 0 == noisy[1] ) noisy[0]->
noisify( noiseframe[1] ,
160 &noisy[0]->vecgau() ) ;
161 if( 0 == noisy[2] ) noisy[0]->
noisify( noiseframe[2] ,
162 &noisy[0]->vecgau() ) ;
169 for(
unsigned int i ( 0 ) ;
i != csize ; ++
i )
171 bool done (
false ) ;
173 if( 0 == wait ) gainId = 1 ;
176 int igain ( gainId - 1 ) ;
186 0 != noisy[igain-1] &&
187 noiseframe[igain-1].isBlank() )
189 noisy[igain-1]->
noisify( noiseframe[igain-1] ,
190 &noisy[0]->vecgau() ) ;
195 const double signal ( pedestals[igain] +
196 ecalSamples[
i] /( LSB[igain]*icalconst ) +
197 trueRMS[igain]*noiseframe[igain-1][
i] ) ;
199 const int isignal ( signal ) ;
200 const int tmpadc ( signal - (
double)isignal < 0.5 ?
201 isignal : isignal + 1 ) ;
207 if( tmpadc <= maxADC[igain] )
223 if (igain == gainId) --wait ;
234 if ( gainId == 3 && adc ==
MAXADC )
250 for (
unsigned int i = 0 ;
i < ecalSamples.
size() ; ++
i)
254 unsigned int hyst =
i+1+2;
255 for (
unsigned int j =
i+1;
j < hyst &&
j < ecalSamples.
size(); ++
j )
268 double&
width )
const
287 ped = (*itped).mean(gainId);
288 width = (*itped).rms(gainId);
318 LogDebug(
"EcalCoder") <<
"Pedestals for " << detId.
rawId() <<
" gain range " << gainId <<
" : \n" <<
"Mean = " << ped <<
" rms = " <<
width;
324 double Gains[] )
const
344 Gains[2] = (*grit).gain6Over1();
345 Gains[1] = Gains[2]*( (*grit).gain12Over6() );
357 double& icalconst )
const
363 if( icalit!=icalMap.
end() )
365 thisconst = (*icalit);
366 if ( icalconst == 0. ) { thisconst = 1.; }
370 edm::LogError(
"EcalCoder") <<
"No intercalib const found for xtal " << detId.
rawId() <<
"! something wrong with EcalIntercalibConstants in your DB? ";
372 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, Noisifier *ebCorrNoise0, Noisifier *eeCorrNoise0=0, Noisifier *ebCorrNoise1=0, Noisifier *eeCorrNoise1=0, Noisifier *ebCorrNoise2=0, Noisifier *eeCorrNoise2=0)
ctor