DataFormats
Provenance
src
ProcessHistory.cc
Go to the documentation of this file.
1
#include <iterator>
2
#include <ostream>
3
#include <sstream>
4
#include "
FWCore/Utilities/interface/Digest.h
"
5
#include "
FWCore/Utilities/interface/Algorithms.h
"
6
7
#include "
DataFormats/Provenance/interface/ProcessHistory.h
"
8
9
namespace
edm
{
10
ProcessHistoryID
ProcessHistory::id
()
const
{
11
if
(
transient_
.
phid_
.
isValid
()) {
12
return
transient_
.
phid_
;
13
}
14
// This implementation is ripe for optimization.
15
// We do not use operator<< because it does not write out everything.
16
std::ostringstream oss;
17
for
(
auto
const
&
item
: *
this
) {
18
oss <<
item
.processName() <<
' '
<<
item
.parameterSetID() <<
' '
<<
item
.releaseVersion() <<
' '
<<
item
.passID()
19
<<
' '
;
20
}
21
std::string
stringrep = oss.str();
22
cms::Digest
md5alg(stringrep);
23
ProcessHistoryID
phID(md5alg.
digest
().
toString
());
24
return
phID;
25
}
26
27
ProcessHistoryID
ProcessHistory::setProcessHistoryID
() {
28
if
(!
transient_
.
phid_
.
isValid
()) {
29
transient_
.
phid_
=
id
();
30
}
31
return
transient_
.
phid_
;
32
}
33
34
bool
ProcessHistory::getConfigurationForProcess
(
std::string
const
&
name
,
ProcessConfiguration
&
config
)
const
{
35
for
(
auto
const
&
item
: *
this
) {
36
if
(
item
.processName() ==
name
) {
37
config
=
item
;
38
return
true
;
39
}
40
}
41
// Name not found!
42
return
false
;
43
}
44
45
ProcessHistory
&
ProcessHistory::reduce
() {
46
phid
() =
ProcessHistoryID
();
47
for
(
auto
&
item
:
data_
) {
48
item
.reduce();
49
}
50
return
*
this
;
51
}
52
53
bool
isAncestor
(
ProcessHistory
const
&
a
,
ProcessHistory
const
&
b
) {
54
if
(
a
.size() >=
b
.size())
55
return
false
;
56
typedef
ProcessHistory::collection_type::const_iterator const_iterator;
57
for
(const_iterator itA =
a
.data().begin(), itB =
b
.data().begin(), itAEnd =
a
.data().end(); itA != itAEnd;
58
++itA, ++itB) {
59
if
(*itA != *itB)
60
return
false
;
61
}
62
return
true
;
63
}
64
65
std::ostream&
operator<<
(std::ostream& ost,
ProcessHistory
const
& ph) {
66
ost <<
"Process History = "
;
67
copy_all
(ph, std::ostream_iterator<ProcessHistory::value_type>(ost,
";"
));
68
return
ost;
69
}
70
}
// namespace edm
edm::ProcessHistory::transient_
Transients transient_
Definition:
ProcessHistory.h:102
edm::ProcessHistory::Transients::phid_
ProcessHistoryID phid_
Definition:
ProcessHistory.h:96
edm::copy_all
Func copy_all(ForwardSequence &s, Func f)
wrappers for copy
Definition:
Algorithms.h:20
cms::Digest::digest
MD5Result digest()
Definition:
Digest.cc:171
edm
HLT enums.
Definition:
AlignableModifier.h:19
Algorithms.h
edm::ProcessHistory::id
ProcessHistoryID id() const
Definition:
ProcessHistory.cc:10
edm::ProcessHistory::getConfigurationForProcess
bool getConfigurationForProcess(std::string const &name, ProcessConfiguration &config) const
Definition:
ProcessHistory.cc:34
edm::operator<<
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
Definition:
HLTGlobalStatus.h:106
config
Definition:
config.py:1
edm::Hash::isValid
bool isValid() const
Definition:
Hash.h:141
edm::isAncestor
bool isAncestor(ProcessHistory const &a, ProcessHistory const &b)
Definition:
ProcessHistory.cc:53
ProcessHistory.h
cms::Digest
Definition:
Digest.h:46
edm::Hash< ProcessHistoryType >
b
double b
Definition:
hdecay.h:118
a
double a
Definition:
hdecay.h:119
edm::ProcessHistory::data_
collection_type data_
Definition:
ProcessHistory.h:101
B2GTnPMonitor_cfi.item
item
Definition:
B2GTnPMonitor_cfi.py:147
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ProcessHistory::setProcessHistoryID
ProcessHistoryID setProcessHistoryID()
Definition:
ProcessHistory.cc:27
Digest.h
edm::ProcessHistory::phid
ProcessHistoryID & phid()
Definition:
ProcessHistory.h:100
edm::ProcessHistoryID
Hash< ProcessHistoryType > ProcessHistoryID
Definition:
ProcessHistoryID.h:8
Skims_PA_cff.name
name
Definition:
Skims_PA_cff.py:17
edm::ProcessHistory
Definition:
ProcessHistory.h:13
edm::ProcessHistory::reduce
ProcessHistory & reduce()
Definition:
ProcessHistory.cc:45
cms::MD5Result::toString
std::string toString() const
Definition:
Digest.cc:95
edm::ProcessConfiguration
Definition:
ProcessConfiguration.h:14
Generated for CMSSW Reference Manual by
1.8.16