Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:29:01

0001 
0002 // This will return the ParameterSetID of the parameter set
0003 // defined in the python file or configuration string.
0004 // Warning, this may not be the same as the ParameterSetID
0005 // of a cmsRun process, because validation code may insert
0006 // additional parameters into the configuration.
0007 
0008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0009 #include "FWCore/ParameterSetReader/interface/ParameterSetReader.h"
0010 #include "FWCore/Utilities/interface/Exception.h"
0011 
0012 #include <memory>
0013 
0014 #include <iostream>
0015 #include <string>
0016 
0017 int main(int argc, char** argv) try {
0018   // config can either be a name or a string
0019   std::string config;
0020 
0021   if (argc == 1) {
0022     // Read input from cin into configstring..
0023     std::string line;
0024     while (std::getline(std::cin, line)) {
0025       config += line;
0026       config += '\n';
0027     }
0028   } else if (argc == 2) {
0029     config = std::string(argv[1]);
0030   }
0031 
0032   std::shared_ptr<edm::ParameterSet> parameterSet = edm::readConfig(config);
0033   parameterSet->registerIt();
0034   std::cout << parameterSet->id() << std::endl;
0035   return 0;
0036 } catch (cms::Exception const& e) {
0037   std::cout << e.explainSelf() << std::endl;
0038   return 1;
0039 } catch (std::exception const& e) {
0040   std::cout << e.what() << std::endl;
0041   return 1;
0042 }