#include <Alignment/SurveyAnalysis/interface/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, parsecf::pyparsing::line(), AlignableObjectId::nameToType(), NINPUTS, and theMap.
Referenced by SurveyMisalignmentInput::beginJob(), and SurveyInputTrackerFromDB::beginJob().
00012 { 00013 00014 std::ifstream myfile( textFileName.c_str() ); 00015 if ( !myfile.is_open() ) 00016 throw cms::Exception("FileAccess") << "Unable to open input text file"; 00017 00018 static AlignableObjectId alignObjId; 00019 00020 while ( !myfile.eof() && myfile.good() ) 00021 { 00022 align::Scalars m_inputs; 00023 00024 UniqueId m_uId; 00025 char firstchar; 00026 firstchar = myfile.peek(); 00027 00028 if(firstchar == '#'){ 00029 std::string line; 00030 getline(myfile,line); 00031 } 00032 else if (firstchar == '!'){ 00033 std::string firststring; 00034 std::string structure; 00035 myfile >> firststring >> structure; 00036 std::string endofline; 00037 getline(myfile,endofline); 00038 m_uId.second = alignObjId.nameToType(structure); 00039 } 00040 else{ 00041 myfile >> m_uId.first; 00042 00043 for ( int i=0; i<NINPUTS; i++ ) 00044 { 00045 float tmpInput; 00046 myfile >> tmpInput; 00047 m_inputs.push_back( tmpInput ); 00048 } 00049 std::string endofline; 00050 getline(myfile,endofline); 00051 theMap.insert( PairType( m_uId, m_inputs)); 00052 00053 // Check if read succeeded (otherwise, we are at eof) 00054 if ( myfile.fail() ) break; 00055 00056 00057 } 00058 } 00059 }
const MapType& SurveyInputTextReader::UniqueIdMap | ( | ) | const [inline] |
Definition at line 31 of file SurveyInputTextReader.h.
References theMap.
Referenced by SurveyMisalignmentInput::beginJob(), and SurveyInputTrackerFromDB::beginJob().
00031 { return theMap; }
const int SurveyInputTextReader::NINPUTS = 27 [static, private] |
MapType SurveyInputTextReader::theMap [private] |