CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Attributes
FFTJetPatRecoProducer Class Reference

#include <RecoJets/FFTJetProducer/plugins/FFTJetPatRecoProducer.cc>

Inheritance diagram for FFTJetPatRecoProducer:
fftjetcms::FFTJetInterface edm::stream::EDProducer<>

Public Member Functions

 FFTJetPatRecoProducer (const edm::ParameterSet &)
 
 FFTJetPatRecoProducer ()=delete
 
 FFTJetPatRecoProducer (const FFTJetPatRecoProducer &)=delete
 
FFTJetPatRecoProduceroperator= (const FFTJetPatRecoProducer &)=delete
 
 ~FFTJetPatRecoProducer () override
 
- Public Member Functions inherited from fftjetcms::FFTJetInterface
 FFTJetInterface ()=delete
 
 FFTJetInterface (const FFTJetInterface &)=delete
 
FFTJetInterfaceoperator= (const FFTJetInterface &)=delete
 
 ~FFTJetInterface () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Protected Types

typedef fftjet::ProximityClusteringTree< fftjet::Peak, long > ClusteringTree
 
typedef fftjet::ClusteringSequencer< RealSequencer
 
typedef fftjet::SparseClusteringTree< fftjet::Peak, long > SparseTree
 
typedef fftjet::ClusteringTreeSparsifier< fftjet::Peak, long > Sparsifier
 

Protected Member Functions

template<class Real >
void buildDenseProduct (edm::Event &) const
 
void buildKernelConvolver (const edm::ParameterSet &)
 
fftjet::PeakFinder buildPeakFinder (const edm::ParameterSet &)
 
template<class Real >
void buildSparseProduct (edm::Event &) const
 
void produce (edm::Event &, const edm::EventSetup &) override
 
- Protected Member Functions inherited from fftjetcms::FFTJetInterface
template<class Ptr >
void checkConfig (const Ptr &ptr, const char *message)
 
void discretizeEnergyFlow ()
 
 FFTJetInterface (const edm::ParameterSet &)
 
double getEventScale () const
 
void loadInputCollection (const edm::Event &)
 
bool storeInSinglePrecision () const
 
const reco::Particle::PointvertexUsed () const
 

Protected Attributes

std::unique_ptr< MyFFTEngineanotherEngine
 
ClusteringTreeclusteringTree
 
const double completeEventDataCutoff
 
std::unique_ptr< fftjet::AbsConvolverBase< Real > > convolver
 
std::unique_ptr< fftjet::AbsDistanceCalculator< fftjet::Peak > > distanceCalc
 
std::unique_ptr< MyFFTEngineengine
 
std::unique_ptr< fftjet::AbsFrequencyKernel1d > etaKernel
 
std::unique_ptr< fftjet::AbsFrequencyKernel > kernel2d
 
const bool makeClusteringTree
 
std::unique_ptr< fftjet::Functor1< bool, fftjet::Peak > > peakSelector
 
std::unique_ptr< fftjet::AbsFrequencyKernel1d > phiKernel
 
std::unique_ptr< Sequencersequencer
 
SparseTree sparseTree
 
std::unique_ptr< Sparsifiersparsifier
 
const bool sparsify
 
const bool storeDiscretizationGrid
 
const bool verifyDataConversion
 
- Protected Attributes inherited from fftjetcms::FFTJetInterface
const AnomalousTower anomalous
 
std::vector< unsigned > candidateIndex
 
const bool doPVCorrection
 
std::unique_ptr< fftjet::Grid2d< fftjetcms::Real > > energyFlow
 
const std::vector< double > etaDependentMagnutideFactors
 
std::vector< fftjetcms::VectorLikeeventData
 
edm::Handle< reco::CandidateViewinputCollection
 
const edm::InputTag inputLabel
 
const JetType jetType
 
const std::string outputLabel
 
const edm::InputTag srcPVs
 

Private Attributes

std::ofstream externalGridStream
 
fftjet::Grid2d< float > * extGrid
 
bool storeGridsExternally
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: Runs FFTJet pattern recognition stage and saves the results

Implementation: [Notes on implementation]

Definition at line 64 of file FFTJetPatRecoProducer.cc.

Member Typedef Documentation

◆ ClusteringTree

typedef fftjet::ProximityClusteringTree<fftjet::Peak, long> FFTJetPatRecoProducer::ClusteringTree
protected

Definition at line 74 of file FFTJetPatRecoProducer.cc.

