CMS 3D CMS Logo

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 () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

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

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

Private Attributes

ClusteringTreeclusteringTree
 
const double completeEventScale
 
unsigned counter
 
std::unique_ptr< DXFormatterdenseFormatter
 
std::unique_ptr< fftjet::AbsDistanceCalculator< fftjet::Peak > > distanceCalc
 
const double etaMax
 
std::unique_ptr< PeakPropertyglyphColor
 
std::unique_ptr< PeakPropertyglyphSize
 
std::unique_ptr< std::vector< double > > iniScales
 
const bool insertCompleteEvent
 
const std::string outputPrefix
 
std::unique_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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Description: formats FFTJet clustering trees for subsequent visualization by OpenDX

Implementation: [Notes on implementation]

Definition at line 52 of file FFTJetTreeDump.cc.

Member Typedef Documentation

◆ ClusteringTree

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

Definition at line 59 of file FFTJetTreeDump.cc.

◆ DXFormatter

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

Definition at line 61 of file FFTJetTreeDump.cc.

◆ PeakProperty

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

Definition at line 63 of file FFTJetTreeDump.cc.

◆ SparseFormatter

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

Definition at line 62 of file FFTJetTreeDump.cc.

◆ SparseTree

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

Definition at line 60 of file FFTJetTreeDump.cc.

◆ StoredTree

Definition at line 64 of file FFTJetTreeDump.cc.

Constructor & Destructor Documentation

◆ FFTJetTreeDump() [1/3]

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

Definition at line 119 of file FFTJetTreeDump.cc.

120  : clusteringTree(nullptr),
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  if (etaMax < 0.0)
129  throw cms::Exception("FFTJetBadConfig") << "etaMax can not be negative" << std::endl;
130 
131  // Build the set of pattern recognition scales
132  const edm::ParameterSet& InitialScales(ps.getParameter<edm::ParameterSet>("InitialScales"));
134  checkConfig(iniScales, "invalid set of scales");
135  std::sort(iniScales->begin(), iniScales->end(), std::greater<double>());
136 
137  // Distance calculator for the clustering tree
138  const edm::ParameterSet& TreeDistanceCalculator(ps.getParameter<edm::ParameterSet>("TreeDistanceCalculator"));
140  checkConfig(distanceCalc, "invalid tree distance calculator");
141 
142  // Determine representations for the OpenDX glyph size and color
145  checkConfig(glyphSize, "invalid glyph size parameters");
146 
149  checkConfig(glyphColor, "invalid glyph color parameters");
150 
151  // Build the tree formatters
152  denseFormatter = std::make_unique<DXFormatter>(glyphSize.get(), glyphColor.get(), etaMax);
153  sparseFormatter = std::make_unique<SparseFormatter>(glyphSize.get(), glyphColor.get(), etaMax);
154 
155  // Build the clustering tree
157 
158  treeToken = consumes<StoredTree>(treeLabel);
159 }

References checkConfig(), clusteringTree, denseFormatter, distanceCalc, etaMax, Exception, fftjetcms::fftjet_DistanceCalculator_parser(), fftjetcms::fftjet_PeakFunctor_parser(), fftjetcms::fftjet_ScaleSet_parser(), edm::ParameterSet::getParameter(), fftjettreedump_cfi::GlyphColor, glyphColor, fftjettreedump_cfi::GlyphSize, glyphSize, iniScales, fftjetdijetfilter_cfi::InitialScales, sparseFormatter, fftjetdijetfilter_cfi::TreeDistanceCalculator, treeLabel, and treeToken.

◆ ~FFTJetTreeDump()

FFTJetTreeDump::~FFTJetTreeDump ( )
override

Definition at line 161 of file FFTJetTreeDump.cc.

161 { delete clusteringTree; }

References clusteringTree.

◆ FFTJetTreeDump() [2/3]

FFTJetTreeDump::FFTJetTreeDump ( )
privatedelete

◆ FFTJetTreeDump() [3/3]

FFTJetTreeDump::FFTJetTreeDump ( const FFTJetTreeDump )
privatedelete

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 189 of file FFTJetTreeDump.cc.

189  {
190  // Create the file name
191  std::ostringstream filename;
192  filename << outputPrefix << '_' << counter++ << ".dx";
193 
194  // Open the file
195  std::ofstream file(filename.str().c_str());
196  if (!file)
197  throw cms::Exception("FFTJetBadConfig") << "Failed to open file \"" << filename.str() << "\"" << std::endl;
198 
200  processTreeData<float>(iEvent, file);
201  else
202  processTreeData<double>(iEvent, file);
203 }

