23 #include "fftjet/ProximityClusteringTree.hh"
24 #include "fftjet/ClusteringSequencer.hh"
25 #include "fftjet/ClusteringTreeSparsifier.hh"
26 #include "fftjet/FrequencyKernelConvolver.hh"
27 #include "fftjet/FrequencySequentialConvolver.hh"
28 #include "fftjet/DiscreteGauss1d.hh"
29 #include "fftjet/DiscreteGauss2d.hh"
62 using namespace fftjetcms;
76 typedef fftjet::SparseClusteringTree<fftjet::Peak,long>
SparseTree;
77 typedef fftjet::ClusteringSequencer<Real>
Sequencer;
78 typedef fftjet::ClusteringTreeSparsifier<fftjet::Peak,long>
Sparsifier;
108 std::auto_ptr<fftjet::AbsFrequencyKernel>
kernel2d;
113 std::auto_ptr<fftjet::AbsConvolverBase<Real> >
convolver;
119 std::auto_ptr<fftjet::AbsDistanceCalculator<fftjet::Peak> >
distanceCalc;
159 completeEventDataCutoff(ps.getParameter<double>(
"completeEventDataCutoff")),
160 makeClusteringTree(ps.getParameter<bool>(
"makeClusteringTree")),
161 verifyDataConversion(ps.getUntrackedParameter<bool>(
"verifyDataConversion",
false)),
162 storeDiscretizationGrid(ps.getParameter<bool>(
"storeDiscretizationGrid")),
163 sparsify(ps.getParameter<bool>(
"sparsify")),
170 produces<reco::PattRecoTree<float,reco::PattRecoPeak<float> > >(
outputLabel);
172 produces<reco::PattRecoTree<double,reco::PattRecoPeak<double> > >(
outputLabel);
175 produces<reco::DiscretizedEnergyFlow>(
outputLabel);
183 std::ios_base::binary);
186 <<
"FFTJetPatRecoProducer failed to open file "
187 << externalGridFile << std::endl;
193 <<
"FFTJetPatRecoProducer is not configured to produce anything"
219 const unsigned maxAdaptiveScales =
221 const double minAdaptiveRatioLog =
223 if (minAdaptiveRatioLog <= 0.0)
225 <<
"bad adaptive ratio logarithm limit" << std::endl;
232 const unsigned nscales = iniScales->size();
233 for (
unsigned i=0;
i<nscales; ++
i)
234 if (cs >= (*iniScales)[
i])
236 <<
"incompatible scale for complete event" << std::endl;
242 *iniScales, maxAdaptiveScales, minAdaptiveRatioLog));
248 SparsifierConfiguration);
266 const std::vector<double> etaDependentScaleFactors(
267 ps.
getParameter<std::vector<double> >(
"etaDependentScaleFactors"));
270 const bool use2dKernel = etaDependentScaleFactors.empty();
272 if (etaDependentScaleFactors.size() !=
energyFlow->nEta())
274 <<
"invalid number of eta-dependent scale factors"
278 double kernelEtaScale = ps.
getParameter<
double>(
"kernelEtaScale");
279 const double kernelPhiScale = ps.
getParameter<
double>(
"kernelPhiScale");
280 if (kernelEtaScale <= 0.0 || kernelPhiScale <= 0.0)
282 <<
"invalid kernel scale" << std::endl;
289 const bool fixEfficiency = ps.
getParameter<
bool>(
"fixEfficiency");
292 unsigned convolverMinBin = 0, convolverMaxBin = 0;
293 if (fixEfficiency || !use2dKernel)
295 convolverMinBin = ps.
getParameter<
unsigned>(
"convolverMinBin");
296 convolverMaxBin = ps.
getParameter<
unsigned>(
"convolverMaxBin");
302 engine = std::auto_ptr<MyFFTEngine>(
306 kernel2d = std::auto_ptr<fftjet::AbsFrequencyKernel>(
307 new fftjet::DiscreteGauss2d(
308 kernelEtaScale, kernelPhiScale,
312 convolver = std::auto_ptr<fftjet::AbsConvolverBase<Real> >(
313 new fftjet::FrequencyKernelConvolver<Real,Complex>(
315 convolverMinBin, convolverMaxBin));
320 engine = std::auto_ptr<MyFFTEngine>(
326 etaKernel = std::auto_ptr<fftjet::AbsFrequencyKernel1d>(
327 new fftjet::DiscreteGauss1d(kernelEtaScale,
energyFlow->nEta()));
329 phiKernel = std::auto_ptr<fftjet::AbsFrequencyKernel1d>(
330 new fftjet::DiscreteGauss1d(kernelPhiScale,
energyFlow->nPhi()));
333 convolver = std::auto_ptr<fftjet::AbsConvolverBase<Real> >(
334 new fftjet::FrequencySequentialConvolver<Real,Complex>(
337 etaDependentScaleFactors, convolverMinBin,
338 convolverMaxBin, fixEfficiency));
345 const double peakFinderMaxEta = ps.
getParameter<
double>(
"peakFinderMaxEta");
346 if (peakFinderMaxEta <= 0.0)
348 <<
"invalid peak finder eta cut" << std::endl;
349 const double maxMagnitude = ps.
getParameter<
double>(
"peakFinderMaxMagnitude");
350 int minBin =
energyFlow->getEtaBin(-peakFinderMaxEta);
353 int maxBin =
energyFlow->getEtaBin(peakFinderMaxEta) + 1;
356 return fftjet::PeakFinder(maxMagnitude,
true, minBin, maxBin);
377 std::auto_ptr<StoredTree>
tree(
new StoredTree());
387 const std::vector<double>& scalesUsed(
sequencer->getInitialScales());
391 <<
"Data conversion failed for sparse clustering tree"
404 std::auto_ptr<StoredTree>
tree(
new StoredTree());
414 const std::vector<double>& scalesUsed(
sequencer->getInitialScales());
418 <<
"Data conversion failed for dense clustering tree"
450 buildSparseProduct<float>(
iEvent);
452 buildSparseProduct<double>(
iEvent);
457 buildDenseProduct<float>(iEvent);
459 buildDenseProduct<double>(
iEvent);
467 std::auto_ptr<reco::DiscretizedEnergyFlow> flow(
469 g.data(), g.title(), g.etaMin(), g.etaMax(),
470 g.phiBin0Edge(), g.nEta(), g.nPhi()));
474 fftjet::Grid2d<Real>
check(
475 flow->nEtaBins(), flow->etaMin(), flow->etaMax(),
476 flow->nPhiBins(), flow->phiBin0Edge(), flow->title());
477 check.blockSet(flow->data(), flow->nEtaBins(), flow->nPhiBins());
493 <<
"Failed to write grid data into an external file"
T getParameter(std::string const &) const
fftjet::Grid2d< float > * convert_Grid2d_to_float(const fftjet::Grid2d< Numeric > &grid)
std::auto_ptr< fftjet::Functor1< bool, fftjet::Peak > > peakSelector
std::auto_ptr< fftjet::Grid2d< fftjetcms::Real > > energyFlow
auto_ptr< ClusterSequence > cs
Class for storing FFTJet sparse clustering trees.
std::auto_ptr< fftjet::AbsFrequencyKernel1d > phiKernel
std::ofstream externalGridStream
std::auto_ptr< fftjet::Grid2d< Real > > fftjet_Grid2d_parser(const edm::ParameterSet &ps)
#define DEFINE_FWK_MODULE(type)
void loadInputCollection(const edm::Event &)
void buildSparseProduct(edm::Event &) const
void buildKernelConvolver(const edm::ParameterSet &)
void checkConfig(const Ptr &ptr, const char *message)
void buildDenseProduct(edm::Event &) const
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
const bool storeDiscretizationGrid
std::auto_ptr< MyFFTEngine > anotherEngine
std::auto_ptr< fftjet::Functor1< bool, fftjet::Peak > > fftjet_PeakSelector_parser(const edm::ParameterSet &ps)
double getEventScale() const
std::auto_ptr< fftjet::AbsFrequencyKernel > kernel2d
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
void sparsePeakTreeToStorable(const fftjet::SparseClusteringTree< fftjet::Peak, long > &in, bool writeOutScaleInfo, reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > *out)
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
ClusteringTree * clusteringTree
fftjet::ClusteringSequencer< Real > Sequencer
std::auto_ptr< MyFFTEngine > engine
void produce(edm::Event &, const edm::EventSetup &)
std::auto_ptr< Sparsifier > sparsifier
std::auto_ptr< fftjet::AbsDistanceCalculator< fftjet::Peak > > distanceCalc
bool storeInSinglePrecision() const
void densePeakTreeToStorable(const fftjet::AbsClusteringTree< fftjet::Peak, long > &in, bool writeOutScaleInfo, reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > *out)
const double completeEventDataCutoff
const bool makeClusteringTree
void sparsePeakTreeFromStorable(const reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > &in, const std::vector< double > *scaleSetIfNotAdaptive, double completeEventScale, fftjet::SparseClusteringTree< fftjet::Peak, long > *out)
void densePeakTreeFromStorable(const reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > &in, const std::vector< double > *scaleSetIfNotAdaptive, double completeEventScale, fftjet::AbsClusteringTree< fftjet::Peak, long > *out)
fftjet::ClusteringTreeSparsifier< fftjet::Peak, long > Sparsifier
std::auto_ptr< fftjet::AbsFrequencyKernel1d > etaKernel
void copy_Grid2d_data(fftjet::Grid2d< F2 > *to, const fftjet::Grid2d< F1 > &from)
void discretizeEnergyFlow()
std::auto_ptr< fftjet::AbsDistanceCalculator< fftjet::Peak > > fftjet_DistanceCalculator_parser(const edm::ParameterSet &ps)
fftjet::PeakFinder buildPeakFinder(const edm::ParameterSet &)
std::auto_ptr< Sequencer > sequencer
std::auto_ptr< fftjet::AbsConvolverBase< Real > > convolver
std::auto_ptr< fftjet::ClusteringTreeSparsifier< fftjet::Peak, long > > fftjet_ClusteringTreeSparsifier_parser(const edm::ParameterSet &ps)
fftjet::FFTWDoubleEngine MyFFTEngine
fftjet::ProximityClusteringTree< fftjet::Peak, long > ClusteringTree
const bool verifyDataConversion
fftjet::SparseClusteringTree< fftjet::Peak, long > SparseTree
bool storeGridsExternally
fftjet::Grid2d< float > * extGrid
const std::string outputLabel
std::auto_ptr< std::vector< double > > fftjet_ScaleSet_parser(const edm::ParameterSet &ps)