LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
ProcessHistory.cc
Go to the documentation of this file.
2 
3 #include "cetlib/MD5Digest.h"
4 #include "cetlib/container_algorithms.h"
5 #include <iterator>
6 #include <ostream>
7 #include <sstream>
8 
9 using namespace cet;
10 using namespace std;
11 
12 namespace art {
14  ProcessHistory::id() const
15  {
16  if (phid().isValid()) {
17  return phid();
18  }
19  // This implementation is ripe for optimization.
20  // We do not use operator<< because it does not write out everything.
21  ostringstream oss;
22  for (const_iterator i = begin(), e = end(); i != e; ++i) {
23  oss << i->processName() << ' ' << i->parameterSetID() << ' '
24  << i->releaseVersion() << ' '
25  << ' '; // retain extra spaces for backwards compatibility
26  }
27  string stringrep = oss.str();
28  cet::MD5Digest md5alg(stringrep);
29  ProcessHistoryID tmp(md5alg.digest().toString());
30  phid().swap(tmp);
31  return phid();
32  }
33 
34  bool
35  ProcessHistory::getConfigurationForProcess(string const& name,
36  ProcessConfiguration& config) const
37  {
38  for (const_iterator i = begin(), e = end(); i != e; ++i) {
39  if (i->processName() == name) {
40  config = *i;
41  return true;
42  }
43  }
44  // Name not found!
45  return false;
46  }
47 
48  bool
50  {
51  if (a.size() >= b.size())
52  return false;
54  for (const_iterator itA = a.data().begin(),
55  itB = b.data().begin(),
56  itAEnd = a.data().end();
57  itA != itAEnd;
58  ++itA, ++itB) {
59  if (*itA != *itB)
60  return false;
61  }
62  return true;
63  }
64 
65  ostream&
66  operator<<(ostream& ost, ProcessHistory const& ph)
67  {
68  ost << "Process History = ";
69  copy_all(ph, ostream_iterator<ProcessHistory::value_type>(ost, ";"));
70  return ost;
71  }
72 }
STL namespace.
Float_t tmp
Definition: plot.C:37
collection_type::const_iterator const_iterator
Hash< ProcessHistoryType > ProcessHistoryID
collection_type const & data() const
intermediate_table::const_iterator const_iterator
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
ostream & operator<<(ostream &ost, ProcessHistory const &ph)
bool isAncestor(ProcessHistory const &a, ProcessHistory const &b)
HLT enums.
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
size_type size() const
Float_t e
Definition: plot.C:34