22 #include "fftjet/FrequencyKernelConvolver.hh"
23 #include "fftjet/DiscreteGauss2d.hh"
24 #include "fftjet/EquidistantSequence.hh"
25 #include "fftjet/interpolate.hh"
26 #include "fftjet/FrequencyKernelConvolver.hh"
27 #include "fftjet/FrequencySequentialConvolver.hh"
28 #include "fftjet/DiscreteGauss1d.hh"
29 #include "fftjet/DiscreteGauss2d.hh"
45 using namespace fftjetcms;
60 void endJob()
override ;
80 std::auto_ptr<fftjet::AbsFrequencyKernel>
kernel2d;
81 std::auto_ptr<fftjet::AbsFrequencyKernel1d>
etaKernel;
82 std::auto_ptr<fftjet::AbsFrequencyKernel1d>
phiKernel;
85 std::auto_ptr<fftjet::AbsConvolverBase<Real> >
convolver;
99 scalePower(ps.getParameter<double>(
"scalePower")),
100 etConversionFactor(ps.getParameter<double>(
"etConversionFactor"))
108 convolvedFlow = std::auto_ptr<fftjet::Grid2d<fftjetcms::Real> >(
109 new fftjet::Grid2d<fftjetcms::Real>(*energyFlow));
129 const std::vector<double> etaDependentScaleFactors(
130 ps.
getParameter<std::vector<double> >(
"etaDependentScaleFactors"));
133 const bool use2dKernel = etaDependentScaleFactors.empty();
135 if (etaDependentScaleFactors.size() !=
energyFlow->nEta())
137 <<
"invalid number of eta-dependent scale factors"
141 double kernelEtaScale = ps.
getParameter<
double>(
"kernelEtaScale");
142 const double kernelPhiScale = ps.
getParameter<
double>(
"kernelPhiScale");
143 if (kernelEtaScale <= 0.0 || kernelPhiScale <= 0.0)
145 <<
"invalid kernel scale" << std::endl;
152 const bool fixEfficiency = ps.
getParameter<
bool>(
"fixEfficiency");
155 unsigned convolverMinBin = 0, convolverMaxBin = 0;
156 if (fixEfficiency || !use2dKernel)
158 convolverMinBin = ps.
getParameter<
unsigned>(
"convolverMinBin");
159 convolverMaxBin = ps.
getParameter<
unsigned>(
"convolverMaxBin");
165 engine = std::auto_ptr<MyFFTEngine>(
169 kernel2d = std::auto_ptr<fftjet::AbsFrequencyKernel>(
170 new fftjet::DiscreteGauss2d(
171 kernelEtaScale, kernelPhiScale,
175 convolver = std::auto_ptr<fftjet::AbsConvolverBase<Real> >(
176 new fftjet::FrequencyKernelConvolver<Real,Complex>(
178 convolverMinBin, convolverMaxBin));
183 engine = std::auto_ptr<MyFFTEngine>(
189 etaKernel = std::auto_ptr<fftjet::AbsFrequencyKernel1d>(
190 new fftjet::DiscreteGauss1d(kernelEtaScale,
energyFlow->nEta()));
192 phiKernel = std::auto_ptr<fftjet::AbsFrequencyKernel1d>(
193 new fftjet::DiscreteGauss1d(kernelPhiScale,
energyFlow->nPhi()));
196 convolver = std::auto_ptr<fftjet::AbsConvolverBase<Real> >(
197 new fftjet::FrequencySequentialConvolver<Real,Complex>(
200 etaDependentScaleFactors, convolverMinBin,
201 convolverMaxBin, fixEfficiency));
220 const unsigned nScales =
iniScales->size();
221 const double* scales = &(*iniScales)[0];
223 const unsigned nEta = g.nEta();
224 const unsigned nPhi = g.nPhi();
225 const double bin0edge = g.phiBin0Edge();
228 std::auto_ptr<TH3F> pTable(
229 new TH3F(
"FFTJetEFlowSmoother",
"FFTJetEFlowSmoother",
230 nScales+1U, -1.5, nScales-0.5,
231 nEta, g.etaMin(), g.etaMax(),
232 nPhi, bin0edge, bin0edge+2.0*
M_PI));
233 TH3F*
h = pTable.get();
235 h->GetXaxis()->SetTitle(
"Scale");
236 h->GetYaxis()->SetTitle(
"Eta");
237 h->GetZaxis()->SetTitle(
"Phi");
241 for (
unsigned ieta=0; ieta<
nEta; ++ieta)
242 for (
unsigned iphi=0; iphi<
nPhi; ++iphi)
243 h->SetBinContent(1U, ieta+1U, iphi+1U,
244 factor*g.binValue(ieta, iphi));
248 for (
unsigned iscale=0; iscale<nScales; ++iscale)
254 scales[iscale], convData,
258 for (
unsigned ieta=0; ieta<
nEta; ++ieta)
260 const Real* etaData = convData + ieta*
nPhi;
261 for (
unsigned iphi=0; iphi<
nPhi; ++iphi)
262 h->SetBinContent(iscale+2U, ieta+1U, iphi+1U,
263 factor*etaData[iphi]);
T getParameter(std::string const &) const
std::auto_ptr< fftjet::Grid2d< fftjetcms::Real > > energyFlow
std::auto_ptr< MyFFTEngine > anotherEngine
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::auto_ptr< fftjet::AbsFrequencyKernel1d > etaKernel
std::auto_ptr< fftjet::Grid2d< Real > > fftjet_Grid2d_parser(const edm::ParameterSet &ps)
std::auto_ptr< fftjet::AbsFrequencyKernel1d > phiKernel
#define DEFINE_FWK_MODULE(type)
void loadInputCollection(const edm::Event &)
std::auto_ptr< MyFFTEngine > engine
void checkConfig(const Ptr &ptr, const char *message)
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::auto_ptr< fftjet::AbsFrequencyKernel > kernel2d
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
void produce(edm::Event &, const edm::EventSetup &) override
std::auto_ptr< fftjet::Grid2d< fftjetcms::Real > > convolvedFlow
std::auto_ptr< std::vector< double > > iniScales
void discretizeEnergyFlow()
fftjet::FFTWDoubleEngine MyFFTEngine
void buildKernelConvolver(const edm::ParameterSet &)
std::auto_ptr< fftjet::AbsConvolverBase< Real > > convolver
const std::string outputLabel
Power< A, B >::type pow(const A &a, const B &b)
std::auto_ptr< std::vector< double > > fftjet_ScaleSet_parser(const edm::ParameterSet &ps)