#include <GenericMVAComputerCache.h>
Classes | |
struct | IndividualComputer |
Public Member Functions | |
GenericMVAComputerCache (const std::vector< std::string > &labels) | |
GenericMVAComputer * | getComputer (int index) const |
bool | isEmpty () const |
bool | update (const PhysicsTools::Calibration::MVAComputerContainer *calib) |
~GenericMVAComputerCache () | |
Private Attributes | |
PhysicsTools::Calibration::MVAComputerContainer::CacheId | cacheId |
std::vector< IndividualComputer > | computers |
bool | empty |
bool | initialized |
Definition at line 12 of file GenericMVAComputerCache.h.
GenericMVAComputerCache::GenericMVAComputerCache | ( | const std::vector< std::string > & | labels | ) |
Definition at line 25 of file GenericMVAComputerCache.cc.
References computers.
: computers(labels.size()), cacheId(MVAComputerContainer::CacheId()), initialized(false), empty(true) { std::vector<IndividualComputer>::iterator computer = computers.begin(); for(std::vector<std::string>::const_iterator iter = labels.begin(); iter != labels.end(); iter++) { computer->label = *iter; computer->cacheId = MVAComputer::CacheId(); computer++; } }
GenericMVAComputerCache::~GenericMVAComputerCache | ( | ) |
Definition at line 41 of file GenericMVAComputerCache.cc.
{ }
GenericMVAComputer* GenericMVAComputerCache::getComputer | ( | int | index | ) | const [inline] |
Definition at line 20 of file GenericMVAComputerCache.h.
References computers, and getHLTprescales::index.
Referenced by GenericMVAJetTagComputer::discriminator().
bool GenericMVAComputerCache::isEmpty | ( | void | ) | const [inline] |
bool GenericMVAComputerCache::update | ( | const PhysicsTools::Calibration::MVAComputerContainer * | calib | ) |
Definition at line 45 of file GenericMVAComputerCache.cc.
References cacheId, PhysicsTools::Calibration::MVAComputer::changed(), PhysicsTools::Calibration::MVAComputerContainer::changed(), computers, empty, PhysicsTools::Calibration::MVAComputerContainer::find(), PhysicsTools::Calibration::MVAComputer::getCacheId(), PhysicsTools::Calibration::MVAComputerContainer::getCacheId(), and initialized.
Referenced by GenericMVAJetTagComputer::setEventSetup().
{ // check container for changes if (initialized && !calib->changed(cacheId)) return false; empty = true; bool changed = false; for(std::vector<IndividualComputer>::iterator iter = computers.begin(); iter != computers.end(); iter++) { // empty labels means we don't want a computer if (iter->label.empty()) continue; const MVAComputer *computerCalib = &calib->find(iter->label); if (!computerCalib) { iter->computer.reset(); continue; } // check container content for changes if (iter->computer.get() && !computerCalib->changed(iter->cacheId)) { empty = false; continue; } // drop old computer iter->computer.reset(); if (!computerCalib) continue; // instantiate new MVAComputer with uptodate calibration iter->computer = std::auto_ptr<GenericMVAComputer>( new GenericMVAComputer(computerCalib)); iter->cacheId = computerCalib->getCacheId(); changed = true; empty = false; } cacheId = calib->getCacheId(); initialized = true; return changed; }
Definition at line 37 of file GenericMVAComputerCache.h.
Referenced by update().
std::vector<IndividualComputer> GenericMVAComputerCache::computers [private] |
Definition at line 36 of file GenericMVAComputerCache.h.
Referenced by GenericMVAComputerCache(), getComputer(), and update().
bool GenericMVAComputerCache::empty [private] |
Definition at line 39 of file GenericMVAComputerCache.h.
bool GenericMVAComputerCache::initialized [private] |
Definition at line 38 of file GenericMVAComputerCache.h.
Referenced by update().