Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-15 04:15:14

0001 #ifndef PhysicsTools_MVAComputer_MVAComputerCache_h
0002 #define PhysicsTools_MVAComputer_MVAComputerCache_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     MVAComputerCache
0006 // Class  :     MVAComputerCache
0007 //
0008 
0009 //
0010 // Author:  Christophe Saout <christophe.saout@cern.ch>
0011 // Created:     Sat Feb 23 15:38 CEST 2007
0012 //
0013 
0014 #include <memory>
0015 
0016 #include "PhysicsTools/MVAComputer/interface/Calibration.h"
0017 #include "PhysicsTools/MVAComputer/interface/MVAComputer.h"
0018 
0019 namespace PhysicsTools {
0020 
0021   /** \class MVAComputerCache
0022  *
0023  * \short Creates and and MVAComputer from calibrations via EventSetup
0024  *
0025  ************************************************************/
0026   class MVAComputerCache {
0027   public:
0028     MVAComputerCache();
0029     ~MVAComputerCache();
0030 
0031     bool update(const Calibration::MVAComputer *computer);
0032     bool update(const Calibration::MVAComputerContainer *container, const char *calib);
0033 
0034     operator bool() const { return computer.get(); }
0035 
0036     MVAComputer &operator*() { return *computer; }
0037     const MVAComputer &operator*() const { return *computer; }
0038 
0039     MVAComputer *operator->() { return computer.get(); }
0040     const MVAComputer *operator->() const { return computer.get(); }
0041 
0042     MVAComputer *get() { return computer.get(); }
0043     const MVAComputer *get() const { return computer.get(); }
0044 
0045     std::unique_ptr<MVAComputer> release();
0046 
0047     void reset() { computer.reset(); }
0048 
0049   private:
0050     Calibration::MVAComputerContainer::CacheId containerCacheId;
0051     Calibration::MVAComputer::CacheId computerCacheId;
0052     std::unique_ptr<MVAComputer> computer;
0053   };
0054 
0055 }  // namespace PhysicsTools
0056 
0057 #endif  // PhysicsTools_MVAComputer_MVAComputerCache_h