CMS 3D CMS Logo

Functions
calculateIdMD5.cc File Reference
#include <iostream>
#include <TSystem.h>
#include "FWCore/FWLite/interface/FWLiteEnabler.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/PythonParameterSet/interface/MakeParameterSets.h"
#include <openssl/md5.h>

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 14 of file calculateIdMD5.cc.

References gather_cfg::cout, edm::ParameterSet::dump(), FWLiteEnabler::enable(), Exception, cmsRelvalreport::exit, mps_fire::i, edm::readPSetsFrom(), AlCaHLTBitMon_QueryRunRegistry::string, and edm::ParameterSet::trackedPart().

15 {
16 
17  // load framework libraries
18  gSystem->Load( "libFWCoreFWLite" );
20 
21  if ( argc < 3 ) {
22  std::cout << "Usage : " << argv[0]
23  << " [your_cutflow_only.py] "
24  << "[cutflow_name] "<< std::endl;
25  return 0;
26  }
27 
28  if( !edm::readPSetsFrom(argv[1])->existsAs<edm::ParameterSet>(argv[2]) ){
29  std::cout << " ERROR: ParametersSet '"<< argv[2]
30  << "' is missing in your configuration file"
31  << std::endl; exit(0);
32  }
33 
34  edm::ParameterSet conf = edm::readPSetsFrom(argv[1])->getParameterSet(argv[2]);
35  edm::ParameterSet trackedconf = conf.trackedPart();
36 
37  std::string tracked(trackedconf.dump()), untracked(conf.dump());
38 
39  if ( tracked != untracked ) {
40  throw cms::Exception("InvalidConfiguration")
41  << "IDs are not allowed to have untracked parameters"
42  << " in the configuration ParameterSet!";
43  }
44 
45  // now setup the md5 and cute accessor functions
46  unsigned char id_md5_[MD5_DIGEST_LENGTH];
47  memset(id_md5_,0,MD5_DIGEST_LENGTH*sizeof(unsigned char));
48  MD5((const unsigned char*)tracked.c_str(), tracked.size(), id_md5_);
49  printf("%s : ",argv[2]);
50  for( unsigned i=0; i<MD5_DIGEST_LENGTH; ++i ){
51  printf("%02x", id_md5_[i]);
52  }
53  printf("\n");
54 
55  return 0;
56 }
std::string dump(unsigned int indent=0) const
std::shared_ptr< ParameterSet > readPSetsFrom(std::string const &fileOrString)
ParameterSet trackedPart() const
static void enable()
enable automatic library loading