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 edm::EDConsumerBase

Public Member Functions

 FFTJetTreeDump (const edm::ParameterSet &)
 
 ~FFTJetTreeDump ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
 
typedef reco::PattRecoTree
< Real, reco::PattRecoPeak
< Real > > 
StoredTree
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob () override
 
template<class Ptr >
void checkConfig (const Ptr &ptr, const char *message)
 
virtual void endJob () override
 
 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
 
edm::EDGetTokenT< StoredTreetreeToken
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: formats FFTJet clustering trees for subsequent visualization by OpenDX

Implementation: [Notes on implementation]

Definition at line 50 of file FFTJetTreeDump.cc.

Member Typedef Documentation

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

Definition at line 58 of file FFTJetTreeDump.cc.

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

Definition at line 60 of file FFTJetTreeDump.cc.

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

Definition at line 62 of file FFTJetTreeDump.cc.

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

Definition at line 61 of file FFTJetTreeDump.cc.

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

Definition at line 59 of file FFTJetTreeDump.cc.

Definition at line 63 of file FFTJetTreeDump.cc.

Constructor & Destructor Documentation

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

Definition at line 119 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(), sparseFormatter, treeLabel, and treeToken.

120  : clusteringTree(0),
121  treeLabel(ps.getParameter<edm::InputTag>("treeLabel")),
122  outputPrefix(ps.getParameter<std::string>("outputPrefix")),
123  etaMax(ps.getParameter<double>("etaMax")),
125  insertCompleteEvent(ps.getParameter<bool>("insertCompleteEvent")),
126  completeEventScale(ps.getParameter<double>("completeEventScale")),
127  counter(0)
128 {
129  if (etaMax < 0.0)
130  throw cms::Exception("FFTJetBadConfig")
131  << "etaMax can not be negative" << std::endl;
132 
133  // Build the set of pattern recognition scales
134  const edm::ParameterSet& InitialScales(
135  ps.getParameter<edm::ParameterSet>("InitialScales"));
136  iniScales = fftjet_ScaleSet_parser(InitialScales);
137  checkConfig(iniScales, "invalid set of scales");
138  std::sort(iniScales->begin(), iniScales->end(), std::greater<double>());
139 
140  // Distance calculator for the clustering tree
141  const edm::ParameterSet& TreeDistanceCalculator(
142  ps.getParameter<edm::ParameterSet>("TreeDistanceCalculator"));
143  distanceCalc = fftjet_DistanceCalculator_parser(TreeDistanceCalculator);
144  checkConfig(distanceCalc, "invalid tree distance calculator");
145 
146  // Determine representations for the OpenDX glyph size and color
147  const edm::ParameterSet& GlyphSize(
148  ps.getParameter<edm::ParameterSet>("GlyphSize"));
150  checkConfig(glyphSize, "invalid glyph size parameters");
151 
152  const edm::ParameterSet& GlyphColor(
153  ps.getParameter<edm::ParameterSet>("GlyphColor"));
155  checkConfig(glyphColor, "invalid glyph color parameters");
156 
157  // Build the tree formatters
158  denseFormatter = std::auto_ptr<DXFormatter>(new DXFormatter(
159  glyphSize.get(), glyphColor.get(), etaMax));
160  sparseFormatter = std::auto_ptr<SparseFormatter>(new SparseFormatter(
161  glyphSize.get(), glyphColor.get(), etaMax));
162 
163  // Build the clustering tree
165 
166  treeToken = consumes<StoredTree>(treeLabel);
167 }
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
edm::EDGetTokenT< StoredTree > treeToken
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 170 of file FFTJetTreeDump.cc.

References clusteringTree.

171 {
172  delete clusteringTree;
173 }
ClusteringTree * clusteringTree
FFTJetTreeDump::FFTJetTreeDump ( )
private
FFTJetTreeDump::FFTJetTreeDump ( const FFTJetTreeDump )
private

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 210 of file FFTJetTreeDump.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 232 of file FFTJetTreeDump.cc.

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

Definition at line 77 of file FFTJetTreeDump.cc.

References NULL.

Referenced by FFTJetTreeDump().

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

Reimplemented from edm::EDAnalyzer.

Definition at line 237 of file FFTJetTreeDump.cc.

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

Definition at line 180 of file FFTJetTreeDump.cc.

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

182 {
183  // Get the event number
184  edm::RunNumber_t const runNum = iEvent.id().run();
185  edm::EventNumber_t const evNum = iEvent.id().event();
186 
187  // Get the input
189  iEvent.getByToken(treeToken, input);
190 
191  const double eventScale = insertCompleteEvent ? completeEventScale : 0.0;
192  if (input->isSparse())
193  {
195  eventScale, &sparseTree);
196  sparseFormatter->setTree(sparseTree, runNum, evNum);
197  file << *sparseFormatter << std::endl;
198  }
199  else
200  {
201  densePeakTreeFromStorable(*input, iniScales.get(),
202  eventScale, clusteringTree);
203  denseFormatter->setTree(*clusteringTree, runNum, evNum);
204  file << *denseFormatter << std::endl;
205  }
206 }
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
std::auto_ptr< SparseFormatter > sparseFormatter
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
SparseTree sparseTree
unsigned long long EventNumber_t
edm::EDGetTokenT< StoredTree > treeToken
static std::string const input
Definition: EdmProvDump.cc:43
std::auto_ptr< std::vector< double > > iniScales
std::auto_ptr< DXFormatter > denseFormatter
ClusteringTree * clusteringTree
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:60
const double completeEventScale
const bool insertCompleteEvent
unsigned int RunNumber_t

Member Data Documentation

ClusteringTree* FFTJetTreeDump::clusteringTree
private

Definition at line 85 of file FFTJetTreeDump.cc.

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

const double FFTJetTreeDump::completeEventScale
private

Definition at line 94 of file FFTJetTreeDump.cc.

Referenced by processTreeData().

unsigned FFTJetTreeDump::counter
private

Definition at line 113 of file FFTJetTreeDump.cc.

Referenced by counter.Counters::__getitem__(), and analyze().

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

Definition at line 110 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump(), and processTreeData().

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

Definition at line 97 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

const double FFTJetTreeDump::etaMax
private

Definition at line 91 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

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

Definition at line 107 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

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

Definition at line 106 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

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

Definition at line 100 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump(), and processTreeData().

const bool FFTJetTreeDump::insertCompleteEvent
private

Definition at line 93 of file FFTJetTreeDump.cc.

Referenced by processTreeData().

const std::string FFTJetTreeDump::outputPrefix
private

Definition at line 90 of file FFTJetTreeDump.cc.

Referenced by analyze().

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

Definition at line 111 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump(), and processTreeData().

SparseTree FFTJetTreeDump::sparseTree
private

Definition at line 103 of file FFTJetTreeDump.cc.

Referenced by processTreeData().

const bool FFTJetTreeDump::storeInSinglePrecision
private

Definition at line 92 of file FFTJetTreeDump.cc.

Referenced by analyze().

const edm::InputTag FFTJetTreeDump::treeLabel
private

Definition at line 87 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

edm::EDGetTokenT<StoredTree> FFTJetTreeDump::treeToken
private

Definition at line 88 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump(), and processTreeData().