File indexing completed on 2024-04-06 12:19:55
0001 #include "L1Trigger/GlobalCaloTrigger/test/produceTrivialCalibrationLut.h"
0002
0003 #include <iostream>
0004 #include <fstream>
0005 #include <sstream>
0006
0007 typedef produceTrivialCalibrationLut::lutPtrVector lutPtrVector;
0008
0009 int main(int argc, char** argv) {
0010 const std::string filename = (argc == 1 ? "" : std::string(argv[1]));
0011 if (filename == "") {
0012 std::cout << "No filename argument supplied - exiting" << std::endl;
0013 return 0;
0014 }
0015
0016 bool allOk = true;
0017
0018 produceTrivialCalibrationLut* lutProducer = new produceTrivialCalibrationLut();
0019 lutPtrVector lutVector = lutProducer->produce();
0020
0021 for (lutPtrVector::const_iterator lut = lutVector.begin(); lut != lutVector.end(); lut++) {
0022 std::stringstream ss;
0023 std::string nextFile;
0024 ss << filename << (*lut)->etaBin() << ".txt";
0025 ss >> nextFile;
0026 std::ofstream outFile(nextFile.c_str(), std::ios::out | std::ios::trunc);
0027 if (!outFile.is_open()) {
0028 std::cout << "Failed to open output file " << nextFile << "\n";
0029 allOk = false;
0030 } else {
0031 outFile << **lut;
0032 outFile.close();
0033 }
0034 }
0035
0036 return (allOk ? 0 : -1);
0037 }