CMS 3D CMS Logo

Public Member Functions | Private Attributes

GenericBenchmarkAnalyzer Class Reference

#include <GenericBenchmarkAnalyzer.h>

Inheritance diagram for GenericBenchmarkAnalyzer:
edm::EDAnalyzer GenericBenchmark edm::EDConsumerBase

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
virtual void endJob ()
 GenericBenchmarkAnalyzer (const edm::ParameterSet &)
virtual ~GenericBenchmarkAnalyzer ()

Private Attributes

std::string benchmarkLabel_
double deltaR_cut
bool doMetPlots_
edm::InputTag inputRecoLabel_
edm::InputTag inputTruthLabel_
float maxDeltaEt_
float maxDeltaPhi_
double maxEta_cut
float minDeltaEt_
float minDeltaPhi_
double minEta_cut
bool onlyTwoJets_
std::string outputFile_
bool plotAgainstRecoQuantities_
double recPt_cut
bool startFromGen_

Detailed Description

Definition at line 16 of file GenericBenchmarkAnalyzer.h.


Constructor & Destructor Documentation

GenericBenchmarkAnalyzer::GenericBenchmarkAnalyzer ( const edm::ParameterSet iConfig) [explicit]

Definition at line 38 of file GenericBenchmarkAnalyzer.cc.

References benchmarkLabel_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

{

  inputTruthLabel_             = iConfig.getParameter<edm::InputTag>("InputTruthLabel");
  inputRecoLabel_              = iConfig.getParameter<edm::InputTag>("InputRecoLabel");
  outputFile_                  = iConfig.getUntrackedParameter<std::string>("OutputFile");
  benchmarkLabel_              = iConfig.getParameter<std::string>("BenchmarkLabel"); 
  startFromGen_                = iConfig.getParameter<bool>("StartFromGen");
  plotAgainstRecoQuantities_   = iConfig.getParameter<bool>("PlotAgainstRecoQuantities");
  onlyTwoJets_                 = iConfig.getParameter<bool>("OnlyTwoJets");
  recPt_cut                    = iConfig.getParameter<double>("recPt");
  minEta_cut                   = iConfig.getParameter<double>("minEta");
  maxEta_cut                   = iConfig.getParameter<double>("maxEta");
  deltaR_cut                   = iConfig.getParameter<double>("deltaRMax");

  minDeltaEt_                   = iConfig.getParameter<double>("minDeltaEt");
  maxDeltaEt_                   = iConfig.getParameter<double>("maxDeltaEt");
  minDeltaPhi_                  = iConfig.getParameter<double>("minDeltaPhi");
  maxDeltaPhi_                  = iConfig.getParameter<double>("maxDeltaPhi");
  doMetPlots_                   = iConfig.getParameter<bool>("doMetPlots");

  if (outputFile_.size() > 0)
    edm::LogInfo("OutputInfo") << " ParticleFLow Task histograms will be saved to '" << outputFile_.c_str()<< "'";
  else edm::LogInfo("OutputInfo") << " ParticleFlow Task histograms will NOT be saved";

}
GenericBenchmarkAnalyzer::~GenericBenchmarkAnalyzer ( ) [virtual]

Definition at line 65 of file GenericBenchmarkAnalyzer.cc.

{ }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 86 of file GenericBenchmarkAnalyzer.cc.

References gather_cfg::cout, lumiContext::fill, edm::Event::getByLabel(), and edm::Handle< T >::product().

