CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
17  ProcessConfiguration::ProcessConfiguration() : processName_(), parameterSetID_(), releaseVersion_(), passID_() {}
18 
20  std::string const& procName,
21  ParameterSetID const& pSetID,
22  ReleaseVersion const& relVersion,
23  PassID const& pass) :
24  processName_(procName),
25  parameterSetID_(pSetID),
26  releaseVersion_(relVersion),
27  passID_(pass) { }
28 
30  std::string const& procName,
31  ReleaseVersion const& relVersion,
32  PassID const& pass) :
33  processName_(procName),
34  parameterSetID_(),
35  releaseVersion_(relVersion),
36  passID_(pass) { setCurrentProcess(); }
37 
38  ParameterSetID const&
42  << "Illegal attempt to access the process top level parameter set ID\n"
43  << "from the ProcessConfiguration before that parameter\n"
44  << "set has been frozen and registered. The parameter set\n"
45  << "can be changed during module validation, which occurs\n"
46  << "concurrently with module construction. The ID of the\n"
47  << "ProcessConfiguration itself also depends on that parameter\n"
48  << "set ID. It is illegal to access either before they are frozen.\n";
49  }
50  return parameterSetID_;
51  }
52 
55  if(transient_.pcid_.isValid()) {
56  return transient_.pcid_;
57  }
58  // This implementation is ripe for optimization.
59  std::ostringstream oss;
60  oss << *this;
61  std::string stringrep = oss.str();
62  cms::Digest md5alg(stringrep);
63  ProcessConfigurationID pcid(md5alg.digest().toString());
64  return pcid;
65  }
66 
67  void
69  assert(parameterSetID_ == ParameterSetID());
70  parameterSetID_ = pSetID;
71  }
72 
75  if(!transient_.pcid_.isValid()) {
76  transient_.pcid_ = id();
77  }
78  return transient_.pcid_;
79  }
80 
81  void
83  // Skip to the part of the release version just after
84  // the first two numbers and erase the rest of it.
85  std::string::iterator iter = releaseVersion_.begin();
86  std::string::iterator iEnd = releaseVersion_.end();
87  while(iter != iEnd && isdigit(*iter) == 0) ++iter;
88  while(iter != iEnd && isdigit(*iter) != 0) ++iter;
89  while(iter != iEnd && isdigit(*iter) == 0) ++iter;
90  while(iter != iEnd && isdigit(*iter) != 0) ++iter;
91  if (iter == iEnd) return;
93  releaseVersion_.erase(iter,iEnd);
94  }
95 
97  if (a.processName() < b.processName()) return true;
98  if (b.processName() < a.processName()) return false;
99  if (a.parameterSetID() < b.parameterSetID()) return true;
100  if (b.parameterSetID() < a.parameterSetID()) return false;
101  if (a.releaseVersion() < b.releaseVersion()) return true;
102  if (b.releaseVersion() < a.releaseVersion()) return false;
103  if (a.passID() < b.passID()) return true;
104  return false;
105  }
106 
107  std::ostream&
108  operator<< (std::ostream& os, ProcessConfiguration const& pc) {
109  os << pc.processName() << ' '
110  << pc.parameterSetID() << ' '
111  << pc.releaseVersion() << ' '
112  << pc.passID();
113  return os;
114  }
115 }
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:90
ProcessConfigurationID setProcessConfigurationID()
ProcessConfigurationID id() const
void setParameterSetID(ParameterSetID const &pSetID)
MD5Result digest() const
Definition: Digest.cc:194
PassID const & passID() const
std::string const & processName() const
ParameterSetID const & parameterSetID() const
Hash< ProcessConfigurationType > ProcessConfigurationID
Hash< ParameterSetType > ParameterSetID
ReleaseVersion const & releaseVersion() const
std::string toString() const
Definition: Digest.cc:87
double b
Definition: hdecay.h:120
std::string ReleaseVersion
Definition: ReleaseVersion.h:7
bool isValid() const
Definition: Hash.h:150
double a
Definition: hdecay.h:121
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
std::string PassID
Definition: PassID.h:8