CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes | Static Private Attributes

SurveyInputTextReader Class Reference

#include <SurveyInputTextReader.h>

List of all members.

Public Types

typedef std::map< UniqueId,
align::Scalars
MapType
typedef std::pair< UniqueId,
align::Scalars
PairType
typedef std::pair< align::ID,
align::StructureType
UniqueId

Public Member Functions

void readFile (const std::string &textFileName)
 Read given text file.
const MapTypeUniqueIdMap () const

Private Attributes

MapType theMap

Static Private Attributes

static const int NINPUTS = 27

Detailed Description

Definition at line 18 of file SurveyInputTextReader.h.


Member Typedef Documentation

Definition at line 24 of file SurveyInputTextReader.h.

Definition at line 25 of file SurveyInputTextReader.h.

Definition at line 22 of file SurveyInputTextReader.h.


Member Function Documentation

void SurveyInputTextReader::readFile ( const std::string &  textFileName)

Read given text file.

Definition at line 11 of file SurveyInputTextReader.cc.

References i, geometryCSVtoXML::line, AlignableObjectId::nameToType(), NINPUTS, and theMap.

Referenced by SurveyInputTrackerFromDB::analyze(), and SurveyMisalignmentInput::analyze().

{

  std::ifstream myfile( textFileName.c_str() );
  if ( !myfile.is_open() )
        throw cms::Exception("FileAccess") << "Unable to open input text file";

  static AlignableObjectId alignObjId;
        
  while ( !myfile.eof() && myfile.good() )
    {
      align::Scalars m_inputs;
                
      UniqueId  m_uId;
      char firstchar;
      firstchar = myfile.peek();

      if(firstchar == '#'){
        std::string line;
        getline(myfile,line);
      }
      else if (firstchar == '!'){
        std::string firststring;
        std::string structure; 
        myfile >> firststring >> structure;
        std::string endofline;
        getline(myfile,endofline);
        m_uId.second = alignObjId.nameToType(structure);
      }
      else{
        myfile >> m_uId.first;

        for ( int i=0; i<NINPUTS; i++ )
          {
            float tmpInput;
            myfile >> tmpInput;
            m_inputs.push_back( tmpInput );
          }
        std::string endofline;
        getline(myfile,endofline);
        theMap.insert( PairType( m_uId, m_inputs));                     
                        
        // Check if read succeeded (otherwise, we are at eof)
        if ( myfile.fail() ) break;
                        

      }
    }
}
const MapType& SurveyInputTextReader::UniqueIdMap ( ) const [inline]

Definition at line 31 of file SurveyInputTextReader.h.

References theMap.

Referenced by SurveyInputTrackerFromDB::analyze(), and SurveyMisalignmentInput::analyze().

{ return theMap; }

Member Data Documentation

const int SurveyInputTextReader::NINPUTS = 27 [static, private]

Definition at line 37 of file SurveyInputTextReader.h.

Referenced by readFile().

Definition at line 35 of file SurveyInputTextReader.h.

Referenced by readFile(), and UniqueIdMap().