12 _gainSwitchUseMaxSample(
false){
31 const unsigned int iSampleMax = 5;
32 const unsigned int iFullPulseMax = 9;
39 for(
unsigned int iSample = 0; iSample < nsample; iSample++) {
43 double amplitude = 0.;
48 double gainratio = 1.;
50 if (gainId==0 || gainId==3) {
65 if ( (gainId != 1) && (iSample==4 || iSample==5 || iSample==6) ) iGainSwitch = 1;
67 amplitude = ((double)(sample.
adc()) - pedestal) * gainratio;
71 amplitude = (4095. -
pedestal) * gainratio;
74 amplitudes[iSample] = amplitude;
76 if (iSample==iSampleMax) {
77 maxamplitude = amplitude;
79 pedrms = pederr*gainratio;
84 double amplitude, amperr, chisq;
90 double maxpulseamplitude = maxamplitude / fullpulse[iFullPulseMax];
93 for (
unsigned int ipulse=0; ipulse<
_pulsefunc.
BXs().rows(); ++ipulse) {
96 rh.setOutOfTimeAmplitude(bx+5, 0.0);
103 bool usePrefit =
false;
118 status =
_pulsefunc.
DoFit(amplitudes,noisecor,pedrms,activeBX,fullpulse,fullpulsecov);
122 edm::LogWarning(
"EcalUncalibRecHitMultiFitAlgo::makeRecHit") <<
"Failed Fit" << std::endl;
125 unsigned int ipulseintime = 0;
126 for (
unsigned int ipulse=0; ipulse<
_pulsefunc.
BXs().rows(); ++ipulse) {
128 ipulseintime = ipulse;
133 amplitude = status ?
_pulsefunc.
X()[ipulseintime] : 0.;
147 for (
unsigned int ipulse=0; ipulse<
_pulsefunc.
BXs().rows(); ++ipulse) {
150 rh.setOutOfTimeAmplitude(bx+5, status ?
_pulsefunc.
X().coeff(ipulse) : 0.);
void setMaxIterWarnings(bool b)
int gainId(sample_type sample)
get the gainId (2 bits)
void disableErrorCalculation()
EcalUncalibratedRecHit makeRecHit(const EcalDataFrame &dataFrame, const EcalPedestals::Item *aped, const EcalMGPAGainRatio *aGain, const SampleMatrix &noisecor, const FullSampleVector &fullpulse, const FullSampleMatrix &fullpulsecov, const BXVector &activeBX)
compute rechits
const PulseVector & Errors() const
Eigen::Matrix< double, 10, 1 > SampleVector
EcalMGPASample sample(int i) const
std::vector< Variable::Flags > flags
Eigen::Matrix< double, 19, 19 > FullSampleMatrix
int gainId() const
get the gainId (2 bits)
EcalUncalibRecHitMultiFitAlgo()
const PulseVector & X() const
bool _gainSwitchUseMaxSample
void setAmplitudeError(float amplitudeerror)
Eigen::Matrix< double, 19, 1 > FullSampleVector
void resize(int bx, unsigned size)
float gain12Over6() const
const BXVector & BXs() const
PulseChiSqSNNLS _pulsefuncSingle
PulseChiSqSNNLS _pulsefunc
volatile std::atomic< bool > shutdown_flag false
Eigen::Matrix< double, 10, 10 > SampleMatrix
static const int MAXSAMPLES
bool DoFit(const SampleVector &samples, const SampleMatrix &samplecor, double pederr, const BXVector &bxs, const FullSampleVector &fullpulse, const FullSampleMatrix &fullpulsecov)
int adc() const
get the ADC sample (12 bits)