00001 #include "DataFormats/JetReco/interface/Jet.h" 00002 #include "DataFormats/JetReco/interface/PFJet.h" 00003 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00004 #include "DQMOffline/PFTau/interface/Matchers.h" 00005 00006 #include "DQMOffline/PFTau/interface/PFJetMonitor.h" 00007 00008 #include <TROOT.h> 00009 #include <TFile.h> 00010 #include <TH1.h> 00011 #include <TH2.h> 00012 00013 PFJetMonitor::~PFJetMonitor() {} 00014 00015 00016 void PFJetMonitor::setParameters( const edm::ParameterSet & parameterSet) { 00017 00018 dRMax_ = parameterSet.getParameter<double>( "deltaRMax" ); 00019 matchCharge_ = parameterSet.getParameter<bool>( "matchCharge" ); 00020 mode_ = (Benchmark::Mode) parameterSet.getParameter<int>( "mode" ); 00021 createPFractionHistos_ = parameterSet.getParameter<bool>( "CreatePFractionHistos" ); 00022 00023 00024 setRange( parameterSet.getParameter<double>("ptMin"), 00025 parameterSet.getParameter<double>("ptMax"), 00026 parameterSet.getParameter<double>("etaMin"), 00027 parameterSet.getParameter<double>("etaMax"), 00028 parameterSet.getParameter<double>("phiMin"), 00029 parameterSet.getParameter<double>("phiMax") ); 00030 00031 candBench_.setParameters(mode_); 00032 matchCandBench_.setParameters(mode_); 00033 } 00034 00035 void PFJetMonitor::setup(const edm::ParameterSet & parameterSet) { 00036 candBench_.setup(parameterSet); 00037 matchCandBench_.setup(parameterSet); 00038 00039 if (createPFractionHistos_) { 00040 delta_frac_VS_frac_muon_ = book2D("delta_frac_VS_frac_muon_", 00041 "#DeltaFraction_Vs_Fraction(muon)", 100, 0.0, 1.0, 100, -1.0, 1.0); 00042 delta_frac_VS_frac_photon_ = book2D("delta_frac_VS_frac_photon_", 00043 "#DeltaFraction_Vs_Fraction(photon)", 100, 0.0, 1.0, 100, -1.0, 1.0); 00044 delta_frac_VS_frac_electron_ = book2D("delta_frac_VS_frac_electron_", 00045 "#DeltaFraction_Vs_Fraction(electron)", 100, 0.0, 1.0, 100, -1.0, 1.0); 00046 delta_frac_VS_frac_charged_hadron_ = book2D("delta_frac_VS_frac_charged_hadron_", 00047 "#DeltaFraction_Vs_Fraction(charged hadron)", 100, 0.0, 1.0, 100, -1.0, 1.0); 00048 delta_frac_VS_frac_neutral_hadron_ = book2D("delta_frac_VS_frac_neutral_hadron_", 00049 "#DeltaFraction_Vs_Fraction(neutral hadron)", 100, 0.0, 1.0, 100, -1.0, 1.0); 00050 } 00051 00052 } 00053 void PFJetMonitor::setup() { 00054 candBench_.setup(); 00055 matchCandBench_.setup(); 00056 00057 if (createPFractionHistos_) { 00058 delta_frac_VS_frac_muon_ = book2D("delta_frac_VS_frac_muon_", 00059 "#DeltaFraction_Vs_Fraction(muon)", 100, 0.0, 1.0, 100, -1.0, 1.0); 00060 delta_frac_VS_frac_photon_ = book2D("delta_frac_VS_frac_photon_", 00061 "#DeltaFraction_Vs_Fraction(photon)", 100, 0.0, 1.0, 100, -1.0, 1.0); 00062 delta_frac_VS_frac_electron_ = book2D("delta_frac_VS_frac_electron_", 00063 "#DeltaFraction_Vs_Fraction(electron)", 100, 0.0, 1.0, 100, -1.0, 1.0); 00064 delta_frac_VS_frac_charged_hadron_ = book2D("delta_frac_VS_frac_charged_hadron_", 00065 "#DeltaFraction_Vs_Fraction(charged hadron)", 100, 0.0, 1.0, 100, -1.0, 1.0); 00066 delta_frac_VS_frac_neutral_hadron_ = book2D("delta_frac_VS_frac_neutral_hadron_", 00067 "#DeltaFraction_Vs_Fraction(neutral hadron)", 100, 0.0, 1.0, 100, -1.0, 1.0); 00068 } 00069 00070 } 00071 void PFJetMonitor::setDirectory(TDirectory* dir) { 00072 Benchmark::setDirectory(dir); 00073 00074 candBench_.setDirectory(dir); 00075 matchCandBench_.setDirectory(dir); 00076 } 00077 00078 void PFJetMonitor::fillOne(const reco::Jet& jet, 00079 const reco::Jet& matchedJet) { 00080 00081 const reco::PFJet* pfJet = dynamic_cast<const reco::PFJet*>(&jet); 00082 const reco::PFJet* pfMatchedJet = dynamic_cast<const reco::PFJet*>(&matchedJet); 00083 if (pfJet && pfMatchedJet && createPFractionHistos_) { 00084 float frac_muon = -99.9; 00085 float frac_elec = -99.9; 00086 float frac_phot = -99.9; 00087 float frac_ch_had = -99.9; 00088 float frac_neu_had = -99.9; 00089 00090 if (pfMatchedJet->muonMultiplicity() > 0) frac_muon = (pfJet->muonMultiplicity() - pfMatchedJet->muonMultiplicity())*1.0/pfMatchedJet->muonMultiplicity(); 00091 if (pfMatchedJet->chargedHadronMultiplicity() > 0) frac_ch_had = (pfJet->chargedHadronMultiplicity() - pfMatchedJet->chargedHadronMultiplicity())*1.0/pfMatchedJet->chargedHadronMultiplicity(); 00092 if (pfMatchedJet->neutralHadronMultiplicity() > 0) frac_neu_had = (pfJet->neutralHadronMultiplicity() - pfMatchedJet->neutralHadronMultiplicity())*1.0/pfMatchedJet->neutralHadronMultiplicity(); 00093 if (pfMatchedJet->photonMultiplicity() > 0) frac_phot = (pfJet->photonMultiplicity() - pfMatchedJet->photonMultiplicity())*1.0/pfMatchedJet->photonMultiplicity(); 00094 if (pfMatchedJet->electronMultiplicity() > 0) frac_elec = (pfJet->electronMultiplicity() - pfMatchedJet->electronMultiplicity())*1.0/pfMatchedJet->electronMultiplicity(); 00095 00096 delta_frac_VS_frac_muon_->Fill(frac_muon); 00097 delta_frac_VS_frac_electron_->Fill(frac_elec); 00098 delta_frac_VS_frac_photon_->Fill(frac_phot); 00099 delta_frac_VS_frac_charged_hadron_->Fill(frac_ch_had); 00100 delta_frac_VS_frac_neutral_hadron_->Fill(frac_neu_had); 00101 } 00102 } 00103