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

◆ MapType

Definition at line 22 of file SurveyInputTextReader.h.

◆ PairType

Definition at line 23 of file SurveyInputTextReader.h.

◆ UniqueId

Definition at line 20 of file SurveyInputTextReader.h.

Member Function Documentation

◆ readFile()

void SurveyInputTextReader::readFile ( const std::string &  textFileName)

Read given text file.

Definition at line 11 of file SurveyInputTextReader.cc.

11  {
12  std::ifstream myfile(textFileName.c_str());
13  if (!myfile.is_open())
14  throw cms::Exception("FileAccess") << "Unable to open input text file";
15 
16  // FIXME: - currently defaulting to RunI as this was the previous behaviour
17  // - check this, when resurrecting this code in the future
19 
20  while (!myfile.eof() && myfile.good()) {
21  align::Scalars m_inputs;
22 
23  UniqueId m_uId;
24  char firstchar;
25  firstchar = myfile.peek();
26 
27  if (firstchar == '#') {
29  getline(myfile, line);
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  } else {
38  myfile >> m_uId.first;
39 
40  for (int i = 0; i < NINPUTS; i++) {
41  float tmpInput;
42  myfile >> tmpInput;
43  m_inputs.push_back(tmpInput);
44  }
45  std::string endofline;
46  getline(myfile, endofline);
47  theMap.insert(PairType(m_uId, m_inputs));
48 
49  // Check if read succeeded (otherwise, we are at eof)
50  if (myfile.fail())
51  break;
52  }
53  }
54 }

References AlignableObjectId::General, mps_fire::i, mps_splice::line, NINPUTS, AlCaHLTBitMon_QueryRunRegistry::string, and theMap.

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

◆ UniqueIdMap()

const MapType& SurveyInputTextReader::UniqueIdMap ( ) const
inline

Definition at line 29 of file SurveyInputTextReader.h.

29 { return theMap; }

References theMap.

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

Member Data Documentation

◆ NINPUTS

const int SurveyInputTextReader::NINPUTS = 27
staticprivate

Definition at line 34 of file SurveyInputTextReader.h.

Referenced by readFile().

◆ theMap

MapType SurveyInputTextReader::theMap
private

Definition at line 32 of file SurveyInputTextReader.h.

Referenced by readFile(), and UniqueIdMap().

SurveyInputTextReader::theMap
MapType theMap
Definition: SurveyInputTextReader.h:32
AlignableObjectId
Allows conversion between type and name, and vice-versa.
Definition: AlignableObjectId.h:12
mps_fire.i
i
Definition: mps_fire.py:428
align::Scalars
std::vector< Scalar > Scalars
Definition: Utilities.h:26
SurveyInputTextReader::PairType
std::pair< UniqueId, align::Scalars > PairType
Definition: SurveyInputTextReader.h:23
AlignableObjectId::Geometry::General
SurveyInputTextReader::UniqueId
std::pair< align::ID, align::StructureType > UniqueId
Definition: SurveyInputTextReader.h:20
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SurveyInputTextReader::NINPUTS
static const int NINPUTS
Definition: SurveyInputTextReader.h:34
cms::Exception
Definition: Exception.h:70
mps_splice.line
line
Definition: mps_splice.py:76