CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCReadoutMappingFromFile.cc
Go to the documentation of this file.
4 #include <iostream>
5 #include <fstream>
6 #include <sstream>
7 
9  fill( ps );
10 }
11 
13 
15  edm::FileInPath fp = ps.getParameter<edm::FileInPath>("theMappingFile");
16  theMappingFile = fp.fullPath();
17  std::ifstream in( theMappingFile.c_str() );
19  const std::string commentFlag = "#";
20  if ( !in ) {
21  edm::LogError("CSC") << " Failed to open file " << theMappingFile << " containing mapping.";
22  }
23  else
24  {
25  edm::LogInfo("CSC") << " Opened file " << theMappingFile << " containing mapping.";
26 
27  while ( getline(in, line) ) { // getline() from <string>
28  // LogDebug("CSC") << line;
29  if ( line[0] != commentFlag[0] ) {
30  int i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11;
31  std::istringstream is( line );
32  is >> i1 >> i2 >> i3 >> i4 >> i5 >> i6 >> i7 >> i8 >> i9 >> i10 >> i11;
33  // LogDebug("CSC") << i1 << " " << i2 << " " << i3 << " " << i4 << " " <<
34  // i5 << " " << i6 << " " << i7 << " " << i8 << " " << i9;
35  addRecord( i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11 );
36  }
37  }
38 
39  }
40 
41  return;
42 }
43 
T getParameter(std::string const &) const
virtual void fill(const edm::ParameterSet &ps)
Fill mapping store.
void addRecord(int endcap, int station, int ring, int chamber, int vmecrate, int dmb, int tmb, int tsector, int cscid, int ddu, int dcc)
virtual ~CSCReadoutMappingFromFile()
Destructor.
std::string fullPath() const
Definition: FileInPath.cc:171