Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:56

0001 #include "CondFormats/CSCObjects/interface/CSCTriggerMappingFromFile.h"
0002 #include <iostream>
0003 #include <fstream>
0004 #include <sstream>
0005 
0006 CSCTriggerMappingFromFile::CSCTriggerMappingFromFile(std::string filename) : filename_(filename) { fill(); }
0007 
0008 CSCTriggerMappingFromFile::~CSCTriggerMappingFromFile() {}
0009 
0010 void CSCTriggerMappingFromFile::fill(void) {
0011   std::ifstream in(filename_.c_str());
0012   std::string line;
0013   const std::string commentFlag = "#";
0014   if (!in) {
0015     std::cout << "CSCTriggerMappingFromFile: ERROR! Failed to open file containing mapping, " << filename_ << std::endl;
0016   } else {
0017     std::cout << "CSCTriggerMappingFromFile: opened file containing mapping, " << filename_ << std::endl;
0018 
0019     while (getline(in, line)) {  // getline() from <string>
0020       if (debugV())
0021         std::cout << line << std::endl;
0022       if (line[0] != commentFlag[0]) {
0023         int i1, i2, i3, i4, i5, i6, i7, i8, i9, i10;
0024         std::istringstream is(line);
0025         is >> i1 >> i2 >> i3 >> i4 >> i5 >> i6 >> i7 >> i8 >> i9 >> i10;
0026         if (debugV())
0027           std::cout << i1 << " " << i2 << " " << i3 << " " << i4 << " " << i5 << " " << i6 << " " << i7 << " " << i8
0028                     << " " << i9 << " " << i10 << std::endl;
0029         addRecord(i1, i2, i3, i4, i5, i6, i7, i8, i9, i10);
0030       }
0031     }
0032   }
0033 
0034   return;
0035 }