CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
FFTJetPatRecoProducer Class Reference

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

Inheritance diagram for FFTJetPatRecoProducer:
edm::EDProducer fftjetcms::FFTJetInterface edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 FFTJetPatRecoProducer (const edm::ParameterSet &)
 
 ~FFTJetPatRecoProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from fftjetcms::FFTJetInterface
virtual ~FFTJetInterface ()
 

Protected Types

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

Protected Member Functions

void beginJob ()
 
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 endJob ()
 
void produce (edm::Event &, const edm::EventSetup &)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 
- 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::auto_ptr< MyFFTEngineanotherEngine
 
ClusteringTreeclusteringTree
 
const double completeEventDataCutoff
 
std::auto_ptr
< fftjet::AbsConvolverBase
< Real > > 
convolver
 
std::auto_ptr
< fftjet::AbsDistanceCalculator
< fftjet::Peak > > 
distanceCalc
 
std::auto_ptr< MyFFTEngineengine
 
std::auto_ptr
< fftjet::AbsFrequencyKernel1d > 
etaKernel
 
std::auto_ptr
< fftjet::AbsFrequencyKernel > 
kernel2d
 
const bool makeClusteringTree
 
std::auto_ptr
< fftjet::Functor1< bool,
fftjet::Peak > > 
peakSelector
 
std::auto_ptr
< fftjet::AbsFrequencyKernel1d > 
phiKernel
 
std::auto_ptr< Sequencersequencer
 
SparseTree sparseTree
 
std::auto_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::auto_ptr< fftjet::Grid2d
< fftjetcms::Real > > 
energyFlow
 
const std::vector< double > etaDependentMagnutideFactors
 
std::vector
< fftjetcms::VectorLike
eventData
 
edm::Handle< reco::CandidateViewinputCollection
 
const edm::InputTag inputLabel
 
const JetType jetType
 
const std::string outputLabel
 
const edm::InputTag srcPVs
 

Private Member Functions

 FFTJetPatRecoProducer ()
 
 FFTJetPatRecoProducer (const FFTJetPatRecoProducer &)
 
FFTJetPatRecoProduceroperator= (const FFTJetPatRecoProducer &)
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from fftjetcms::FFTJetInterface
enum  JetType {
  BASICJET = 0, GENJET, CALOJET, PFJET,
  TRACKJET, JPTJET
}
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from fftjetcms::FFTJetInterface
static JetType parse_jet_type (const std::string &name)
 

Detailed Description

Description: Runs FFTJet pattern recognition stage and saves the results

Implementation: [Notes on implementation]

Definition at line 67 of file FFTJetPatRecoProducer.cc.

Member Typedef Documentation

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

Definition at line 75 of file FFTJetPatRecoProducer.cc.

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

Definition at line 77 of file FFTJetPatRecoProducer.cc.

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

Definition at line 76 of file FFTJetPatRecoProducer.cc.

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

Definition at line 78 of file FFTJetPatRecoProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 156 of file FFTJetPatRecoProducer.cc.

References buildKernelConvolver(), buildPeakFinder(), fftjetcms::FFTJetInterface::checkConfig(), clusteringTree, convolver, fwrapper::cs, distanceCalc, fftjetcms::FFTJetInterface::energyFlow, edm::hlt::Exception, 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(), i, makeClusteringTree, dbtoconf::out, fftjetcms::FFTJetInterface::outputLabel, peakSelector, sequencer, sparsifier, storeDiscretizationGrid, storeGridsExternally, and fftjetcms::FFTJetInterface::storeInSinglePrecision().

