CMS 3D CMS Logo

Public Member Functions | Protected Attributes

PFJetMonitor Class Reference

#include <PFJetMonitor.h>

Inheritance diagram for PFJetMonitor:
Benchmark

List of all members.

Public Member Functions

template<class T , class C >
void fill (const T &jetCollection, const C &matchedJetCollection, float &minVal, float &maxVal)
 fill histograms with all particle
void fillOne (const reco::Jet &jet, const reco::Jet &matchedJet)
 PFJetMonitor (float dRMax=0.3, bool matchCharge=true, Benchmark::Mode mode=Benchmark::DEFAULT)
void setDirectory (TDirectory *dir)
 set directory (to use in ROOT)
void setParameters (const edm::ParameterSet &parameterSet)
 set the parameters accessing them from ParameterSet
void setParameters (float dRMax, bool matchCharge, Benchmark::Mode mode, float ptmin, float ptmax, float etamin, float etamax, float phimin, float phimax, bool fracHistoFlag=true)
 set the parameters locally
void setup ()
 book histograms
void setup (const edm::ParameterSet &parameterSet)
 book histograms
virtual ~PFJetMonitor ()

Protected Attributes

CandidateBenchmark candBench_
bool createPFractionHistos_
TH2F * delta_frac_VS_frac_charged_hadron_
TH2F * delta_frac_VS_frac_electron_
TH2F * delta_frac_VS_frac_muon_
TH2F * delta_frac_VS_frac_neutral_hadron_
TH2F * delta_frac_VS_frac_photon_
float dRMax_
bool histogramBooked_
MatchCandidateBenchmark matchCandBench_
bool matchCharge_

Detailed Description

Definition at line 12 of file PFJetMonitor.h.


Constructor & Destructor Documentation

PFJetMonitor::PFJetMonitor ( float  dRMax = 0.3,
bool  matchCharge = true,
Benchmark::Mode  mode = Benchmark::DEFAULT 
)
PFJetMonitor::~PFJetMonitor ( ) [virtual]

Definition at line 36 of file PFJetMonitor.cc.

{}

Member Function Documentation

template<class T , class C >
void PFJetMonitor::fill ( const T jetCollection,
const C &  matchedJetCollection,
float &  minVal,
float &  maxVal 
)

fill histograms with all particle

Definition at line 67 of file PFJetMonitor.h.

References candBench_, createPFractionHistos_, dRMax_, reco::LeafCandidate::eta(), reco::Candidate::eta(), fillOne(), CandidateBenchmark::fillOne(), MatchCandidateBenchmark::fillOne(), histogramBooked_, i, Benchmark::isInRange(), metsig::jet, match(), matchCandBench_, matchCharge_, reco::LeafCandidate::phi(), reco::Candidate::phi(), reco::LeafCandidate::pt(), reco::Candidate::pt(), and findQualityFiles::size.

Referenced by PFJetDQMAnalyzer::analyze(), and PFRootEventManager::processEntry().

                                                                                     {
  

  std::vector<int> matchIndices;
  PFB::match( jetCollection, matchedJetCollection, matchIndices, 
              matchCharge_, dRMax_ );

  for (unsigned int i = 0; i < (jetCollection).size(); i++) {
    const reco::Jet& jet = jetCollection[i];

    if( !isInRange(jet.pt(), jet.eta(), jet.phi() ) ) continue;
    
    int iMatch = matchIndices[i];
    assert(iMatch< static_cast<int>(matchedJetCollection.size()));

    if( iMatch!=-1 ) {
      const reco::Candidate& matchedJet = matchedJetCollection[ iMatch ];
      if(!isInRange(matchedJet.pt(),matchedJet.eta(),matchedJet.phi() ) ) continue;
      float ptRes = (jet.pt() - matchedJet.pt())/matchedJet.pt();
      
      if (ptRes > maxVal) maxVal = ptRes;
      if (ptRes < minVal) minVal = ptRes;
 
      candBench_.fillOne(jet);
      matchCandBench_.fillOne(jet, matchedJetCollection[ iMatch ]);
      if (createPFractionHistos_ && histogramBooked_) fillOne(jet, matchedJetCollection[ iMatch ]);
    }
  }
}
void PFJetMonitor::fillOne ( const reco::Jet jet,
const reco::Jet matchedJet 
)

Definition at line 135 of file PFJetMonitor.cc.

References reco::PFJet::chargedHadronMultiplicity(), createPFractionHistos_, delta_frac_VS_frac_charged_hadron_, delta_frac_VS_frac_electron_, delta_frac_VS_frac_muon_, delta_frac_VS_frac_neutral_hadron_, delta_frac_VS_frac_photon_, reco::PFJet::electronMultiplicity(), metsig::jet, reco::PFJet::muonMultiplicity(), reco::PFJet::neutralHadronMultiplicity(), and reco::PFJet::photonMultiplicity().

