CMS 3D CMS Logo

CSCTriggerMappingFromFile.cc
Go to the documentation of this file.
2 #include <iostream>
3 #include <fstream>
4 #include <sstream>
5 
7  : filename_( filename ) { fill(); }
8 
10 
12  std::ifstream in( filename_.c_str() );
14  const std::string commentFlag = "#";
15  if ( !in ) {
16  std::cout << "CSCTriggerMappingFromFile: ERROR! Failed to open file containing mapping, " <<
17  filename_ << std::endl ;
18  }
19  else
20  {
21  std::cout << "CSCTriggerMappingFromFile: opened file containing mapping, " <<
22  filename_ << std::endl ;
23 
24  while ( getline(in, line) ) { // getline() from <string>
25  if ( debugV() ) std::cout << line << std::endl;
26  if ( line[0] != commentFlag[0] ) {
27  int i1, i2, i3, i4, i5, i6, i7, i8, i9, i10;
28  std::istringstream is( line );
29  is >> i1 >> i2 >> i3 >> i4 >> i5 >> i6 >> i7 >> i8 >> i9 >> i10;
30  if ( debugV() ) std::cout << i1 << " " << i2 << " " << i3 << " " << i4 << " "
31  << i5 << " " << i6 << " " << i7 << " " << i8 << " "
32  << i9 << " " << i10 << std::endl;
33  addRecord( i1, i2, i3, i4, i5, i6, i7, i8, i9 , i10);
34  }
35  }
36 
37  }
38 
39  return;
40 }
41 
bool debugV(void) const
void addRecord(int rendcap, int rstation, int rsector, int rsubsector, int rcscid, int cendcap, int cstation, int csector, int csubsector, int ccscid)
void fill(void) override
Fill mapping store.
~CSCTriggerMappingFromFile() override
Destructor.