CMS 3D CMS Logo

Public Member Functions | Protected Attributes

CandidateBenchmark Class Reference

To plot Candidate quantities. More...

#include <CandidateBenchmark.h>

Inheritance diagram for CandidateBenchmark:
Benchmark CandidateBenchmarkAnalyzer

List of all members.

Public Member Functions

 CandidateBenchmark (Mode mode)
template<class C >
void fill (const C &candidates)
void fillOne (const reco::Candidate &candidate)
 fill histograms with a given particle
void setup ()
 book histograms
void setup (const edm::ParameterSet &parameterSet)
 book histograms
virtual ~CandidateBenchmark ()

Protected Attributes

TH1F * charge_
TH1F * eta_
bool histogramBooked_
TH1F * pdgId_
 COLIN add this histo.
TH1F * phi_
TH1F * pt_

Detailed Description

To plot Candidate quantities.

Definition at line 10 of file CandidateBenchmark.h.


Constructor & Destructor Documentation

CandidateBenchmark::CandidateBenchmark ( Mode  mode)

Definition at line 15 of file CandidateBenchmark.cc.

References charge_, eta_, histogramBooked_, pdgId_, phi_, and pt_.

                                                : Benchmark(mode) {
  pt_     = 0; 
  eta_    = 0; 
  phi_    = 0; 
  charge_ = 0;
  pdgId_  = 0;

  histogramBooked_ = false;
 
}
CandidateBenchmark::~CandidateBenchmark ( ) [virtual]

Definition at line 26 of file CandidateBenchmark.cc.

{}

Member Function Documentation

template<class C >
void CandidateBenchmark::fill ( const C &  candidates)

Definition at line 43 of file CandidateBenchmark.h.

References fillOne(), and i.

Referenced by CandidateBenchmarkAnalyzer::analyze().

                                                     {

  for (unsigned int i = 0; i < candCollection.size(); i++) {
    const reco::Candidate& cand = candCollection[i];
    fillOne(cand);
  }
}
void CandidateBenchmark::fillOne ( const reco::Candidate candidate)

fill histograms with a given particle

Definition at line 88 of file CandidateBenchmark.cc.

References reco::Candidate::charge(), charge_, reco::Candidate::eta(), eta_, histogramBooked_, Benchmark::isInRange(), reco::Candidate::phi(), phi_, reco::Candidate::pt(), and pt_.

Referenced by PFCandidateManager::fill(), fill(), PFCandidateMonitor::fill(), PFJetMonitor::fill(), and PFMETMonitor::fillOne().

                                                          {

  if( !isInRange(cand.pt(), cand.eta(), cand.phi() ) ) return;

  if (histogramBooked_) {
    if (pt_) pt_->Fill( cand.pt() );
    if (eta_) eta_->Fill( cand.eta() );
    if (phi_) phi_->Fill( cand.phi() );
    if (charge_) charge_->Fill( cand.charge() );
  }
}
void CandidateBenchmark::setup ( void  )

book histograms

Definition at line 29 of file CandidateBenchmark.cc.

References Benchmark::book1D(), charge_, Benchmark::DQMOFFLINE, eta_, histogramBooked_, Benchmark::PhaseSpace::m, Benchmark::PhaseSpace::M, Benchmark::mode_, Benchmark::PhaseSpace::n, phi_, and pt_.

Referenced by CandidateBenchmarkAnalyzer::beginJob(), PFMETMonitor::setup(), PFJetMonitor::setup(), and PFCandidateMonitor::setup().

                               {

  if (!histogramBooked_) {
    PhaseSpace ptPS(100,0,100);
    PhaseSpace phiPS(360, -3.1416, 3.1416);
    PhaseSpace etaPS(100, -5,5);
    switch(mode_) {
    case DQMOFFLINE:
    default:
      ptPS = PhaseSpace(50, 0, 100);
      phiPS.n = 50;
      etaPS.n = 20;
      break;
    }
    
    pt_ = book1D("pt_", "pt_;p_{T} (GeV)", ptPS.n, ptPS.m, ptPS.M);
    
    eta_ = book1D("eta_", "eta_;#eta", etaPS.n, etaPS.m, etaPS.M);
    
    phi_ = book1D("phi_", "phi_;#phi", phiPS.n, phiPS.m, phiPS.M);

    charge_ = book1D("charge_", "charge_;charge", 3,-1.5,1.5);

    histogramBooked_ = true;
  }
}
void CandidateBenchmark::setup ( const edm::ParameterSet parameterSet)

book histograms

Definition at line 56 of file CandidateBenchmark.cc.

References Benchmark::book1D(), charge_, eta_, edm::ParameterSet::getParameter(), histogramBooked_, phi_, and pt_.

                                                                  {
  if (!histogramBooked_)  {
    edm::ParameterSet ptPS  = parameterSet.getParameter<edm::ParameterSet>("PtHistoParameter");
    edm::ParameterSet etaPS = parameterSet.getParameter<edm::ParameterSet>("EtaHistoParameter");
    edm::ParameterSet phiPS = parameterSet.getParameter<edm::ParameterSet>("PhiHistoParameter");
    edm::ParameterSet chPS = parameterSet.getParameter<edm::ParameterSet>("ChargeHistoParameter");
    
    if (ptPS.getParameter<bool>("switchOn")) {
      pt_ = book1D("pt_", "pt_;p_{T} (GeV)", ptPS.getParameter<int32_t>("nBin"), 
                   ptPS.getParameter<double>("xMin"),
                   ptPS.getParameter<double>("xMax"));
    } 
    
    if (etaPS.getParameter<bool>("switchOn")) {
      eta_ = book1D("eta_", "eta_;#eta", etaPS.getParameter<int32_t>("nBin"), 
                    etaPS.getParameter<double>("xMin"),
                    etaPS.getParameter<double>("xMax"));
    }
    if (phiPS.getParameter<bool>("switchOn")) {
      phi_ = book1D("phi_", "phi_;#phi", phiPS.getParameter<int32_t>("nBin"), 
                    phiPS.getParameter<double>("xMin"),
                    phiPS.getParameter<double>("xMax"));
    }
    if (chPS.getParameter<bool>("switchOn")) {
      charge_ = book1D("charge_","charge_;charge",chPS.getParameter<int32_t>("nBin"),
                       chPS.getParameter<double>("xMin"),
                       chPS.getParameter<double>("xMax"));
    }   
    histogramBooked_ = true;
  }
}

Member Data Documentation

TH1F* CandidateBenchmark::charge_ [protected]

Definition at line 35 of file CandidateBenchmark.h.

Referenced by CandidateBenchmark(), fillOne(), and setup().

TH1F* CandidateBenchmark::eta_ [protected]

Definition at line 33 of file CandidateBenchmark.h.

Referenced by CandidateBenchmark(), fillOne(), and setup().

Definition at line 39 of file CandidateBenchmark.h.

Referenced by CandidateBenchmark(), fillOne(), and setup().

TH1F* CandidateBenchmark::pdgId_ [protected]

COLIN add this histo.

Definition at line 37 of file CandidateBenchmark.h.

Referenced by CandidateBenchmark().

TH1F* CandidateBenchmark::phi_ [protected]

Definition at line 34 of file CandidateBenchmark.h.

Referenced by CandidateBenchmark(), fillOne(), and setup().

TH1F* CandidateBenchmark::pt_ [protected]

Definition at line 32 of file CandidateBenchmark.h.

Referenced by CandidateBenchmark(), fillOne(), and setup().