References Exception, FrontierConditions_GlobalTag_cff::file, corrVsCorr::filename, iEvent, outputPrefix, and storeInSinglePrecision.

◆ beginJob()

void FFTJetTreeDump::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 206 of file FFTJetTreeDump.cc.

206 {}

◆ checkConfig()

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

Definition at line 78 of file FFTJetTreeDump.cc.

78  {
79  if (ptr.get() == nullptr)
80  throw cms::Exception("FFTJetBadConfig") << message << std::endl;
81  }

Referenced by FFTJetTreeDump().

◆ endJob()

void FFTJetTreeDump::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 209 of file FFTJetTreeDump.cc.

209 {}

◆ operator=()

FFTJetTreeDump& FFTJetTreeDump::operator= ( const FFTJetTreeDump )
privatedelete

◆ processTreeData()

template<class Real >
void FFTJetTreeDump::processTreeData ( const edm::Event iEvent,
std::ofstream &  file 
)
private

Definition at line 167 of file FFTJetTreeDump.cc.

167  {
168  // Get the event number
169  edm::RunNumber_t const runNum = iEvent.id().run();
170  edm::EventNumber_t const evNum = iEvent.id().event();
171 
172  // Get the input
174  iEvent.getByToken(treeToken, input);
175 
176  const double eventScale = insertCompleteEvent ? completeEventScale : 0.0;
177  if (input->isSparse()) {
178  sparsePeakTreeFromStorable(*input, iniScales.get(), eventScale, &sparseTree);
179  sparseFormatter->setTree(sparseTree, runNum, evNum);
180  file << *sparseFormatter << std::endl;
181  } else {
183  denseFormatter->setTree(*clusteringTree, runNum, evNum);
184  file << *denseFormatter << std::endl;
185  }
186 }

References clusteringTree, completeEventScale, denseFormatter, fftjetcms::densePeakTreeFromStorable(), FrontierConditions_GlobalTag_cff::file, iEvent, iniScales, input, insertCompleteEvent, DeadROC_duringRun::runNum, sparseFormatter, fftjetcms::sparsePeakTreeFromStorable(), sparseTree, and treeToken.

Member Data Documentation

◆ clusteringTree

ClusteringTree* FFTJetTreeDump::clusteringTree
private

Definition at line 85 of file FFTJetTreeDump.cc.

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

◆ completeEventScale

const double FFTJetTreeDump::completeEventScale
private

Definition at line 94 of file FFTJetTreeDump.cc.

Referenced by processTreeData().

◆ counter

unsigned FFTJetTreeDump::counter
private

Definition at line 113 of file FFTJetTreeDump.cc.

Referenced by counter.Counters::__getitem__().

◆ denseFormatter

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

Definition at line 110 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump(), and processTreeData().

◆ distanceCalc

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

Definition at line 97 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

◆ etaMax

const double FFTJetTreeDump::etaMax
private

Definition at line 91 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

◆ glyphColor

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

Definition at line 107 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

◆ glyphSize

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

Definition at line 106 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

◆ iniScales

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

Definition at line 100 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump(), and processTreeData().

◆ insertCompleteEvent

const bool FFTJetTreeDump::insertCompleteEvent
private

Definition at line 93 of file FFTJetTreeDump.cc.

Referenced by processTreeData().

◆ outputPrefix

const std::string FFTJetTreeDump::outputPrefix
private

Definition at line 90 of file FFTJetTreeDump.cc.

Referenced by analyze().

◆ sparseFormatter

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

Definition at line 111 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump(), and processTreeData().

◆ sparseTree

SparseTree FFTJetTreeDump::sparseTree
private

Definition at line 103 of file FFTJetTreeDump.cc.

Referenced by processTreeData().

◆ storeInSinglePrecision

const bool FFTJetTreeDump::storeInSinglePrecision
private

Definition at line 92 of file FFTJetTreeDump.cc.

Referenced by analyze().

◆ treeLabel

const edm::InputTag FFTJetTreeDump::treeLabel
private

Definition at line 87 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

◆ treeToken

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

Definition at line 88 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump(), and processTreeData().

