23 #include "fftjet/FrequencyKernelConvolver.hh" 24 #include "fftjet/DiscreteGauss2d.hh" 25 #include "fftjet/EquidistantSequence.hh" 26 #include "fftjet/interpolate.hh" 63 void endJob()
override ;
78 std::unique_ptr<fftjet::AbsFrequencyKernel>
kernel2d;
81 std::unique_ptr<fftjet::AbsConvolverBase<Real> >
convolver;
128 ps.getParameter<
std::vector<double> >(
"etaFlatteningFactors")),
129 nPercentiles(ps.getParameter<unsigned>(
"nPercentiles")),
147 convolvedFlow = std::unique_ptr<fftjet::Grid2d<fftjetcms::Real> >(
148 new fftjet::Grid2d<fftjetcms::Real>(*energyFlow));
155 <<
"ERROR in FFTJetPileupProcessor constructor:" 156 " number of elements in the \"etaFlatteningFactors\"" 157 " vector is inconsistent with the discretization grid binning" 169 if (minScale <= 0.0 || maxScale < minScale || nScales == 0
U)
171 <<
"invalid filter scales" << std::endl;
173 filterScales = std::unique_ptr<fftjet::EquidistantInLogSpace>(
174 new fftjet::EquidistantInLogSpace(minScale, maxScale, nScales));
178 produces<reco::DiscretizedEnergyFlow>(
outputLabel);
188 if (kernelEtaScale <= 0.0 || kernelPhiScale <= 0.0)
190 <<
"invalid kernel scales" << std::endl;
196 <<
"invalid convolver bin range" << std::endl;
203 engine = std::unique_ptr<MyFFTEngine>(
207 kernel2d = std::unique_ptr<fftjet::AbsFrequencyKernel>(
208 new fftjet::DiscreteGauss2d(
209 kernelEtaScale, kernelPhiScale,
213 convolver = std::unique_ptr<fftjet::AbsConvolverBase<Real> >(
214 new fftjet::FrequencyKernelConvolver<Real,Complex>(
238 double densityAfterMixing = -1.0;
247 const double* scales = &(*filterScales)[0];
259 convolver->setEventData(g.data(), g.nEta(), g.nPhi());
260 for (
unsigned iscale=0; iscale<
nScales; ++iscale)
264 scales[iscale], convData,
273 std::sort(sortData, sortData+dataLen);
281 const double dindex = q*(dataLen-1
U);
282 const unsigned ilow =
static_cast<unsigned>(std::floor(dindex));
283 const double percentile = fftjet::lin_interpolate_1d(
284 ilow, ilow+1
U, sortData[ilow], sortData[ilow+1
U], dindex);
293 iEvent.
put(std::make_unique<reco::DiscretizedEnergyFlow>(
297 iEvent.
put(std::make_unique<std::pair<double,double>>(densityBeforeMixing, densityAfterMixing),
outputLabel);
312 <<
"ERROR in FFTJetPileupProcessor::mixExtraGrid():" 313 " failed to open external grid file " 317 const fftjet::Grid2d<float>*
g =
nullptr;
318 const unsigned maxFail = 100
U;
319 unsigned nEnergyRejected = 0;
326 for (
unsigned ntries=0; ntries<nFiles && g ==
nullptr; ++ntries)
334 <<
"ERROR in FFTJetPileupProcessor::mixExtraGrid():" 335 " failed to open external grid file " 345 if (++nEnergyRejected >= maxFail)
347 <<
"ERROR in FFTJetPileupProcessor::mixExtraGrid():" 348 " too many grids in a row (" << nEnergyRejected
349 <<
") failed the maximum energy cut" << std::endl;
362 <<
"ERROR in FFTJetPileupProcessor::mixExtraGrid():" 363 " no valid grid records found" << std::endl;
385 boost::shared_ptr<npstat::StorableMultivariateFunctor>
f =
392 for (
unsigned ieta=0; ieta<
nEta; ++ieta)
T getParameter(std::string const &) const
std::unique_ptr< fftjet::AbsConvolverBase< Real > > convolver
std::vector< std::string > externalGridFiles
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::string flatteningTableRecord
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
void loadInputCollection(const edm::Event &)
void checkConfig(const Ptr &ptr, const char *message)
std::unique_ptr< fftjet::Grid2d< Real > > fftjet_Grid2d_parser(const edm::ParameterSet &ps)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
loadFlatteningFactorsFromDB
std::string flatteningTableCategory
FFTJetPileupProcessor()=delete
std::unique_ptr< fftjet::Grid2d< fftjetcms::Real > > convolvedFlow
#define DEFINE_FWK_MODULE(type)
std::vector< double > percentileData
std::unique_ptr< fftjet::Grid2d< fftjetcms::Real > > energyFlow
~FFTJetPileupProcessor() override
std::unique_ptr< fftjet::EquidistantInLogSpace > filterScales
std::unique_ptr< MyFFTEngine > engine
void buildKernelConvolver(const edm::ParameterSet &)
std::vector< double > etaFlatteningFactors
void loadFlatteningFactors(const edm::EventSetup &iSetup)
std::string flatteningTableName
void produce(edm::Event &, const edm::EventSetup &) override
double externalGridMaxEnergy
void discretizeEnergyFlow()
bool loadFlatteningFactorsFromDB
fftjet::FFTWDoubleEngine MyFFTEngine
static const Mapper & instance()
void add_Grid2d_data(fftjet::Grid2d< F2 > *to, const fftjet::Grid2d< F1 > &from)
const std::string outputLabel
std::unique_ptr< fftjet::AbsFrequencyKernel > kernel2d