CMS 3D CMS Logo

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
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)