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::stream::EDAnalyzer<> edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 FFTJetTreeDump (const edm::ParameterSet &)
 
 FFTJetTreeDump ()=delete
 
 FFTJetTreeDump (const FFTJetTreeDump &)=delete
 
FFTJetTreeDumpoperator= (const FFTJetTreeDump &)=delete
 
 ~FFTJetTreeDump () override
 
- Public Member Functions inherited from edm::stream::EDAnalyzer<>
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
 EDAnalyzerBase (const EDAnalyzerBase &)=delete
 
ModuleDescription const & moduleDescription () const
 
const EDAnalyzerBaseoperator= (const EDAnalyzerBase &)=delete
 
 ~EDAnalyzerBase () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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< float, reco::PattRecoPeak< float > > StoredTree
 

Private Member Functions

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

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer<>
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
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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 62 of file FFTJetTreeDump.cc.

◆ DXFormatter

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

Definition at line 64 of file FFTJetTreeDump.cc.

◆ PeakProperty

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

Definition at line 66 of file FFTJetTreeDump.cc.

◆ SparseFormatter

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

Definition at line 65 of file FFTJetTreeDump.cc.

◆ SparseTree

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

Definition at line 63 of file FFTJetTreeDump.cc.

◆ StoredTree

Definition at line 67 of file FFTJetTreeDump.cc.

Constructor & Destructor Documentation

◆ FFTJetTreeDump() [1/3]

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

Definition at line 114 of file FFTJetTreeDump.cc.

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, jetsAK4_CHS_cff::sort, sparseFormatter, fftjetdijetfilter_cfi::TreeDistanceCalculator, treeLabel, and treeToken.

115  : clusteringTree(nullptr),
116  treeLabel(ps.getParameter<edm::InputTag>("treeLabel")),
117  outputPrefix(ps.getParameter<std::string>("outputPrefix")),
118  etaMax(ps.getParameter<double>("etaMax")),
119  insertCompleteEvent(ps.getParameter<bool>("insertCompleteEvent")),
120  completeEventScale(ps.getParameter<double>("completeEventScale")),
121  counter(0) {
122  if (etaMax < 0.0)
123  throw cms::Exception("FFTJetBadConfig") << "etaMax can not be negative" << std::endl;
124 
125  // Build the set of pattern recognition scales
126  const edm::ParameterSet& InitialScales(ps.getParameter<edm::ParameterSet>("InitialScales"));
128  checkConfig(iniScales, "invalid set of scales");
129  std::sort(iniScales->begin(), iniScales->end(), std::greater<double>());
130 
131  // Distance calculator for the clustering tree
132  const edm::ParameterSet& TreeDistanceCalculator(ps.getParameter<edm::ParameterSet>("TreeDistanceCalculator"));
134  checkConfig(distanceCalc, "invalid tree distance calculator");
135 
136  // Determine representations for the OpenDX glyph size and color
139  checkConfig(glyphSize, "invalid glyph size parameters");
140 
143  checkConfig(glyphColor, "invalid glyph color parameters");
144 
145  // Build the tree formatters
146  denseFormatter = std::make_unique<DXFormatter>(glyphSize.get(), glyphColor.get(), etaMax);
147  sparseFormatter = std::make_unique<SparseFormatter>(glyphSize.get(), glyphColor.get(), etaMax);
148 
149  // Build the clustering tree
151 
152  treeToken = consumes<StoredTree>(treeLabel);
153 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::InputTag treeLabel
std::unique_ptr< fftjet::Functor1< double, fftjet::Peak > > fftjet_PeakFunctor_parser(const edm::ParameterSet &ps)
void checkConfig(const Ptr &ptr, const char *message)
const double etaMax
edm::EDGetTokenT< StoredTree > treeToken
ClusteringTree * clusteringTree
fftjet::ProximityClusteringTree< fftjet::Peak, long > ClusteringTree
std::unique_ptr< fftjet::AbsDistanceCalculator< fftjet::Peak > > distanceCalc
const std::string outputPrefix
std::unique_ptr< DXFormatter > denseFormatter
std::unique_ptr< fftjet::AbsDistanceCalculator< fftjet::Peak > > fftjet_DistanceCalculator_parser(const edm::ParameterSet &ps)
std::unique_ptr< PeakProperty > glyphSize
std::unique_ptr< SparseFormatter > sparseFormatter
const double completeEventScale
const bool insertCompleteEvent
std::unique_ptr< std::vector< double > > iniScales
std::unique_ptr< std::vector< double > > fftjet_ScaleSet_parser(const edm::ParameterSet &ps)
std::unique_ptr< PeakProperty > glyphColor

◆ FFTJetTreeDump() [2/3]

FFTJetTreeDump::FFTJetTreeDump ( )
delete

◆ FFTJetTreeDump() [3/3]

FFTJetTreeDump::FFTJetTreeDump ( const FFTJetTreeDump )
delete

◆ ~FFTJetTreeDump()

FFTJetTreeDump::~FFTJetTreeDump ( )
override

Definition at line 155 of file FFTJetTreeDump.cc.

References clusteringTree.

155 { delete clusteringTree; }
ClusteringTree * clusteringTree

Member Function Documentation

◆ analyze()

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 182 of file FFTJetTreeDump.cc.

References Exception, geometryDiff::file, corrVsCorr::filename, iEvent, outputPrefix, and processTreeData().

182  {
183  // Create the file name
184  std::ostringstream filename;
185  filename << outputPrefix << '_' << counter++ << ".dx";
186 
187  // Open the file
188  std::ofstream file(filename.str().c_str());
189  if (!file)
190  throw cms::Exception("FFTJetBadConfig") << "Failed to open file \"" << filename.str() << "\"" << std::endl;
191 
193 }
void processTreeData(const edm::Event &, std::ofstream &)
int iEvent
Definition: GenABIO.cc:224
const std::string outputPrefix

◆ checkConfig()

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

Definition at line 74 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

74  {
75  if (ptr.get() == nullptr)
76  throw cms::Exception("FFTJetBadConfig") << message << std::endl;
77  }

◆ operator=()

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

◆ processTreeData()

void FFTJetTreeDump::processTreeData ( const edm::Event iEvent,
std::ofstream &  file 
)
private

Definition at line 160 of file FFTJetTreeDump.cc.

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

Referenced by analyze().

160  {
161  // Get the event number
162  edm::RunNumber_t const runNum = iEvent.id().run();
163  edm::EventNumber_t const evNum = iEvent.id().event();
164 
165  // Get the input
167  iEvent.getByToken(treeToken, input);
168 
169  const double eventScale = insertCompleteEvent ? completeEventScale : 0.0;
170  if (input->isSparse()) {
171  sparsePeakTreeFromStorable(*input, iniScales.get(), eventScale, &sparseTree);
172  sparseFormatter->setTree(sparseTree, runNum, evNum);
173  file << *sparseFormatter << std::endl;
174  } else {
176  denseFormatter->setTree(*clusteringTree, runNum, evNum);
177  file << *denseFormatter << std::endl;
178  }
179 }
SparseTree sparseTree
unsigned long long EventNumber_t
edm::EDGetTokenT< StoredTree > treeToken
static std::string const input
Definition: EdmProvDump.cc:50
int iEvent
Definition: GenABIO.cc:224
ClusteringTree * clusteringTree
std::unique_ptr< DXFormatter > denseFormatter
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)
std::unique_ptr< SparseFormatter > sparseFormatter
const double completeEventScale
const bool insertCompleteEvent
unsigned int RunNumber_t
std::unique_ptr< std::vector< double > > iniScales

