CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/CondFormats/CSCObjects/src/CSCTriggerElectronicsMappingFromFile.cc

Go to the documentation of this file.
00001 #include "CondFormats/CSCObjects/interface/CSCTriggerElectronicsMappingFromFile.h"
00002 #include <iostream>
00003 #include <fstream>
00004 #include <sstream>
00005 
00006 CSCTriggerElectronicsMappingFromFile::CSCTriggerElectronicsMappingFromFile( std::string filename ) 
00007   : filename_( filename ) { fill(); }
00008 
00009 CSCTriggerElectronicsMappingFromFile::~CSCTriggerElectronicsMappingFromFile(){}
00010 
00011 void CSCTriggerElectronicsMappingFromFile::fill( void ) {
00012   std::ifstream in( filename_.c_str() );
00013   std::string line;
00014   const std::string commentFlag = "#";
00015   if ( !in ) {
00016     std::cout << "CSCTriggerElectronicsMappingFromFile: ERROR! Failed to open file containing mapping, " <<
00017       filename_ << std::endl ;
00018   }
00019   else
00020   {
00021     std::cout << "CSCTriggerElectronicsMappingFromFile: opened file containing mapping, " << 
00022       filename_ << std::endl ;
00023 
00024     while ( getline(in, line) ) { // getline() from <string>
00025       if ( debugV() ) std::cout << line << std::endl;
00026       if ( line[0] != commentFlag[0] ) {
00027         int i1, i2, i3, i6, i7, i8, i9, i10;
00028         std::istringstream is( line );
00029         is >> i1 >> i2 >> i3 >> i6 >> i7 >> i8 >> i9 >> i10;
00030         if ( debugV() ) std::cout << i1 << " " << i2 << " " << i3 << " " 
00031                                   << i6 << " " << i7 << " " << i8 << " " 
00032                                   << i9 << " " << i10 << std::endl;
00033         addRecord( i1, i2, i3, 0, 0, i6, i7, i8, i9 , i10);
00034       }
00035     }
00036 
00037   }
00038 
00039   return;
00040 }
00041