#include <SurveyInputTextReader.h>
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 MapType & | UniqueIdMap () const |
Private Attributes | |
MapType | theMap |
Static Private Attributes | |
static const int | NINPUTS = 27 |
Definition at line 18 of file SurveyInputTextReader.h.
typedef std::map<UniqueId, align::Scalars> SurveyInputTextReader::MapType |
Definition at line 24 of file SurveyInputTextReader.h.
typedef std::pair<UniqueId, align::Scalars> SurveyInputTextReader::PairType |
Definition at line 25 of file SurveyInputTextReader.h.
typedef std::pair<align::ID, align::StructureType> SurveyInputTextReader::UniqueId |
Definition at line 22 of file SurveyInputTextReader.h.
void SurveyInputTextReader::readFile | ( | const std::string & | textFileName | ) |
Read given text file.
Definition at line 11 of file SurveyInputTextReader.cc.
References i, geometryCSVtoXML::line, NINPUTS, AlCaHLTBitMon_QueryRunRegistry::string, AlignableObjectId::stringToId(), 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"; 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 = AlignableObjectId::stringToId(structure.c_str()); } 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; }
const int SurveyInputTextReader::NINPUTS = 27 [static, private] |
Definition at line 37 of file SurveyInputTextReader.h.
Referenced by readFile().
MapType SurveyInputTextReader::theMap [private] |
Definition at line 35 of file SurveyInputTextReader.h.
Referenced by readFile(), and UniqueIdMap().