CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TrackProbabilityTagPlotter Class Reference

#include <TrackProbabilityTagPlotter.h>

Inheritance diagram for TrackProbabilityTagPlotter:
BaseTagInfoPlotter BaseBTagPlotter

Public Member Functions

void analyzeTag (const reco::BaseTagInfo *tagInfo, double jec, int jetFlavour, float w=1) override
 
void epsPlot (const std::string &name) override
 
void finalize (DQMStore::IBooker &ibook_, DQMStore::IGetter &igetter_) override
 
void psPlot (const std::string &name) override
 
 TrackProbabilityTagPlotter (const std::string &tagName, const EtaPtBin &etaPtBin, const edm::ParameterSet &pSet, const unsigned int &mc, const bool &wf, DQMStore::IBooker &ibook)
 
 ~TrackProbabilityTagPlotter () override
 
- Public Member Functions inherited from BaseTagInfoPlotter
virtual void analyzeTag (const std::vector< const reco::BaseTagInfo * > &tagInfos, double jec, int jetFlavour, float w=1)
 
 BaseTagInfoPlotter (const std::string &tagName, const EtaPtBin &etaPtBin)
 
virtual void setEventSetup (const edm::EventSetup &setup)
 
virtual std::vector< std::string > tagInfoRequirements () const
 
 ~BaseTagInfoPlotter () override
 
- Public Member Functions inherited from BaseBTagPlotter
 BaseBTagPlotter (const std::string &tagName, const EtaPtBin &etaPtBin)
 
const EtaPtBinetaPtBin ()
 
virtual ~BaseBTagPlotter ()
 

Private Attributes

std::vector< std::unique_ptr< EffPurFromHistos > > effPurFromHistos_
 
double endEffPur_
 
unsigned int mcPlots_
 
int nBinEffPur_
 
double startEffPur_
 
std::vector< std::unique_ptr< FlavourHistograms< double > > > tkcntHistosSig2D_
 
std::vector< std::unique_ptr< FlavourHistograms< double > > > tkcntHistosSig3D_
 
bool willFinalize_
 

Additional Inherited Members

- Protected Attributes inherited from BaseBTagPlotter
const EtaPtBin etaPtBin_
 
const std::string tagName_
 
const std::string theExtensionString
 

Detailed Description

Definition at line 12 of file TrackProbabilityTagPlotter.h.

Constructor & Destructor Documentation

TrackProbabilityTagPlotter::TrackProbabilityTagPlotter ( const std::string &  tagName,
const EtaPtBin etaPtBin,
const edm::ParameterSet pSet,
const unsigned int &  mc,
const bool &  wf,
DQMStore::IBooker ibook 
)

Definition at line 7 of file TrackProbabilityTagPlotter.cc.

References dir, mps_fire::i, AlCaHLTBitMon_QueryRunRegistry::string, BaseBTagPlotter::theExtensionString, tkcntHistosSig2D_, tkcntHistosSig3D_, and willFinalize_.

