9 : _computeErrors(
true),
12 _dynamicPedestals(
false),
13 _mitigateBadSamples(
false),
14 _selectiveBadSampleCriteria(
false),
15 _addPedestalUncertainty(0.),
16 _simplifiedNoiseModelForGainSwitch(
true),
17 _gainSwitchUseMaxSample(
false) {
39 const unsigned int iSampleMax = 5;
40 const unsigned int iFullPulseMax = 9;
54 for (
unsigned int iSample = 0; iSample < nsample; iSample++) {
61 double gainratio = 1.;
66 gainsNoise[iSample] = 2;
67 gainsPedestal[iSample] = dynamicPedestal ? 2 : -1;
71 gainsNoise[iSample] = 0;
72 gainsPedestal[iSample] = dynamicPedestal ? 0 : -1;
76 gainsNoise[iSample] = 1;
77 gainsPedestal[iSample] = dynamicPedestal ? 1 : -1;
80 if (dynamicPedestal) {
88 <<
"Saturation encountered. Multifit is not intended to be used for saturated channels.";
90 if (dynamicPedestal) {
99 if (iSample == iSampleMax) {
112 double maxpulseamplitude = maxamplitude / fullpulse[iFullPulseMax];
115 for (
unsigned int ipulse = 0; ipulse <
_pulsefunc.
BXs().rows(); ++ipulse) {
118 rh.setOutOfTimeAmplitude(
bx + 5, 0.0);
129 if (mitigateBadSample) {
130 badSamples[iSampleMax - 1] = 1;
136 std::array<double, 3> pedrmss = {{aped->rms_x12, aped->rms_x6, aped->rms_x1}};
139 int gainidxmax = gainsNoise[iSampleMax];
140 noisecov = gainratios[gainidxmax] * gainratios[gainidxmax] * pedrmss[gainidxmax] * pedrmss[gainidxmax] *
141 noisecors[gainidxmax];
147 noisecov = SampleMatrix::Zero();
148 for (
unsigned int gainidx = 0; gainidx < noisecors.size(); ++gainidx) {
154 noisecov += gainratios[gainidx] * gainratios[gainidx] * pedrmss[gainidx] * pedrmss[gainidx] *
165 noisecov = aped->rms_x12 * aped->rms_x12 * noisecors[0];
173 bool usePrefit =
false;
189 status =
_pulsefunc.
DoFit(amplitudes, noisecov, activeBX, fullpulse, fullpulsecov, gainsPedestal, badSamples);
193 edm::LogWarning(
"EcalUncalibRecHitMultiFitAlgo::makeRecHit") <<
"Failed Fit" << std::endl;
196 unsigned int ipulseintime = 0;
197 for (
unsigned int ipulse = 0; ipulse <
_pulsefunc.
BXs().rows(); ++ipulse) {
199 ipulseintime = ipulse;
214 for (
unsigned int ipulse = 0; ipulse <
_pulsefunc.
BXs().rows(); ++ipulse) {
218 }
else if (
bx == (100 + gainsPedestal[iSampleMax])) {