Go to the documentation of this file.00001
00002
00003 #include <fstream>
00004
00005 #include "FWCore/Utilities/interface/Exception.h"
00006
00007 #include "Alignment/CommonAlignment/interface/AlignableObjectId.h"
00008 #include "Alignment/SurveyAnalysis/interface/SurveyInputTextReader.h"
00009
00010
00011 void SurveyInputTextReader::readFile( const std::string& textFileName )
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 while ( !myfile.eof() && myfile.good() )
00019 {
00020 align::Scalars m_inputs;
00021
00022 UniqueId m_uId;
00023 char firstchar;
00024 firstchar = myfile.peek();
00025
00026 if(firstchar == '#'){
00027 std::string line;
00028 getline(myfile,line);
00029 }
00030 else if (firstchar == '!'){
00031 std::string firststring;
00032 std::string structure;
00033 myfile >> firststring >> structure;
00034 std::string endofline;
00035 getline(myfile,endofline);
00036 m_uId.second = AlignableObjectId::stringToId(structure.c_str());
00037 }
00038 else{
00039 myfile >> m_uId.first;
00040
00041 for ( int i=0; i<NINPUTS; i++ )
00042 {
00043 float tmpInput;
00044 myfile >> tmpInput;
00045 m_inputs.push_back( tmpInput );
00046 }
00047 std::string endofline;
00048 getline(myfile,endofline);
00049 theMap.insert( PairType( m_uId, m_inputs));
00050
00051
00052 if ( myfile.fail() ) break;
00053
00054
00055 }
00056 }
00057 }