File indexing completed on 2024-04-06 12:01:55
0001 #ifndef AlignmentSurfaceDeformations_H
0002 #define AlignmentSurfaceDeformations_H
0003
0004 #include "CondFormats/Serialization/interface/Serializable.h"
0005
0006 #include <vector>
0007
0008 #include "CondFormats/Alignment/interface/Definitions.h"
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 class AlignmentSurfaceDeformations {
0021 public:
0022 struct Item {
0023 align::ID m_rawId;
0024 int m_parametrizationType;
0025 int m_index;
0026
0027 COND_SERIALIZABLE;
0028 };
0029
0030 typedef std::vector<Item> ItemVector;
0031 typedef std::vector<align::Scalar>::const_iterator ParametersConstIterator;
0032 typedef std::pair<ParametersConstIterator, ParametersConstIterator> ParametersConstIteratorPair;
0033
0034 AlignmentSurfaceDeformations() {}
0035 virtual ~AlignmentSurfaceDeformations() {}
0036
0037
0038 inline bool empty() const { return m_items.empty(); }
0039
0040
0041 bool add(align::ID rawId, int type, const std::vector<align::Scalar>& parameters) {
0042 Item item;
0043 item.m_rawId = rawId;
0044 item.m_parametrizationType = type;
0045 item.m_index = m_parameters.size();
0046 m_items.push_back(item);
0047
0048 m_parameters.reserve(m_parameters.size() + parameters.size());
0049 std::copy(parameters.begin(), parameters.end(), std::back_inserter(m_parameters));
0050
0051 return true;
0052 }
0053
0054
0055 const ItemVector& items() const { return m_items; }
0056
0057
0058
0059 ParametersConstIteratorPair parameters(size_t index) const {
0060 ParametersConstIteratorPair pair;
0061 pair.first = m_parameters.begin() + m_items[index].m_index;
0062 if (index < m_items.size() - 1) {
0063 pair.second = m_parameters.begin() + m_items[index + 1].m_index;
0064 } else {
0065 pair.second = m_parameters.end();
0066 }
0067 return pair;
0068 }
0069
0070 private:
0071 std::vector<align::Scalar> m_parameters;
0072 ItemVector m_items;
0073
0074 COND_SERIALIZABLE;
0075 };
0076
0077 #endif