1 |
/* |
2 |
* CommonDefs.h |
3 |
* |
4 |
* Created on: 10-mar-2009 |
5 |
* Author: Nicola Mori |
6 |
*/ |
7 |
|
8 |
/*! @file CommonDefs.h A header file with all the common definitions for the PamCut framework. |
9 |
*/ |
10 |
|
11 |
#ifndef COMMONDEFS_H_ |
12 |
#define COMMONDEFS_H_ |
13 |
|
14 |
/*! @brief The implementations of PamCut::Check() must return this value if the event satisfy the cut*/ |
15 |
const int CUTOK = -1; |
16 |
|
17 |
/*! @enum DETECTORCODE |
18 |
* The values for each detector correspond to a binary code associated to that detector. |
19 |
* These can be arithmetically added to create a binary code for a set of detectors. |
20 |
*/ |
21 |
enum DETECTORCODE { |
22 |
TRK = 1, ///< Code for Tracker |
23 |
CALO = 2, ///< Code for Calorimeter level2 |
24 |
TOF = 4, ///< Code for ToF |
25 |
AC = 8, ///< Code for AntiCoincidence |
26 |
TRIG = 16, ///< Code for Trigger |
27 |
ORB = 32, ///< Code for Orbital Info |
28 |
ALL = 63, ///< Sum of all the above codes |
29 |
CALO_L1 = 64 ///< Code for Calorimeter level1 |
30 |
}; |
31 |
|
32 |
/*! @var TOFNPADLAYER |
33 |
* The number of pads in each ToF layer. S11 corresponds to element 0, S12 to element 1 and so on. |
34 |
*/ |
35 |
const int TOFNPADLAYER[6] = { 8, 6, 2, 2, 3, 3 }; |
36 |
|
37 |
/*! @brief A simple matrix class. |
38 |
* |
39 |
* This class defines a matrix built by STL vectors. It is basically a variable-dimension |
40 |
* vector of vectors; the dimension is defined at construction and cannot be changed in |
41 |
* current implementation. It is intended as a container and not for algebraic manipulations. |
42 |
* The class provides a standard access operator []. |
43 |
*/ |
44 |
template<class T> |
45 |
class SimpleMatrix { |
46 |
|
47 |
public: |
48 |
/*! @brief Constructor |
49 |
* |
50 |
* The constructor will build an nRows x nCols matrix, initialized with a default value. If T |
51 |
* is a class with no default constructor, a default value for T must be provided, which will |
52 |
* be replicated in every matrix element. |
53 |
* |
54 |
* @param nRows The number of rows. |
55 |
* @param nCols The number of columns |
56 |
* @param elements The initialization value for the matrix elements. |
57 |
*/ |
58 |
SimpleMatrix(unsigned int nRows, unsigned int nCols, T elements = T()) : |
59 |
_matrix(nRows, std::vector<T>(nCols, elements)), _nRows(nRows), _nCols(nCols) { |
60 |
|
61 |
} |
62 |
|
63 |
/*! @brief Standard accessor. |
64 |
* |
65 |
* @param i The desired row. |
66 |
* @return The i-th row (a vector). |
67 |
*/ |
68 |
std::vector<T>& operator[](int i) { |
69 |
return _matrix[i]; |
70 |
} |
71 |
|
72 |
/*! @brief Returns the number of rows. |
73 |
* |
74 |
* @return The number of rows. |
75 |
*/ |
76 |
unsigned int GetNRows() { |
77 |
return _nRows; |
78 |
} |
79 |
|
80 |
/*! @brief Returns the number of columns. |
81 |
* |
82 |
* @return The number of columns. |
83 |
*/ |
84 |
unsigned int GetNCols() { |
85 |
return _nCols; |
86 |
} |
87 |
|
88 |
private: |
89 |
|
90 |
std::vector<std::vector<T> > _matrix; |
91 |
unsigned int _nRows, _nCols; |
92 |
}; |
93 |
|
94 |
#endif /* COMMONDEFS_H_ */ |