◆ Sequencer

typedef fftjet::ClusteringSequencer<Real> FFTJetPatRecoProducer::Sequencer
protected

Definition at line 76 of file FFTJetPatRecoProducer.cc.

◆ SparseTree

typedef fftjet::SparseClusteringTree<fftjet::Peak, long> FFTJetPatRecoProducer::SparseTree
protected

Definition at line 75 of file FFTJetPatRecoProducer.cc.

◆ Sparsifier

typedef fftjet::ClusteringTreeSparsifier<fftjet::Peak, long> FFTJetPatRecoProducer::Sparsifier
protected

Definition at line 77 of file FFTJetPatRecoProducer.cc.

Constructor & Destructor Documentation

◆ FFTJetPatRecoProducer() [1/3]

FFTJetPatRecoProducer::FFTJetPatRecoProducer ( const edm::ParameterSet ps)
explicit

Definition at line 149 of file FFTJetPatRecoProducer.cc.

References buildKernelConvolver(), buildPeakFinder(), fftjetcms::FFTJetInterface::checkConfig(), clusteringTree, convolver, callgraph::cs, distanceCalc, fftjetcms::FFTJetInterface::energyFlow, Exception, fftjetpatrecoproducer_cfi::externalGridFile, externalGridStream, fftjetcms::fftjet_ClusteringTreeSparsifier_parser(), fftjetcms::fftjet_DistanceCalculator_parser(), fftjetcms::fftjet_Grid2d_parser(), fftjetcms::fftjet_PeakSelector_parser(), fftjetcms::fftjet_ScaleSet_parser(), fftjetcms::FFTJetInterface::getEventScale(), edm::ParameterSet::getParameter(), mps_fire::i, makeClusteringTree, fftjetpatrecoproducer_cfi::maxAdaptiveScales, fftjetpatrecoproducer_cfi::minAdaptiveRatioLog, MillePedeFileConverter_cfg::out, fftjetcms::FFTJetInterface::outputLabel, peakSelector, sequencer, sparsifier, fftjetpatrecoproducer_cfi::SparsifierConfiguration, storeDiscretizationGrid, storeGridsExternally, fftjetcms::FFTJetInterface::storeInSinglePrecision(), AlCaHLTBitMon_QueryRunRegistry::string, and fftjetdijetfilter_cfi::TreeDistanceCalculator.

