CMS 3D CMS Logo

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)
 
template<class T >
bool update (const char *label, const edm::EventSetup &es)
 
template<class T >
bool update (const char *label, const edm::EventSetup &es, const char *calib)
 
template<class T >
bool update (const edm::EventSetup &es)
 
template<class T >
bool update (const edm::EventSetup &es, 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 28 of file MVAComputerCache.h.

Constructor & Destructor Documentation

◆ MVAComputerCache()

PhysicsTools::MVAComputerCache::MVAComputerCache ( )

◆ ~MVAComputerCache()

PhysicsTools::MVAComputerCache::~MVAComputerCache ( )

Definition at line 13 of file MVAComputerCache.cc.

13 {}

Member Function Documentation

◆ get() [1/2]

MVAComputer* PhysicsTools::MVAComputerCache::get ( )
inline

◆ get() [2/2]

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

◆ operator bool()

PhysicsTools::MVAComputerCache::operator bool ( ) const
inline

Definition at line 64 of file MVAComputerCache.h.

64 { return computer.get(); }

References computer.

◆ operator*() [1/2]

MVAComputer& PhysicsTools::MVAComputerCache::operator* ( void  )
inline

Definition at line 66 of file MVAComputerCache.h.

66 { return *computer; }

References computer.

◆ operator*() [2/2]

const MVAComputer& PhysicsTools::MVAComputerCache::operator* ( void  ) const
inline

Definition at line 67 of file MVAComputerCache.h.

67 { return *computer; }

References computer.

◆ operator->() [1/2]

MVAComputer* PhysicsTools::MVAComputerCache::operator-> ( )
inline

Definition at line 69 of file MVAComputerCache.h.

69 { return computer.get(); }

References computer.

◆ operator->() [2/2]

const MVAComputer* PhysicsTools::MVAComputerCache::operator-> ( ) const
inline

Definition at line 70 of file MVAComputerCache.h.

70 { return computer.get(); }

References computer.

◆ release()

std::unique_ptr< MVAComputer > PhysicsTools::MVAComputerCache::release ( )

◆ reset()

void PhysicsTools::MVAComputerCache::reset ( void  )
inline

Definition at line 77 of file MVAComputerCache.h.

77 { computer.reset(); }

References computer.

◆ update() [1/6]

bool PhysicsTools::MVAComputerCache::update ( const Calibration::MVAComputer computer)

Definition at line 15 of file MVAComputerCache.cc.

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();
27  }
28 
30  return true;
31  }

References computer, computerCacheId, and containerCacheId.

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().

◆ update() [2/6]

bool PhysicsTools::MVAComputerCache::update ( const Calibration::MVAComputerContainer container,
const char *  calib 
)

Definition at line 33 of file MVAComputerCache.cc.

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  }

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().

◆ update() [3/6]

template<class T >
bool PhysicsTools::MVAComputerCache::update ( const char *  label,
const edm::EventSetup es 
)
inline

◆ update() [4/6]

template<class T >
bool PhysicsTools::MVAComputerCache::update ( const char *  label,
const edm::EventSetup es,
const char *  calib 
)
inline

◆ update() [5/6]

template<class T >
bool PhysicsTools::MVAComputerCache::update ( const edm::EventSetup es)
inline

◆ update() [6/6]

template<class T >
bool PhysicsTools::MVAComputerCache::update ( const edm::EventSetup es,
const char *  calib 
)
inline

Member Data Documentation

◆ computer

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

Definition at line 82 of file MVAComputerCache.h.

Referenced by get(), operator bool(), operator*(), operator->(), release(), reset(), and update().

◆ computerCacheId

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

Definition at line 81 of file MVAComputerCache.h.

Referenced by release(), and update().

◆ containerCacheId

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

Definition at line 80 of file MVAComputerCache.h.

Referenced by release(), and update().

PhysicsTools::MVAComputerCache::get
MVAComputer * get()
Definition: MVAComputerCache.h:72
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
patZpeak.handle
handle
Definition: patZpeak.py:23
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
PhysicsTools::MVAComputerCache::containerCacheId
Calibration::MVAComputerContainer::CacheId containerCacheId
Definition: MVAComputerCache.h:80
edm::ESHandle
Definition: DTSurvey.h:22
calib
Definition: CalibElectron.h:12
PhysicsTools::Calibration::MVAComputer::CacheId
unsigned int CacheId
Definition: MVAComputer.h:233
L1EGammaCrystalsEmulatorProducer_cfi.calib
calib
Definition: L1EGammaCrystalsEmulatorProducer_cfi.py:6
eostools.move
def move(src, dest)
Definition: eostools.py:511
T
long double T
Definition: Basic3DVectorLD.h:48
PhysicsTools::MVAComputerCache::update
bool update(const Calibration::MVAComputer *computer)
Definition: MVAComputerCache.cc:15
mps_fire.result
result
Definition: mps_fire.py:311
label
const char * label
Definition: PFTauDecayModeTools.cc:11