CMS 3D CMS Logo

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

#include <MVAJetTagPlotter.h>

Inheritance diagram for MVAJetTagPlotter:
BaseTagInfoPlotter BaseBTagPlotter

Public Member Functions

void analyzeTag (const std::vector< const reco::BaseTagInfo * > &baseTagInfos, double jec, int jetFlavour, float w=1) override
 
void epsPlot (const std::string &name) override
 
void finalize (DQMStore::IBooker &ibook_, DQMStore::IGetter &igetter_) override
 
 MVAJetTagPlotter (const std::string &tagName, const EtaPtBin &etaPtBin, const edm::ParameterSet &pSet, const std::string &folderName, unsigned int mc, bool willFinalize, DQMStore::IBooker &ibook)
 
void psPlot (const std::string &name) override
 
void setEventSetup (const edm::EventSetup &setup) override
 
std::vector< std::string > tagInfoRequirements () const override
 
 ~MVAJetTagPlotter () override
 
- Public Member Functions inherited from BaseTagInfoPlotter
virtual void analyzeTag (const reco::BaseTagInfo *tagInfo, double jec, int jetFlavour, float w=1)
 
 BaseTagInfoPlotter (const std::string &tagName, const EtaPtBin &etaPtBin)
 
 ~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< TaggingVariablePlotter > > categoryPlotters
 
reco::TaggingVariableName categoryVariable
 
const GenericMVAJetTagComputercomputer
 
std::string jetTagComputer
 

Additional Inherited Members

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

Detailed Description

Definition at line 16 of file MVAJetTagPlotter.h.

Constructor & Destructor Documentation

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

Definition at line 16 of file MVAJetTagPlotter.cc.

References categoryPlotters, categoryVariable, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), reco::getTaggingVariableName(), mps_fire::i, and AlCaHLTBitMon_QueryRunRegistry::string.

21  :
22  BaseTagInfoPlotter(folderName, etaPtBin),
23  jetTagComputer(tagName), computer(nullptr),
25 {
26  typedef std::vector<ParameterSet> VParameterSet;
27  VParameterSet pSets;
28  if (pSet.exists("categoryVariable")) {
30  pSet.getParameter<string>("categoryVariable"));
31  pSets = pSet.getParameter<VParameterSet>("categories");
32  } else pSets.push_back(pSet);
33 
34  for (unsigned int i = 0; i != pSets.size(); ++i) {
35  std::string ss = "CAT";
36  ss += std::to_string(i);
37  categoryPlotters.push_back(
38  std::make_unique<TaggingVariablePlotter>(folderName, etaPtBin,
39  pSets[i], mc, willFinalize, ibook,
40  i ? ss : std::string())
41  );
42  }
43 }
T getParameter(std::string const &) const
std::vector< std::unique_ptr< TaggingVariablePlotter > > categoryPlotters
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::string jetTagComputer
BaseTagInfoPlotter(const std::string &tagName, const EtaPtBin &etaPtBin)
TaggingVariableName getTaggingVariableName(const std::string &name)
const GenericMVAJetTagComputer * computer
reco::TaggingVariableName categoryVariable
MVAJetTagPlotter::~MVAJetTagPlotter ( )
override

Definition at line 45 of file MVAJetTagPlotter.cc.

45 { }

Member Function Documentation

void MVAJetTagPlotter::analyzeTag ( const std::vector< const reco::BaseTagInfo * > &  baseTagInfos,
double  jec,
int  jetFlavour,
float  w = 1 
)
overridevirtual

Reimplemented from BaseTagInfoPlotter.

Definition at line 60 of file MVAJetTagPlotter.cc.

References eostools::cat(), categoryPlotters, categoryVariable, computer, reco::TaggingVariableList::get(), createfilelist::int, reco::btau::lastTaggingVariable, and GenericMVAJetTagComputer::taggingVariables().

