23 #include "fftjet/FrequencyKernelConvolver.hh"
24 #include "fftjet/DiscreteGauss2d.hh"
25 #include "fftjet/EquidistantSequence.hh"
26 #include "fftjet/interpolate.hh"
27 #include "fftjet/FrequencyKernelConvolver.hh"
28 #include "fftjet/FrequencySequentialConvolver.hh"
29 #include "fftjet/DiscreteGauss1d.hh"
30 #include "fftjet/DiscreteGauss2d.hh"
46 using namespace fftjetcms;
63 void endJob()
override;
79 std::unique_ptr<fftjet::AbsFrequencyKernel>
kernel2d;
80 std::unique_ptr<fftjet::AbsFrequencyKernel1d>
etaKernel;
81 std::unique_ptr<fftjet::AbsFrequencyKernel1d>
phiKernel;
84 std::unique_ptr<fftjet::AbsConvolverBase<Real> >
convolver;
98 scalePower(ps.getParameter<double>(
"scalePower")),
99 etConversionFactor(ps.getParameter<double>(
"etConversionFactor")) {
105 convolvedFlow = std::make_unique<fftjet::Grid2d<fftjetcms::Real> >(*energyFlow);
122 const std::vector<double> etaDependentScaleFactors(ps.
getParameter<std::vector<double> >(
"etaDependentScaleFactors"));
125 const bool use2dKernel = etaDependentScaleFactors.empty();
127 if (etaDependentScaleFactors.size() !=
energyFlow->nEta())
128 throw cms::Exception(
"FFTJetBadConfig") <<
"invalid number of eta-dependent scale factors" << std::endl;
131 double kernelEtaScale = ps.
getParameter<
double>(
"kernelEtaScale");
132 const double kernelPhiScale = ps.
getParameter<
double>(
"kernelPhiScale");
133 if (kernelEtaScale <= 0.0 || kernelPhiScale <= 0.0)
134 throw cms::Exception(
"FFTJetBadConfig") <<
"invalid kernel scale" << std::endl;
141 const bool fixEfficiency = ps.
getParameter<
bool>(
"fixEfficiency");
144 unsigned convolverMinBin = 0, convolverMaxBin = 0;
145 if (fixEfficiency || !use2dKernel) {
146 convolverMinBin = ps.
getParameter<
unsigned>(
"convolverMinBin");
147 convolverMaxBin = ps.
getParameter<
unsigned>(
"convolverMaxBin");
155 kernel2d = std::unique_ptr<fftjet::AbsFrequencyKernel>(
156 new fftjet::DiscreteGauss2d(kernelEtaScale, kernelPhiScale,
energyFlow->nEta(),
energyFlow->nPhi()));
159 convolver = std::unique_ptr<fftjet::AbsConvolverBase<Real> >(
new fftjet::FrequencyKernelConvolver<Real, Complex>(
160 engine.get(), kernel2d.get(), convolverMinBin, convolverMaxBin));
168 std::unique_ptr<fftjet::AbsFrequencyKernel1d>(
new fftjet::DiscreteGauss1d(kernelEtaScale,
energyFlow->nEta()));
171 std::unique_ptr<fftjet::AbsFrequencyKernel1d>(
new fftjet::DiscreteGauss1d(kernelPhiScale,
energyFlow->nPhi()));
174 convolver = std::unique_ptr<fftjet::AbsConvolverBase<Real> >(
175 new fftjet::FrequencySequentialConvolver<Real, Complex>(
engine.get(),
179 etaDependentScaleFactors,
195 const unsigned nScales =
iniScales->size();
196 const double* scales = &(*iniScales)[0];
198 const unsigned nEta = g.nEta();
199 const unsigned nPhi = g.nPhi();
200 const double bin0edge = g.phiBin0Edge();
203 auto pTable = std::make_unique<TH3F>(
"FFTJetEFlowSmoother",
204 "FFTJetEFlowSmoother",
213 bin0edge + 2.0 *
M_PI);
214 TH3F*
h = pTable.get();
215 h->SetDirectory(
nullptr);
216 h->GetXaxis()->SetTitle(
"Scale");
217 h->GetYaxis()->SetTitle(
"Eta");
218 h->GetZaxis()->SetTitle(
"Phi");
222 for (
unsigned ieta = 0; ieta <
nEta; ++ieta)
223 for (
unsigned iphi = 0; iphi <
nPhi; ++iphi)
224 h->SetBinContent(1U, ieta + 1U, iphi + 1U, factor * g.binValue(ieta, iphi));
228 for (
unsigned iscale = 0; iscale < nScales; ++iscale) {
235 for (
unsigned ieta = 0; ieta <
nEta; ++ieta) {
236 const Real* etaData = convData + ieta *
nPhi;
237 for (
unsigned iphi = 0; iphi <
nPhi; ++iphi)
238 h->SetBinContent(iscale + 2U, ieta + 1U, iphi + 1U, factor * etaData[iphi]);
std::unique_ptr< MyFFTEngine > engine
std::unique_ptr< fftjet::AbsFrequencyKernel1d > etaKernel
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::unique_ptr< fftjet::AbsConvolverBase< Real > > convolver
#define DEFINE_FWK_MODULE(type)
void loadInputCollection(const edm::Event &)
std::unique_ptr< MyFFTEngine > anotherEngine
FFTJetEFlowSmoother()=delete
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
double etConversionFactor
double getEventScale() const
std::unique_ptr< std::vector< double > > iniScales
std::unique_ptr< fftjet::Grid2d< fftjetcms::Real > > convolvedFlow
std::unique_ptr< fftjet::Grid2d< fftjetcms::Real > > energyFlow
void produce(edm::Event &, const edm::EventSetup &) override
std::unique_ptr< fftjet::AbsFrequencyKernel > kernel2d
~FFTJetEFlowSmoother() override
T getParameter(std::string const &) const
void discretizeEnergyFlow()
void buildKernelConvolver(const edm::ParameterSet &)
std::unique_ptr< fftjet::AbsFrequencyKernel1d > phiKernel
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
std::unique_ptr< std::vector< double > > fftjet_ScaleSet_parser(const edm::ParameterSet &ps)
const std::string outputLabel
Power< A, B >::type pow(const A &a, const B &b)