CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TagInfoMVACategorySelector.cc
Go to the documentation of this file.
1 #include <ext/functional>
2 #include <string>
3 #include <vector>
4 
11 
12 using namespace reco;
13 
15  const edm::ParameterSet &params)
16 {
17  std::string variableName =
18  params.getParameter<std::string>("categoryVariableName");
19 
20  categoryVariable = getTaggingVariableName(variableName);
21  if (categoryVariable >= btau::lastTaggingVariable)
22  throw cms::Exception("TagInfoMVACategorySelector")
23  << "No such tagging variable \""
24  << categoryVariable << "\"." << std::endl;
25 
26  categoryLabels = params.getParameter<std::vector<std::string> >(
27  "calibrationRecords");
28  for(std::vector<std::string>::iterator iter = categoryLabels.begin();
29  iter != categoryLabels.end(); iter++)
30  if (*iter == " " || *iter == "-" || *iter == "*")
31  *iter = "";
32 }
33 
35 {
36 }
37 
39  const TaggingVariableList &taggingVariables) const
40 {
41  int index = (int)taggingVariables.get(categoryVariable, -1);
42 
43  if (index < 0 || (unsigned int)index >= categoryLabels.size())
44  return -1;
45 
46  return index;
47 }
T getParameter(std::string const &) const
int findCategory(const reco::TaggingVariableList &taggingVariables) const
TagInfoMVACategorySelector(const edm::ParameterSet &params)
TaggingValue get(TaggingVariableName tag) const
TaggingVariableName getTaggingVariableName(const std::string &name)