CMS 3D CMS Logo

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
edm::ParameterSetID
Hash< ParameterSetType > ParameterSetID
Definition: ParameterSetID.h:21
edm::ProcessConfiguration::ProcessConfiguration
ProcessConfiguration()
Definition: ProcessConfiguration.cc:16
edm::ProcessConfiguration::releaseVersion
ReleaseVersion const & releaseVersion() const
Definition: ProcessConfiguration.h:27
cms::Digest::digest
MD5Result digest()
Definition: Digest.cc:171
edm::errors::LogicError
Definition: EDMException.h:37
edm::ProcessConfiguration::isCurrentProcess
bool isCurrentProcess() const
Definition: ProcessConfiguration.h:52
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ProcessConfiguration::setCurrentProcess
void setCurrentProcess()
Definition: ProcessConfiguration.h:53
cms::cuda::assert
assert(be >=bs)
edm::ProcessConfiguration::passID
PassID const & passID() const
Definition: ProcessConfiguration.h:28
edm::operator<<
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
Definition: HLTGlobalStatus.h:106
EDMException.h
edm::ProcessConfiguration::id
ProcessConfigurationID id() const
Definition: ProcessConfiguration.cc:44
edm::Hash::isValid
bool isValid() const
Definition: Hash.h:141
ProcessConfiguration.h
cms::Digest
Definition: Digest.h:46
edm::operator<
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:89
edm::Hash< ParameterSetType >
edm::ProcessConfiguration::processName
std::string const & processName() const
Definition: ProcessConfiguration.h:24
b
double b
Definition: hdecay.h:118
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ProcessConfiguration::parameterSetID
ParameterSetID const & parameterSetID() const
Definition: ProcessConfiguration.cc:31
a
double a
Definition: hdecay.h:119
edm::ProcessConfigurationID
Hash< ProcessConfigurationType > ProcessConfigurationID
Definition: ProcessConfigurationID.h:8
edm::ProcessConfiguration::setParameterSetID
void setParameterSetID(ParameterSetID const &pSetID)
Definition: ProcessConfiguration.cc:57
edm::ProcessConfiguration::reduce
void reduce()
Definition: ProcessConfiguration.cc:69
edm::ProcessConfiguration::parameterSetID_
ParameterSetID parameterSetID_
Definition: ProcessConfiguration.h:56
edm::ReleaseVersion
std::string ReleaseVersion
Definition: ReleaseVersion.h:6
Digest.h
edm::ProcessConfiguration::setProcessConfigurationID
ProcessConfigurationID setProcessConfigurationID()
Definition: ProcessConfiguration.cc:62
Exception
Definition: hltDiff.cc:246
edm::ProcessConfiguration::releaseVersion_
ReleaseVersion releaseVersion_
Definition: ProcessConfiguration.h:57
edm::ProcessConfiguration::transient_
Transients transient_
Definition: ProcessConfiguration.h:59
cms::MD5Result::toString
std::string toString() const
Definition: Digest.cc:95
edm::ProcessConfiguration
Definition: ProcessConfiguration.h:14
edm::PassID
std::string PassID
Definition: PassID.h:7
edm::ProcessConfiguration::Transients::pcid_
ProcessConfigurationID pcid_
Definition: ProcessConfiguration.h:46