CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ProcessConfiguration.cc
Go to the documentation of this file.
4 
5 #include <ostream>
6 #include <cassert>
7 #include <sstream>
8 #include <cctype>
9 
10 /*----------------------------------------------------------------------
11 
12 ----------------------------------------------------------------------*/
13 
14 namespace edm {
15 
16  ProcessConfiguration::ProcessConfiguration() : processName_(), parameterSetID_(), releaseVersion_(), passID_() {}
17 
19  ParameterSetID const& pSetID,
20  ReleaseVersion const& relVersion,
21  PassID const& pass)
22  : processName_(procName), parameterSetID_(pSetID), releaseVersion_(relVersion), passID_(pass) {}
23 
25  ReleaseVersion const& relVersion,
26  PassID const& pass)
27  : processName_(procName), parameterSetID_(), releaseVersion_(relVersion), passID_(pass) {
29  }
30 
33  throw edm::Exception(errors::LogicError) << "Illegal attempt to access the process top level parameter set ID\n"
34  << "from the ProcessConfiguration before that parameter\n"
35  << "set has been frozen and registered. The parameter set\n"
36  << "can be changed during module validation, which occurs\n"
37  << "concurrently with module construction. The ID of the\n"
38  << "ProcessConfiguration itself also depends on that parameter\n"
39  << "set ID. It is illegal to access either before they are frozen.\n";
40  }
41  return parameterSetID_;
42  }
43 
45  if (transient_.pcid_.isValid()) {
46  return transient_.pcid_;
47  }
48  // This implementation is ripe for optimization.
49  std::ostringstream oss;
50  oss << *this;
51  std::string stringrep = oss.str();
52  cms::Digest md5alg(stringrep);
53  ProcessConfigurationID pcid(md5alg.digest().toString());
54  return pcid;
55  }
56 
59  parameterSetID_ = pSetID;
60  }
61 
63  if (!transient_.pcid_.isValid()) {
64  transient_.pcid_ = id();
65  }
66  return transient_.pcid_;
67  }
68 
70  // Skip to the part of the release version just after
71  // the first two numbers and erase the rest of it.
72  std::string::iterator iter = releaseVersion_.begin();
73  std::string::iterator iEnd = releaseVersion_.end();
74  while (iter != iEnd && isdigit(*iter) == 0)
75  ++iter;
76  while (iter != iEnd && isdigit(*iter) != 0)
77  ++iter;
78  while (iter != iEnd && isdigit(*iter) == 0)
79  ++iter;
80  while (iter != iEnd && isdigit(*iter) != 0)
81  ++iter;
82  if (iter == iEnd)
83  return;
85  releaseVersion_.erase(iter, iEnd);
86  }
87 
89  if (a.processName() < b.processName())
90  return true;
91  if (b.processName() < a.processName())
92  return false;
93  if (a.parameterSetID() < b.parameterSetID())
94  return true;
95  if (b.parameterSetID() < a.parameterSetID())
96  return false;
97  if (a.releaseVersion() < b.releaseVersion())
98  return true;
99  if (b.releaseVersion() < a.releaseVersion())
100  return false;
101  if (a.passID() < b.passID())
102  return true;
103  return false;
104  }
105 
106  std::ostream& operator<<(std::ostream& os, ProcessConfiguration const& pc) {
107  os << pc.processName() << ' ' << pc.parameterSetID() << ' ' << pc.releaseVersion() << ' ' << pc.passID();
108  return os;
109  }
110 } // namespace edm
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:89
ProcessConfigurationID setProcessConfigurationID()
ProcessConfigurationID id() const
void setParameterSetID(ParameterSetID const &pSetID)
assert(be >=bs)
PassID const & passID() const
std::string const & processName() const
ParameterSetID const & parameterSetID() const
MD5Result digest()
Definition: Digest.cc:171
Hash< ProcessConfigurationType > ProcessConfigurationID
Hash< ParameterSetType > ParameterSetID
ReleaseVersion const & releaseVersion() const
std::string toString() const
Definition: Digest.cc:95
double b
Definition: hdecay.h:118
std::string ReleaseVersion
Definition: ReleaseVersion.h:6
bool isValid() const
Definition: Hash.h:141
double a
Definition: hdecay.h:119
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
std::string PassID
Definition: PassID.h:7