Referenced by fill().

                                                   {
  const reco::PFJet* pfJet = dynamic_cast<const reco::PFJet*>(&jet);
  const reco::PFJet* pfMatchedJet = dynamic_cast<const reco::PFJet*>(&matchedJet);
  if (pfJet && pfMatchedJet && createPFractionHistos_) {
    float del_frac_muon    = -99.9;
    float del_frac_elec    = -99.9; 
    float del_frac_phot    = -99.9;
    float del_frac_ch_had  = -99.9;
    float del_frac_neu_had = -99.9;

    int mult_muon = pfMatchedJet->muonMultiplicity();
    int mult_elec = pfMatchedJet->electronMultiplicity();
    int mult_phot = pfMatchedJet->photonMultiplicity();
    int mult_ch_had = pfMatchedJet->chargedHadronMultiplicity();
    int mult_neu_had = pfMatchedJet->neutralHadronMultiplicity();
 
    if (mult_muon > 0)     del_frac_muon = (pfJet->muonMultiplicity() - mult_muon)*1.0/mult_muon; 
    if (mult_elec > 0)     del_frac_elec = (pfJet->electronMultiplicity() - mult_elec)*1.0/mult_elec; 
    if (mult_phot > 0)     del_frac_phot = (pfJet->photonMultiplicity() - mult_phot)*1.0/mult_phot; 
    if (mult_ch_had > 0)   del_frac_ch_had = (pfJet->chargedHadronMultiplicity() - mult_ch_had)*1.0/mult_ch_had; 
    if (mult_neu_had > 0)  del_frac_neu_had = (pfJet->neutralHadronMultiplicity() - mult_neu_had)*1.0/mult_neu_had; 

    delta_frac_VS_frac_muon_->Fill(mult_muon, del_frac_muon);
    delta_frac_VS_frac_electron_->Fill(mult_elec, del_frac_elec);
    delta_frac_VS_frac_photon_->Fill(mult_phot, del_frac_phot);
    delta_frac_VS_frac_charged_hadron_->Fill(mult_ch_had, del_frac_ch_had);
    delta_frac_VS_frac_neutral_hadron_->Fill(mult_neu_had, del_frac_neu_had);
  }
}
void PFJetMonitor::setDirectory ( TDirectory *  dir) [virtual]

set directory (to use in ROOT)

Reimplemented from Benchmark.

Definition at line 126 of file PFJetMonitor.cc.

References candBench_, matchCandBench_, and Benchmark::setDirectory().

Referenced by PFRootEventManager::readOptions().

void PFJetMonitor::setParameters ( const edm::ParameterSet parameterSet)

set the parameters accessing them from ParameterSet

Definition at line 41 of file PFJetMonitor.cc.

References candBench_, createPFractionHistos_, dRMax_, edm::ParameterSet::getParameter(), matchCandBench_, matchCharge_, Benchmark::mode_, Benchmark::setParameters(), and Benchmark::setRange().

                                                                      {

  dRMax_                 = parameterSet.getParameter<double>( "deltaRMax" );
  matchCharge_           = parameterSet.getParameter<bool>( "matchCharge" );
  mode_                  = (Benchmark::Mode) parameterSet.getParameter<int>( "mode" );
  createPFractionHistos_ = parameterSet.getParameter<bool>( "CreatePFractionHistos" );

  
  setRange( parameterSet.getParameter<double>("ptMin"),
            parameterSet.getParameter<double>("ptMax"),
            parameterSet.getParameter<double>("etaMin"),
            parameterSet.getParameter<double>("etaMax"),
            parameterSet.getParameter<double>("phiMin"),
            parameterSet.getParameter<double>("phiMax") );

  candBench_.setParameters(mode_);
  matchCandBench_.setParameters(mode_);
}
void PFJetMonitor::setParameters ( float  dRMax,
bool  matchCharge,
Benchmark::Mode  mode,
float  ptmin,
float  ptmax,
float  etamin,
float  etamax,
float  phimin,
float  phimax,
bool  fracHistoFlag = true 
)
void PFJetMonitor::setup ( void  )

book histograms

Definition at line 102 of file PFJetMonitor.cc.

References Benchmark::book2D(), candBench_, createPFractionHistos_, delta_frac_VS_frac_charged_hadron_, delta_frac_VS_frac_electron_, delta_frac_VS_frac_muon_, delta_frac_VS_frac_neutral_hadron_, delta_frac_VS_frac_photon_, histogramBooked_, matchCandBench_, MatchCandidateBenchmark::setup(), and CandidateBenchmark::setup().

