00001
00002 #ifndef AcdId_H
00003 #define AcdId_H
00004
00005 #include "TObject.h"
00006
00046 class AcdId : public TObject {
00047
00048 private:
00050 UInt_t m_id;
00052 Char_t m_used;
00054 UShort_t m_readoutIndex;
00056 void setLayer( unsigned int val );
00058 void setFace (unsigned int f);
00060 void setRow( unsigned int r );
00062 void setColumn( unsigned int c );
00063
00064
00065 enum {
00066 _layermask = 0x1800,
00067 _facemask = 0x0700,
00068 _rowmask = 0x00F0,
00069 _colmask = 0x000F,
00070 layerShift = 11
00071 };
00072
00073 public:
00074 AcdId();
00075 AcdId(const AcdId& id);
00076 AcdId(short l, short f, short r, short c);
00077 AcdId(UInt_t i, short base=10, short used=1);
00078 virtual ~AcdId() { };
00079
00081 UInt_t getId(short base = 10) const;
00083 void setId(UInt_t newVal, short used = 1, short base=10);
00085 bool isTop () const;
00087 bool isSide () const;
00089 short getLayer () const;
00091 short getFace() const;
00093 short getRow() const;
00095 short getColumn () const;
00097 bool wasConnected() const;
00099 void setConnected(Char_t c);
00101 UShort_t getReadoutIndex() const { return m_readoutIndex; };
00103 void setReadoutIndex(UShort_t i) { m_readoutIndex = i; };
00105 void base10ToAcdId(UInt_t val, short &lay, short &face, short &row, short &col);
00106
00107 static UShort_t badId;
00108
00109 private:
00110 inline short int word ( short i, const UInt_t& v ) const
00111 {
00112 short shft = i*4;
00113 unsigned int mask = 0x000F << shft;
00114 return (v & mask) >> shft;
00115 }
00116
00117 void set_word ( short i, UInt_t& v, const UInt_t& s )
00118 {
00119 short shft = i*4;
00120 unsigned int mask = 0x000F << shft;
00121 v = ((v & ~mask) | ((s << shft) & mask));
00122 }
00123
00124 ClassDef(AcdId,3)
00125 };
00126
00127 #endif