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) { isCurrentProcess() = true; }
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(pcid().isValid()) {
56  return 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);
64  pcid().swap(tmp);
65  return pcid();
66  }
67 
68  void
70  assert(parameterSetID_ == ParameterSetID());
71  parameterSetID_ = pSetID;
72  }
73 
74  void
76  // Skip to the part of the release version just after
77  // the first two numbers and erase the rest of it.
78  std::string::iterator iter = releaseVersion_.begin();
79  std::string::iterator iEnd = releaseVersion_.end();
80  while(iter != iEnd && isdigit(*iter) == 0) ++iter;
81  while(iter != iEnd && isdigit(*iter) != 0) ++iter;
82  while(iter != iEnd && isdigit(*iter) == 0) ++iter;
83  while(iter != iEnd && isdigit(*iter) != 0) ++iter;
84  if (iter == iEnd) return;
86  releaseVersion_.erase(iter,iEnd);
87  }
88 
90  if (a.processName() < b.processName()) return true;
91  if (b.processName() < a.processName()) return false;
92  if (a.parameterSetID() < b.parameterSetID()) return true;
93  if (b.parameterSetID() < a.parameterSetID()) return false;
94  if (a.releaseVersion() < b.releaseVersion()) return true;
95  if (b.releaseVersion() < a.releaseVersion()) return false;
96  if (a.passID() < b.passID()) return true;
97  return false;
98  }
99 
100  std::ostream&
101  operator<< (std::ostream& os, ProcessConfiguration const& pc) {
102  os << pc.processName() << ' '
103  << pc.parameterSetID() << ' '
104  << pc.releaseVersion() << ' '
105  << pc.passID();
106  return os;
107  }
108 }
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:91
ProcessConfigurationID id() const
void setParameterSetID(ParameterSetID const &pSetID)
void swap(Hash< I > &other)
Definition: Hash.h:202
MD5Result digest() const
Definition: Digest.cc:194
PassID const & passID() const
ProcessConfigurationID & pcid() 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
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
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