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 ()=delete
 
 FFTJetTreeDump (const FFTJetTreeDump &)=delete
 
FFTJetTreeDumpoperator= (const FFTJetTreeDump &)=delete
 
 ~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 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< 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
 
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
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 118 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, jetUpdater_cfi::sort, sparseFormatter, fftjetdijetfilter_cfi::TreeDistanceCalculator, treeLabel, and treeToken.

119  : clusteringTree(nullptr),
120  treeLabel(ps.getParameter<edm::InputTag>("treeLabel")),
121  outputPrefix(ps.getParameter<std::string>("outputPrefix")),
122  etaMax(ps.getParameter<double>("etaMax")),
124  insertCompleteEvent(ps.getParameter<bool>("insertCompleteEvent")),
125  completeEventScale(ps.getParameter<double>("completeEventScale")),
126  counter(0) {
127  if (etaMax < 0.0)
128  throw cms::Exception("FFTJetBadConfig") << "etaMax can not be negative" << std::endl;
129 
130  // Build the set of pattern recognition scales
131  const edm::ParameterSet& InitialScales(ps.getParameter<edm::ParameterSet>("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(ps.getParameter<edm::ParameterSet>("TreeDistanceCalculator"));
139  checkConfig(distanceCalc, "invalid tree distance calculator");
140 
141  // Determine representations for the OpenDX glyph size and color
144  checkConfig(glyphSize, "invalid glyph size parameters");
145 
148  checkConfig(glyphColor, "invalid glyph color parameters");
149 
150  // Build the tree formatters
151  denseFormatter = std::make_unique<DXFormatter>(glyphSize.get(), glyphColor.get(), etaMax);
152  sparseFormatter = std::make_unique<SparseFormatter>(glyphSize.get(), glyphColor.get(), etaMax);
153 
154  // Build the clustering tree
156 
157  treeToken = consumes<StoredTree>(treeLabel);
158 }
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 bool storeInSinglePrecision
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 160 of file FFTJetTreeDump.cc.

References clusteringTree.

160 { delete clusteringTree; }
ClusteringTree * clusteringTree

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 188 of file FFTJetTreeDump.cc.

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

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

◆ beginJob()

void FFTJetTreeDump::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 205 of file FFTJetTreeDump.cc.

205 {}

◆ checkConfig()

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

Definition at line 77 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

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

◆ endJob()

void FFTJetTreeDump::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 208 of file FFTJetTreeDump.cc.

208 {}

◆ operator=()

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

◆ processTreeData()

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

Definition at line 166 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.

166  {
167  // Get the event number
168  edm::RunNumber_t const runNum = iEvent.id().run();
169  edm::EventNumber_t const evNum = iEvent.id().event();
170 
171  // Get the input
173  iEvent.getByToken(treeToken, input);
174 
175  const double eventScale = insertCompleteEvent ? completeEventScale : 0.0;
176  if (input->isSparse()) {
177  sparsePeakTreeFromStorable(*input, iniScales.get(), eventScale, &sparseTree);
178  sparseFormatter->setTree(sparseTree, runNum, evNum);
179  file << *sparseFormatter << std::endl;
180  } else {
182  denseFormatter->setTree(*clusteringTree, runNum, evNum);
183  file << *denseFormatter << std::endl;
184  }
185 }
SparseTree sparseTree
unsigned long long EventNumber_t
edm::EDGetTokenT< StoredTree > treeToken
static std::string const input
Definition: EdmProvDump.cc:47
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 84 of file FFTJetTreeDump.cc.

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

◆ completeEventScale

const double FFTJetTreeDump::completeEventScale
private

Definition at line 93 of file FFTJetTreeDump.cc.

Referenced by processTreeData().

◆ counter

unsigned FFTJetTreeDump::counter
private

Definition at line 112 of file FFTJetTreeDump.cc.

Referenced by counter.Counters::__getitem__().

◆ denseFormatter

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

Definition at line 109 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump(), and processTreeData().

◆ distanceCalc

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

Definition at line 96 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

◆ etaMax

const double FFTJetTreeDump::etaMax
private

Definition at line 90 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

◆ glyphColor

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

Definition at line 106 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

◆ glyphSize

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

Definition at line 105 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

◆ iniScales

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

Definition at line 99 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump(), and processTreeData().

◆ insertCompleteEvent

const bool FFTJetTreeDump::insertCompleteEvent
private

Definition at line 92 of file FFTJetTreeDump.cc.

Referenced by processTreeData().

◆ outputPrefix

const std::string FFTJetTreeDump::outputPrefix
private

Definition at line 89 of file FFTJetTreeDump.cc.

Referenced by analyze().

◆ sparseFormatter

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

Definition at line 110 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump(), and processTreeData().

◆ sparseTree

SparseTree FFTJetTreeDump::sparseTree
private

Definition at line 102 of file FFTJetTreeDump.cc.

Referenced by processTreeData().

◆ storeInSinglePrecision

const bool FFTJetTreeDump::storeInSinglePrecision
private

Definition at line 91 of file FFTJetTreeDump.cc.

Referenced by analyze().

◆ treeLabel

const edm::InputTag FFTJetTreeDump::treeLabel
private

Definition at line 86 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump().

◆ treeToken

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

Definition at line 87 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump(), and processTreeData().