CMS 3D CMS Logo

GenericBenchmarkAnalyzer Class Reference

#include <Validation/RecoParticleFlow/interface/GenericBenchmarkAnalyzer.h>

Inheritance diagram for GenericBenchmarkAnalyzer:

edm::EDAnalyzer GenericBenchmark

List of all members.

Public Member Functions

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

Private Attributes

std::string benchmarkLabel_
double deltaR_cut
edm::InputTag inputRecoLabel_
edm::InputTag inputTruthLabel_
double maxEta_cut
bool onlyTwoJets_
std::string outputFile_
bool plotAgainstRecoQuantities_
double recPt_cut


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_, deltaR_cut, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), inputRecoLabel_, inputTruthLabel_, maxEta_cut, onlyTwoJets_, outputFile_, plotAgainstRecoQuantities_, and recPt_cut.

00039 {
00040 
00041   inputTruthLabel_             = iConfig.getParameter<edm::InputTag>("InputTruthLabel");
00042   inputRecoLabel_              = iConfig.getParameter<edm::InputTag>("InputRecoLabel");
00043   outputFile_                  = iConfig.getUntrackedParameter<std::string>("OutputFile");
00044   benchmarkLabel_              = iConfig.getParameter<std::string>("BenchmarkLabel"); 
00045   plotAgainstRecoQuantities_   = iConfig.getParameter<bool>("PlotAgainstRecoQuantities");
00046   onlyTwoJets_                 = iConfig.getParameter<bool>("OnlyTwoJets");
00047   recPt_cut                    = iConfig.getParameter<double>("recPt");
00048   maxEta_cut                    = iConfig.getParameter<double>("maxEta");
00049   deltaR_cut                    = iConfig.getParameter<double>("deltaRMax");
00050 
00051   if (outputFile_.size() > 0)
00052     edm::LogInfo("OutputInfo") << " ParticleFLow Task histograms will be saved to '" << outputFile_.c_str()<< "'";
00053   else edm::LogInfo("OutputInfo") << " ParticleFlow Task histograms will NOT be saved";
00054 
00055 }

GenericBenchmarkAnalyzer::~GenericBenchmarkAnalyzer (  )  [virtual]

Definition at line 57 of file GenericBenchmarkAnalyzer.cc.

00057 { }


Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 76 of file GenericBenchmarkAnalyzer.cc.

References GenMuonPlsPt100GeV_cfg::cout, deltaR_cut, lat::endl(), GenericBenchmark::fill(), edm::Event::getByLabel(), inputRecoLabel_, inputTruthLabel_, maxEta_cut, onlyTwoJets_, plotAgainstRecoQuantities_, edm::Handle< T >::product(), and recPt_cut.

00077 {
00078   
00079   // Typedefs to use views
00080   typedef edm::View<reco::Candidate> candidateCollection ;
00081   typedef edm::View<reco::Candidate> candidateCollection ;
00082   
00083   const candidateCollection *truth_candidates;
00084   const candidateCollection *reco_candidates;
00085  
00086   // ==========================================================
00087   // Retrieve!
00088   // ==========================================================
00089 
00090   { 
00091     // Get Truth Candidates (GenCandidates, GenJets, etc.)
00092     Handle<candidateCollection> truth_hnd;
00093     bool isGen = iEvent.getByLabel(inputTruthLabel_, truth_hnd);
00094     if ( !isGen ) { 
00095       std::cout << "Warning : no Gen jets in input !" << std::endl;
00096       return;
00097     }
00098 
00099     truth_candidates = truth_hnd.product();
00100 
00101     // Get Reco Candidates (PFlow, CaloJet, etc.)
00102     Handle<candidateCollection> reco_hnd;
00103     bool isReco = iEvent.getByLabel(inputRecoLabel_, reco_hnd);
00104     if ( !isReco ) { 
00105       std::cout << "Warning : no Reco jets in input !" << std::endl;
00106       return; 
00107     }
00108     reco_candidates = reco_hnd.product();
00109 
00110     // no longer needed with template-ized Benchmark
00111     //const PFCandidateCollection *pf_candidates = reco_hnd.product();
00112     //static CandidateCollection reco_storage = algo_->makeCandidateCollection(pf_candidates);
00113     //reco_candidates = &reco_storage;
00114 
00115   }
00116   if (!truth_candidates || !reco_candidates) {
00117 
00118     edm::LogInfo("OutputInfo") << " failed to retrieve data required by ParticleFlow Task";
00119     edm::LogInfo("OutputInfo") << " ParticleFlow Task cannot continue...!";
00120     return;
00121 
00122   }
00123 
00124   // ==========================================================
00125   // Analyze!
00126   // ==========================================================
00127 
00128   fill(reco_candidates,truth_candidates,plotAgainstRecoQuantities_, onlyTwoJets_, recPt_cut, maxEta_cut, deltaR_cut);
00129 
00130 }