DeadROC_duringRun.runNum
runNum
Definition: DeadROC_duringRun.py:21
fftjetcms::fftjet_PeakFunctor_parser
std::unique_ptr< fftjet::Functor1< double, fftjet::Peak > > fftjet_PeakFunctor_parser(const edm::ParameterSet &ps)
Definition: FFTJetParameterParser.cc:473
edm::RunNumber_t
unsigned int RunNumber_t
Definition: RunLumiEventNumber.h:14
counter
Definition: counter.py:1
input
static const std::string input
Definition: EdmProvDump.cc:48
FFTJetTreeDump::sparseFormatter
std::unique_ptr< SparseFormatter > sparseFormatter
Definition: FFTJetTreeDump.cc:111
fftjetcms::fftjet_ScaleSet_parser
std::unique_ptr< std::vector< double > > fftjet_ScaleSet_parser(const edm::ParameterSet &ps)
Definition: FFTJetParameterParser.cc:350
FFTJetTreeDump::glyphSize
std::unique_ptr< PeakProperty > glyphSize
Definition: FFTJetTreeDump.cc:106
edm::Handle
Definition: AssociativeIterator.h:50
FFTJetTreeDump::insertCompleteEvent
const bool insertCompleteEvent
Definition: FFTJetTreeDump.cc:93
fftjetcms::densePeakTreeFromStorable
void densePeakTreeFromStorable(const reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > &in, const std::vector< double > *scaleSetIfNotAdaptive, double completeEventScale, fftjet::AbsClusteringTree< fftjet::Peak, long > *out)
Definition: clusteringTreeConverters.h:271
FFTJetTreeDump::outputPrefix
const std::string outputPrefix
Definition: FFTJetTreeDump.cc:90
FFTJetTreeDump::treeToken
edm::EDGetTokenT< StoredTree > treeToken
Definition: FFTJetTreeDump.cc:88
FFTJetTreeDump::storeInSinglePrecision
const bool storeInSinglePrecision
Definition: FFTJetTreeDump.cc:92
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
FFTJetTreeDump::etaMax
const double etaMax
Definition: FFTJetTreeDump.cc:91
edm::EventNumber_t
unsigned long long EventNumber_t
Definition: RunLumiEventNumber.h:12
fftjetcms::sparsePeakTreeFromStorable
void sparsePeakTreeFromStorable(const reco::PattRecoTree< Real, reco::PattRecoPeak< Real > > &in, const std::vector< double > *scaleSetIfNotAdaptive, double completeEventScale, fftjet::SparseClusteringTree< fftjet::Peak, long > *out)
Definition: clusteringTreeConverters.h:133
fftjettreedump_cfi.GlyphColor
GlyphColor
Definition: fftjettreedump_cfi.py:55
FFTJetTreeDump::treeLabel
const edm::InputTag treeLabel
Definition: FFTJetTreeDump.cc:87
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
fftjettreedump_cfi.GlyphSize
GlyphSize
Definition: fftjettreedump_cfi.py:50
FFTJetTreeDump::checkConfig
void checkConfig(const Ptr &ptr, const char *message)
Definition: FFTJetTreeDump.cc:78
edm::ParameterSet
Definition: ParameterSet.h:47
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
iEvent
int iEvent
Definition: GenABIO.cc:224
FFTJetTreeDump::sparseTree
SparseTree sparseTree
Definition: FFTJetTreeDump.cc:103
FFTJetTreeDump::distanceCalc
std::unique_ptr< fftjet::AbsDistanceCalculator< fftjet::Peak > > distanceCalc
Definition: FFTJetTreeDump.cc:97
FFTJetTreeDump::completeEventScale
const double completeEventScale
Definition: FFTJetTreeDump.cc:94
FFTJetTreeDump::glyphColor
std::unique_ptr< PeakProperty > glyphColor
Definition: FFTJetTreeDump.cc:107
fftjetdijetfilter_cfi.InitialScales
InitialScales
Definition: fftjetdijetfilter_cfi.py:22
FFTJetTreeDump::ClusteringTree
fftjet::ProximityClusteringTree< fftjet::Peak, long > ClusteringTree
Definition: FFTJetTreeDump.cc:59
FFTJetTreeDump::iniScales
std::unique_ptr< std::vector< double > > iniScales
Definition: FFTJetTreeDump.cc:100
fftjetdijetfilter_cfi.TreeDistanceCalculator
TreeDistanceCalculator
Definition: fftjetdijetfilter_cfi.py:25
Exception
Definition: hltDiff.cc:246
FFTJetTreeDump::clusteringTree
ClusteringTree * clusteringTree
Definition: FFTJetTreeDump.cc:85
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
FFTJetTreeDump::denseFormatter
std::unique_ptr< DXFormatter > denseFormatter
Definition: FFTJetTreeDump.cc:110
cms::Exception
Definition: Exception.h:70
FFTJetTreeDump::counter
unsigned counter
Definition: FFTJetTreeDump.cc:113
fftjetcms::fftjet_DistanceCalculator_parser
std::unique_ptr< fftjet::AbsDistanceCalculator< fftjet::Peak > > fftjet_DistanceCalculator_parser(const edm::ParameterSet &ps)
Definition: FFTJetParameterParser.cc:404
edm::InputTag
Definition: InputTag.h:15