CMS 3D CMS Logo

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:222
std::auto_ptr< MVAComputer > release()
Calibration::MVAComputer::CacheId computerCacheId
Calibration::MVAComputerContainer::CacheId containerCacheId
Main interface class to the generic discriminator computer framework.
Definition: MVAComputer.h:39
bool changed(CacheId old) const
Definition: MVAComputer.h:232
bool update(const Calibration::MVAComputer *computer)
std::auto_ptr< MVAComputer > computer