157  : FFTJetInterface(ps),
158  clusteringTree(0),
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")),
164  extGrid(0)
165 {
166  // register your products
167  if (makeClusteringTree)
168  {
170  produces<reco::PattRecoTree<float,reco::PattRecoPeak<float> > >(outputLabel);
171  else
172  produces<reco::PattRecoTree<double,reco::PattRecoPeak<double> > >(outputLabel);
173  }
175  produces<reco::DiscretizedEnergyFlow>(outputLabel);
176 
177  // Check if we want to write the grids into an external file
178  const std::string externalGridFile(ps.getParameter<std::string>("externalGridFile"));
179  storeGridsExternally = externalGridFile.size() > 0;
181  {
182  externalGridStream.open(externalGridFile.c_str(), std::ios_base::out |
183  std::ios_base::binary);
184  if (!externalGridStream.is_open())
185  throw cms::Exception("FFTJetBadConfig")
186  << "FFTJetPatRecoProducer failed to open file "
187  << externalGridFile << std::endl;
188  }
189 
191  {
192  throw cms::Exception("FFTJetBadConfig")
193  << "FFTJetPatRecoProducer is not configured to produce anything"
194  << std::endl;
195  }
196 
197  // now do whatever other initialization is needed
198 
199  // Build the discretization grid
201  ps.getParameter<edm::ParameterSet>("GridConfiguration"));
202  checkConfig(energyFlow, "invalid discretization grid");
203 
204  // Build the FFT engine(s), pattern recognition kernel(s),
205  // and the kernel convolver
207 
208  // Build the peak selector
210  ps.getParameter<edm::ParameterSet>("PeakSelectorConfiguration"));
211  checkConfig(peakSelector, "invalid peak selector");
212 
213  // Build the initial set of pattern recognition scales
214  std::auto_ptr<std::vector<double> > iniScales = fftjet_ScaleSet_parser(
215  ps.getParameter<edm::ParameterSet>("InitialScales"));
216  checkConfig(iniScales, "invalid set of scales");
217 
218  // Do we want to use the adaptive clustering tree algorithm?
219  const unsigned maxAdaptiveScales =
220  ps.getParameter<unsigned>("maxAdaptiveScales");
221  const double minAdaptiveRatioLog =
222  ps.getParameter<double>("minAdaptiveRatioLog");
223  if (minAdaptiveRatioLog <= 0.0)
224  throw cms::Exception("FFTJetBadConfig")
225  << "bad adaptive ratio logarithm limit" << std::endl;
226 
227  // Make sure that all standard scales are larger than the
228  // complete event scale
229  if (getEventScale() > 0.0)
230  {
231  const double cs = getEventScale();
232  const unsigned nscales = iniScales->size();
233  for (unsigned i=0; i<nscales; ++i)
234  if (cs >= (*iniScales)[i])
235  throw cms::Exception("FFTJetBadConfig")
236  << "incompatible scale for complete event" << std::endl;
237  }
238 
239  // At this point we are ready to build the clustering sequencer
240  sequencer = std::auto_ptr<Sequencer>(new Sequencer(
241  convolver.get(), peakSelector.get(), buildPeakFinder(ps),
242  *iniScales, maxAdaptiveScales, minAdaptiveRatioLog));
243 
244  // Build the clustering tree sparsifier
245  const edm::ParameterSet& SparsifierConfiguration(
246  ps.getParameter<edm::ParameterSet>("SparsifierConfiguration"));
248  SparsifierConfiguration);
249  checkConfig(sparsifier, "invalid sparsifier parameters");
250 
251  // Build the distance calculator for the clustering tree
252  const edm::ParameterSet& TreeDistanceCalculator(
253  ps.getParameter<edm::ParameterSet>("TreeDistanceCalculator"));
254  distanceCalc = fftjet_DistanceCalculator_parser(TreeDistanceCalculator);
255  checkConfig(distanceCalc, "invalid tree distance calculator");
256 
257  // Build the clustering tree itself
259 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
std::auto_ptr< fftjet::Functor1< bool, fftjet::Peak > > peakSelector
std::auto_ptr< fftjet::Grid2d< fftjetcms::Real > > energyFlow
auto_ptr< ClusterSequence > cs
std::auto_ptr< fftjet::Grid2d< Real > > fftjet_Grid2d_parser(const edm::ParameterSet &ps)
void buildKernelConvolver(const edm::ParameterSet &)
void checkConfig(const Ptr &ptr, const char *message)
std::auto_ptr< fftjet::Functor1< bool, fftjet::Peak > > fftjet_PeakSelector_parser(const edm::ParameterSet &ps)
ClusteringTree * clusteringTree
fftjet::ClusteringSequencer< Real > Sequencer
std::auto_ptr< Sparsifier > sparsifier
std::auto_ptr< fftjet::AbsDistanceCalculator< fftjet::Peak > > distanceCalc
bool storeInSinglePrecision() const
tuple out
Definition: dbtoconf.py:99
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::ProximityClusteringTree< fftjet::Peak, long > ClusteringTree
fftjet::Grid2d< float > * extGrid
const std::string outputLabel
std::auto_ptr< std::vector< double > > fftjet_ScaleSet_parser(const edm::ParameterSet &ps)
FFTJetPatRecoProducer::~FFTJetPatRecoProducer ( )

