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