CMS 3D CMS Logo

PhysicsTools::MVAComputerCache Class Reference

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

#include <PhysicsTools/MVAComputer/interface/MVAComputerCache.h>

List of all members.

Public Member Functions

const MVAComputerget () const
MVAComputerget ()
 MVAComputerCache ()
const MVAComputeroperator * () const
MVAComputeroperator * ()
 operator bool () const
const MVAComputeroperator-> () const
MVAComputeroperator-> ()
std::auto_ptr< MVAComputerrelease ()
void reset ()
template<class T>
bool update (const char *label, const edm::EventSetup &es, const char *calib)
template<class T>
bool update (const char *label, const edm::EventSetup &es)
template<class T>
bool update (const edm::EventSetup &es, const char *calib)
template<class T>
bool update (const edm::EventSetup &es)
bool update (const Calibration::MVAComputerContainer *container, const char *calib)
bool update (const Calibration::MVAComputer *computer)
 ~MVAComputerCache ()

Private Attributes

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


Detailed Description

Creates and and MVAComputer from calibrations via EventSetup.

Definition at line 29 of file MVAComputerCache.h.


Constructor & Destructor Documentation

PhysicsTools::MVAComputerCache::MVAComputerCache (  ) 

Definition at line 9 of file MVAComputerCache.cc.

PhysicsTools::MVAComputerCache::~MVAComputerCache (  ) 

Definition at line 15 of file MVAComputerCache.cc.

00016 {
00017 }


Member Function Documentation

const MVAComputer* PhysicsTools::MVAComputerCache::get ( void   )  const [inline]

Definition at line 80 of file MVAComputerCache.h.

00080 { return computer.get(); }

MVAComputer* PhysicsTools::MVAComputerCache::get ( void   )  [inline]

Definition at line 79 of file MVAComputerCache.h.

00079 { return computer.get(); }

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

Definition at line 74 of file MVAComputerCache.h.

00074 { return *computer; }

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

Definition at line 73 of file MVAComputerCache.h.

00073 { return *computer; }

PhysicsTools::MVAComputerCache::operator bool ( void   )  const [inline]

Definition at line 71 of file MVAComputerCache.h.

00071 { return computer.get(); }

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

Definition at line 77 of file MVAComputerCache.h.

00077 { return computer.get(); }

MVAComputer* PhysicsTools::MVAComputerCache::operator-> ( void   )  [inline]

Definition at line 76 of file MVAComputerCache.h.

00076 { return computer.get(); }

std::auto_ptr< MVAComputer > PhysicsTools::MVAComputerCache::release ( void   ) 

Definition at line 62 of file MVAComputerCache.cc.

References computer, computerCacheId, and containerCacheId.

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

Definition at line 84 of file MVAComputerCache.h.

00084 { computer.reset(); }

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

Definition at line 63 of file MVAComputerCache.h.

References edm::EventSetup::get(), edm::ESHandle< T >::product(), and update().

00065         {
00066                 edm::ESHandle<Calibration::MVAComputerContainer> handle;
00067                 es.get<T>().get(label, handle);
00068                 return update(handle.product(), calib);
00069         }

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

Definition at line 55 of file MVAComputerCache.h.

References edm::EventSetup::get(), edm::ESHandle< T >::product(), and update().

00056         {
00057                 edm::ESHandle<Calibration::MVAComputer> handle;
00058                 es.get<T>().get(label, handle);
00059                 return update(handle.product());
00060         }

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

Definition at line 47 of file MVAComputerCache.h.

References edm::EventSetup::get(), edm::ESHandle< T >::product(), and update().

00048         {
00049                 edm::ESHandle<Calibration::MVAComputerContainer> handle;
00050                 es.get<T>().get(handle);
00051                 return update(handle.product(), calib);
00052         }

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

Definition at line 39 of file MVAComputerCache.h.

References edm::EventSetup::get(), edm::ESHandle< T >::product(), and update().

00040         {
00041                 edm::ESHandle<Calibration::MVAComputer> handle;
00042                 es.get<T>().get(handle);
00043                 return update(handle.product());
00044         }

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

Definition at line 38 of file MVAComputerCache.cc.

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

00041 {
00042         if (!container && !*this)
00043                 return false;
00044         if (container && !container->changed(containerCacheId))
00045                 return false;
00046 
00047         if (container) {
00048                 const Calibration::MVAComputer *computer =
00049                                                 &container->find(calib);
00050                 bool result = update(computer);
00051                 containerCacheId = container->getCacheId();
00052                 return result;
00053         }
00054 
00055         this->computer.reset();
00056 
00057         computerCacheId = Calibration::MVAComputer::CacheId();
00058         containerCacheId = Calibration::MVAComputerContainer::CacheId();
00059         return true;
00060 }

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

Definition at line 19 of file MVAComputerCache.cc.

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

Referenced by TtSemiLepSignalSelMVATrainer::analyze(), TtSemiLepJetCombMVATrainer::analyze(), TtSemiLepSignalSelMVAComputer::produce(), TtSemiLepJetCombMVAComputer::produce(), PhysicsTools::MVAModuleHelper< Record, Object, Filler >::setEventSetup(), and update().

00020 {
00021         if (!computer && !*this)
00022                 return false;
00023         if (computer && !computer->changed(computerCacheId))
00024                 return false;
00025 
00026         if (computer) {
00027                 this->computer.reset(new MVAComputer(computer));
00028                 computerCacheId = computer->getCacheId();
00029         } else {
00030                 this->computer.reset();
00031                 computerCacheId = Calibration::MVAComputer::CacheId();
00032         }
00033 
00034         containerCacheId = Calibration::MVAComputerContainer::CacheId();
00035         return true;
00036 }


Member Data Documentation

std::auto_ptr<MVAComputer> PhysicsTools::MVAComputerCache::computer [private]

Definition at line 89 of file MVAComputerCache.h.

Referenced by release(), and update().

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

Definition at line 88 of file MVAComputerCache.h.

Referenced by release(), and update().

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

Definition at line 87 of file MVAComputerCache.h.

Referenced by release(), and update().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:50:08 2009 for CMSSW by  doxygen 1.5.4