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 
7 #include <boost/shared_ptr.hpp>
8 
14 
18 
19 namespace PhysicsTools {
20 
22  const edm::ParameterSet &params)
23 {
24  std::vector<std::string> names = params.getParameterNames();
25  for(std::vector<std::string>::const_iterator iter = names.begin();
26  iter != names.end(); iter++) {
27  if (iter->c_str()[0] == '@')
28  continue;
29 
30  const edm::Entry &entry = params.retrieve(*iter);
31 
32  std::string path;
33  if (entry.typeCode() == 'F')
34  path = entry.getFileInPath().fullPath();
35  else
36  path = entry.getString();
37 
38  mvaCalibrations[*iter] = path;
39  }
40 }
41 
43 {
44 }
45 
48 {
50 
51  for(LabelFileMap::const_iterator iter = mvaCalibrations.begin();
52  iter != mvaCalibrations.end(); iter++) {
53  std::auto_ptr<Calibration::MVAComputer> calibration(
54  MVAComputer::readCalibration(iter->second.c_str()));
55 
56  container->add(iter->first) = *calibration;
57  }
58 
59  return container;
60 }
61 
62 } // 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
list path
Definition: scaleCards.py:51
MVAComputerESSourceBase(const edm::ParameterSet &params)
boost::shared_ptr< Calibration::MVAComputerContainer > ReturnType
std::pair< std::string, MonitorElement * > entry
Definition: ME_MAP.h:8
std::vector< std::string > getParameterNames() const
FileInPath getFileInPath() const
Definition: Entry.cc:787
char typeCode() const
Definition: Entry.h:175
std::string fullPath() const
Definition: FileInPath.cc:171
std::string getString() const
Definition: Entry.cc:764