9  :
10  BaseTagInfoPlotter(tagName, etaPtBin),
11  nBinEffPur_(pSet.getParameter<int>("nBinEffPur")),
12  startEffPur_(pSet.getParameter<double>("startEffPur")),
13  endEffPur_(pSet.getParameter<double>("endEffPur")),
15 {
16  const std::string dir(theExtensionString.substr(1));
17 
18  if (willFinalize_) return;
19 
20  for (unsigned int i = 1; i <= 4; i++) {
21  tkcntHistosSig3D_.push_back(std::make_unique<FlavourHistograms<double>>
22  ("ips" + std::to_string(i) + "_3D" + theExtensionString, "3D Probability of impact parameter " + std::to_string(i) + ". trk",
23  50, -1.0, 1.0, false, true, true, "b", dir, mc, ibook));
24  }
25 
26  tkcntHistosSig3D_.push_back(std::make_unique<FlavourHistograms<double>>
27  ("ips_3D" + theExtensionString, "3D Probability of impact parameter",
28  50, -1.0, 1.0, false, true, true, "b", dir, mc, ibook));
29 
30 
31  for (unsigned int i = 1; i <= 4; i++) {
32  tkcntHistosSig2D_.push_back(std::make_unique<FlavourHistograms<double>>
33  ("ips" + std::to_string(i) + "_2D" + theExtensionString, "2D Probability of impact parameter " + std::to_string(i) + ". trk",
34  50, -1.0, 1.0, false, true, true, "b", dir, mc, ibook));
35  }
36 
37  tkcntHistosSig2D_.push_back(std::make_unique<FlavourHistograms<double>>
38  ("ips_2D" + theExtensionString, "2D Probability of impact parameter",
39  50, -1.0, 1.0, false, true, true, "b", dir, mc, ibook));
40 }
T getParameter(std::string const &) const
std::vector< std::unique_ptr< FlavourHistograms< double > > > tkcntHistosSig2D_
const std::string theExtensionString
BaseTagInfoPlotter(const std::string &tagName, const EtaPtBin &etaPtBin)
std::vector< std::unique_ptr< FlavourHistograms< double > > > tkcntHistosSig3D_
dbl *** dir
Definition: mlp_gen.cc:35
TrackProbabilityTagPlotter::~TrackProbabilityTagPlotter ( )
override

Definition at line 43 of file TrackProbabilityTagPlotter.cc.

43 { }

Member Function Documentation

void TrackProbabilityTagPlotter::analyzeTag ( const reco::BaseTagInfo tagInfo,
double  jec,
int  jetFlavour,
float  w = 1 
)
overridevirtual

Reimplemented from BaseTagInfoPlotter.

Definition at line 45 of file TrackProbabilityTagPlotter.cc.

References Exception, lumiContext::fill, gen::n, reco::TrackProbabilityTagInfo::probability(), reco::TrackProbabilityTagInfo::selectedTracks(), tkcntHistosSig2D_, tkcntHistosSig3D_, and w.

49 {
50  const reco::TrackProbabilityTagInfo * tagInfo =
51  dynamic_cast<const reco::TrackProbabilityTagInfo *>(baseTagInfo);
52 
53  if (!tagInfo) {
54  throw cms::Exception("Configuration")
55  << "BTagPerformanceAnalyzer: Extended TagInfo not of type TrackProbabilityTagInfo. " << endl;
56  }
57 
58  for (int n = 0; n != tagInfo->selectedTracks(1) && n != 4; ++n)
59  tkcntHistosSig2D_[n]->fill(jetFlavour, tagInfo->probability(n, 1), w);
60  for (int n = 0; n != tagInfo->selectedTracks(0) && n != 4; ++n)
61  tkcntHistosSig3D_[n]->fill(jetFlavour, tagInfo->probability(n, 0), w);
62 
63  for (int n = 0; n != tagInfo->selectedTracks(1); ++n)
64  tkcntHistosSig2D_[4]->fill(jetFlavour, tagInfo->probability(n, 1), w);
65  for (int n = 0; n != tagInfo->selectedTracks(0); ++n)
66  tkcntHistosSig3D_[4]->fill(jetFlavour, tagInfo->probability(n, 0), w);
67 }
std::vector< std::unique_ptr< FlavourHistograms< double > > > tkcntHistosSig2D_
const double w
Definition: UKUtility.cc:23
virtual float probability(size_t n, int ip) const
std::vector< std::unique_ptr< FlavourHistograms< double > > > tkcntHistosSig3D_
virtual int selectedTracks(int ipType) const
void TrackProbabilityTagPlotter::epsPlot ( const std::string &  name)
overridevirtual

Implements BaseBTagPlotter.

Definition at line 158 of file TrackProbabilityTagPlotter.cc.

References effPurFromHistos_, gen::n, tkcntHistosSig2D_, tkcntHistosSig3D_, and willFinalize_.