61 {
62  const JetTagComputer::TagInfoHelper helper(baseTagInfos);
64 
65  categoryPlotters.front()->analyzeTag(vars, jetFlavour, w);
67  unsigned int cat = (unsigned int)(vars.get(categoryVariable, -1) + 1);
68  if (cat >= 1 && cat < categoryPlotters.size())
69  categoryPlotters[cat]->analyzeTag(vars, jetFlavour, w);
70  }
71 }
Definition: helper.py:1
const double w
Definition: UKUtility.cc:23
std::vector< std::unique_ptr< TaggingVariablePlotter > > categoryPlotters
def cat(path)
Definition: eostools.py:401
TaggingValue get(TaggingVariableName tag) const
const GenericMVAJetTagComputer * computer
reco::TaggingVariableName categoryVariable
vars
Definition: DeepTauId.cc:77
void analyzeTag(const std::vector< const reco::BaseTagInfo * > &baseTagInfos, double jec, int jetFlavour, float w=1) override
virtual reco::TaggingVariableList taggingVariables(const reco::BaseTagInfo &tagInfo) const
void MVAJetTagPlotter::epsPlot ( const std::string &  name)
overridevirtual

Implements BaseBTagPlotter.

Definition at line 88 of file MVAJetTagPlotter.cc.

References categoryPlotters, and plotFactory::plot.

89 {
90  for (const auto& plot: categoryPlotters)
91  plot->epsPlot(name);
92 }
std::vector< std::unique_ptr< TaggingVariablePlotter > > categoryPlotters
void MVAJetTagPlotter::finalize ( DQMStore::IBooker ibook_,
DQMStore::IGetter igetter_ 
)
overridevirtual

Implements BaseBTagPlotter.

Definition at line 73 of file MVAJetTagPlotter.cc.

74 {
75  //nothing done here in principle and function below does not work
76  /*
77  for_each(categoryPlotters.begin(), categoryPlotters.end(),
78  boost::bind(&TaggingVariablePlotter::finalize, _1, boost::ref(ibook_), _2, boost::ref(igetter_)));
79  */
80 }
void MVAJetTagPlotter::psPlot ( const std::string &  name)
overridevirtual

Implements BaseBTagPlotter.

Definition at line 82 of file MVAJetTagPlotter.cc.

References categoryPlotters, and plotFactory::plot.

83 {
84  for (const auto& plot: categoryPlotters)
85  plot->psPlot(name);
86 }
std::vector< std::unique_ptr< TaggingVariablePlotter > > categoryPlotters
void MVAJetTagPlotter::setEventSetup ( const edm::EventSetup setup)
overridevirtual

Reimplemented from BaseTagInfoPlotter.

Definition at line 47 of file MVAJetTagPlotter.cc.

References computer, Exception, edm::EventSetup::get(), cmsBatch::handle, jetTagComputer, and edm::ESHandle< T >::product().

48 {
50  setup.get<JetTagComputerRecord>().get(jetTagComputer, handle);
51  computer = dynamic_cast<const GenericMVAJetTagComputer*>(handle.product());
52 
53  if (!computer)
54  throw cms::Exception("Configuration")
55  << "JetTagComputer passed to "
56  "MVAJetTagPlotter::analyzeTag is not a "
57  "GenericMVAJetTagComputer." << endl;
58 }
std::string jetTagComputer
const GenericMVAJetTagComputer * computer
T get() const
Definition: EventSetup.h:71
T const * product() const
Definition: ESHandle.h:86
vector< string > MVAJetTagPlotter::tagInfoRequirements ( ) const
overridevirtual

Reimplemented from BaseTagInfoPlotter.

Definition at line 94 of file MVAJetTagPlotter.cc.

References computer, JetTagComputer::getInputLabels(), and tablePrinter::labels.

95 {
96  vector<string> labels = computer->getInputLabels();
97  if (labels.empty())
98  labels.push_back("tagInfos");
99  return labels;
100 }
const std::vector< std::string > & getInputLabels() const
const GenericMVAJetTagComputer * computer

Member Data Documentation

std::vector<std::unique_ptr<TaggingVariablePlotter> > MVAJetTagPlotter::categoryPlotters
private

Definition at line 43 of file MVAJetTagPlotter.h.

Referenced by analyzeTag(), epsPlot(), MVAJetTagPlotter(), and psPlot().

reco::TaggingVariableName MVAJetTagPlotter::categoryVariable
private

Definition at line 42 of file MVAJetTagPlotter.h.

Referenced by analyzeTag(), and MVAJetTagPlotter().

const GenericMVAJetTagComputer* MVAJetTagPlotter::computer
private

Definition at line 40 of file MVAJetTagPlotter.h.

Referenced by analyzeTag(), setEventSetup(), and tagInfoRequirements().

std::string MVAJetTagPlotter::jetTagComputer
private

Definition at line 39 of file MVAJetTagPlotter.h.

Referenced by setEventSetup().