CMS 3D CMS Logo

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

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

Inheritance diagram for FFTJetTreeDump:
edm::EDAnalyzer

Public Member Functions

 FFTJetTreeDump (const edm::ParameterSet &)
 
 ~FFTJetTreeDump ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Types

typedef
fftjet::ProximityClusteringTree
< fftjet::Peak, long > 
ClusteringTree
 
typedef fftjet::OpenDXPeakTree
< long,
fftjet::AbsClusteringTree > 
DXFormatter
 
typedef fftjet::Functor1
< double, fftjet::Peak > 
PeakProperty
 
typedef fftjet::OpenDXPeakTree
< long,
fftjet::SparseClusteringTree > 
SparseFormatter
 
typedef
fftjet::SparseClusteringTree
< fftjet::Peak, long > 
SparseTree
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
template<class Ptr >
void checkConfig (const Ptr &ptr, const char *message)
 
virtual void endJob ()
 
 FFTJetTreeDump ()
 
 FFTJetTreeDump (const FFTJetTreeDump &)
 
FFTJetTreeDumpoperator= (const FFTJetTreeDump &)
 
template<class Real >
void processTreeData (const edm::Event &, std::ofstream &)
 

Private Attributes

ClusteringTreeclusteringTree
 
const double completeEventScale
 
unsigned counter
 
std::auto_ptr< DXFormatterdenseFormatter
 
std::auto_ptr
< fftjet::AbsDistanceCalculator
< fftjet::Peak > > 
distanceCalc
 
const double etaMax
 
std::auto_ptr< PeakPropertyglyphColor
 
std::auto_ptr< PeakPropertyglyphSize
 
std::auto_ptr< std::vector
< double > > 
iniScales
 
const bool insertCompleteEvent
 
const std::string outputPrefix
 
std::auto_ptr< SparseFormattersparseFormatter
 
SparseTree sparseTree
 
const bool storeInSinglePrecision
 
const edm::InputTag treeLabel
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Description: formats FFTJet clustering trees for subsequent visualization by OpenDX

Implementation: [Notes on implementation]

Definition at line 49 of file FFTJetTreeDump.cc.

Member Typedef Documentation

typedef fftjet::ProximityClusteringTree<fftjet::Peak,long> FFTJetTreeDump::ClusteringTree
private

Definition at line 57 of file FFTJetTreeDump.cc.

typedef fftjet::OpenDXPeakTree<long,fftjet::AbsClusteringTree> FFTJetTreeDump::DXFormatter
private

Definition at line 59 of file FFTJetTreeDump.cc.

typedef fftjet::Functor1<double,fftjet::Peak> FFTJetTreeDump::PeakProperty
private

Definition at line 61 of file FFTJetTreeDump.cc.

typedef fftjet::OpenDXPeakTree<long,fftjet::SparseClusteringTree> FFTJetTreeDump::SparseFormatter
private

Definition at line 60 of file FFTJetTreeDump.cc.

typedef fftjet::SparseClusteringTree<fftjet::Peak,long> FFTJetTreeDump::SparseTree
private

Definition at line 58 of file FFTJetTreeDump.cc.

Constructor & Destructor Documentation

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

Definition at line 115 of file FFTJetTreeDump.cc.

References checkConfig(), clusteringTree, denseFormatter, distanceCalc, etaMax, edm::hlt::Exception, fftjetcms::fftjet_DistanceCalculator_parser(), fftjetcms::fftjet_PeakFunctor_parser(), fftjetcms::fftjet_ScaleSet_parser(), edm::ParameterSet::getParameter(), glyphColor, glyphSize, iniScales, python.multivaluedict::sort(), and sparseFormatter.

