Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
DataFormats
Provenance
src
FullHistoryToReducedHistoryMap.cc
Go to the documentation of this file.
1
#include "
DataFormats/Provenance/interface/FullHistoryToReducedHistoryMap.h
"
2
#include "
DataFormats/Provenance/interface/ProcessHistory.h
"
3
#include "
DataFormats/Provenance/interface/ProcessHistoryRegistry.h
"
4
#include "
FWCore/Utilities/interface/EDMException.h
"
5
6
namespace
edm {
7
8
FullHistoryToReducedHistoryMap::FullHistoryToReducedHistoryMap
() {
9
// Put in the conversion for the ID of an empty process history.
10
// It always maps onto itself, often is needed, and gives
11
// us something valid to initialize the iterator with. That removes
12
// the need to check for its validity and also for the validity
13
// of the fullID argument to the reduce function, because the invalid
14
// ProcessHistoryID is strangely also defined as the ID of the empty
15
// Process History (maybe that should be fixed ...).
16
ProcessHistory
ph;
17
std::pair<ProcessHistoryID, ProcessHistoryID> newEntry(ph.
id
(), ph.
id
());
18
std::pair<Map::iterator, bool>
result
=
cache_
.insert(newEntry);
19
previous_
= result.first;
20
}
21
22
ProcessHistoryID
const
&
23
FullHistoryToReducedHistoryMap::reduceProcessHistoryID
(
ProcessHistoryID
const
& fullID) {
24
if
(
previous_
->first == fullID)
return
previous_
->second;
25
Map::const_iterator iter =
cache_
.find(fullID);
26
if
(iter !=
cache_
.end()) {
27
previous_
= iter;
28
return
iter->second;
29
}
30
ProcessHistoryRegistry
*
registry
=
ProcessHistoryRegistry::instance
();
31
ProcessHistory
ph;
32
if
(!registry->
getMapped
(fullID, ph)) {
33
throw
Exception
(
errors::LogicError
)
34
<<
"FullHistoryToReducedHistoryMap::reduceProcessHistoryID\n"
35
<<
"ProcessHistory not found in registry\n"
36
<<
"Contact a Framework developer\n"
;
37
}
38
ph.
reduce
();
39
std::pair<ProcessHistoryID, ProcessHistoryID> newEntry(fullID, ph.
id
());
40
std::pair<Map::iterator, bool>
result
=
cache_
.insert(newEntry);
41
previous_
= result.first;
42
return
result.first->second;
43
}
44
}
edm::ProcessHistory::reduce
void reduce()
Definition:
ProcessHistory.cc:46
edm::FullHistoryToReducedHistoryMap::reduceProcessHistoryID
ProcessHistoryID const & reduceProcessHistoryID(ProcessHistoryID const &fullID)
Use to obtain reduced ProcessHistoryID's from full ProcessHistoryID's.
Definition:
FullHistoryToReducedHistoryMap.cc:23
edm::FullHistoryToReducedHistoryMap::previous_
Map::const_iterator previous_
Definition:
FullHistoryToReducedHistoryMap.h:49
edm::Hash
Definition:
Hash.h:41
edm::detail::ThreadSafeRegistry::instance
static ThreadSafeRegistry * instance()
ProcessHistory.h
edm::detail::ThreadSafeRegistry::getMapped
bool getMapped(key_type const &k, value_type &result) const
EDMException.h
query.result
tuple result
Definition:
query.py:137
edm::FullHistoryToReducedHistoryMap::cache_
Map cache_
Definition:
FullHistoryToReducedHistoryMap.h:48
edm::hlt::Exception
error
Definition:
HLTenums.h:24
edm::detail::ThreadSafeRegistry
Definition:
ThreadSafeRegistry.h:34
edm::ProcessHistory
Definition:
ProcessHistory.h:13
ProcessHistoryRegistry.h
PhysicsTools::registry
static Interceptor::Registry registry("Interceptor")
edm::ProcessHistory::id
ProcessHistoryID id() const
Definition:
ProcessHistory.cc:12
FullHistoryToReducedHistoryMap.h
edm::errors::LogicError
Definition:
EDMException.h:41
edm::FullHistoryToReducedHistoryMap::FullHistoryToReducedHistoryMap
FullHistoryToReducedHistoryMap()
Definition:
FullHistoryToReducedHistoryMap.cc:8
Generated for CMSSW Reference Manual by
1.8.5