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.reset(new 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
PhysicsTools::MVAComputerCache::computer
std::unique_ptr< MVAComputer > computer
Definition: MVAComputerCache.h:82
PhysicsTools::Calibration::MVAComputerContainer::CacheId
unsigned int CacheId
Definition: MVAComputer.h:262
PhysicsTools::MVAComputerCache::computerCacheId
Calibration::MVAComputer::CacheId computerCacheId
Definition: MVAComputerCache.h:81
HLT_2018_cff.Calibration
Calibration
Definition: HLT_2018_cff.py:3579
PhysicsTools::MVAComputerCache::release
std::unique_ptr< MVAComputer > release()
Definition: MVAComputerCache.cc:53
PhysicsTools::MVAComputer
Main interface class to the generic discriminator computer framework.
Definition: MVAComputer.h:39
PhysicsTools::MVAComputerCache::containerCacheId
Calibration::MVAComputerContainer::CacheId containerCacheId
Definition: MVAComputerCache.h:80
MVAComputer.h
calib
Definition: CalibElectron.h:12
PhysicsTools::Calibration::MVAComputer::CacheId
unsigned int CacheId
Definition: MVAComputer.h:233
PhysicsTools::Calibration::MVAComputerContainer::getCacheId
CacheId getCacheId() const
Definition: MVAComputer.h:263
PhysicsTools::Calibration::MVAComputer
Definition: MVAComputer.h:221
PhysicsTools
Definition: Histogram.h:13
PhysicsTools::Calibration::MVAComputerContainer::find
virtual const MVAComputer & find(const std::string &label) const
Definition: MVAComputer.cc:162
MVAComputerCache.h
PhysicsTools::MVAComputerCache::~MVAComputerCache
~MVAComputerCache()
Definition: MVAComputerCache.cc:13
eostools.move
def move(src, dest)
Definition: eostools.py:511
PhysicsTools::MVAComputerCache::MVAComputerCache
MVAComputerCache()
Definition: MVAComputerCache.cc:9
PhysicsTools::Calibration::MVAComputerContainer::changed
bool changed(CacheId old) const
Definition: MVAComputer.h:264
PhysicsTools::MVAComputerCache::update
bool update(const Calibration::MVAComputer *computer)
Definition: MVAComputerCache.cc:15
Calibration.h
HLT_2018_cff.computer
computer
Definition: HLT_2018_cff.py:50520
PhysicsTools::Calibration::MVAComputerContainer
Definition: MVAComputer.h:250
mps_fire.result
result
Definition: mps_fire.py:303