116  : clusteringTree(0),
117  treeLabel(ps.getParameter<edm::InputTag>("treeLabel")),
118  outputPrefix(ps.getParameter<std::string>("outputPrefix")),
119  etaMax(ps.getParameter<double>("etaMax")),
121  insertCompleteEvent(ps.getParameter<bool>("insertCompleteEvent")),
122  completeEventScale(ps.getParameter<double>("completeEventScale")),
123  counter(0)
124 {
125  if (etaMax < 0.0)
126  throw cms::Exception("FFTJetBadConfig")
127  << "etaMax can not be negative" << std::endl;
128 
129  // Build the set of pattern recognition scales
130  const edm::ParameterSet& InitialScales(
131  ps.getParameter<edm::ParameterSet>("InitialScales"));
132  iniScales = fftjet_ScaleSet_parser(InitialScales);
133  checkConfig(iniScales, "invalid set of scales");
134  std::sort(iniScales->begin(), iniScales->end(), std::greater<double>());
135 
136  // Distance calculator for the clustering tree
137  const edm::ParameterSet& TreeDistanceCalculator(
138  ps.getParameter<edm::ParameterSet>("TreeDistanceCalculator"));
139  distanceCalc = fftjet_DistanceCalculator_parser(TreeDistanceCalculator);
140  checkConfig(distanceCalc, "invalid tree distance calculator");
141 
142  // Determine representations for the OpenDX glyph size and color
143  const edm::ParameterSet& GlyphSize(
144  ps.getParameter<edm::ParameterSet>("GlyphSize"));
146  checkConfig(glyphSize, "invalid glyph size parameters");
147 
148  const edm::ParameterSet& GlyphColor(
149  ps.getParameter<edm::ParameterSet>("GlyphColor"));
151  checkConfig(glyphColor, "invalid glyph color parameters");
152 
153  // Build the tree formatters
154  denseFormatter = std::auto_ptr<DXFormatter>(new DXFormatter(
155  glyphSize.get(), glyphColor.get(), etaMax));
156  sparseFormatter = std::auto_ptr<SparseFormatter>(new SparseFormatter(
157  glyphSize.get(), glyphColor.get(), etaMax));
158 
159  // Build the clustering tree
161 }
fftjet::OpenDXPeakTree< long, fftjet::AbsClusteringTree > DXFormatter
std::auto_ptr< PeakProperty > glyphSize
T getParameter(std::string const &) const
std::auto_ptr< SparseFormatter > sparseFormatter
const edm::InputTag treeLabel
void checkConfig(const Ptr &ptr, const char *message)
const double etaMax
std::auto_ptr< std::vector< double > > iniScales
std::auto_ptr< DXFormatter > denseFormatter
ClusteringTree * clusteringTree
fftjet::ProximityClusteringTree< fftjet::Peak, long > ClusteringTree
std::auto_ptr< fftjet::AbsDistanceCalculator< fftjet::Peak > > distanceCalc
const bool storeInSinglePrecision
std::auto_ptr< PeakProperty > glyphColor
const std::string outputPrefix
fftjet::OpenDXPeakTree< long, fftjet::SparseClusteringTree > SparseFormatter
std::auto_ptr< fftjet::Functor1< double, fftjet::Peak > > fftjet_PeakFunctor_parser(const edm::ParameterSet &ps)
const double completeEventScale
std::auto_ptr< fftjet::AbsDistanceCalculator< fftjet::Peak > > fftjet_DistanceCalculator_parser(const edm::ParameterSet &ps)
const bool insertCompleteEvent
std::auto_ptr< std::vector< double > > fftjet_ScaleSet_parser(const edm::ParameterSet &ps)
FFTJetTreeDump::~FFTJetTreeDump ( )

Definition at line 164 of file FFTJetTreeDump.cc.

References clusteringTree.

165 {
166  delete clusteringTree;
167 }
ClusteringTree * clusteringTree
FFTJetTreeDump::FFTJetTreeDump ( )
private
FFTJetTreeDump::FFTJetTreeDump ( const FFTJetTreeDump )
private

Member Function Documentation

void FFTJetTreeDump::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 206 of file FFTJetTreeDump.cc.

References counter, edm::hlt::Exception, mergeVDriftHistosByStation::file, lut2db_cfg::filename, iEvent, outputPrefix, and storeInSinglePrecision.

208 {
209  // Create the file name
210  std::ostringstream filename;
211  filename << outputPrefix << '_' << counter++ << ".dx";
212 
213  // Open the file
214  std::ofstream file(filename.str().c_str());
215  if (!file)
216  throw cms::Exception("FFTJetBadConfig")
217  << "Failed to open file \""
218  << filename.str() << "\"" << std::endl;
219 
221  processTreeData<float>(iEvent, file);
222  else
223  processTreeData<double>(iEvent, file);
224 }
int iEvent
Definition: GenABIO.cc:243
const bool storeInSinglePrecision
const std::string outputPrefix
tuple filename
Definition: lut2db_cfg.py:20
void FFTJetTreeDump::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 228 of file FFTJetTreeDump.cc.

229 {
230 }
template<class Ptr >
void FFTJetTreeDump::checkConfig ( const Ptr &  ptr,
const char *  message 
)
inlineprivate

Definition at line 75 of file FFTJetTreeDump.cc.

References NULL.

Referenced by FFTJetTreeDump().