void GenericBenchmarkAnalyzer::beginJob ( const edm::EventSetup iSetup  )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 59 of file GenericBenchmarkAnalyzer.cc.

References benchmarkLabel_, GenericBenchmark::dbe_, path(), plotAgainstRecoQuantities_, DQMStore::setCurrentFolder(), and GenericBenchmark::setup().

00060 {
00061 
00062   // get ahold of back-end interface
00063   dbe_ = edm::Service<DQMStore>().operator->();
00064   
00065   if (dbe_) {
00066     //dbe_->setVerbose(1);
00067     string path = "PFTask/Benchmarks/" + benchmarkLabel_ + "/";
00068     if (plotAgainstRecoQuantities_) path += "Reco"; else path += "Gen";
00069     dbe_->setCurrentFolder(path.c_str());
00070     setup(dbe_, plotAgainstRecoQuantities_);
00071 
00072   }
00073 
00074 }

void GenericBenchmarkAnalyzer::endJob ( void   )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 132 of file GenericBenchmarkAnalyzer.cc.

References GenericBenchmark::dbe_, outputFile_, and DQMStore::save().

00133 {
00134 
00135   // Store the DAQ Histograms
00136   if (outputFile_.size() != 0)
00137     dbe_->save(outputFile_);
00138 }


Member Data Documentation

std::string GenericBenchmarkAnalyzer::benchmarkLabel_ [private]

Definition at line 32 of file GenericBenchmarkAnalyzer.h.

Referenced by beginJob(), and GenericBenchmarkAnalyzer().

double GenericBenchmarkAnalyzer::deltaR_cut [private]

Definition at line 37 of file GenericBenchmarkAnalyzer.h.

Referenced by analyze(), and GenericBenchmarkAnalyzer().

edm::InputTag GenericBenchmarkAnalyzer::inputRecoLabel_ [private]

Definition at line 31 of file GenericBenchmarkAnalyzer.h.

Referenced by analyze(), and GenericBenchmarkAnalyzer().

edm::InputTag GenericBenchmarkAnalyzer::inputTruthLabel_ [private]

Definition at line 30 of file GenericBenchmarkAnalyzer.h.

Referenced by analyze(), and GenericBenchmarkAnalyzer().

double GenericBenchmarkAnalyzer::maxEta_cut [private]

Definition at line 36 of file GenericBenchmarkAnalyzer.h.

Referenced by analyze(), and GenericBenchmarkAnalyzer().

bool GenericBenchmarkAnalyzer::onlyTwoJets_ [private]

Definition at line 34 of file GenericBenchmarkAnalyzer.h.

Referenced by analyze(), and GenericBenchmarkAnalyzer().

std::string GenericBenchmarkAnalyzer::outputFile_ [private]

Definition at line 29 of file GenericBenchmarkAnalyzer.h.

Referenced by endJob(), and GenericBenchmarkAnalyzer().

bool GenericBenchmarkAnalyzer::plotAgainstRecoQuantities_ [private]

Definition at line 33 of file GenericBenchmarkAnalyzer.h.

Referenced by analyze(), beginJob(), and GenericBenchmarkAnalyzer().

double GenericBenchmarkAnalyzer::recPt_cut [private]

Definition at line 35 of file GenericBenchmarkAnalyzer.h.

Referenced by analyze(), and GenericBenchmarkAnalyzer().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:21:11 2009 for CMSSW by  doxygen 1.5.4