Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-27 03:17:28

0001 #include <iostream>
0002 #include <stdexcept>
0003 #include <sstream>
0004 #include "TString.h"
0005 #include "PhysicsTools/FWLite/interface/CommandLineParser.h"
0006 #include "CaloOnlineTools/HcalOnlineDb/interface/HcalLutManager.h"
0007 #include "FWCore/Utilities/interface/FileInPath.h"
0008 
0009 using namespace std;
0010 
0011 void mergeLUTs(const char *flist, const char *out) {
0012   LutXml xmls;
0013   stringstream ss(flist);
0014   while (ss.good()) {
0015     string file;
0016     ss >> file;
0017     xmls += LutXml(file);
0018   }
0019   xmls.write(out);
0020 }
0021 
0022 int main(int argc, char **argv) {
0023   optutl::CommandLineParser parser("runTestParameters");
0024   parser.parseArguments(argc, argv, true);
0025   if (argc < 2) {
0026     std::cerr << "runTest: missing input command" << std::endl;
0027   } else if (strcmp(argv[1], "merge") == 0) {
0028     std::string flist_ = parser.stringValue("storePrepend");
0029     std::string out_ = parser.stringValue("outputFile");
0030     mergeLUTs(flist_.c_str(), out_.c_str());
0031   } else if (strcmp(argv[1], "create-lut-loader") == 0) {
0032     std::string _file_list = parser.stringValue("outputFile");
0033     std::string _tag = parser.stringValue("tag");
0034     std::string _comment = parser.stringValue("storePrepend");
0035     const std::string &_prefix = _tag;
0036     std::string _version = "1";
0037     int _subversion = 0;
0038     HcalLutManager manager;
0039     manager.create_lut_loader(_file_list, _prefix, _tag, _comment, _tag, _subversion);
0040   } else {
0041     throw std::invalid_argument(Form("Unknown command: %s", argv[1]));
0042   }
0043 
0044   return 0;
0045 }