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"
47 using namespace fftjetcms;
62 void endJob()
override ;
82 std::auto_ptr<fftjet::AbsFrequencyKernel>
kernel2d;
83 std::auto_ptr<fftjet::AbsFrequencyKernel1d>
etaKernel;
84 std::auto_ptr<fftjet::AbsFrequencyKernel1d>
phiKernel;
87 std::auto_ptr<fftjet::AbsConvolverBase<Real> >
convolver;
101 scalePower(ps.getParameter<double>(
"scalePower")),
102 etConversionFactor(ps.getParameter<double>(
"etConversionFactor"))
110 convolvedFlow = std::auto_ptr<fftjet::Grid2d<fftjetcms::Real> >(
111 new fftjet::Grid2d<fftjetcms::Real>(*energyFlow));
131 const std::vector<double> etaDependentScaleFactors(
132 ps.
getParameter<std::vector<double> >(
"etaDependentScaleFactors"));
135 const bool use2dKernel = etaDependentScaleFactors.empty();
137 if (etaDependentScaleFactors.size() !=
energyFlow->nEta())
139 <<
"invalid number of eta-dependent scale factors"
143 double kernelEtaScale = ps.
getParameter<
double>(
"kernelEtaScale");
144 const double kernelPhiScale = ps.
getParameter<
double>(
"kernelPhiScale");
145 if (kernelEtaScale <= 0.0 || kernelPhiScale <= 0.0)
147 <<
"invalid kernel scale" << std::endl;
154 const bool fixEfficiency = ps.
getParameter<
bool>(
"fixEfficiency");
157 unsigned convolverMinBin = 0, convolverMaxBin = 0;
158 if (fixEfficiency || !use2dKernel)
160 convolverMinBin = ps.
getParameter<
unsigned>(
"convolverMinBin");
161 convolverMaxBin = ps.
getParameter<
unsigned>(
"convolverMaxBin");
167 engine = std::auto_ptr<MyFFTEngine>(
171 kernel2d = std::auto_ptr<fftjet::AbsFrequencyKernel>(
172 new fftjet::DiscreteGauss2d(
173 kernelEtaScale, kernelPhiScale,
177 convolver = std::auto_ptr<fftjet::AbsConvolverBase<Real> >(
178 new fftjet::FrequencyKernelConvolver<Real,Complex>(
180 convolverMinBin, convolverMaxBin));
185 engine = std::auto_ptr<MyFFTEngine>(
191 etaKernel = std::auto_ptr<fftjet::AbsFrequencyKernel1d>(
192 new fftjet::DiscreteGauss1d(kernelEtaScale,
energyFlow->nEta()));
194 phiKernel = std::auto_ptr<fftjet::AbsFrequencyKernel1d>(
195 new fftjet::DiscreteGauss1d(kernelPhiScale,
energyFlow->nPhi()));
198 convolver = std::auto_ptr<fftjet::AbsConvolverBase<Real> >(
199 new fftjet::FrequencySequentialConvolver<Real,Complex>(
202 etaDependentScaleFactors, convolverMinBin,
203 convolverMaxBin, fixEfficiency));
222 const unsigned nScales =
iniScales->size();
223 const double* scales = &(*iniScales)[0];
225 const unsigned nEta = g.nEta();
226 const unsigned nPhi = g.nPhi();
227 const double bin0edge = g.phiBin0Edge();
230 std::auto_ptr<TH3F> pTable(
231 new TH3F(
"FFTJetEFlowSmoother",
"FFTJetEFlowSmoother",
232 nScales+1U, -1.5, nScales-0.5,
233 nEta, g.etaMin(), g.etaMax(),
234 nPhi, bin0edge, bin0edge+2.0*
M_PI));
235 TH3F*
h = pTable.get();
237 h->GetXaxis()->SetTitle(
"Scale");
238 h->GetYaxis()->SetTitle(
"Eta");
239 h->GetZaxis()->SetTitle(
"Phi");
243 for (
unsigned ieta=0; ieta<nEta; ++ieta)
244 for (
unsigned iphi=0; iphi<nPhi; ++iphi)
245 h->SetBinContent(1U, ieta+1U, iphi+1U,
246 factor*g.binValue(ieta, iphi));
249 convolver->setEventData(g.data(), nEta, nPhi);
250 for (
unsigned iscale=0; iscale<nScales; ++iscale)
256 scales[iscale], convData,
260 for (
unsigned ieta=0; ieta<nEta; ++ieta)
262 const Real* etaData = convData + ieta*nPhi;
263 for (
unsigned iphi=0; iphi<nPhi; ++iphi)
264 h->SetBinContent(iscale+2U, ieta+1U, iphi+1U,
265 factor*etaData[iphi]);
T getParameter(std::string const &) const
std::auto_ptr< fftjet::Grid2d< fftjetcms::Real > > energyFlow
std::auto_ptr< MyFFTEngine > anotherEngine
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
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
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)