Referenced by PFJetDQMAnalyzer::beginJob(), and PFRootEventManager::readOptions().

                         {
  candBench_.setup();
  matchCandBench_.setup();

  if (createPFractionHistos_ && !histogramBooked_) {
    delta_frac_VS_frac_muon_ = book2D("delta_frac_VS_frac_muon_", 
 "#DeltaFraction_Vs_Fraction(muon)", 100, 0.0, 1.0, 100, -1.0, 1.0);
    delta_frac_VS_frac_photon_ = book2D("delta_frac_VS_frac_photon_", 
 "#DeltaFraction_Vs_Fraction(photon)", 100, 0.0, 1.0, 100, -1.0, 1.0);
    delta_frac_VS_frac_electron_ = book2D("delta_frac_VS_frac_electron_", 
 "#DeltaFraction_Vs_Fraction(electron)", 100, 0.0, 1.0, 100, -1.0, 1.0);
    delta_frac_VS_frac_charged_hadron_ = book2D("delta_frac_VS_frac_charged_hadron_", 
 "#DeltaFraction_Vs_Fraction(charged hadron)", 100, 0.0, 1.0, 100, -1.0, 1.0);
    delta_frac_VS_frac_neutral_hadron_ = book2D("delta_frac_VS_frac_neutral_hadron_", 
 "#DeltaFraction_Vs_Fraction(neutral hadron)", 100, 0.0, 1.0, 100, -1.0, 1.0);

    histogramBooked_ = true;
  }

}
void PFJetMonitor::setup ( const edm::ParameterSet parameterSet)

book histograms

Definition at line 79 of file PFJetMonitor.cc.

References Benchmark::book2D(), candBench_, createPFractionHistos_, delta_frac_VS_frac_charged_hadron_, delta_frac_VS_frac_electron_, delta_frac_VS_frac_muon_, delta_frac_VS_frac_neutral_hadron_, delta_frac_VS_frac_photon_, histogramBooked_, matchCandBench_, MatchCandidateBenchmark::setup(), and CandidateBenchmark::setup().

                                                             {
  candBench_.setup(parameterSet);
  matchCandBench_.setup(parameterSet);

  if (createPFractionHistos_ && !histogramBooked_) {
    delta_frac_VS_frac_muon_ = book2D("delta_frac_VS_frac_muon_", 
 "#DeltaFraction_Vs_Fraction(muon)", 100, 0.0, 1.0, 100, -1.0, 1.0);
    delta_frac_VS_frac_photon_ = book2D("delta_frac_VS_frac_photon_", 
 "#DeltaFraction_Vs_Fraction(photon)", 100, 0.0, 1.0, 100, -1.0, 1.0);
    delta_frac_VS_frac_electron_ = book2D("delta_frac_VS_frac_electron_", 
 "#DeltaFraction_Vs_Fraction(electron)", 100, 0.0, 1.0, 100, -1.0, 1.0);
    delta_frac_VS_frac_charged_hadron_ = book2D("delta_frac_VS_frac_charged_hadron_", 
 "#DeltaFraction_Vs_Fraction(charged hadron)", 100, 0.0, 1.0, 100, -1.0, 1.0);
    delta_frac_VS_frac_neutral_hadron_ = book2D("delta_frac_VS_frac_neutral_hadron_", 
 "#DeltaFraction_Vs_Fraction(neutral hadron)", 100, 0.0, 1.0, 100, -1.0, 1.0);
  
    histogramBooked_ = true;
  }

}

Member Data Documentation

Definition at line 49 of file PFJetMonitor.h.

Referenced by fill(), setDirectory(), setParameters(), and setup().

Definition at line 60 of file PFJetMonitor.h.

Referenced by fill(), fillOne(), PFJetMonitor(), setParameters(), and setup().

Definition at line 55 of file PFJetMonitor.h.

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

Definition at line 54 of file PFJetMonitor.h.

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

Definition at line 52 of file PFJetMonitor.h.

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

Definition at line 56 of file PFJetMonitor.h.

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

Definition at line 53 of file PFJetMonitor.h.

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

float PFJetMonitor::dRMax_ [protected]

Definition at line 58 of file PFJetMonitor.h.

Referenced by fill(), and setParameters().

Definition at line 61 of file PFJetMonitor.h.

Referenced by fill(), PFJetMonitor(), and setup().

Definition at line 50 of file PFJetMonitor.h.

Referenced by fill(), setDirectory(), setParameters(), and setup().

bool PFJetMonitor::matchCharge_ [protected]

Definition at line 59 of file PFJetMonitor.h.

Referenced by fill(), and setParameters().