00001 #ifndef HLTriggerOffline_BJet_OfflineJetPlots_h
00002 #define HLTriggerOffline_BJet_OfflineJetPlots_h
00003
00004
00005 #include <vector>
00006 #include <string>
00007
00008
00009 #include <TDirectory.h>
00010
00011
00012 #include "DataFormats/JetReco/interface/Jet.h"
00013 #include "DataFormats/JetReco/interface/JetTracksAssociation.h"
00014 #include "DataFormats/TrackReco/interface/Track.h"
00015 #include "HLTriggerOffline/BJet/interface/JetPlots.h"
00016
00017 struct OfflineJetPlots {
00018
00019 std::vector<double> m_cuts;
00020 std::vector<std::string> m_labels;
00021 std::vector<JetPlots> m_plots;
00022
00023 void init(
00024 const std::string & name,
00025 const std::string & title,
00026 const std::vector<double> & cuts,
00027 const std::vector<std::string> & labels,
00028 unsigned int energyBins,
00029 double minEnergy,
00030 double maxEnergy,
00031 unsigned int geometryBins,
00032 double maxEta,
00033 bool hasTracks = false
00034 ) {
00035 m_cuts = cuts;
00036 m_labels = labels;
00037 m_plots.resize( m_cuts.size() );
00038 for (unsigned int i = 0; i < m_cuts.size(); ++i)
00039 m_plots[i].init(name + "_" + m_labels[i], title + " (" + m_labels[i] + ")", energyBins, minEnergy, maxEnergy, geometryBins, maxEta, hasTracks);
00040 }
00041
00042 void fill(const reco::Jet & jet, double discriminant) {
00043 for (unsigned int i = 0; i < m_cuts.size(); ++i)
00044 if (discriminant >= m_cuts[i])
00045 m_plots[i].fill(jet);
00046 }
00047
00048 void fill(const reco::Jet & jet, const reco::TrackRefVector & tracks, double discriminant) {
00049 for (unsigned int i = 0; i < m_cuts.size(); ++i)
00050 if (discriminant >= m_cuts[i])
00051 m_plots[i].fill(jet, tracks);
00052 }
00053
00054 void save(TDirectory & file) {
00055 for (unsigned int i = 0; i < m_cuts.size(); ++i)
00056 m_plots[i].save(file);
00057 }
00058
00059 OfflineJetPlots efficiency(const OfflineJetPlots & denominator) {
00060 OfflineJetPlots efficiency;
00061 efficiency.m_cuts = m_cuts;
00062 efficiency.m_labels = m_labels;
00063 efficiency.m_plots.resize(m_cuts.size());
00064 for (unsigned int i = 0; i < m_cuts.size(); ++i)
00065 efficiency.m_plots[i] = m_plots[i].efficiency( denominator.m_plots[i] );
00066 return efficiency;
00067 }
00068 };
00069
00070 #endif // HLTriggerOffline_BJet_OfflineJetPlots_h