CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AlignmentSurfaceDeformations.h
Go to the documentation of this file.
1 #ifndef AlignmentSurfaceDeformations_H
2 #define AlignmentSurfaceDeformations_H
3 
4 #include <vector>
5 
7 
17 
19 public:
20 
21  struct Item {
24  int m_index;
25  };
26 
27  typedef std::vector<Item> ItemVector;
28  typedef std::vector<align::Scalar>::const_iterator ParametersConstIterator;
29  typedef std::pair<ParametersConstIterator,ParametersConstIterator> ParametersConstIteratorPair;
30 
33 
35  inline bool empty() const { return m_items.empty(); }
36 
38  bool add(align::ID rawId, int type, const std::vector<align::Scalar> & parameters) {
39 
40  Item item;
41  item.m_rawId = rawId;
43  item.m_index = m_parameters.size();
44  m_items.push_back(item);
45 
46  m_parameters.reserve(m_parameters.size() + parameters.size());
47  std::copy(parameters.begin(), parameters.end(), std::back_inserter(m_parameters));
48 
49  return true;
50  }
51 
53  const ItemVector & items() const {return m_items; }
54 
59  pair.first = m_parameters.begin() + m_items[index].m_index;
60  if (index<m_items.size()-1) {
61  pair.second = m_parameters.begin() + m_items[index+1].m_index;
62  } else {
63  pair.second = m_parameters.end();
64  }
65  return pair;
66  }
67 
68  private:
69 
70  std::vector<align::Scalar> m_parameters;
72 };
73 
74 #endif // AlignmentSurfaceDeformations_H
type
Definition: HCALResponse.h:21
bool empty() const
Test of empty vector without having to look into internals:
uint32_t ID
Definition: Definitions.h:26
std::pair< ParametersConstIterator, ParametersConstIterator > ParametersConstIteratorPair
std::vector< align::Scalar > m_parameters
ParametersConstIteratorPair parameters(size_t index) const
const ItemVector & items() const
Get vector of all items.
bool add(align::ID rawId, int type, const std::vector< align::Scalar > &parameters)
Add a new item.
std::vector< align::Scalar >::const_iterator ParametersConstIterator