150  : FFTJetInterface(ps),
151  clusteringTree(nullptr),
152  completeEventDataCutoff(ps.getParameter<double>("completeEventDataCutoff")),
153  makeClusteringTree(ps.getParameter<bool>("makeClusteringTree")),
154  verifyDataConversion(ps.getUntrackedParameter<bool>("verifyDataConversion", false)),
155  storeDiscretizationGrid(ps.getParameter<bool>("storeDiscretizationGrid")),
156  sparsify(ps.getParameter<bool>("sparsify")),
157  extGrid(nullptr) {
158  // register your products
159  if (makeClusteringTree) {
161  produces<reco::PattRecoTree<float, reco::PattRecoPeak<float> > >(outputLabel);
162  else
163  produces<reco::PattRecoTree<double, reco::PattRecoPeak<double> > >(outputLabel);
164  }
166  produces<reco::DiscretizedEnergyFlow>(outputLabel);
167 
168  // Check if we want to write the grids into an external file
169  const std::string externalGridFile(ps.getParameter<std::string>("externalGridFile"));
171  if (storeGridsExternally) {
172  externalGridStream.open(externalGridFile.c_str(), std::ios_base::out | std::ios_base::binary);
173  if (!externalGridStream.is_open())
174  throw cms::Exception("FFTJetBadConfig")
175  << "FFTJetPatRecoProducer failed to open file " << externalGridFile << std::endl;
176  }
177 
179  throw cms::Exception("FFTJetBadConfig")
180  << "FFTJetPatRecoProducer is not configured to produce anything" << std::endl;
181  }
182 
183  // now do whatever other initialization is needed
184 
185  // Build the discretization grid
187  checkConfig(energyFlow, "invalid discretization grid");
188 
189  // Build the FFT engine(s), pattern recognition kernel(s),
190  // and the kernel convolver
192 
193  // Build the peak selector
194  peakSelector = fftjet_PeakSelector_parser(ps.getParameter<edm::ParameterSet>("PeakSelectorConfiguration"));
195  checkConfig(peakSelector, "invalid peak selector");
196 
197  // Build the initial set of pattern recognition scales
198  std::unique_ptr<std::vector<double> > iniScales =
200  checkConfig(iniScales, "invalid set of scales");
201 
202  // Do we want to use the adaptive clustering tree algorithm?
203  const unsigned maxAdaptiveScales = ps.getParameter<unsigned>("maxAdaptiveScales");
204  const double minAdaptiveRatioLog = ps.getParameter<double>("minAdaptiveRatioLog");
205  if (minAdaptiveRatioLog <= 0.0)
206  throw cms::Exception("FFTJetBadConfig") << "bad adaptive ratio logarithm limit" << std::endl;
207 
208  // Make sure that all standard scales are larger than the
209  // complete event scale
210  if (getEventScale() > 0.0) {
211  const double cs = getEventScale();
212  const unsigned nscales = iniScales->size();
213  for (unsigned i = 0; i < nscales; ++i)
214  if (cs >= (*iniScales)[i])
215  throw cms::Exception("FFTJetBadConfig") << "incompatible scale for complete event" << std::endl;
216  }
217 
218  // At this point we are ready to build the clustering sequencer
219  sequencer = std::make_unique<Sequencer>(
221 
222  // Build the clustering tree sparsifier
223  const edm::ParameterSet& SparsifierConfiguration(ps.getParameter<edm::ParameterSet>("SparsifierConfiguration"));
225  checkConfig(sparsifier, "invalid sparsifier parameters");
226 
227  // Build the distance calculator for the clustering tree
228  const edm::ParameterSet& TreeDistanceCalculator(ps.getParameter<edm::ParameterSet>("TreeDistanceCalculator"));
230  checkConfig(distanceCalc, "invalid tree distance calculator");
231 
232  // Build the clustering tree itself
234 }
std::unique_ptr< Sparsifier > sparsifier
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
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)
std::unique_ptr< fftjet::AbsDistanceCalculator< fftjet::Peak > > distanceCalc
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< Sequencer > sequencer
std::unique_ptr< fftjet::Functor1< bool, fftjet::Peak > > peakSelector
std::unique_ptr< fftjet::Grid2d< fftjetcms::Real > > energyFlow
ClusteringTree * clusteringTree
std::unique_ptr< fftjet::AbsDistanceCalculator< fftjet::Peak > > fftjet_DistanceCalculator_parser(const edm::ParameterSet &ps)
std::unique_ptr< fftjet::AbsConvolverBase< Real > > convolver
fftjet::PeakFinder buildPeakFinder(const edm::ParameterSet &)
std::unique_ptr< fftjet::Functor1< bool, fftjet::Peak > > fftjet_PeakSelector_parser(const edm::ParameterSet &ps)
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

◆ FFTJetPatRecoProducer() [2/3]

FFTJetPatRecoProducer::FFTJetPatRecoProducer ( )
delete

◆ FFTJetPatRecoProducer() [3/3]

FFTJetPatRecoProducer::FFTJetPatRecoProducer ( const FFTJetPatRecoProducer )
delete

◆ ~FFTJetPatRecoProducer()

FFTJetPatRecoProducer::~FFTJetPatRecoProducer ( )
override

Definition at line 317 of file FFTJetPatRecoProducer.cc.

References clusteringTree, externalGridStream, extGrid, and storeGridsExternally.

317  {
318  // do anything here that needs to be done at desctruction time
319  // (e.g. close files, deallocate resources etc.)
321  externalGridStream.close();
322  delete clusteringTree;
323  delete extGrid;
324 }
ClusteringTree * clusteringTree
fftjet::Grid2d< float > * extGrid

Member Function Documentation

◆ buildDenseProduct()

template<class Real >
void FFTJetPatRecoProducer::buildDenseProduct ( edm::Event ev) const
protected

Definition at line 350 of file FFTJetPatRecoProducer.cc.

References RPCNoise_example::check, clusteringTree, fftjetcms::densePeakTreeFromStorable(), fftjetcms::densePeakTreeToStorable(), distanceCalc, makeMEIFBenchmarkPlots::ev, Exception, fftjetcms::FFTJetInterface::getEventScale(), eostools::move(), fftjetcms::FFTJetInterface::outputLabel, sequencer, fftjetcms::FFTJetInterface::storeInSinglePrecision(), and verifyDataConversion.