Definition at line 360 of file FFTJetPatRecoProducer.cc.

References clusteringTree, and extGrid.

361 {
362  // do anything here that needs to be done at desctruction time
363  // (e.g. close files, deallocate resources etc.)
364  delete clusteringTree;
365  delete extGrid;
366 }
ClusteringTree * clusteringTree
fftjet::Grid2d< float > * extGrid
FFTJetPatRecoProducer::FFTJetPatRecoProducer ( )
private
FFTJetPatRecoProducer::FFTJetPatRecoProducer ( const FFTJetPatRecoProducer )
private

Member Function Documentation

void FFTJetPatRecoProducer::beginJob ( void  )
protectedvirtual

Reimplemented from edm::EDProducer.

Definition at line 501 of file FFTJetPatRecoProducer.cc.

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

Definition at line 400 of file FFTJetPatRecoProducer.cc.

References CastorDataFrameFilter_impl::check(), clusteringTree, fftjetcms::densePeakTreeFromStorable(), fftjetcms::densePeakTreeToStorable(), distanceCalc, edm::hlt::Exception, fftjetcms::FFTJetInterface::getEventScale(), fftjetcms::FFTJetInterface::outputLabel, edm::Event::put(), sequencer, fftjetcms::FFTJetInterface::storeInSinglePrecision(), MainPageGenerator::tree, and verifyDataConversion.

401 {
403 
404  std::auto_ptr<StoredTree> tree(new StoredTree());
405 
407  sequencer->maxAdaptiveScales(),
408  tree.get());
409 
410  // Check that we can restore the tree
412  {
414  const std::vector<double>& scalesUsed(sequencer->getInitialScales());
416  if (*clusteringTree != check)
417  throw cms::Exception("FFTJetInterface")
418  << "Data conversion failed for dense clustering tree"
419  << std::endl;
420  }
421 
422  ev.put(tree, outputLabel);
423 }
Class for storing FFTJet sparse clustering trees.
Definition: PattRecoTree.h:19
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
ClusteringTree * clusteringTree
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)
void densePeakTreeFromStorable(const reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > &in, const std::vector< double > *scaleSetIfNotAdaptive, double completeEventScale, fftjet::AbsClusteringTree< fftjet::Peak, long > *out)
std::auto_ptr< Sequencer > sequencer
fftjet::ProximityClusteringTree< fftjet::Peak, long > ClusteringTree
const std::string outputLabel
void FFTJetPatRecoProducer::buildKernelConvolver ( const edm::ParameterSet ps)
protected

Definition at line 262 of file FFTJetPatRecoProducer.cc.

References anotherEngine, convolver, fftjetcms::FFTJetInterface::energyFlow, engine, etaKernel, edm::hlt::Exception, edm::ParameterSet::getParameter(), kernel2d, M_PI, and phiKernel.

Referenced by FFTJetPatRecoProducer().

