CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
PhysicsTools::MVAComputerCache Class Reference

Creates and and MVAComputer from calibrations via EventSetup. More...

#include <MVAComputerCache.h>

Public Member Functions

MVAComputerget ()
 
const MVAComputerget () const
 
 MVAComputerCache ()
 
 operator bool () const
 
MVAComputeroperator* ()
 
const MVAComputeroperator* () const
 
MVAComputeroperator-> ()
 
const MVAComputeroperator-> () const
 
std::unique_ptr< MVAComputerrelease ()
 
void reset ()
 
bool update (const Calibration::MVAComputer *computer)
 
bool update (const Calibration::MVAComputerContainer *container, const char *calib)
 
 ~MVAComputerCache ()
 

Private Attributes

std::unique_ptr< MVAComputercomputer
 
Calibration::MVAComputer::CacheId computerCacheId
 
Calibration::MVAComputerContainer::CacheId containerCacheId
 

Detailed Description

Creates and and MVAComputer from calibrations via EventSetup.

Definition at line 26 of file MVAComputerCache.h.

Constructor & Destructor Documentation

PhysicsTools::MVAComputerCache::MVAComputerCache ( )
PhysicsTools::MVAComputerCache::~MVAComputerCache ( )

Definition at line 13 of file MVAComputerCache.cc.

13 {}

Member Function Documentation

MVAComputer* PhysicsTools::MVAComputerCache::get ( )
inline
const MVAComputer* PhysicsTools::MVAComputerCache::get ( ) const
inline
PhysicsTools::MVAComputerCache::operator bool ( ) const
inline

Definition at line 34 of file MVAComputerCache.h.

34 { return computer.get(); }
std::unique_ptr< MVAComputer > computer
MVAComputer& PhysicsTools::MVAComputerCache::operator* ( void  )
inline

Definition at line 36 of file MVAComputerCache.h.

References computer.

36 { return *computer; }
std::unique_ptr< MVAComputer > computer
const MVAComputer& PhysicsTools::MVAComputerCache::operator* ( void  ) const
inline

Definition at line 37 of file MVAComputerCache.h.

References computer.

37 { return *computer; }
std::unique_ptr< MVAComputer > computer
MVAComputer* PhysicsTools::MVAComputerCache::operator-> ( )
inline

Definition at line 39 of file MVAComputerCache.h.

39 { return computer.get(); }
std::unique_ptr< MVAComputer > computer
const MVAComputer* PhysicsTools::MVAComputerCache::operator-> ( ) const
inline

Definition at line 40 of file MVAComputerCache.h.

40 { return computer.get(); }
std::unique_ptr< MVAComputer > computer
std::unique_ptr< MVAComputer > PhysicsTools::MVAComputerCache::release ( )

Definition at line 53 of file MVAComputerCache.cc.

References computer, computerCacheId, containerCacheId, and eostools::move().

53  {
56  return std::move(computer);
57  }
Calibration::MVAComputer::CacheId computerCacheId
Calibration::MVAComputerContainer::CacheId containerCacheId
def move
Definition: eostools.py:511
std::unique_ptr< MVAComputer > computer
void PhysicsTools::MVAComputerCache::reset ( void  )
inline

Definition at line 47 of file MVAComputerCache.h.

47 { computer.reset(); }
std::unique_ptr< MVAComputer > computer
bool PhysicsTools::MVAComputerCache::update ( const Calibration::MVAComputer computer)

Definition at line 15 of file MVAComputerCache.cc.

References PhysicsTools::Calibration::MVAComputer::changed(), computer, computerCacheId, containerCacheId, and PhysicsTools::Calibration::MVAComputer::getCacheId().

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), MatrixUtil.Steps::overwrite(), TtFullHadSignalSelMVAComputer::produce(), TtSemiLepJetCombMVAComputer::produce(), TtSemiLepSignalSelMVAComputer::produce(), and update().

15  {
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();
26  computerCacheId = Calibration::MVAComputer::CacheId();
27  }
28 
30  return true;
31  }
Calibration::MVAComputer::CacheId computerCacheId
Calibration::MVAComputerContainer::CacheId containerCacheId
std::unique_ptr< MVAComputer > computer
bool PhysicsTools::MVAComputerCache::update ( const Calibration::MVAComputerContainer container,
const char *  calib 
)

Definition at line 33 of file MVAComputerCache.cc.

References PhysicsTools::Calibration::MVAComputerContainer::changed(), computer, computerCacheId, containerCacheId, PhysicsTools::Calibration::MVAComputerContainer::find(), PhysicsTools::Calibration::MVAComputerContainer::getCacheId(), mps_fire::result, and update().

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

33  {
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  }
Calibration::MVAComputer::CacheId computerCacheId
Calibration::MVAComputerContainer::CacheId containerCacheId
tuple result
Definition: mps_fire.py:311
std::unique_ptr< MVAComputer > computer
bool update(const Calibration::MVAComputer *computer)

Member Data Documentation

std::unique_ptr<MVAComputer> PhysicsTools::MVAComputerCache::computer
private

Definition at line 52 of file MVAComputerCache.h.

Referenced by operator*(), release(), and update().

Calibration::MVAComputer::CacheId PhysicsTools::MVAComputerCache::computerCacheId
private

Definition at line 51 of file MVAComputerCache.h.

Referenced by release(), and update().

Calibration::MVAComputerContainer::CacheId PhysicsTools::MVAComputerCache::containerCacheId
private

Definition at line 50 of file MVAComputerCache.h.

Referenced by release(), and update().