{
  
  // Typedefs to use views
  typedef edm::View<reco::Candidate> candidateCollection ;
  typedef edm::View<reco::Candidate> candidateCollection ;
  
  const candidateCollection *truth_candidates;
  const candidateCollection *reco_candidates;
 
  // ==========================================================
  // Retrieve!
  // ==========================================================

  { 
    // Get Truth Candidates (GenCandidates, GenJets, etc.)
    Handle<candidateCollection> truth_hnd;
    bool isGen = iEvent.getByLabel(inputTruthLabel_, truth_hnd);
    if ( !isGen ) { 
      std::cout << "Warning : no Gen jets in input !" << std::endl;
      return;
    }

    truth_candidates = truth_hnd.product();

    // Get Reco Candidates (PFlow, CaloJet, etc.)
    Handle<candidateCollection> reco_hnd;
    bool isReco = iEvent.getByLabel(inputRecoLabel_, reco_hnd);
    if ( !isReco ) { 
      std::cout << "Warning : no Reco jets in input !" << std::endl;
      return; 
    }
    reco_candidates = reco_hnd.product();

    // no longer needed with template-ized Benchmark
    //const PFCandidateCollection *pf_candidates = reco_hnd.product();
    //static CandidateCollection reco_storage = algo_->makeCandidateCollection(pf_candidates);
    //reco_candidates = &reco_storage;

  }
  if (!truth_candidates || !reco_candidates) {

    edm::LogInfo("OutputInfo") << " failed to retrieve data required by ParticleFlow Task";
    edm::LogInfo("OutputInfo") << " ParticleFlow Task cannot continue...!";
    return;

  }

  // ==========================================================
  // Analyze!
  // ==========================================================

  fill(reco_candidates,truth_candidates,
      startFromGen_, plotAgainstRecoQuantities_, 
      onlyTwoJets_, recPt_cut,  minEta_cut, maxEta_cut, deltaR_cut);
}
void GenericBenchmarkAnalyzer::beginJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 68 of file GenericBenchmarkAnalyzer.cc.

References benchmarkLabel_, dbe_, cppFunctionSkipper::operator, getHLTPrescaleColumns::path, DQMStore::setCurrentFolder(), and HcalObjRepresent::setup().

{

  // get ahold of back-end interface
  dbe_ = edm::Service<DQMStore>().operator->();
  
  if (dbe_) {
    //dbe_->setVerbose(1);
    string path = "PFTask/Benchmarks/" + benchmarkLabel_ + "/";
    if (plotAgainstRecoQuantities_) path += "Reco"; else path += "Gen";
    dbe_->setCurrentFolder(path.c_str());
    setup(dbe_, plotAgainstRecoQuantities_, minDeltaEt_, maxDeltaEt_, minDeltaPhi_, maxDeltaPhi_, doMetPlots_);

  }

}
void GenericBenchmarkAnalyzer::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 144 of file GenericBenchmarkAnalyzer.cc.

References dbe_, and DQMStore::save().

{

  // Store the DAQ Histograms
  if (outputFile_.size() != 0)
    dbe_->save(outputFile_);
}

Member Data Documentation

Definition at line 32 of file GenericBenchmarkAnalyzer.h.

Definition at line 39 of file GenericBenchmarkAnalyzer.h.

Reimplemented from GenericBenchmark.

Definition at line 44 of file GenericBenchmarkAnalyzer.h.

Definition at line 31 of file GenericBenchmarkAnalyzer.h.

Definition at line 30 of file GenericBenchmarkAnalyzer.h.

Definition at line 41 of file GenericBenchmarkAnalyzer.h.

Definition at line 43 of file GenericBenchmarkAnalyzer.h.

Definition at line 38 of file GenericBenchmarkAnalyzer.h.

Definition at line 40 of file GenericBenchmarkAnalyzer.h.

Definition at line 42 of file GenericBenchmarkAnalyzer.h.

Definition at line 37 of file GenericBenchmarkAnalyzer.h.

Definition at line 35 of file GenericBenchmarkAnalyzer.h.

Definition at line 29 of file GenericBenchmarkAnalyzer.h.

Definition at line 34 of file GenericBenchmarkAnalyzer.h.

Definition at line 36 of file GenericBenchmarkAnalyzer.h.

Definition at line 33 of file GenericBenchmarkAnalyzer.h.