CMS 3D CMS Logo

Public Member Functions | Private Attributes

CSCReadoutMappingFromFile Class Reference

#include <CSCReadoutMappingFromFile.h>

Inheritance diagram for CSCReadoutMappingFromFile:
CSCReadoutMappingForSliceTest CSCReadoutMapping

List of all members.

Public Member Functions

 CSCReadoutMappingFromFile (const edm::ParameterSet &ps)
 Constructor.
 CSCReadoutMappingFromFile ()
virtual void fill (const edm::ParameterSet &ps)
 Fill mapping store.
virtual ~CSCReadoutMappingFromFile ()
 Destructor.

Private Attributes

std::string theMappingFile

Detailed Description

Author:
Tim Cox A concrete CSCReadoutMappingForSliceTest to read mapping from Ascii file. Find file from FileInPath of ParameterSet passed from calling E_Producer.

Definition at line 15 of file CSCReadoutMappingFromFile.h.


Constructor & Destructor Documentation

CSCReadoutMappingFromFile::CSCReadoutMappingFromFile ( const edm::ParameterSet ps) [explicit]

Constructor.

Definition at line 8 of file CSCReadoutMappingFromFile.cc.

References fill().

                                                                                {
  fill( ps ); 
}
CSCReadoutMappingFromFile::CSCReadoutMappingFromFile ( ) [inline]

Definition at line 20 of file CSCReadoutMappingFromFile.h.

{}
CSCReadoutMappingFromFile::~CSCReadoutMappingFromFile ( ) [virtual]

Destructor.

Definition at line 12 of file CSCReadoutMappingFromFile.cc.

{}

Member Function Documentation

void CSCReadoutMappingFromFile::fill ( const edm::ParameterSet ps) [virtual]

Fill mapping store.

Implements CSCReadoutMapping.

Definition at line 14 of file CSCReadoutMappingFromFile.cc.

References CSCReadoutMapping::addRecord(), edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), recoMuon::in, geometryCSVtoXML::line, and theMappingFile.

Referenced by CSCReadoutMappingFromFile().

                                                                {
  edm::FileInPath fp = ps.getParameter<edm::FileInPath>("theMappingFile");
  theMappingFile = fp.fullPath();
  std::ifstream in( theMappingFile.c_str() );
  std::string line;
  const std::string commentFlag = "#";
  if ( !in ) {
    edm::LogError("CSC") << " Failed to open file " << theMappingFile << " containing mapping.";
  }
  else
  {
    edm::LogInfo("CSC") << " Opened file " << theMappingFile << " containing mapping.";

    while ( getline(in, line) ) { // getline() from <string>
      // LogDebug("CSC") << line;
      if ( line[0] != commentFlag[0] ) {
        int i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11;
        std::istringstream is( line );
        is >> i1 >> i2 >> i3 >> i4 >> i5 >> i6 >> i7 >> i8 >> i9 >> i10 >> i11;
        // LogDebug("CSC") << i1 << " " << i2 << " " << i3 << " " << i4 << " " <<
        //        i5 << " " << i6 << " " << i7 << " " << i8 << " " << i9;
        addRecord( i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11 );
      }
    }

  }

  return;
}

Member Data Documentation

Definition at line 29 of file CSCReadoutMappingFromFile.h.

Referenced by fill().