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
void setup (const edm::ParameterSet &parameterSet)
 book histograms
void setup ()
 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_
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 
) [inline]

Definition at line 16 of file PFJetMonitor.h.

PFJetMonitor::~PFJetMonitor ( ) [virtual]

Definition at line 13 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 65 of file PFJetMonitor.h.

References candBench_, createPFractionHistos_, dRMax_, reco::LeafCandidate::eta(), reco::Candidate::eta(), fillOne(), MatchCandidateBenchmark::fillOne(), CandidateBenchmark::fillOne(), 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().

                                                                                     {
  

  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_) fillOne(jet, matchedJetCollection[ iMatch ]);
    }
  }
}
void PFJetMonitor::fillOne ( const reco::Jet jet,
const reco::Jet matchedJet 
)

Definition at line 78 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 frac_muon = -99.9;
    float frac_elec = -99.9; 
    float frac_phot = -99.9;
    float frac_ch_had = -99.9;
    float frac_neu_had = -99.9;
 
    if (pfMatchedJet->muonMultiplicity() > 0) frac_muon = (pfJet->muonMultiplicity() - pfMatchedJet->muonMultiplicity())*1.0/pfMatchedJet->muonMultiplicity(); 
    if (pfMatchedJet->chargedHadronMultiplicity() > 0) frac_ch_had = (pfJet->chargedHadronMultiplicity() - pfMatchedJet->chargedHadronMultiplicity())*1.0/pfMatchedJet->chargedHadronMultiplicity(); 
    if (pfMatchedJet->neutralHadronMultiplicity() > 0) frac_neu_had = (pfJet->neutralHadronMultiplicity() - pfMatchedJet->neutralHadronMultiplicity())*1.0/pfMatchedJet->neutralHadronMultiplicity(); 
    if (pfMatchedJet->photonMultiplicity() > 0) frac_phot = (pfJet->photonMultiplicity() - pfMatchedJet->photonMultiplicity())*1.0/pfMatchedJet->photonMultiplicity(); 
    if (pfMatchedJet->electronMultiplicity() > 0) frac_elec = (pfJet->electronMultiplicity() - pfMatchedJet->electronMultiplicity())*1.0/pfMatchedJet->electronMultiplicity(); 

    delta_frac_VS_frac_muon_->Fill(frac_muon);
    delta_frac_VS_frac_electron_->Fill(frac_elec);
    delta_frac_VS_frac_photon_->Fill(frac_phot);
    delta_frac_VS_frac_charged_hadron_->Fill(frac_ch_had);
    delta_frac_VS_frac_neutral_hadron_->Fill(frac_neu_had);
  }
}
void PFJetMonitor::setDirectory ( TDirectory *  dir) [virtual]

set directory (to use in ROOT)

Reimplemented from Benchmark.

Definition at line 71 of file PFJetMonitor.cc.

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

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

set the parameters

Definition at line 16 of file PFJetMonitor.cc.

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

Referenced by PFJetDQMAnalyzer::PFJetDQMAnalyzer().

                                                                      {

  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::setup ( void  )

book histograms

Definition at line 53 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_, matchCandBench_, MatchCandidateBenchmark::setup(), and CandidateBenchmark::setup().

Referenced by PFJetDQMAnalyzer::beginJob().

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

  if (createPFractionHistos_) {
    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);
  }

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

book histograms

Definition at line 35 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_, matchCandBench_, MatchCandidateBenchmark::setup(), and CandidateBenchmark::setup().

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

  if (createPFractionHistos_) {
    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);
  }

}

Member Data Documentation

Definition at line 48 of file PFJetMonitor.h.

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

Definition at line 59 of file PFJetMonitor.h.

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

Definition at line 54 of file PFJetMonitor.h.

Referenced by fillOne(), and setup().

Definition at line 53 of file PFJetMonitor.h.

Referenced by fillOne(), and setup().

Definition at line 51 of file PFJetMonitor.h.

Referenced by fillOne(), and setup().

Definition at line 55 of file PFJetMonitor.h.

Referenced by fillOne(), and setup().

Definition at line 52 of file PFJetMonitor.h.

Referenced by fillOne(), and setup().

float PFJetMonitor::dRMax_ [protected]

Definition at line 57 of file PFJetMonitor.h.

Referenced by fill(), and setParameters().

Definition at line 49 of file PFJetMonitor.h.

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

bool PFJetMonitor::matchCharge_ [protected]

Definition at line 58 of file PFJetMonitor.h.

Referenced by fill(), and setParameters().