src
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
MVAComputerCache::~MVAComputerCache
() {}
14
15
bool
MVAComputerCache::update
(
const
Calibration::MVAComputer
*
computer
) {
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();
26
computerCacheId
=
Calibration::MVAComputer::CacheId
();
27
}
28
29
containerCacheId
=
Calibration::MVAComputerContainer::CacheId
();
30
return
true
;
31
}
32
33
bool
MVAComputerCache::update
(
const
Calibration::MVAComputerContainer
*container,
const
char
*
calib
) {
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
48
computerCacheId
=
Calibration::MVAComputer::CacheId
();
49
containerCacheId
=
Calibration::MVAComputerContainer::CacheId
();
50
return
true
;
51
}
52
53
std::unique_ptr<MVAComputer>
MVAComputerCache::release
() {
54
computerCacheId
=
Calibration::MVAComputer::CacheId
();
55
containerCacheId
=
Calibration::MVAComputerContainer::CacheId
();
56
return
std::move
(
computer
);
57
}
58
59
}
// namespace PhysicsTools
PhysicsTools::Calibration::MVAComputerContainer::changed
bool changed(CacheId old) const
Definition:
MVAComputer.h:269
PhysicsTools::Calibration::MVAComputerContainer::find
virtual const MVAComputer & find(const std::string &label) const
Definition:
MVAComputer.cc:168
MVAComputer.h
PhysicsTools::MVAComputerCache::computerCacheId
Calibration::MVAComputer::CacheId computerCacheId
Definition:
MVAComputerCache.h:51
mps_fire.result
result
Definition:
mps_fire.py:311
HLT_2024v14_cff.computer
computer
Definition:
HLT_2024v14_cff.py:65982
PhysicsTools::MVAComputerCache::MVAComputerCache
MVAComputerCache()
Definition:
MVAComputerCache.cc:9
messageLoggerDebug_cff.Calibration
Calibration
Definition:
messageLoggerDebug_cff.py:14
PhysicsTools::Calibration::MVAComputer::CacheId
unsigned int CacheId
Definition:
MVAComputer.h:238
PhysicsTools::MVAComputerCache::containerCacheId
Calibration::MVAComputerContainer::CacheId containerCacheId
Definition:
MVAComputerCache.h:50
MVAComputerCache.h
PhysicsTools::MVAComputerCache::release
std::unique_ptr< MVAComputer > release()
Definition:
MVAComputerCache.cc:53
PhysicsTools::Calibration::MVAComputerContainer::CacheId
unsigned int CacheId
Definition:
MVAComputer.h:267
PhysicsTools::Calibration::MVAComputer
Definition:
MVAComputer.h:225
calib
Definition:
CalibElectron.h:12
PhysicsTools::MVAComputer
Main interface class to the generic discriminator computer framework.
Definition:
MVAComputer.h:39
PhysicsTools
Definition:
Histogram.h:13
PhysicsTools::MVAComputerCache::computer
std::unique_ptr< MVAComputer > computer
Definition:
MVAComputerCache.h:52
PhysicsTools::Calibration::MVAComputerContainer::getCacheId
CacheId getCacheId() const
Definition:
MVAComputer.h:268
PhysicsTools::MVAComputerCache::update
bool update(const Calibration::MVAComputer *computer)
Definition:
MVAComputerCache.cc:15
PhysicsTools::MVAComputerCache::~MVAComputerCache
~MVAComputerCache()
Definition:
MVAComputerCache.cc:13
Calibration.h
PhysicsTools::Calibration::MVAComputerContainer
Definition:
MVAComputer.h:255
eostools.move
def move(src, dest)
Definition:
eostools.py:511
Generated for CMSSW Reference Manual by
1.8.14