File indexing completed on 2024-04-06 12:19:53
0001 #include "L1Trigger/GlobalCaloTrigger/test/L1GctLutFromFile.h"
0002 #include "L1Trigger/GlobalCaloTrigger/test/produceTrivialCalibrationLut.h"
0003
0004 #include <iostream>
0005 #include <fstream>
0006 #include <sstream>
0007
0008 typedef produceTrivialCalibrationLut::lutPtrVector lutPtrVector;
0009
0010 int main(int argc, char** argv) {
0011 if (argc < 2) {
0012 std::cout << "No filename argument supplied - exiting" << std::endl;
0013 return 0;
0014 }
0015
0016 char* filename = argv[1];
0017
0018 bool allOk = true;
0019
0020 produceTrivialCalibrationLut* lutProducer = new produceTrivialCalibrationLut();
0021 lutPtrVector lutVector1 = lutProducer->produce();
0022
0023 for (lutPtrVector::const_iterator lut1 = lutVector1.begin(); lut1 != lutVector1.end(); lut1++) {
0024 std::stringstream ss;
0025 std::string nextFile;
0026 ss << filename << (*lut1)->etaBin() << ".txt";
0027 ss >> nextFile;
0028
0029 static const int NAdd = JET_ET_CAL_LUT_ADD_BITS;
0030 static const int NDat = JET_ET_CAL_LUT_DAT_BITS;
0031
0032 std::ifstream inFile(nextFile.c_str(), std::ios::in);
0033 if (!inFile.is_open()) {
0034 std::cout << "Failed to open input file " << nextFile << std::endl;
0035 allOk = false;
0036 } else {
0037 L1GctLutFromFile<NAdd, NDat>* lut2 = L1GctLutFromFile<NAdd, NDat>::setupLut(nextFile);
0038
0039 std::cout << "Eta bin " << (*lut1)->etaBin() << std::endl;
0040 if (**lut1 == *lut2) {
0041 std::cout << "Look-up table match check ok\n";
0042 } else {
0043 std::cout << "Look-up table match check failed\n";
0044 }
0045 if (*lut2 != **lut1) {
0046 std::cout << "Look-up tables are not equal\n";
0047 } else {
0048 std::cout << "Look-up tables are equal\n";
0049 }
0050 }
0051 }
0052
0053 return (allOk ? 0 : -1);
0054 }