CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
calculateIdMD5.cc File Reference
#include <iostream>
#include <TSystem.h>
#include "FWCore/FWLite/interface/AutoLibraryLoader.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 dbtoconf::conf, gather_cfg::cout, edm::ParameterSet::dump(), AutoLibraryLoader::enable(), edm::hlt::Exception, cmsRelvalreport::exit, i, edm::readPSetsFrom(), AlCaHLTBitMon_QueryRunRegistry::string, edm::ParameterSet::trackedPart(), and Types::untracked.

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((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 }
int i
Definition: DBlmapReader.cc:9
std::string dump(unsigned int indent=0) const
std::shared_ptr< ParameterSet > readPSetsFrom(std::string const &fileOrString)
ParameterSet trackedPart() const
tuple conf
Definition: dbtoconf.py:185
tuple argc
Definition: dir2webdir.py:38
static void enable()
enable automatic library loading
tuple cout
Definition: gather_cfg.py:121
tuple untracked
Definition: Types.py:27