CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MVAComputerCache.cc
Go to the documentation of this file.
1 #include <memory>
2 
6 
7 namespace PhysicsTools {
8 
10  containerCacheId(Calibration::MVAComputerContainer::CacheId()),
11  computerCacheId(Calibration::MVAComputer::CacheId())
12 {
13 }
14 
16 {
17 }
18 
20 {
21  if (!computer && !*this)
22  return false;
23  if (computer && !computer->changed(computerCacheId))
24  return false;
25 
26  if (computer) {
27  this->computer.reset(new MVAComputer(computer));
28  computerCacheId = computer->getCacheId();
29  } else {
30  this->computer.reset();
32  }
33 
35  return true;
36 }
37 
39  const Calibration::MVAComputerContainer *container,
40  const char *calib)
41 {
42  if (!container && !*this)
43  return false;
44  if (container && !container->changed(containerCacheId))
45  return false;
46 
47  if (container) {
49  &container->find(calib);
50  bool result = update(computer);
51  containerCacheId = container->getCacheId();
52  return result;
53  }
54 
55  this->computer.reset();
56 
59  return true;
60 }
61 
62 std::auto_ptr<MVAComputer> MVAComputerCache::release()
63 {
66  return computer;
67 }
68 
69 } // namespace PhysicsTools
virtual const MVAComputer & find(const std::string &label) const
Definition: MVAComputer.cc:192
std::auto_ptr< MVAComputer > release()
Calibration::MVAComputer::CacheId computerCacheId
Calibration::MVAComputerContainer::CacheId containerCacheId
MVATrainerComputer * calib
Definition: MVATrainer.cc:64
Main interface class to the generic discriminator computer framework.
Definition: MVAComputer.h:39
tuple result
Definition: query.py:137
bool changed(CacheId old) const
Definition: MVAComputer.h:175
bool update(const Calibration::MVAComputer *computer)
std::auto_ptr< MVAComputer > computer