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" 75 typedef fftjet::SparseClusteringTree<fftjet::Peak, long>
SparseTree;
76 typedef fftjet::ClusteringSequencer<Real>
Sequencer;
77 typedef fftjet::ClusteringTreeSparsifier<fftjet::Peak, long>
Sparsifier;
82 void endJob()
override;
107 std::unique_ptr<fftjet::AbsFrequencyKernel>
kernel2d;
108 std::unique_ptr<fftjet::AbsFrequencyKernel1d>
etaKernel;
109 std::unique_ptr<fftjet::AbsFrequencyKernel1d>
phiKernel;
112 std::unique_ptr<fftjet::AbsConvolverBase<Real> >
convolver;
118 std::unique_ptr<fftjet::AbsDistanceCalculator<fftjet::Peak> >
distanceCalc;
153 clusteringTree(nullptr),
163 produces<reco::PattRecoTree<float, reco::PattRecoPeak<float> > >(
outputLabel);
165 produces<reco::PattRecoTree<double, reco::PattRecoPeak<double> > >(
outputLabel);
168 produces<reco::DiscretizedEnergyFlow>(
outputLabel);
177 <<
"FFTJetPatRecoProducer failed to open file " <<
externalGridFile << std::endl;
182 <<
"FFTJetPatRecoProducer is not configured to produce anything" << std::endl;
200 std::unique_ptr<std::vector<double> > iniScales =
208 throw cms::Exception(
"FFTJetBadConfig") <<
"bad adaptive ratio logarithm limit" << std::endl;
214 const unsigned nscales = iniScales->size();
215 for (
unsigned i = 0;
i < nscales; ++
i)
216 if (
cs >= (*iniScales)[
i])
217 throw cms::Exception(
"FFTJetBadConfig") <<
"incompatible scale for complete event" << std::endl;
247 throw cms::Exception(
"FFTJetBadConfig") <<
"invalid number of eta-dependent scale factors" << std::endl;
253 throw cms::Exception(
"FFTJetBadConfig") <<
"invalid kernel scale" << std::endl;
274 kernel2d = std::unique_ptr<fftjet::AbsFrequencyKernel>(
278 convolver = std::unique_ptr<fftjet::AbsConvolverBase<Real> >(
new fftjet::FrequencyKernelConvolver<Real, Complex>(
293 convolver = std::unique_ptr<fftjet::AbsConvolverBase<Real> >(
294 new fftjet::FrequencySequentialConvolver<Real, Complex>(
engine.get(),
308 throw cms::Exception(
"FFTJetBadConfig") <<
"invalid peak finder eta cut" << std::endl;
309 const double maxMagnitude = ps.
getParameter<
double>(
"peakFinderMaxMagnitude");
316 return fftjet::PeakFinder(maxMagnitude,
true,
minBin,
maxBin);
329 template <
class Real>
333 auto tree = std::make_unique<StoredTree>();
340 const std::vector<double>& scalesUsed(
sequencer->getInitialScales());
343 throw cms::Exception(
"FFTJetInterface") <<
"Data conversion failed for sparse clustering tree" << std::endl;
349 template <
class Real>
353 auto tree = std::make_unique<StoredTree>();
360 const std::vector<double>& scalesUsed(
sequencer->getInitialScales());
363 throw cms::Exception(
"FFTJetInterface") <<
"Data conversion failed for dense clustering tree" << std::endl;
388 buildSparseProduct<float>(
iEvent);
390 buildSparseProduct<double>(
iEvent);
393 buildDenseProduct<float>(
iEvent);
395 buildDenseProduct<double>(
iEvent);
402 auto flow = std::make_unique<reco::DiscretizedEnergyFlow>(
403 g.data(),
g.title(),
g.etaMin(),
g.etaMax(),
g.phiBin0Edge(),
g.nEta(),
g.nPhi());
406 fftjet::Grid2d<Real>
check(
422 <<
"Failed to write grid data into an external file" << std::endl;
fftjet::Grid2d< float > * convert_Grid2d_to_float(const fftjet::Grid2d< Numeric > &grid)
std::unique_ptr< Sparsifier > sparsifier
T getParameter(std::string const &) const
std::unique_ptr< fftjet::AbsFrequencyKernel1d > etaKernel
Class for storing FFTJet sparse clustering trees.
std::ofstream externalGridStream
double getEventScale() const
constexpr unsigned int maxBin
#define DEFINE_FWK_MODULE(type)
void loadInputCollection(const edm::Event &)
void buildKernelConvolver(const edm::ParameterSet &)
void checkConfig(const Ptr &ptr, const char *message)
std::unique_ptr< fftjet::Grid2d< Real > > fftjet_Grid2d_parser(const edm::ParameterSet &ps)
fftjet::SparseClusteringTree< fftjet::Peak, long > SparseTree
std::unique_ptr< fftjet::AbsDistanceCalculator< fftjet::Peak > > distanceCalc
fftjet::ClusteringTreeSparsifier< fftjet::Peak, long > Sparsifier
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::unique_ptr< fftjet::AbsFrequencyKernel1d > phiKernel
FFTJetPatRecoProducer()=delete
std::unique_ptr< Sequencer > sequencer
std::unique_ptr< fftjet::Functor1< bool, fftjet::Peak > > peakSelector
void produce(edm::Event &, const edm::EventSetup &) override
std::unique_ptr< fftjet::Grid2d< fftjetcms::Real > > energyFlow
~FFTJetPatRecoProducer() override
void sparsePeakTreeToStorable(const fftjet::SparseClusteringTree< fftjet::Peak, long > &in, bool writeOutScaleInfo, reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > *out)
std::unique_ptr< MyFFTEngine > anotherEngine
ClusteringTree * clusteringTree
fftjet::ClusteringSequencer< Real > Sequencer
std::unique_ptr< fftjet::AbsDistanceCalculator< fftjet::Peak > > fftjet_DistanceCalculator_parser(const edm::ParameterSet &ps)
void buildSparseProduct(edm::Event &) 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)
bool storeInSinglePrecision() const
std::unique_ptr< fftjet::AbsConvolverBase< Real > > convolver
void buildDenseProduct(edm::Event &) const
void copy_Grid2d_data(fftjet::Grid2d< F2 > *to, const fftjet::Grid2d< F1 > &from)
void discretizeEnergyFlow()
std::unique_ptr< fftjet::AbsFrequencyKernel > kernel2d
fftjet::PeakFinder buildPeakFinder(const edm::ParameterSet &)
std::unique_ptr< fftjet::Functor1< bool, fftjet::Peak > > fftjet_PeakSelector_parser(const edm::ParameterSet &ps)
const bool verifyDataConversion
bool storeGridsExternally
std::unique_ptr< fftjet::ClusteringTreeSparsifier< fftjet::Peak, long > > fftjet_ClusteringTreeSparsifier_parser(const edm::ParameterSet &ps)
fftjet::ProximityClusteringTree< fftjet::Peak, long > ClusteringTree
fftjet::Grid2d< float > * extGrid
std::unique_ptr< std::vector< double > > fftjet_ScaleSet_parser(const edm::ParameterSet &ps)
const std::string outputLabel
std::unique_ptr< MyFFTEngine > engine
constexpr unsigned int minBin