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 
14 
16  if (!computer && !*this)
17  return false;
18  if (computer && !computer->changed(computerCacheId))
19  return false;
20 
21  if (computer) {
22  this->computer = std::make_unique<MVAComputer>(computer);
23  computerCacheId = computer->getCacheId();
24  } else {
25  this->computer.reset();
27  }
28 
30  return true;
31  }
32 
34  if (!container && !*this)
35  return false;
36  if (container && !container->changed(containerCacheId))
37  return false;
38 
39  if (container) {
40  const Calibration::MVAComputer *computer = &container->find(calib);
41  bool result = update(computer);
42  containerCacheId = container->getCacheId();
43  return result;
44  }
45 
46  this->computer.reset();
47 
50  return true;
51  }
52 
53  std::unique_ptr<MVAComputer> MVAComputerCache::release() {
56  return std::move(computer);
57  }
58 
59 } // namespace PhysicsTools
virtual const MVAComputer & find(const std::string &label) const
Definition: MVAComputer.cc:168
Calibration::MVAComputer::CacheId computerCacheId
Calibration::MVAComputerContainer::CacheId containerCacheId
std::unique_ptr< MVAComputer > release()
Main interface class to the generic discriminator computer framework.
Definition: MVAComputer.h:39
std::unique_ptr< MVAComputer > computer
bool update(const Calibration::MVAComputer *computer)
def move(src, dest)
Definition: eostools.py:511