23 m_maxEneEB ( 1668.3 ) ,
24 m_maxEneEE ( 2859.9 ) ,
25 m_addNoise ( addNoise ) ,
101 CLHEP::HepRandomEngine* engine )
const
105 const unsigned int csize ( ecalSamples.
size() ) ;
108 DetId detId = ecalSamples.
id();
112 if ( ecalSamples[5] > 0. )
LogDebug(
"EcalCoder") <<
"Input caloSample" <<
"\n" << ecalSamples;
115 double pedestals[
NGAINS+1];
121 double icalconst = 1. ;
124 for(
unsigned int igain ( 0 ); igain <=
NGAINS ; ++igain )
133 trueRMS[igain] =
std::sqrt( widths[igain]*widths[igain] - 1./12. ) ;
140 if ( igain > 0 ) LSB[igain]= Emax/(
MAXADC*gains[igain]);
162 noisy[0]->
noisify( noiseframe[0], engine ) ;
163 if( 0 == noisy[1] ) noisy[0]->
noisify( noiseframe[1] ,
165 &noisy[0]->vecgau() ) ;
166 if( 0 == noisy[2] ) noisy[0]->
noisify( noiseframe[2] ,
168 &noisy[0]->vecgau() ) ;
178 for(
unsigned int i ( 0 ) ;
i != csize ; ++
i )
180 bool done (
false ) ;
182 if( 0 == wait ) gainId = 1 ;
185 int igain ( gainId - 1 ) ;
195 0 != noisy[igain-1] &&
196 noiseframe[igain-1].isBlank() )
198 noisy[igain-1]->
noisify( noiseframe[igain-1] ,
200 &noisy[0]->vecgau() ) ;
209 const double asignal ( pedestals[igain] +
210 ecalSamples[
i] /( LSB[igain]*icalconst ) +
211 trueRMS[igain]*noiseframe[igain-1][
i] ) ;
216 const double asignal (
217 ecalSamples[
i] /( LSB[igain]*icalconst ) );
224 const int isignal ( signal ) ;
225 const int tmpadc ( signal - (
double)isignal < 0.5 ?
226 isignal : isignal + 1 ) ;
232 if( tmpadc <= maxADC[igain] )
248 if (igain == gainId) --wait ;
259 if ( gainId == 3 && adc ==
MAXADC )
275 for (
unsigned int i = 0 ;
i < ecalSamples.
size() ; ++
i)
279 unsigned int hyst =
i+1+2;
280 for (
unsigned int j =
i+1;
j < hyst &&
j < ecalSamples.
size(); ++
j )
293 double&
width )
const
312 ped = (*itped).mean(gainId);
313 width = (*itped).rms(gainId);
343 LogDebug(
"EcalCoder") <<
"Pedestals for " << detId.
rawId() <<
" gain range " << gainId <<
" : \n" <<
"Mean = " << ped <<
" rms = " <<
width;
349 double Gains[] )
const
369 Gains[2] = (*grit).gain6Over1();
370 Gains[1] = Gains[2]*( (*grit).gain12Over6() );
382 double& icalconst )
const
388 if( icalit!=icalMap.
end() )
390 thisconst = (*icalit);
391 if ( icalconst == 0. ) { thisconst = 1.; }
395 edm::LogError(
"EcalCoder") <<
"No intercalib const found for xtal " << detId.
rawId() <<
"! something wrong with EcalIntercalibConstants in your DB? ";
397 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)
virtual void analogToDigital(CLHEP::HepRandomEngine *, const EcalSamples &clf, EcalDataFrame &df) const
from EcalSamples to EcalDataFrame
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
void findGains(const DetId &detId, double theGains[]) const
void encode(const EcalSamples &ecalSamples, EcalDataFrame &df, CLHEP::HepRandomEngine *) const
produce the pulse-shape
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
EcalCoder(bool addNoise, bool PreMix1, Noisifier *ebCorrNoise0, Noisifier *eeCorrNoise0=0, Noisifier *ebCorrNoise1=0, Noisifier *eeCorrNoise1=0, Noisifier *ebCorrNoise2=0, Noisifier *eeCorrNoise2=0)
ctor