/* * CommonDefs.h * * Created on: 10-mar-2009 * Author: Nicola Mori */ /*! @file CommonDefs.h A header file with all the common definitions for the PamCut framework. */ #ifndef COMMONDEFS_H_ #define COMMONDEFS_H_ /*! @brief The implementations of PamCut::Check() must return this value if the event satisfy the cut*/ const int CUTOK = -1; /*! @enum DETECTORCODE * The values for each detector correspond to a binary code associated to that detector. * These can be arithmetically added to create a binary code for a set of detectors. */ enum DETECTORCODE { TRK = 1, ///< Code for Tracker CALO = 2, ///< Code for Calorimeter level2 TOF = 4, ///< Code for ToF AC = 8, ///< Code for AntiCoincidence TRIG = 16, ///< Code for Trigger ORB = 32, ///< Code for Orbital Info ALL = 63, ///< Sum of all the above codes CALO_L1 = 64 ///< Code for Calorimeter level1 }; /*! @var TOFNPADLAYER * The number of pads in each ToF layer. S11 corresponds to element 0, S12 to element 1 and so on. */ const int TOFNPADLAYER[6] = { 8, 6, 2, 2, 3, 3 }; /*! @brief A simple matrix class. * * This class defines a matrix built by STL vectors. It is basically a variable-dimension * vector of vectors; the dimension is defined at construction and cannot be changed in * current implementation. It is intended as a container and not for algebraic manipulations. * The class provides a standard access operator []. */ template class SimpleMatrix { public: /*! @brief Constructor * * The constructor will build an nRows x nCols matrix, initialized with a default value. If T * is a class with no default constructor, a default value for T must be provided, which will * be replicated in every matrix element. * * @param nRows The number of rows. * @param nCols The number of columns * @param elements The initialization value for the matrix elements. */ SimpleMatrix(unsigned int nRows, unsigned int nCols, T elements = T()) : _matrix(nRows, std::vector(nCols, elements)), _nRows(nRows), _nCols(nCols) { } /*! @brief Standard accessor. * * @param i The desired row. * @return The i-th row (a vector). */ std::vector& operator[](int i) { return _matrix[i]; } /*! @brief Returns the number of rows. * * @return The number of rows. */ unsigned int GetNRows() { return _nRows; } /*! @brief Returns the number of columns. * * @return The number of columns. */ unsigned int GetNCols() { return _nCols; } private: std::vector > _matrix; unsigned int _nRows, _nCols; }; #endif /* COMMONDEFS_H_ */