263 {
264  // Check the parameter named "etaDependentScaleFactors". If the vector
265  // of scales is empty we will use 2d kernel, otherwise use 1d kernels
266  const std::vector<double> etaDependentScaleFactors(
267  ps.getParameter<std::vector<double> >("etaDependentScaleFactors"));
268 
269  // Make sure that the number of scale factors provided is correct
270  const bool use2dKernel = etaDependentScaleFactors.empty();
271  if (!use2dKernel)
272  if (etaDependentScaleFactors.size() != energyFlow->nEta())
273  throw cms::Exception("FFTJetBadConfig")
274  << "invalid number of eta-dependent scale factors"
275  << std::endl;
276 
277  // Get the eta and phi scales for the kernel(s)
278  double kernelEtaScale = ps.getParameter<double>("kernelEtaScale");
279  const double kernelPhiScale = ps.getParameter<double>("kernelPhiScale");
280  if (kernelEtaScale <= 0.0 || kernelPhiScale <= 0.0)
281  throw cms::Exception("FFTJetBadConfig")
282  << "invalid kernel scale" << std::endl;
283 
284  // FFT assumes that the grid extent in eta is 2*Pi. Adjust the
285  // kernel scale in eta to compensate.
286  kernelEtaScale *= (2.0*M_PI/(energyFlow->etaMax() - energyFlow->etaMin()));
287 
288  // Are we going to try to fix the efficiency near detector edges?
289  const bool fixEfficiency = ps.getParameter<bool>("fixEfficiency");
290 
291  // Minimum and maximum eta bin for the convolver
292  unsigned convolverMinBin = 0, convolverMaxBin = 0;
293  if (fixEfficiency || !use2dKernel)
294  {
295  convolverMinBin = ps.getParameter<unsigned>("convolverMinBin");
296  convolverMaxBin = ps.getParameter<unsigned>("convolverMaxBin");
297  }
298 
299  if (use2dKernel)
300  {
301  // Build the FFT engine
302  engine = std::auto_ptr<MyFFTEngine>(
303  new MyFFTEngine(energyFlow->nEta(), energyFlow->nPhi()));
304 
305  // 2d kernel
306  kernel2d = std::auto_ptr<fftjet::AbsFrequencyKernel>(
307  new fftjet::DiscreteGauss2d(
308  kernelEtaScale, kernelPhiScale,
309  energyFlow->nEta(), energyFlow->nPhi()));
310 
311  // 2d convolver
312  convolver = std::auto_ptr<fftjet::AbsConvolverBase<Real> >(
313  new fftjet::FrequencyKernelConvolver<Real,Complex>(
314  engine.get(), kernel2d.get(),
315  convolverMinBin, convolverMaxBin));
316  }
317  else
318  {
319  // Need separate FFT engines for eta and phi
320  engine = std::auto_ptr<MyFFTEngine>(
321  new MyFFTEngine(1, energyFlow->nEta()));
322  anotherEngine = std::auto_ptr<MyFFTEngine>(
323  new MyFFTEngine(1, energyFlow->nPhi()));
324 
325  // 1d kernels
326  etaKernel = std::auto_ptr<fftjet::AbsFrequencyKernel1d>(
327  new fftjet::DiscreteGauss1d(kernelEtaScale, energyFlow->nEta()));
328 
329  phiKernel = std::auto_ptr<fftjet::AbsFrequencyKernel1d>(
330  new fftjet::DiscreteGauss1d(kernelPhiScale, energyFlow->nPhi()));
331 
332  // Sequential convolver
333  convolver = std::auto_ptr<fftjet::AbsConvolverBase<Real> >(
334  new fftjet::FrequencySequentialConvolver<Real,Complex>(
335  engine.get(), anotherEngine.get(),
336  etaKernel.get(), phiKernel.get(),
337  etaDependentScaleFactors, convolverMinBin,
338  convolverMaxBin, fixEfficiency));
339  }
340 }
T getParameter(std::string const &) const
std::auto_ptr< fftjet::Grid2d< fftjetcms::Real > > energyFlow
std::auto_ptr< fftjet::AbsFrequencyKernel1d > phiKernel
std::auto_ptr< MyFFTEngine > anotherEngine
std::auto_ptr< fftjet::AbsFrequencyKernel > kernel2d
std::auto_ptr< MyFFTEngine > engine
#define M_PI
Definition: BFit3D.cc:3
std::auto_ptr< fftjet::AbsFrequencyKernel1d > etaKernel
std::auto_ptr< fftjet::AbsConvolverBase< Real > > convolver
fftjet::FFTWDoubleEngine MyFFTEngine
fftjet::PeakFinder FFTJetPatRecoProducer::buildPeakFinder ( const edm::ParameterSet ps)
protected

Definition at line 343 of file FFTJetPatRecoProducer.cc.

References fftjetcms::FFTJetInterface::energyFlow, edm::hlt::Exception, and edm::ParameterSet::getParameter().

Referenced by FFTJetPatRecoProducer().

