26 |
TRIG = 16, ///< Code for Trigger |
TRIG = 16, ///< Code for Trigger |
27 |
ORB = 32, ///< Code for Orbital Info |
ORB = 32, ///< Code for Orbital Info |
28 |
ALL = 63, ///< Sum of all the above codes |
ALL = 63, ///< Sum of all the above codes |
29 |
CALO_L1 = 64 ///< Code for Calorimeter level1 |
CALO_L1 = 64 |
30 |
|
///< Code for Calorimeter level1 |
31 |
}; |
}; |
32 |
|
|
33 |
/*! @var TOFNPADLAYER |
/*! @var TOFNPADLAYER |
38 |
/*! @brief A simple matrix class. |
/*! @brief A simple matrix class. |
39 |
* |
* |
40 |
* This class defines a matrix built by STL vectors. It is basically a variable-dimension |
* This class defines a matrix built by STL vectors. It is basically a variable-dimension |
41 |
* vector of vectors; the dimension is defined at construction and cannot be changed in |
* vector of vectors. It is intended as a container and not for algebraic manipulations. |
42 |
* current implementation. It is intended as a container and not for algebraic manipulations. |
* The class provides a standard access operator [] and a resize method. |
|
* The class provides a standard access operator []. |
|
43 |
*/ |
*/ |
44 |
template<class T> |
template<class T> |
45 |
class SimpleMatrix { |
class SimpleMatrix { |
56 |
* @param elements The initialization value for the matrix elements. |
* @param elements The initialization value for the matrix elements. |
57 |
*/ |
*/ |
58 |
SimpleMatrix(unsigned int nRows, unsigned int nCols, T elements = T()) : |
SimpleMatrix(unsigned int nRows, unsigned int nCols, T elements = T()) : |
59 |
_matrix(nRows, std::vector<T>(nCols, elements)), _nRows(nRows), _nCols(nCols) { |
_matrix(nRows, std::vector<T>(nCols, elements)) { |
60 |
|
|
61 |
} |
} |
62 |
|
|
74 |
* @return The number of rows. |
* @return The number of rows. |
75 |
*/ |
*/ |
76 |
unsigned int GetNRows() { |
unsigned int GetNRows() { |
77 |
return _nRows; |
return _matrix.size(); |
78 |
} |
} |
79 |
|
|
80 |
/*! @brief Returns the number of columns. |
/*! @brief Returns the number of columns. |
82 |
* @return The number of columns. |
* @return The number of columns. |
83 |
*/ |
*/ |
84 |
unsigned int GetNCols() { |
unsigned int GetNCols() { |
85 |
return _nCols; |
return _matrix[0].size(); |
86 |
|
} |
87 |
|
|
88 |
|
/*! @brief Resizes the matrix. |
89 |
|
* |
90 |
|
* If new rows or columns are added, they are initialized to the default value; if T |
91 |
|
* is a class with no default constructor, a default value for T must be provided, which will |
92 |
|
* be replicated in every new matrix element. No modification |
93 |
|
* is done to existing elements (except for those that will be eventually removed). |
94 |
|
* |
95 |
|
* @param nRows The new number of rows. |
96 |
|
* @param nCols The new number of columns. |
97 |
|
* @param elements The initialization value for the new matrix elements. |
98 |
|
*/ |
99 |
|
void Resize(unsigned int nRows, unsigned int nCols, T elements = T()) { |
100 |
|
|
101 |
|
_matrix.resize(nRows, std::vector<T>(nCols, elements)); |
102 |
|
for (unsigned int i = 0; i < _matrix.size(); i++) |
103 |
|
_matrix[i].resize(nCols, elements); |
104 |
} |
} |
105 |
|
|
106 |
private: |
private: |
107 |
|
|
108 |
std::vector<std::vector<T> > _matrix; |
std::vector<std::vector<T> > _matrix; |
|
unsigned int _nRows, _nCols; |
|
109 |
}; |
}; |
110 |
|
|
111 |
#endif /* COMMONDEFS_H_ */ |
#endif /* COMMONDEFS_H_ */ |