Member Data Documentation

◆ clusteringTree

ClusteringTree* FFTJetTreeDump::clusteringTree
private

Definition at line 81 of file FFTJetTreeDump.cc.

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

◆ completeEventScale

const double FFTJetTreeDump::completeEventScale
private

Definition at line 89 of file FFTJetTreeDump.cc.

Referenced by processTreeData().

◆ counter

unsigned FFTJetTreeDump::counter
private

Definition at line 108 of file FFTJetTreeDump.cc.

Referenced by counter.Counters::__getitem__().

◆ denseFormatter

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

Definition at line 105 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump(), and processTreeData().

◆ distanceCalc

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

Definition at line 92 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

◆ etaMax

const double FFTJetTreeDump::etaMax
private

Definition at line 87 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

◆ glyphColor

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

Definition at line 102 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

◆ glyphSize

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

Definition at line 101 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

◆ iniScales

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

Definition at line 95 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump(), and processTreeData().

◆ insertCompleteEvent

const bool FFTJetTreeDump::insertCompleteEvent
private

Definition at line 88 of file FFTJetTreeDump.cc.

Referenced by processTreeData().

◆ outputPrefix

const std::string FFTJetTreeDump::outputPrefix
private

Definition at line 86 of file FFTJetTreeDump.cc.

Referenced by analyze().

◆ sparseFormatter

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

Definition at line 106 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump(), and processTreeData().

◆ sparseTree

SparseTree FFTJetTreeDump::sparseTree
private

Definition at line 98 of file FFTJetTreeDump.cc.

Referenced by processTreeData().

◆ treeLabel

const edm::InputTag FFTJetTreeDump::treeLabel
private

Definition at line 83 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

◆ treeToken

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

Definition at line 84 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump(), and processTreeData().