CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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  const edm::ParameterSet &params)
21 {
22  std::vector<std::string> names = params.getParameterNames();
23  for(std::vector<std::string>::const_iterator iter = names.begin();
24  iter != names.end(); iter++) {
25  if (iter->c_str()[0] == '@')
26  continue;
27 
28  const edm::Entry &entry = params.retrieve(*iter);
29 
31  if (entry.typeCode() == 'F')
32  path = entry.getFileInPath().fullPath();
33  else
34  path = entry.getString();
35 
36  mvaCalibrations[*iter] = path;
37  }
38 }
39 
41 {
42 }
43 
46 {
48 
49  for(LabelFileMap::const_iterator iter = mvaCalibrations.begin();
50  iter != mvaCalibrations.end(); iter++) {
51  std::auto_ptr<Calibration::MVAComputer> calibration(
52  MVAComputer::readCalibration(iter->second.c_str()));
53 
54  container->add(iter->first) = *calibration;
55  }
56 
57  return container;
58 }
59 
60 } // namespace PhysicsTools
Entry const & retrieve(char const *) const
static const HistoName names[]
static Calibration::MVAComputer * readCalibration(const char *filename)
read calibration object from plain file
Definition: MVAComputer.cc:232
std::shared_ptr< Calibration::MVAComputerContainer > ReturnType
MVAComputerESSourceBase(const edm::ParameterSet &params)
std::vector< std::string > getParameterNames() const
FileInPath getFileInPath() const
Definition: Entry.cc:787
list entry
Definition: mps_splice.py:62
char typeCode() const
Definition: Entry.h:175
std::string fullPath() const
Definition: FileInPath.cc:184
std::string getString() const
Definition: Entry.cc:764