159 {
160  if (willFinalize_) {
161  for (int n = 0; n != 4; ++n) effPurFromHistos_[n]->epsPlot(name);
162  return;
163  }
164  for (int n = 0; n != 5; ++n) {
165  tkcntHistosSig2D_[n]->epsPlot(name);
166  tkcntHistosSig3D_[n]->epsPlot(name);
167  }
168 }
std::vector< std::unique_ptr< FlavourHistograms< double > > > tkcntHistosSig2D_
void epsPlot(const std::string &name) override
std::vector< std::unique_ptr< EffPurFromHistos > > effPurFromHistos_
std::vector< std::unique_ptr< FlavourHistograms< double > > > tkcntHistosSig3D_
void TrackProbabilityTagPlotter::finalize ( DQMStore::IBooker ibook_,
DQMStore::IGetter igetter_ 
)
overridevirtual

Implements BaseBTagPlotter.

Definition at line 69 of file TrackProbabilityTagPlotter.cc.

References bookConverter::compute(), dir, effPurFromHistos_, endEffPur_, mps_fire::i, mcPlots_, gen::n, nBinEffPur_, startEffPur_, AlCaHLTBitMon_QueryRunRegistry::string, BaseBTagPlotter::theExtensionString, tkcntHistosSig2D_, and tkcntHistosSig3D_.

