CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes | Static Private Attributes
SurveyInputTextReader Class Reference

#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. More...
 
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, NINPUTS, AlCaHLTBitMon_QueryRunRegistry::string, AlignableObjectId::stringToId(), and theMap.

Referenced by SurveyInputTrackerFromDB::analyze(), SurveyMisalignmentInput::analyze(), Vispa.Plugins.EventBrowser.EventBrowserTabController.EventBrowserTabController::navigate(), Vispa.Main.TabController.TabController::open(), and Vispa.Main.TabController.TabController::refresh().

12 {
13 
14  std::ifstream myfile( textFileName.c_str() );
15  if ( !myfile.is_open() )
16  throw cms::Exception("FileAccess") << "Unable to open input text file";
17 
18  while ( !myfile.eof() && myfile.good() )
19  {
20  align::Scalars m_inputs;
21 
22  UniqueId m_uId;
23  char firstchar;
24  firstchar = myfile.peek();
25 
26  if(firstchar == '#'){
28  getline(myfile,line);
29  }
30  else if (firstchar == '!'){
31  std::string firststring;
32  std::string structure;
33  myfile >> firststring >> structure;
34  std::string endofline;
35  getline(myfile,endofline);
36  m_uId.second = AlignableObjectId::stringToId(structure.c_str());
37  }
38  else{
39  myfile >> m_uId.first;
40 
41  for ( int i=0; i<NINPUTS; i++ )
42  {
43  float tmpInput;
44  myfile >> tmpInput;
45  m_inputs.push_back( tmpInput );
46  }
47  std::string endofline;
48  getline(myfile,endofline);
49  theMap.insert( PairType( m_uId, m_inputs));
50 
51  // Check if read succeeded (otherwise, we are at eof)
52  if ( myfile.fail() ) break;
53 
54 
55  }
56  }
57 }
int i
Definition: DBlmapReader.cc:9
static align::StructureType stringToId(const char *)
std::vector< Scalar > Scalars
Definition: Utilities.h:22
std::pair< UniqueId, align::Scalars > PairType
std::pair< align::ID, align::StructureType > UniqueId
const MapType& SurveyInputTextReader::UniqueIdMap ( ) const
inline

Definition at line 31 of file SurveyInputTextReader.h.

References theMap.

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

31 { return theMap; }

Member Data Documentation

const int SurveyInputTextReader::NINPUTS = 27
staticprivate

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().