24 #include "fftjet/FrequencyKernelConvolver.hh"
25 #include "fftjet/DiscreteGauss2d.hh"
26 #include "fftjet/EquidistantSequence.hh"
27 #include "fftjet/interpolate.hh"
65 void endJob()
override;
76 std::unique_ptr<fftjet::AbsFrequencyKernel>
kernel2d;
79 std::unique_ptr<fftjet::AbsConvolverBase<Real>>
convolver;
126 nPercentiles(ps.getParameter<unsigned>(
"nPercentiles")),
142 convolvedFlow = std::make_unique<fftjet::Grid2d<fftjetcms::Real>>(*energyFlow);
147 throw cms::Exception(
"FFTJetBadConfig") <<
"ERROR in FFTJetPileupProcessor constructor:"
148 " number of elements in the \"etaFlatteningFactors\""
149 " vector is inconsistent with the discretization grid binning"
162 throw cms::Exception(
"FFTJetBadConfig") <<
"invalid filter scales" << std::endl;
168 produces<reco::DiscretizedEnergyFlow>(
outputLabel);
177 throw cms::Exception(
"FFTJetBadConfig") <<
"invalid kernel scales" << std::endl;
181 throw cms::Exception(
"FFTJetBadConfig") <<
"invalid convolver bin range" << std::endl;
191 kernel2d = std::unique_ptr<fftjet::AbsFrequencyKernel>(
195 convolver = std::unique_ptr<fftjet::AbsConvolverBase<Real>>(
new fftjet::FrequencyKernelConvolver<Real, Complex>(
212 double densityAfterMixing = -1.0;
220 const double* scales = &(*filterScales)[0];
232 for (
unsigned iscale = 0; iscale <
nScales; ++iscale) {
248 const double dindex =
q * (dataLen - 1
U);
249 const unsigned ilow = static_cast<unsigned>(std::floor(dindex));
250 const double percentile =
251 fftjet::lin_interpolate_1d(ilow, ilow + 1
U, sortData[ilow], sortData[ilow + 1
U], dindex);
260 iEvent.put(std::make_unique<reco::DiscretizedEnergyFlow>(
264 iEvent.put(std::make_unique<std::pair<double, double>>(densityBeforeMixing, densityAfterMixing),
outputLabel);
274 throw cms::Exception(
"FFTJetBadConfig") <<
"ERROR in FFTJetPileupProcessor::mixExtraGrid():"
275 " failed to open external grid file "
279 const fftjet::Grid2d<float>*
g =
nullptr;
280 const unsigned maxFail = 100
U;
281 unsigned nEnergyRejected = 0;
292 throw cms::Exception(
"FFTJetBadConfig") <<
"ERROR in FFTJetPileupProcessor::mixExtraGrid():"
293 " failed to open external grid file "
302 if (++nEnergyRejected >= maxFail)
303 throw cms::Exception(
"FFTJetBadConfig") <<
"ERROR in FFTJetPileupProcessor::mixExtraGrid():"
304 " too many grids in a row ("
305 << nEnergyRejected <<
") failed the maximum energy cut" << std::endl;
314 throw cms::Exception(
"FFTJetBadConfig") <<
"ERROR in FFTJetPileupProcessor::mixExtraGrid():"
315 " no valid grid records found"