350  {
352 
353  auto tree = std::make_unique<StoredTree>();
354 
355  densePeakTreeToStorable(*clusteringTree, sequencer->maxAdaptiveScales(), tree.get());
356 
357  // Check that we can restore the tree
360  const std::vector<double>& scalesUsed(sequencer->getInitialScales());
362  if (*clusteringTree != check)
363  throw cms::Exception("FFTJetInterface") << "Data conversion failed for dense clustering tree" << std::endl;
364  }
365 
366  ev.put(std::move(tree), outputLabel);
367 }
Class for storing FFTJet sparse clustering trees.
Definition: PattRecoTree.h:20
std::unique_ptr< fftjet::AbsDistanceCalculator< fftjet::Peak > > distanceCalc
std::unique_ptr< Sequencer > sequencer
ClusteringTree * clusteringTree
void densePeakTreeToStorable(const fftjet::AbsClusteringTree< fftjet::Peak, long > &in, bool writeOutScaleInfo, reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > *out)
void densePeakTreeFromStorable(const reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > &in, const std::vector< double > *scaleSetIfNotAdaptive, double completeEventScale, fftjet::AbsClusteringTree< fftjet::Peak, long > *out)
Definition: tree.py:1
fftjet::ProximityClusteringTree< fftjet::Peak, long > ClusteringTree
const std::string outputLabel
def move(src, dest)
Definition: eostools.py:511

◆ buildKernelConvolver()

void FFTJetPatRecoProducer::buildKernelConvolver ( const edm::ParameterSet ps)
protected

Definition at line 236 of file FFTJetPatRecoProducer.cc.

References anotherEngine, convolver, fftjeteflowsmoother_cfi::convolverMaxBin, fftjeteflowsmoother_cfi::convolverMinBin, fftjetcms::FFTJetInterface::energyFlow, engine, fftjeteflowsmoother_cfi::etaDependentScaleFactors, etaKernel, Exception, fftjeteflowsmoother_cfi::fixEfficiency, edm::ParameterSet::getParameter(), kernel2d, fftjeteflowsmoother_cfi::kernelEtaScale, fftjeteflowsmoother_cfi::kernelPhiScale, M_PI, and phiKernel.

Referenced by FFTJetPatRecoProducer().

