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])) {
void setMaxIterWarnings(bool b)
std::array< SampleMatrix, NGains > SampleMatrixGainArray
Eigen::Matrix< double, FullSampleVectorSize, FullSampleVectorSize > FullSampleMatrix
bool hasSwitchToGain1() const
void disableErrorCalculation()
Eigen::Matrix< double, FullSampleVectorSize, 1 > FullSampleVector
bool _simplifiedNoiseModelForGainSwitch
bool hasSwitchToGain6() const
bool DoFit(const SampleVector &samples, const SampleMatrix &samplecov, const BXVector &bxs, const FullSampleVector &fullpulse, const FullSampleMatrix &fullpulsecov, const SampleGainVector &gains=-1 *SampleGainVector::Ones(), const SampleGainVector &badSamples=SampleGainVector::Zero())
Log< level::Error, false > LogError
EcalUncalibRecHitMultiFitAlgo()
bool _gainSwitchUseMaxSample
double _addPedestalUncertainty
const BXVector & BXs() const
Abs< T >::type abs(const T &t)
EcalMGPASample sample(int i) const
void setAmplitudeError(float amplitudeerror)
bool _selectiveBadSampleCriteria
EcalUncalibratedRecHit makeRecHit(const EcalDataFrame &dataFrame, const EcalPedestals::Item *aped, const EcalMGPAGainRatio *aGain, const SampleMatrixGainArray &noisecors, const FullSampleVector &fullpulse, const FullSampleMatrix &fullpulsecov, const BXVector &activeBX)
compute rechits
float gain12Over6() const
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
void resize(int bx, unsigned size)
Eigen::Matrix< double, SampleVectorSize, 1 > SampleVector
Eigen::Matrix< double, SampleVectorSize, SampleVectorSize > SampleMatrix
const PulseVector & Errors() const
Eigen::Matrix< char, SampleVectorSize, 1 > SampleGainVector
PulseChiSqSNNLS _pulsefuncSingle
PulseChiSqSNNLS _pulsefunc
static constexpr int MAXSAMPLES
Log< level::Warning, false > LogWarning
const PulseVector & X() const