Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:00

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