70 {
71  //
72  // final processing:
73  // produce the misid. vs. eff histograms
74  //
75  const std::string dir("TrackProbability" + theExtensionString);
76 
77  tkcntHistosSig3D_.clear();
78  tkcntHistosSig2D_.clear();
79  effPurFromHistos_.clear();
80 
81  for (unsigned int i = 2; i <= 3; i++) {
82  tkcntHistosSig3D_.push_back(
83  std::make_unique<FlavourHistograms<double>>
84  ("ips" + std::to_string(i) + "_3D" + theExtensionString, "3D Probability of impact parameter " + std::to_string(i) + ". trk",
85  50, -1.0, 1.0, "b", dir, mcPlots_, igetter_));
86  effPurFromHistos_.push_back(
87  std::make_unique<EffPurFromHistos>(*tkcntHistosSig3D_.back(), dir, mcPlots_, ibook,
89  }
90 
91  for (unsigned int i = 2; i <= 3; i++) {
92  tkcntHistosSig2D_.push_back(
93  std::make_unique<FlavourHistograms<double>>
94  ("ips" + std::to_string(i) + "_2D" + theExtensionString, "2D Probability of impact parameter " + std::to_string(i) + ". trk",
95  50, -1.0, 1.0, "b", dir, mcPlots_, igetter_));
96  effPurFromHistos_.push_back(
97  std::make_unique<EffPurFromHistos>(*tkcntHistosSig2D_.back(), dir, mcPlots_, ibook,
99  }
100 
101  for (int n = 0; n != 4; ++n) effPurFromHistos_[n]->compute(ibook);
102 }
std::vector< std::unique_ptr< FlavourHistograms< double > > > tkcntHistosSig2D_
const std::string theExtensionString
std::vector< std::unique_ptr< EffPurFromHistos > > effPurFromHistos_
std::vector< std::unique_ptr< FlavourHistograms< double > > > tkcntHistosSig3D_
def compute(min, max)
dbl *** dir
Definition: mlp_gen.cc:35
void TrackProbabilityTagPlotter::psPlot ( const std::string &  name)
overridevirtual

Implements BaseBTagPlotter.

Definition at line 104 of file TrackProbabilityTagPlotter.cc.

References svgfig::canvas(), effPurFromHistos_, gen::n, plotscripts::setTDRStyle(), AlCaHLTBitMon_QueryRunRegistry::string, BaseBTagPlotter::theExtensionString, tkcntHistosSig2D_, tkcntHistosSig3D_, and willFinalize_.

105 {
106  const std::string cName("TrackProbabilityPlots"+ theExtensionString);
107  setTDRStyle()->cd();
108  TCanvas canvas(cName.c_str(), cName.c_str(), 600, 900);
109  canvas.UseCurrentStyle();
110  if (willFinalize_) {
111  for (int n=0; n != 2; ++n) {
112  canvas.Print((name + cName + ".ps").c_str());
113  canvas.Clear();
114  canvas.Divide(2,3);
115  canvas.cd(1);
116  effPurFromHistos_[0+n]->discriminatorNoCutEffic().plot();
117  canvas.cd(2);
118  effPurFromHistos_[0+n]->discriminatorCutEfficScan().plot();
119  canvas.cd(3);
120  effPurFromHistos_[0+n]->plot();
121  canvas.cd(4);
122  effPurFromHistos_[1+n]->discriminatorNoCutEffic().plot();
123  canvas.cd(5);
124  effPurFromHistos_[1+n]->discriminatorCutEfficScan().plot();
125  canvas.cd(6);
126  effPurFromHistos_[1+n]->plot();
127  }
128  return;
129  }
130 
131  canvas.Clear();
132  canvas.Divide(2,3);
133  canvas.Print((name + cName + ".ps[").c_str());
134  canvas.cd(1);
135 
136  tkcntHistosSig3D_[4]->plot();
137  for (int n = 0; n != 4; ++n) {
138  canvas.cd(2+n);
139  tkcntHistosSig3D_[n]->plot();
140  }
141 
142  canvas.Print((name + cName + ".ps").c_str());
143  canvas.Clear();
144  canvas.Divide(2,3);
145 
146  canvas.cd(1);
147  tkcntHistosSig2D_[4]->plot();
148  for (int n = 0; n != 4; ++n) {
149  canvas.cd(2+n);
150  tkcntHistosSig2D_[n]->plot();
151  }
152 
153  canvas.Print((name + cName + ".ps").c_str());
154  canvas.Print((name + cName + ".ps]").c_str());
155 }
std::vector< std::unique_ptr< FlavourHistograms< double > > > tkcntHistosSig2D_
const std::string theExtensionString
std::vector< std::unique_ptr< EffPurFromHistos > > effPurFromHistos_
def setTDRStyle()
Definition: plotscripts.py:89
std::vector< std::unique_ptr< FlavourHistograms< double > > > tkcntHistosSig3D_
def canvas(sub, attr)
Definition: svgfig.py:482

Member Data Documentation

std::vector< std::unique_ptr<EffPurFromHistos> > TrackProbabilityTagPlotter::effPurFromHistos_
private

Definition at line 38 of file TrackProbabilityTagPlotter.h.

Referenced by epsPlot(), finalize(), and psPlot().

double TrackProbabilityTagPlotter::endEffPur_
private

Definition at line 35 of file TrackProbabilityTagPlotter.h.

Referenced by finalize().

unsigned int TrackProbabilityTagPlotter::mcPlots_
private

Definition at line 39 of file TrackProbabilityTagPlotter.h.

Referenced by finalize().

int TrackProbabilityTagPlotter::nBinEffPur_
private

Definition at line 33 of file TrackProbabilityTagPlotter.h.

Referenced by finalize().

double TrackProbabilityTagPlotter::startEffPur_
private

Definition at line 34 of file TrackProbabilityTagPlotter.h.

Referenced by finalize().

std::vector< std::unique_ptr<FlavourHistograms<double> > > TrackProbabilityTagPlotter::tkcntHistosSig2D_
private
std::vector< std::unique_ptr<FlavourHistograms<double> > > TrackProbabilityTagPlotter::tkcntHistosSig3D_
private
bool TrackProbabilityTagPlotter::willFinalize_
private

Definition at line 40 of file TrackProbabilityTagPlotter.h.

Referenced by epsPlot(), psPlot(), and TrackProbabilityTagPlotter().