CMS 3D CMS Logo

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::ScalarsMapType
 
typedef std::pair< UniqueId, align::ScalarsPairType
 
typedef std::pair< align::ID, align::StructureTypeUniqueId
 

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 AlignableObjectId::General, mps_fire::i, mps_splice::line, NINPUTS, AlCaHLTBitMon_QueryRunRegistry::string, 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  // FIXME: - currently defaulting to RunI as this was the previous behaviour
19  // - check this, when resurrecting this code in the future
21 
22  while ( !myfile.eof() && myfile.good() )
23  {
24  align::Scalars m_inputs;
25 
26  UniqueId m_uId;
27  char firstchar;
28  firstchar = myfile.peek();
29 
30  if(firstchar == '#'){
32  getline(myfile,line);
33  }
34  else if (firstchar == '!'){
35  std::string firststring;
36  std::string structure;
37  myfile >> firststring >> structure;
38  std::string endofline;
39  getline(myfile,endofline);
40  m_uId.second = alignableObjectId.stringToId(structure.c_str());
41  }
42  else{
43  myfile >> m_uId.first;
44 
45  for ( int i=0; i<NINPUTS; i++ )
46  {
47  float tmpInput;
48  myfile >> tmpInput;
49  m_inputs.push_back( tmpInput );
50  }
51  std::string endofline;
52  getline(myfile,endofline);
53  theMap.insert( PairType( m_uId, m_inputs));
54 
55  // Check if read succeeded (otherwise, we are at eof)
56  if ( myfile.fail() ) break;
57 
58 
59  }
60  }
61 }
std::vector< Scalar > Scalars
Definition: Utilities.h:27
Allows conversion between type and name, and vice-versa.
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().