236  {
237  // Check the parameter named "etaDependentScaleFactors". If the vector
238  // of scales is empty we will use 2d kernel, otherwise use 1d kernels
239  const std::vector<double> etaDependentScaleFactors(ps.getParameter<std::vector<double> >("etaDependentScaleFactors"));
240 
241  // Make sure that the number of scale factors provided is correct
242  const bool use2dKernel = etaDependentScaleFactors.empty();
243  if (!use2dKernel)
244  if (etaDependentScaleFactors.size() != energyFlow->nEta())
245  throw cms::Exception("FFTJetBadConfig") << "invalid number of eta-dependent scale factors" << std::endl;
246 
247  // Get the eta and phi scales for the kernel(s)
248  double kernelEtaScale = ps.getParameter<double>("kernelEtaScale");
249  const double kernelPhiScale = ps.getParameter<double>("kernelPhiScale");
250  if (kernelEtaScale <= 0.0 || kernelPhiScale <= 0.0)
251  throw cms::Exception("FFTJetBadConfig") << "invalid kernel scale" << std::endl;
252 
253  // FFT assumes that the grid extent in eta is 2*Pi. Adjust the
254  // kernel scale in eta to compensate.
255  kernelEtaScale *= (2.0 * M_PI / (energyFlow->etaMax() - energyFlow->etaMin()));
256 
257  // Are we going to try to fix the efficiency near detector edges?
258  const bool fixEfficiency = ps.getParameter<bool>("fixEfficiency");
259 
260  // Minimum and maximum eta bin for the convolver
261  unsigned convolverMinBin = 0, convolverMaxBin = 0;
262  if (fixEfficiency || !use2dKernel) {
263  convolverMinBin = ps.getParameter<unsigned>("convolverMinBin");
264  convolverMaxBin = ps.getParameter<unsigned>("convolverMaxBin");
265  }
266 
267  if (use2dKernel) {
268  // Build the FFT engine
269  engine = std::make_unique<MyFFTEngine>(energyFlow->nEta(), energyFlow->nPhi());
270 
271  // 2d kernel
272  kernel2d = std::unique_ptr<fftjet::AbsFrequencyKernel>(
273  new fftjet::DiscreteGauss2d(kernelEtaScale, kernelPhiScale, energyFlow->nEta(), energyFlow->nPhi()));
274 
275  // 2d convolver
276  convolver = std::unique_ptr<fftjet::AbsConvolverBase<Real> >(new fftjet::FrequencyKernelConvolver<Real, Complex>(
278  } else {
279  // Need separate FFT engines for eta and phi
280  engine = std::make_unique<MyFFTEngine>(1, energyFlow->nEta());
281  anotherEngine = std::make_unique<MyFFTEngine>(1, energyFlow->nPhi());
282 
283  // 1d kernels
284  etaKernel =
285  std::unique_ptr<fftjet::AbsFrequencyKernel1d>(new fftjet::DiscreteGauss1d(kernelEtaScale, energyFlow->nEta()));
286 
287  phiKernel =
288  std::unique_ptr<fftjet::AbsFrequencyKernel1d>(new fftjet::DiscreteGauss1d(kernelPhiScale, energyFlow->nPhi()));
289 
290  // Sequential convolver
291  convolver = std::unique_ptr<fftjet::AbsConvolverBase<Real> >(
292  new fftjet::FrequencySequentialConvolver<Real, Complex>(engine.get(),
293  anotherEngine.get(),
294  etaKernel.get(),
295  phiKernel.get(),
299  fixEfficiency));
300  }
301 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::unique_ptr< fftjet::AbsFrequencyKernel1d > etaKernel
std::unique_ptr< fftjet::AbsFrequencyKernel1d > phiKernel
std::unique_ptr< fftjet::Grid2d< fftjetcms::Real > > energyFlow
std::unique_ptr< MyFFTEngine > anotherEngine
#define M_PI
std::unique_ptr< fftjet::AbsConvolverBase< Real > > convolver
std::unique_ptr< fftjet::AbsFrequencyKernel > kernel2d
std::unique_ptr< MyFFTEngine > engine

◆ buildPeakFinder()

fftjet::PeakFinder FFTJetPatRecoProducer::buildPeakFinder ( const edm::ParameterSet ps)
protected

Definition at line 303 of file FFTJetPatRecoProducer.cc.

References fftjetcms::FFTJetInterface::energyFlow, Exception, edm::ParameterSet::getParameter(), cms::cuda::allocator::maxBin, cms::cuda::allocator::minBin, and fftjetpatrecoproducer_cfi::peakFinderMaxEta.

Referenced by FFTJetPatRecoProducer().

303  {
304  const double peakFinderMaxEta = ps.getParameter<double>("peakFinderMaxEta");
305  if (peakFinderMaxEta <= 0.0)
306  throw cms::Exception("FFTJetBadConfig") << "invalid peak finder eta cut" << std::endl;
307  const double maxMagnitude = ps.getParameter<double>("peakFinderMaxMagnitude");
308  int minBin = energyFlow->getEtaBin(-peakFinderMaxEta);
309  if (minBin < 0)
310  minBin = 0;
311  int maxBin = energyFlow->getEtaBin(peakFinderMaxEta) + 1;
312  if (maxBin < 0)
313  maxBin = 0;
314  return fftjet::PeakFinder(maxMagnitude, true, minBin, maxBin);
315 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
constexpr unsigned int maxBin
std::unique_ptr< fftjet::Grid2d< fftjetcms::Real > > energyFlow
constexpr unsigned int minBin

◆ buildSparseProduct()

template<class Real >
void FFTJetPatRecoProducer::buildSparseProduct ( edm::Event ev) const
protected

Definition at line 330 of file FFTJetPatRecoProducer.cc.

References RPCNoise_example::check, makeMEIFBenchmarkPlots::ev, Exception, fftjetcms::FFTJetInterface::getEventScale(), eostools::move(), fftjetcms::FFTJetInterface::outputLabel, sequencer, fftjetcms::sparsePeakTreeFromStorable(), fftjetcms::sparsePeakTreeToStorable(), sparseTree, fftjetcms::FFTJetInterface::storeInSinglePrecision(), and verifyDataConversion.

330  {
332 
333  auto tree = std::make_unique<StoredTree>();
334 
335  sparsePeakTreeToStorable(sparseTree, sequencer->maxAdaptiveScales(), tree.get());
336 
337  // Check that we can restore the tree
340  const std::vector<double>& scalesUsed(sequencer->getInitialScales());
342  if (sparseTree != check)
343  throw cms::Exception("FFTJetInterface") << "Data conversion failed for sparse clustering tree" << std::endl;
344  }
345 
346  ev.put(std::move(tree), outputLabel);
347 }
Class for storing FFTJet sparse clustering trees.
Definition: PattRecoTree.h:20
fftjet::SparseClusteringTree< fftjet::Peak, long > SparseTree
std::unique_ptr< Sequencer > sequencer
void sparsePeakTreeToStorable(const fftjet::SparseClusteringTree< fftjet::Peak, long > &in, bool writeOutScaleInfo, reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > *out)
void sparsePeakTreeFromStorable(const reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > &in, const std::vector< double > *scaleSetIfNotAdaptive, double completeEventScale, fftjet::SparseClusteringTree< fftjet::Peak, long > *out)
Definition: tree.py:1
const std::string outputLabel
def move(src, dest)
Definition: eostools.py:511

◆ operator=()

FFTJetPatRecoProducer& FFTJetPatRecoProducer::operator= ( const FFTJetPatRecoProducer )
delete

◆ produce()

void FFTJetPatRecoProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprotected

Definition at line 370 of file FFTJetPatRecoProducer.cc.

References cms::cuda::assert(), RPCNoise_example::check, clusteringTree, completeEventDataCutoff, fftjetcms::convert_Grid2d_to_float(), fftjetcms::copy_Grid2d_data(), fftjetcms::FFTJetInterface::discretizeEnergyFlow(), fftjetcms::FFTJetInterface::energyFlow, Exception, externalGridStream, extGrid, fftjetcommon_cfi::flow, g, fftjetcms::FFTJetInterface::getEventScale(), iEvent, fftjetcms::FFTJetInterface::loadInputCollection(), makeClusteringTree, eostools::move(), fftjetcms::FFTJetInterface::outputLabel, sequencer, sparseTree, sparsifier, sparsify, storeDiscretizationGrid, storeGridsExternally, fftjetcms::FFTJetInterface::storeInSinglePrecision(), and verifyDataConversion.

370  {
373 
374  if (makeClusteringTree) {
376  if (getEventScale() > 0.0)
378 
379  if (sparsify) {
380  sparsifier->sparsify(*clusteringTree, &sparseTree);
381 
382  // Do not call the "sortNodes" method of the sparse tree here.
383  // Currently, the nodes are sorted by daughter number.
384  // This is the way we want it in storage because the stored
385  // tree does not include daughter ordering info explicitly.
386 
388  buildSparseProduct<float>(iEvent);
389  else
390  buildSparseProduct<double>(iEvent);
391  } else {
393  buildDenseProduct<float>(iEvent);
394  else
395  buildDenseProduct<double>(iEvent);
396  }
397  }
398 
400  const fftjet::Grid2d<Real>& g(*energyFlow);
401 
402  auto flow = std::make_unique<reco::DiscretizedEnergyFlow>(
403  g.data(), g.title(), g.etaMin(), g.etaMax(), g.phiBin0Edge(), g.nEta(), g.nPhi());
404 
405  if (verifyDataConversion) {
406  fftjet::Grid2d<Real> check(
407  flow->nEtaBins(), flow->etaMin(), flow->etaMax(), flow->nPhiBins(), flow->phiBin0Edge(), flow->title());
408  check.blockSet(flow->data(), flow->nEtaBins(), flow->nPhiBins());
409  assert(g == check);
410  }
411 
413  }
414 
415  if (storeGridsExternally) {
416  if (extGrid)
418  else
420  if (!extGrid->write(externalGridStream)) {
421  throw cms::Exception("FFTJetPatRecoProducer::produce")
422  << "Failed to write grid data into an external file" << std::endl;
423  }
424  }
425 }
fftjet::Grid2d< float > * convert_Grid2d_to_float(const fftjet::Grid2d< Numeric > &grid)
std::unique_ptr< Sparsifier > sparsifier
void loadInputCollection(const edm::Event &)
assert(be >=bs)
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
Definition: Activities.doc:4
std::unique_ptr< Sequencer > sequencer
int iEvent
Definition: GenABIO.cc:224
std::unique_ptr< fftjet::Grid2d< fftjetcms::Real > > energyFlow
ClusteringTree * clusteringTree
void copy_Grid2d_data(fftjet::Grid2d< F2 > *to, const fftjet::Grid2d< F1 > &from)
fftjet::Grid2d< float > * extGrid
const std::string outputLabel
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ anotherEngine

std::unique_ptr<MyFFTEngine> FFTJetPatRecoProducer::anotherEngine
protected

Definition at line 102 of file FFTJetPatRecoProducer.cc.

Referenced by buildKernelConvolver().

◆ clusteringTree

ClusteringTree* FFTJetPatRecoProducer::clusteringTree
protected

◆ completeEventDataCutoff

const double FFTJetPatRecoProducer::completeEventDataCutoff
protected

Definition at line 124 of file FFTJetPatRecoProducer.cc.

Referenced by produce().

◆ convolver

std::unique_ptr<fftjet::AbsConvolverBase<Real> > FFTJetPatRecoProducer::convolver
protected

Definition at line 110 of file FFTJetPatRecoProducer.cc.

Referenced by buildKernelConvolver(), and FFTJetPatRecoProducer().

◆ distanceCalc

std::unique_ptr<fftjet::AbsDistanceCalculator<fftjet::Peak> > FFTJetPatRecoProducer::distanceCalc
protected

Definition at line 116 of file FFTJetPatRecoProducer.cc.

Referenced by buildDenseProduct(), and FFTJetPatRecoProducer().

◆ engine

std::unique_ptr<MyFFTEngine> FFTJetPatRecoProducer::engine
protected

Definition at line 101 of file FFTJetPatRecoProducer.cc.

Referenced by buildKernelConvolver().

◆ etaKernel

std::unique_ptr<fftjet::AbsFrequencyKernel1d> FFTJetPatRecoProducer::etaKernel
protected

Definition at line 106 of file FFTJetPatRecoProducer.cc.

Referenced by buildKernelConvolver().

◆ externalGridStream

std::ofstream FFTJetPatRecoProducer::externalGridStream
private

◆ extGrid

fftjet::Grid2d<float>* FFTJetPatRecoProducer::extGrid
private

Definition at line 143 of file FFTJetPatRecoProducer.cc.

Referenced by produce(), and ~FFTJetPatRecoProducer().

◆ kernel2d

std::unique_ptr<fftjet::AbsFrequencyKernel> FFTJetPatRecoProducer::kernel2d
protected

Definition at line 105 of file FFTJetPatRecoProducer.cc.

Referenced by buildKernelConvolver().

◆ makeClusteringTree

const bool FFTJetPatRecoProducer::makeClusteringTree
protected

Definition at line 127 of file FFTJetPatRecoProducer.cc.

Referenced by FFTJetPatRecoProducer(), and produce().

◆ peakSelector

std::unique_ptr<fftjet::Functor1<bool, fftjet::Peak> > FFTJetPatRecoProducer::peakSelector
protected

Definition at line 113 of file FFTJetPatRecoProducer.cc.

Referenced by FFTJetPatRecoProducer().

◆ phiKernel

std::unique_ptr<fftjet::AbsFrequencyKernel1d> FFTJetPatRecoProducer::phiKernel
protected

Definition at line 107 of file FFTJetPatRecoProducer.cc.

Referenced by buildKernelConvolver().

◆ sequencer

std::unique_ptr<Sequencer> FFTJetPatRecoProducer::sequencer
protected

◆ sparseTree

SparseTree FFTJetPatRecoProducer::sparseTree
protected

Definition at line 119 of file FFTJetPatRecoProducer.cc.

Referenced by buildSparseProduct(), and produce().

◆ sparsifier

std::unique_ptr<Sparsifier> FFTJetPatRecoProducer::sparsifier
protected

Definition at line 98 of file FFTJetPatRecoProducer.cc.

Referenced by FFTJetPatRecoProducer(), and produce().

◆ sparsify

const bool FFTJetPatRecoProducer::sparsify
protected

Definition at line 137 of file FFTJetPatRecoProducer.cc.

Referenced by produce().

◆ storeDiscretizationGrid

const bool FFTJetPatRecoProducer::storeDiscretizationGrid
protected

Definition at line 134 of file FFTJetPatRecoProducer.cc.

Referenced by FFTJetPatRecoProducer(), and produce().

◆ storeGridsExternally

bool FFTJetPatRecoProducer::storeGridsExternally
private

◆ verifyDataConversion

const bool FFTJetPatRecoProducer::verifyDataConversion
protected

Definition at line 131 of file FFTJetPatRecoProducer.cc.

Referenced by buildDenseProduct(), buildSparseProduct(), and produce().