CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MVAComputerESSourceBase.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <string>
3 #include <memory>
4 #include <vector>
5 #include <map>
6 
12 
16 
17 namespace PhysicsTools {
18 
20  std::vector<std::string> names = params.getParameterNames();
21  for (std::vector<std::string>::const_iterator iter = names.begin(); iter != names.end(); iter++) {
22  if (iter->c_str()[0] == '@')
23  continue;
24 
25  const edm::Entry &entry = params.retrieve(*iter);
26 
28  if (entry.typeCode() == 'F')
29  path = entry.getFileInPath().fullPath();
30  else
31  path = entry.getString();
32 
33  mvaCalibrations[*iter] = path;
34  }
35  }
36 
38 
40  auto container = std::make_unique<Calibration::MVAComputerContainer>();
41 
42  for (LabelFileMap::const_iterator iter = mvaCalibrations.begin(); iter != mvaCalibrations.end(); iter++) {
43  std::unique_ptr<Calibration::MVAComputer> calibration(MVAComputer::readCalibration(iter->second.c_str()));
44 
45  container->add(iter->first) = *calibration;
46  }
47 
48  return container;
49  }
50 
51 } // namespace PhysicsTools
std::unique_ptr< Calibration::MVAComputerContainer > ReturnType
Entry const & retrieve(char const *) const
static Calibration::MVAComputer * readCalibration(const char *filename)
read calibration object from plain file
Definition: MVAComputer.cc:195
const std::string names[nVars_]
MVAComputerESSourceBase(const edm::ParameterSet &params)
std::vector< std::string > getParameterNames() const
FileInPath getFileInPath() const
Definition: Entry.cc:938
list entry
Definition: mps_splice.py:68
std::string fullPath() const
Definition: FileInPath.cc:161
char typeCode() const
Definition: Entry.h:176
std::string getString() const
Definition: Entry.cc:914