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 
5 
6 #include <vector>
7 
9 
19 
21 public:
22 
23  struct Item {
26  int m_index;
27 
29 };
30 
31  typedef std::vector<Item> ItemVector;
32  typedef std::vector<align::Scalar>::const_iterator ParametersConstIterator;
33  typedef std::pair<ParametersConstIterator,ParametersConstIterator> ParametersConstIteratorPair;
34 
37 
39  inline bool empty() const { return m_items.empty(); }
40 
42  bool add(align::ID rawId, int type, const std::vector<align::Scalar> & parameters) {
43 
44  Item item;
45  item.m_rawId = rawId;
47  item.m_index = m_parameters.size();
48  m_items.push_back(item);
49 
50  m_parameters.reserve(m_parameters.size() + parameters.size());
51  std::copy(parameters.begin(), parameters.end(), std::back_inserter(m_parameters));
52 
53  return true;
54  }
55 
57  const ItemVector & items() const {return m_items; }
58 
63  pair.first = m_parameters.begin() + m_items[index].m_index;
64  if (index<m_items.size()-1) {
65  pair.second = m_parameters.begin() + m_items[index+1].m_index;
66  } else {
67  pair.second = m_parameters.end();
68  }
69  return pair;
70  }
71 
72  private:
73 
74  std::vector<align::Scalar> m_parameters;
76 
78 };
79 
80 #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.
#define COND_SERIALIZABLE
Definition: Serializable.h:37
std::vector< align::Scalar >::const_iterator ParametersConstIterator