344 {
345  const double peakFinderMaxEta = ps.getParameter<double>("peakFinderMaxEta");
346  if (peakFinderMaxEta <= 0.0)
347  throw cms::Exception("FFTJetBadConfig")
348  << "invalid peak finder eta cut" << std::endl;
349  const double maxMagnitude = ps.getParameter<double>("peakFinderMaxMagnitude");
350  int minBin = energyFlow->getEtaBin(-peakFinderMaxEta);
351  if (minBin < 0)
352  minBin = 0;
353  int maxBin = energyFlow->getEtaBin(peakFinderMaxEta) + 1;
354  if (maxBin < 0)
355  maxBin = 0;
356  return fftjet::PeakFinder(maxMagnitude, true, minBin, maxBin);
357 }
T getParameter(std::string const &) const
std::auto_ptr< fftjet::Grid2d< fftjetcms::Real > > energyFlow
template<class Real >
void FFTJetPatRecoProducer::buildSparseProduct ( edm::Event ev) const
protected

Definition at line 373 of file FFTJetPatRecoProducer.cc.

References CastorDataFrameFilter_impl::check(), edm::hlt::Exception, fftjetcms::FFTJetInterface::getEventScale(), fftjetcms::FFTJetInterface::outputLabel, edm::Event::put(), sequencer, fftjetcms::sparsePeakTreeFromStorable(), fftjetcms::sparsePeakTreeToStorable(), sparseTree, fftjetcms::FFTJetInterface::storeInSinglePrecision(), MainPageGenerator::tree, and verifyDataConversion.

374 {
376 
377  std::auto_ptr<StoredTree> tree(new StoredTree());
378 
380  sequencer->maxAdaptiveScales(),
381  tree.get());
382 
383  // Check that we can restore the tree
385  {
387  const std::vector<double>& scalesUsed(sequencer->getInitialScales());
388  sparsePeakTreeFromStorable(*tree, &scalesUsed, getEventScale(), &check);
389  if (sparseTree != check)
390  throw cms::Exception("FFTJetInterface")
391  << "Data conversion failed for sparse clustering tree"
392  << std::endl;
393  }
394 
395  ev.put(tree, outputLabel);
396 }
Class for storing FFTJet sparse clustering trees.
Definition: PattRecoTree.h:19
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
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)
bool storeInSinglePrecision() const
void sparsePeakTreeFromStorable(const reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > &in, const std::vector< double > *scaleSetIfNotAdaptive, double completeEventScale, fftjet::SparseClusteringTree< fftjet::Peak, long > *out)
std::auto_ptr< Sequencer > sequencer
fftjet::SparseClusteringTree< fftjet::Peak, long > SparseTree
const std::string outputLabel
void FFTJetPatRecoProducer::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDProducer.

Definition at line 507 of file FFTJetPatRecoProducer.cc.

References externalGridStream, and storeGridsExternally.

508 {
510  externalGridStream.close();
511 }
FFTJetPatRecoProducer& FFTJetPatRecoProducer::operator= ( const FFTJetPatRecoProducer )
private
void FFTJetPatRecoProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
protectedvirtual

Implements edm::EDProducer.

Definition at line 427 of file FFTJetPatRecoProducer.cc.

References CastorDataFrameFilter_impl::check(), clusteringTree, completeEventDataCutoff, fftjetcms::convert_Grid2d_to_float(), fftjetcms::copy_Grid2d_data(), fftjetcms::FFTJetInterface::discretizeEnergyFlow(), fftjetcms::FFTJetInterface::energyFlow, edm::hlt::Exception, externalGridStream, extGrid, g, fftjetcms::FFTJetInterface::getEventScale(), iEvent, fftjetcms::FFTJetInterface::loadInputCollection(), makeClusteringTree, fftjetcms::FFTJetInterface::outputLabel, edm::Event::put(), sequencer, sparseTree, sparsifier, sparsify, storeDiscretizationGrid, storeGridsExternally, fftjetcms::FFTJetInterface::storeInSinglePrecision(), and verifyDataConversion.