76  {
77  if (ptr.get() == NULL)
78  throw cms::Exception("FFTJetBadConfig") << message << std::endl;
79  }
#define NULL
Definition: scimark2.h:8
void FFTJetTreeDump::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 233 of file FFTJetTreeDump.cc.

233  {
234 }
FFTJetTreeDump& FFTJetTreeDump::operator= ( const FFTJetTreeDump )
private
template<class Real >
void FFTJetTreeDump::processTreeData ( const edm::Event iEvent,
std::ofstream &  file 
)
private

Definition at line 174 of file FFTJetTreeDump.cc.

References clusteringTree, completeEventScale, denseFormatter, fftjetcms::densePeakTreeFromStorable(), edm::EventID::event(), edm::Event::getByLabel(), edm::EventBase::id(), iniScales, LaserDQM_cfg::input, insertCompleteEvent, edm::EventID::run(), sparseFormatter, fftjetcms::sparsePeakTreeFromStorable(), sparseTree, and treeLabel.

176 {
178 
179  // Get the event number
180  const unsigned long runNum = iEvent.id().run();
181  const unsigned long evNum = iEvent.id().event();
182 
183  // Get the input
185  iEvent.getByLabel(treeLabel, input);
186 
187  const double eventScale = insertCompleteEvent ? completeEventScale : 0.0;
188  if (input->isSparse())
189  {
191  eventScale, &sparseTree);
192  sparseFormatter->setTree(sparseTree, runNum, evNum);
193  file << *sparseFormatter << std::endl;
194  }
195  else
196  {
197  densePeakTreeFromStorable(*input, iniScales.get(),
198  eventScale, clusteringTree);
199  denseFormatter->setTree(*clusteringTree, runNum, evNum);
200  file << *denseFormatter << std::endl;
201  }
202 }
RunNumber_t run() const
Definition: EventID.h:42
EventNumber_t event() const
Definition: EventID.h:44
Class for storing FFTJet sparse clustering trees.
Definition: PattRecoTree.h:19
std::auto_ptr< SparseFormatter > sparseFormatter
const edm::InputTag treeLabel
SparseTree sparseTree
std::auto_ptr< std::vector< double > > iniScales
std::auto_ptr< DXFormatter > denseFormatter
ClusteringTree * clusteringTree
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
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)
edm::EventID id() const
Definition: EventBase.h:56
const double completeEventScale
const bool insertCompleteEvent

Member Data Documentation

ClusteringTree* FFTJetTreeDump::clusteringTree
private

Definition at line 83 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump(), processTreeData(), and ~FFTJetTreeDump().

const double FFTJetTreeDump::completeEventScale
private

Definition at line 90 of file FFTJetTreeDump.cc.

Referenced by processTreeData().

unsigned FFTJetTreeDump::counter
private

Definition at line 109 of file FFTJetTreeDump.cc.

Referenced by analyze().

std::auto_ptr<DXFormatter> FFTJetTreeDump::denseFormatter
private

Definition at line 106 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump(), and processTreeData().

std::auto_ptr<fftjet::AbsDistanceCalculator<fftjet::Peak> > FFTJetTreeDump::distanceCalc
private

Definition at line 93 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

const double FFTJetTreeDump::etaMax
private

Definition at line 87 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

std::auto_ptr<PeakProperty> FFTJetTreeDump::glyphColor
private

Definition at line 103 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

std::auto_ptr<PeakProperty> FFTJetTreeDump::glyphSize
private

Definition at line 102 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

std::auto_ptr<std::vector<double> > FFTJetTreeDump::iniScales
private

Definition at line 96 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump(), and processTreeData().

const bool FFTJetTreeDump::insertCompleteEvent
private

Definition at line 89 of file FFTJetTreeDump.cc.

Referenced by processTreeData().

const std::string FFTJetTreeDump::outputPrefix
private

Definition at line 86 of file FFTJetTreeDump.cc.

Referenced by analyze().

std::auto_ptr<SparseFormatter> FFTJetTreeDump::sparseFormatter
private

Definition at line 107 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump(), and processTreeData().

SparseTree FFTJetTreeDump::sparseTree
private

Definition at line 99 of file FFTJetTreeDump.cc.

Referenced by processTreeData().

const bool FFTJetTreeDump::storeInSinglePrecision
private

Definition at line 88 of file FFTJetTreeDump.cc.

Referenced by analyze().

const edm::InputTag FFTJetTreeDump::treeLabel
private

Definition at line 85 of file FFTJetTreeDump.cc.

Referenced by processTreeData().