CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/CondFormats/CSCObjects/src/CSCTriggerMappingFromFile.cc

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