CMS 3D CMS Logo

calculateIdMD5.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <TSystem.h>
3 
6 
9 
10 #include <openssl/md5.h>
11 
12 using namespace std;
13 
14 int main(int argc, char** argv) {
15  // load framework libraries
16  gSystem->Load("libFWCoreFWLite");
18 
19  if (argc < 3) {
20  std::cout << "Usage : " << argv[0] << " [your_cutflow_only.py] "
21  << "[cutflow_name] " << std::endl;
22  return 0;
23  }
24 
25  if (!edm::readPSetsFrom(argv[1])->existsAs<edm::ParameterSet>(argv[2])) {
26  std::cout << " ERROR: ParametersSet '" << argv[2] << "' is missing in your configuration file" << std::endl;
27  exit(0);
28  }
29 
30  edm::ParameterSet conf = edm::readPSetsFrom(argv[1])->getParameterSet(argv[2]);
31  edm::ParameterSet trackedconf = conf.trackedPart();
32 
33  std::string tracked(trackedconf.dump()), untracked(conf.dump());
34 
35  if (tracked != untracked) {
36  throw cms::Exception("InvalidConfiguration") << "IDs are not allowed to have untracked parameters"
37  << " in the configuration ParameterSet!";
38  }
39 
40  // now setup the md5 and cute accessor functions
41  unsigned char id_md5_[MD5_DIGEST_LENGTH];
42  memset(id_md5_, 0, MD5_DIGEST_LENGTH * sizeof(unsigned char));
43  MD5((const unsigned char*)tracked.c_str(), tracked.size(), id_md5_);
44  printf("%s : ", argv[2]);
45  for (unsigned i = 0; i < MD5_DIGEST_LENGTH; ++i) {
46  printf("%02x", id_md5_[i]);
47  }
48  printf("\n");
49 
50  return 0;
51 }
cmsBatch.argv
argv
Definition: cmsBatch.py:279
mps_fire.i
i
Definition: mps_fire.py:355
dir2webdir.argc
argc
Definition: dir2webdir.py:39
edm::readPSetsFrom
std::unique_ptr< edm::ParameterSet > readPSetsFrom(std::string const &fileOrString)
Definition: ParameterSetReader.cc:23
gather_cfg.cout
cout
Definition: gather_cfg.py:144
main
int main(int argc, char **argv)
Definition: calculateIdMD5.cc:14
edm::ParameterSet::dump
std::string dump(unsigned int indent=0) const
Definition: ParameterSet.cc:825
ParameterSetReader.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FWLiteEnabler::enable
static void enable()
enable automatic library loading
Definition: FWLiteEnabler.cc:46
edm::ParameterSet
Definition: ParameterSet.h:36
std
Definition: JetResolutionObject.h:76
Exception
Definition: hltDiff.cc:246
edm::ParameterSet::trackedPart
ParameterSet trackedPart() const
Definition: ParameterSet.cc:679
Types.untracked
untracked
Definition: Types.py:35
Exception.h
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
ParameterSet.h
FWLiteEnabler.h