429 {
430  loadInputCollection(iEvent);
432 
433  if (makeClusteringTree)
434  {
436  if (getEventScale() > 0.0)
437  sequencer->insertCompleteEvent(getEventScale(), *energyFlow,
439 
440  if (sparsify)
441  {
442  sparsifier->sparsify(*clusteringTree, &sparseTree);
443 
444  // Do not call the "sortNodes" method of the sparse tree here.
445  // Currently, the nodes are sorted by daughter number.
446  // This is the way we want it in storage because the stored
447  // tree does not include daughter ordering info explicitly.
448 
450  buildSparseProduct<float>(iEvent);
451  else
452  buildSparseProduct<double>(iEvent);
453  }
454  else
455  {
457  buildDenseProduct<float>(iEvent);
458  else
459  buildDenseProduct<double>(iEvent);
460  }
461  }
462 
464  {
465  const fftjet::Grid2d<Real>& g(*energyFlow);
466 
467  std::auto_ptr<reco::DiscretizedEnergyFlow> flow(
469  g.data(), g.title(), g.etaMin(), g.etaMax(),
470  g.phiBin0Edge(), g.nEta(), g.nPhi()));
471 
473  {
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());
478  assert(g == check);
479  }
480 
481  iEvent.put(flow, outputLabel);
482  }
483 
485  {
486  if (extGrid)
488  else
490  if (!extGrid->write(externalGridStream))
491  {
492  throw cms::Exception("FFTJetPatRecoProducer::produce")
493  << "Failed to write grid data into an external file"
494  << std::endl;
495  }
496  }
497 }
fftjet::Grid2d< float > * convert_Grid2d_to_float(const fftjet::Grid2d< Numeric > &grid)
std::auto_ptr< fftjet::Grid2d< fftjetcms::Real > > energyFlow
void loadInputCollection(const edm::Event &)
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
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
ClusteringTree * clusteringTree
std::auto_ptr< Sparsifier > sparsifier
bool storeInSinglePrecision() const
void copy_Grid2d_data(fftjet::Grid2d< F2 > *to, const fftjet::Grid2d< F1 > &from)
std::auto_ptr< Sequencer > sequencer
fftjet::Grid2d< float > * extGrid
const std::string outputLabel

Member Data Documentation

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

Definition at line 105 of file FFTJetPatRecoProducer.cc.

Referenced by buildKernelConvolver().

ClusteringTree* FFTJetPatRecoProducer::clusteringTree
protected
const double FFTJetPatRecoProducer::completeEventDataCutoff
protected

Definition at line 127 of file FFTJetPatRecoProducer.cc.

Referenced by produce().

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

Definition at line 113 of file FFTJetPatRecoProducer.cc.

Referenced by buildKernelConvolver(), and FFTJetPatRecoProducer().

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

Definition at line 119 of file FFTJetPatRecoProducer.cc.

Referenced by buildDenseProduct(), and FFTJetPatRecoProducer().

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

Definition at line 104 of file FFTJetPatRecoProducer.cc.

Referenced by buildKernelConvolver().

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

Definition at line 109 of file FFTJetPatRecoProducer.cc.

Referenced by buildKernelConvolver().

std::ofstream FFTJetPatRecoProducer::externalGridStream
private

Definition at line 148 of file FFTJetPatRecoProducer.cc.

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

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

Definition at line 150 of file FFTJetPatRecoProducer.cc.

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

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

Definition at line 108 of file FFTJetPatRecoProducer.cc.

Referenced by buildKernelConvolver().

const bool FFTJetPatRecoProducer::makeClusteringTree
protected

Definition at line 130 of file FFTJetPatRecoProducer.cc.

Referenced by FFTJetPatRecoProducer(), and produce().

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

Definition at line 116 of file FFTJetPatRecoProducer.cc.

Referenced by FFTJetPatRecoProducer().

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

Definition at line 110 of file FFTJetPatRecoProducer.cc.

Referenced by buildKernelConvolver().

std::auto_ptr<Sequencer> FFTJetPatRecoProducer::sequencer
protected
SparseTree FFTJetPatRecoProducer::sparseTree
protected

Definition at line 122 of file FFTJetPatRecoProducer.cc.

Referenced by buildSparseProduct(), and produce().

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

Definition at line 101 of file FFTJetPatRecoProducer.cc.

Referenced by FFTJetPatRecoProducer(), and produce().

const bool FFTJetPatRecoProducer::sparsify
protected

Definition at line 140 of file FFTJetPatRecoProducer.cc.

Referenced by produce().

const bool FFTJetPatRecoProducer::storeDiscretizationGrid
protected

Definition at line 137 of file FFTJetPatRecoProducer.cc.

Referenced by FFTJetPatRecoProducer(), and produce().

bool FFTJetPatRecoProducer::storeGridsExternally
private

Definition at line 149 of file FFTJetPatRecoProducer.cc.

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

const bool FFTJetPatRecoProducer::verifyDataConversion
protected

Definition at line 134 of file FFTJetPatRecoProducer.cc.

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