CMS 3D CMS Logo

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

List of all members.

Public Member Functions

 FFTJetTreeDump (const edm::ParameterSet &)
 ~FFTJetTreeDump ()

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

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, Exception, fftjetcms::fftjet_DistanceCalculator_parser(), fftjetcms::fftjet_PeakFunctor_parser(), fftjetcms::fftjet_ScaleSet_parser(), edm::ParameterSet::getParameter(), glyphColor, glyphSize, iniScales, python::multivaluedict::sort(), and sparseFormatter.

    : clusteringTree(0),
      treeLabel(ps.getParameter<edm::InputTag>("treeLabel")),
      outputPrefix(ps.getParameter<std::string>("outputPrefix")),
      etaMax(ps.getParameter<double>("etaMax")),
      storeInSinglePrecision(true),
      insertCompleteEvent(ps.getParameter<bool>("insertCompleteEvent")),
      completeEventScale(ps.getParameter<double>("completeEventScale")),
      counter(0)
{
    if (etaMax < 0.0)
        throw cms::Exception("FFTJetBadConfig")
            << "etaMax can not be negative" << std::endl;

    // Build the set of pattern recognition scales
    const edm::ParameterSet& InitialScales(
        ps.getParameter<edm::ParameterSet>("InitialScales"));
    iniScales = fftjet_ScaleSet_parser(InitialScales);
    checkConfig(iniScales, "invalid set of scales");
    std::sort(iniScales->begin(), iniScales->end(), std::greater<double>());

    // Distance calculator for the clustering tree
    const edm::ParameterSet& TreeDistanceCalculator(
        ps.getParameter<edm::ParameterSet>("TreeDistanceCalculator"));
    distanceCalc = fftjet_DistanceCalculator_parser(TreeDistanceCalculator);
    checkConfig(distanceCalc, "invalid tree distance calculator");

    // Determine representations for the OpenDX glyph size and color
    const edm::ParameterSet& GlyphSize(
        ps.getParameter<edm::ParameterSet>("GlyphSize"));
    glyphSize = fftjet_PeakFunctor_parser(GlyphSize);
    checkConfig(glyphSize, "invalid glyph size parameters");

    const edm::ParameterSet& GlyphColor(
        ps.getParameter<edm::ParameterSet>("GlyphColor"));
    glyphColor = fftjet_PeakFunctor_parser(GlyphColor);
    checkConfig(glyphColor, "invalid glyph color parameters");

    // Build the tree formatters
    denseFormatter = std::auto_ptr<DXFormatter>(new DXFormatter(
        glyphSize.get(), glyphColor.get(), etaMax));
    sparseFormatter = std::auto_ptr<SparseFormatter>(new SparseFormatter(
        glyphSize.get(), glyphColor.get(), etaMax));

    // Build the clustering tree
    clusteringTree = new ClusteringTree(distanceCalc.get());
}
FFTJetTreeDump::~FFTJetTreeDump ( )

Definition at line 164 of file FFTJetTreeDump.cc.

References clusteringTree.

{
    delete clusteringTree;
}
FFTJetTreeDump::FFTJetTreeDump ( ) [private]
FFTJetTreeDump::FFTJetTreeDump ( const FFTJetTreeDump ) [private]

Member Function Documentation

void FFTJetTreeDump::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 206 of file FFTJetTreeDump.cc.

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

{
    // Create the file name
    std::ostringstream filename;
    filename << outputPrefix << '_' << counter++ << ".dx";

    // Open the file
    std::ofstream file(filename.str().c_str());
    if (!file)
        throw cms::Exception("FFTJetBadConfig") 
            << "Failed to open file \""
            << filename.str() << "\"" << std::endl;

    if (storeInSinglePrecision)
        processTreeData<float>(iEvent, file);
    else
        processTreeData<double>(iEvent, file);
}
void FFTJetTreeDump::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 228 of file FFTJetTreeDump.cc.

{
}
template<class Ptr >
void FFTJetTreeDump::checkConfig ( const Ptr &  ptr,
const char *  message 
) [inline, private]

Definition at line 75 of file FFTJetTreeDump.cc.

References NULL.

Referenced by FFTJetTreeDump().

    {
        if (ptr.get() == NULL)
            throw cms::Exception("FFTJetBadConfig") << message << std::endl;
    }
void FFTJetTreeDump::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 233 of file FFTJetTreeDump.cc.

                            {
}
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.

{
    typedef reco::PattRecoTree<Real,reco::PattRecoPeak<Real> > StoredTree;

    // Get the event number
    const unsigned long runNum = iEvent.id().run();
    const unsigned long evNum = iEvent.id().event();

    // Get the input
    edm::Handle<StoredTree> input;
    iEvent.getByLabel(treeLabel, input);

    const double eventScale = insertCompleteEvent ? completeEventScale : 0.0;
    if (input->isSparse())
    {
        sparsePeakTreeFromStorable(*input, iniScales.get(),
                                   eventScale, &sparseTree);
        sparseFormatter->setTree(sparseTree, runNum, evNum);
        file << *sparseFormatter << std::endl;
    }
    else
    {
        densePeakTreeFromStorable(*input, iniScales.get(),
                                  eventScale, clusteringTree);
        denseFormatter->setTree(*clusteringTree, runNum, evNum);
        file << *denseFormatter << std::endl;
    }
}

Member Data Documentation

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().

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().

Definition at line 107 of file FFTJetTreeDump.cc.

Referenced by FFTJetTreeDump(), and processTreeData().

Definition at line 99 of file FFTJetTreeDump.cc.

Referenced by processTreeData().

Definition at line 88 of file FFTJetTreeDump.cc.

Referenced by analyze().

Definition at line 85 of file FFTJetTreeDump.cc.

Referenced by processTreeData().