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, AlignableObjectId::nameToType(), NINPUTS, 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  static AlignableObjectId alignObjId;
19 
20  while ( !myfile.eof() && myfile.good() )
21  {
22  align::Scalars m_inputs;
23 
24  UniqueId m_uId;
25  char firstchar;
26  firstchar = myfile.peek();
27 
28  if(firstchar == '#'){
29  std::string line;
30  getline(myfile,line);
31  }
32  else if (firstchar == '!'){
33  std::string firststring;
34  std::string structure;
35  myfile >> firststring >> structure;
36  std::string endofline;
37  getline(myfile,endofline);
38  m_uId.second = alignObjId.nameToType(structure);
39  }
40  else{
41  myfile >> m_uId.first;
42 
43  for ( int i=0; i<NINPUTS; i++ )
44  {
45  float tmpInput;
46  myfile >> tmpInput;
47  m_inputs.push_back( tmpInput );
48  }
49  std::string endofline;
50  getline(myfile,endofline);
51  theMap.insert( PairType( m_uId, m_inputs));
52 
53  // Check if read succeeded (otherwise, we are at eof)
54  if ( myfile.fail() ) break;
55 
56 
57  }
58  }
59 }
int i
Definition: DBlmapReader.cc:9
std::vector< Scalar > Scalars
Definition: Utilities.h:22
Allows conversion between type and name, and vice-versa.
std::pair< UniqueId, align::Scalars > PairType
align::StructureType nameToType(const std::string &name) const
Convert name to type.
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().