22 #include "fftjet/ProximityClusteringTree.hh" 23 #include "fftjet/ClusteringSequencer.hh" 24 #include "fftjet/ClusteringTreeSparsifier.hh" 25 #include "fftjet/FrequencyKernelConvolver.hh" 26 #include "fftjet/FrequencySequentialConvolver.hh" 27 #include "fftjet/DiscreteGauss1d.hh" 28 #include "fftjet/DiscreteGauss2d.hh" 72 typedef fftjet::SparseClusteringTree<fftjet::Peak,long>
SparseTree;
73 typedef fftjet::ClusteringSequencer<Real>
Sequencer;
74 typedef fftjet::ClusteringTreeSparsifier<fftjet::Peak,long>
Sparsifier;
79 void endJob()
override ;
104 std::auto_ptr<fftjet::AbsFrequencyKernel>
kernel2d;
109 std::auto_ptr<fftjet::AbsConvolverBase<Real> >
convolver;
115 std::auto_ptr<fftjet::AbsDistanceCalculator<fftjet::Peak> >
distanceCalc;
166 produces<reco::PattRecoTree<float,reco::PattRecoPeak<float> > >(
outputLabel);
168 produces<reco::PattRecoTree<double,reco::PattRecoPeak<double> > >(
outputLabel);
171 produces<reco::DiscretizedEnergyFlow>(
outputLabel);
179 std::ios_base::binary);
182 <<
"FFTJetPatRecoProducer failed to open file " 183 << externalGridFile << std::endl;
189 <<
"FFTJetPatRecoProducer is not configured to produce anything" 219 if (minAdaptiveRatioLog <= 0.0)
221 <<
"bad adaptive ratio logarithm limit" << std::endl;
228 const unsigned nscales = iniScales->size();
229 for (
unsigned i=0;
i<nscales; ++
i)
230 if (cs >= (*iniScales)[
i])
232 <<
"incompatible scale for complete event" << std::endl;
244 SparsifierConfiguration);
263 ps.
getParameter<std::vector<double> >(
"etaDependentScaleFactors"));
266 const bool use2dKernel = etaDependentScaleFactors.empty();
268 if (etaDependentScaleFactors.size() !=
energyFlow->nEta())
270 <<
"invalid number of eta-dependent scale factors" 276 if (kernelEtaScale <= 0.0 || kernelPhiScale <= 0.0)
278 <<
"invalid kernel scale" << std::endl;
289 if (fixEfficiency || !use2dKernel)
291 convolverMinBin = ps.
getParameter<
unsigned>(
"convolverMinBin");
298 engine = std::auto_ptr<MyFFTEngine>(
302 kernel2d = std::auto_ptr<fftjet::AbsFrequencyKernel>(
303 new fftjet::DiscreteGauss2d(
304 kernelEtaScale, kernelPhiScale,
308 convolver = std::auto_ptr<fftjet::AbsConvolverBase<Real> >(
309 new fftjet::FrequencyKernelConvolver<Real,Complex>(
316 engine = std::auto_ptr<MyFFTEngine>(
322 etaKernel = std::auto_ptr<fftjet::AbsFrequencyKernel1d>(
323 new fftjet::DiscreteGauss1d(kernelEtaScale,
energyFlow->nEta()));
325 phiKernel = std::auto_ptr<fftjet::AbsFrequencyKernel1d>(
326 new fftjet::DiscreteGauss1d(kernelPhiScale,
energyFlow->nPhi()));
329 convolver = std::auto_ptr<fftjet::AbsConvolverBase<Real> >(
330 new fftjet::FrequencySequentialConvolver<Real,Complex>(
342 if (peakFinderMaxEta <= 0.0)
344 <<
"invalid peak finder eta cut" << std::endl;
345 const double maxMagnitude = ps.
getParameter<
double>(
"peakFinderMaxMagnitude");
346 int minBin =
energyFlow->getEtaBin(-peakFinderMaxEta);
349 int maxBin =
energyFlow->getEtaBin(peakFinderMaxEta) + 1;
352 return fftjet::PeakFinder(maxMagnitude,
true, minBin, maxBin);
373 auto tree = std::make_unique<StoredTree>();
383 const std::vector<double>& scalesUsed(
sequencer->getInitialScales());
387 <<
"Data conversion failed for sparse clustering tree" 400 auto tree = std::make_unique<StoredTree>();
410 const std::vector<double>& scalesUsed(
sequencer->getInitialScales());
414 <<
"Data conversion failed for dense clustering tree" 446 buildSparseProduct<float>(
iEvent);
448 buildSparseProduct<double>(
iEvent);
453 buildDenseProduct<float>(iEvent);
455 buildDenseProduct<double>(
iEvent);
463 auto flow = std::make_unique<reco::DiscretizedEnergyFlow>(
464 g.data(), g.title(), g.etaMin(), g.etaMax(),
465 g.phiBin0Edge(), g.nEta(), g.nPhi());
469 fftjet::Grid2d<Real>
check(
488 <<
"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
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
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
FFTJetPatRecoProducer()=delete
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
void produce(edm::Event &, const edm::EventSetup &) override
~FFTJetPatRecoProducer() override
void sparsePeakTreeToStorable(const fftjet::SparseClusteringTree< fftjet::Peak, long > &in, bool writeOutScaleInfo, reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > *out)
ClusteringTree * clusteringTree
fftjet::ClusteringSequencer< Real > Sequencer
std::auto_ptr< MyFFTEngine > engine
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)