Main Page
Namespaces
Classes
Package Documentation
PhysicsTools
MVAComputer
src
MVAComputerCache.cc
Go to the documentation of this file.
1
#include <memory>
2
3
#include "
PhysicsTools/MVAComputer/interface/Calibration.h
"
4
#include "
PhysicsTools/MVAComputer/interface/MVAComputer.h
"
5
#include "
PhysicsTools/MVAComputer/interface/MVAComputerCache.h
"
6
7
namespace
PhysicsTools
{
8
9
MVAComputerCache::MVAComputerCache
() :
10
containerCacheId(Calibration::MVAComputerContainer::CacheId()),
11
computerCacheId(Calibration::
MVAComputer
::CacheId())
12
{
13
}
14
15
MVAComputerCache::~MVAComputerCache
()
16
{
17
}
18
19
bool
MVAComputerCache::update
(
const
Calibration::MVAComputer
*
computer
)
20
{
21
if
(!computer && !*
this
)
22
return
false
;
23
if
(computer && !computer->
changed
(
computerCacheId
))
24
return
false
;
25
26
if
(computer) {
27
this->computer.reset(
new
MVAComputer
(computer));
28
computerCacheId
= computer->
getCacheId
();
29
}
else
{
30
this->computer.reset();
31
computerCacheId
=
Calibration::MVAComputer::CacheId
();
32
}
33
34
containerCacheId
=
Calibration::MVAComputerContainer::CacheId
();
35
return
true
;
36
}
37
38
bool
MVAComputerCache::update
(
39
const
Calibration::MVAComputerContainer
*container,
40
const
char
*
calib
)
41
{
42
if
(!container && !*
this
)
43
return
false
;
44
if
(container && !container->
changed
(
containerCacheId
))
45
return
false
;
46
47
if
(container) {
48
const
Calibration::MVAComputer
*
computer
=
49
&container->
find
(calib);
50
bool
result
=
update
(computer);
51
containerCacheId
= container->
getCacheId
();
52
return
result
;
53
}
54
55
this->
computer
.reset();
56
57
computerCacheId
=
Calibration::MVAComputer::CacheId
();
58
containerCacheId
=
Calibration::MVAComputerContainer::CacheId
();
59
return
true
;
60
}
61
62
std::unique_ptr<MVAComputer>
MVAComputerCache::release
()
63
{
64
computerCacheId
=
Calibration::MVAComputer::CacheId
();
65
containerCacheId
=
Calibration::MVAComputerContainer::CacheId
();
66
return
std::move
(
computer
);
67
}
68
69
}
// namespace PhysicsTools
PhysicsTools::Calibration::MVAComputerContainer::find
virtual const MVAComputer & find(const std::string &label) const
Definition:
MVAComputer.cc:207
MVAComputer.h
PhysicsTools::MVAComputerCache::computerCacheId
Calibration::MVAComputer::CacheId computerCacheId
Definition:
MVAComputerCache.h:87
mps_fire.result
result
Definition:
mps_fire.py:283
PhysicsTools::MVAComputerCache::MVAComputerCache
MVAComputerCache()
Definition:
MVAComputerCache.cc:9
PhysicsTools::Calibration::MVAComputer::CacheId
unsigned int CacheId
Definition:
MVAComputer.h:230
PhysicsTools::MVAComputerCache::containerCacheId
Calibration::MVAComputerContainer::CacheId containerCacheId
Definition:
MVAComputerCache.h:86
MVAComputerCache.h
PhysicsTools::MVAComputerCache::release
std::unique_ptr< MVAComputer > release()
Definition:
MVAComputerCache.cc:62
PhysicsTools::Calibration::MVAComputerContainer::changed
bool changed(CacheId old) const
Definition:
MVAComputer.h:261
PhysicsTools::Calibration::MVAComputerContainer::CacheId
unsigned int CacheId
Definition:
MVAComputer.h:259
PhysicsTools::Calibration::MVAComputer
Definition:
MVAComputer.h:218
PhysicsTools::Calibration::MVAComputerContainer::getCacheId
CacheId getCacheId() const
Definition:
MVAComputer.h:260
calib
Definition:
CalibElectron.h:14
PhysicsTools::MVAComputer
Main interface class to the generic discriminator computer framework.
Definition:
MVAComputer.h:39
PhysicsTools
Definition:
Histogram.h:13
PhysicsTools::Calibration::MVAComputer::changed
bool changed(CacheId old) const
Definition:
MVAComputer.h:232
PhysicsTools::MVAComputerCache::computer
std::unique_ptr< MVAComputer > computer
Definition:
MVAComputerCache.h:88
PhysicsTools::MVAComputerCache::update
bool update(const Calibration::MVAComputer *computer)
Definition:
MVAComputerCache.cc:19
PhysicsTools::MVAComputerCache::~MVAComputerCache
~MVAComputerCache()
Definition:
MVAComputerCache.cc:15
Calibration.h
PhysicsTools::Calibration::MVAComputerContainer
Definition:
MVAComputer.h:247
PhysicsTools::Calibration::MVAComputer::getCacheId
CacheId getCacheId() const
Definition:
MVAComputer.h:231
eostools.move
def move(src, dest)
Definition:
eostools.py:511
Generated for CMSSW Reference Manual by
1.8.11