Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

LogId.h

Go to the documentation of this file.
00001 
00002 
00003 #ifndef LogId_H
00004 #define LogId_H
00005 
00006 #include "TObject.h"
00007 
00019 class LogId : public TObject {
00020 public: 
00021     typedef struct TAG_STRUCT {
00022         UInt_t xy, 
00023                sequence, 
00024                pipeline, 
00025                layer, 
00026                column, 
00027                tower;
00028     };
00029 private:
00030     /*
00031     LogId tag word layout
00032     (defined in following enum):
00033      ________________________________________________________________
00034     |31| ... |17||16|  |  |13|12|  |  |09|08|07||06|  |04|03|  |01|00|
00035     |__|_____|__||__|__|__|__|__|__|__|__|__|__||__|__|__|__|__|__|__|
00036     |           ||   TOWER   |  COLUMN   |LAYER||PIPELINE|SEQUENCE|XY|
00037     |RESERVERD 4||___________|___________|_____||________|________|__| 
00038     |FUTURE USE ||         LOG POSITION        ||   LOG ID NUMBER    |
00039     |___________||_____________________________||____________________| 
00040 
00041     ***** NOTES: *****
00042 
00043       (1) LAYER Field:
00044       The layer field contains the most significant two bits necessary
00045       to encode the 8 physical cal layers.  When the 'XY' bit is appended
00046       to this field as the LSB an actual physical layer number is obtained.
00047       This is done to prevent the dual storage of data which could result 
00048       in errors if they were to differ.
00049     */
00050     enum {
00051         // X/Y bit:
00052         CAL_K_XY = 1,
00053         CAL_V_XY = 0,
00054         CAL_M_XY = ((1 << CAL_K_XY) - 1),
00055         // ADC Sequence #:
00056         CAL_K_SEQ = 3,
00057         CAL_V_SEQ = (CAL_V_XY + CAL_K_XY),
00058         CAL_M_SEQ = ((1 << CAL_K_SEQ) - 1),
00059         // Pipeline #:
00060         CAL_K_PIPE = 3,
00061         CAL_V_PIPE = (CAL_V_SEQ + CAL_K_SEQ),
00062         CAL_M_PIPE = ((1 << CAL_K_PIPE) - 1),
00063         // Log ID Number as a whole:
00064         CAL_K_ID = (CAL_K_XY + CAL_K_SEQ + CAL_K_PIPE),
00065         CAL_V_ID = CAL_V_XY,
00066         CAL_M_ID = ((1 << CAL_K_ID) - 1),
00067 
00068         // Log Position (Layer):
00069         CAL_K_LAYER = 2,
00070         CAL_V_LAYER = (CAL_V_PIPE + CAL_K_PIPE),
00071         CAL_M_LAYER = ((1 << CAL_K_LAYER) - 1),
00072         // Log Position (Column):
00073         CAL_K_COLUMN = 4,
00074         CAL_V_COLUMN = (CAL_V_LAYER + CAL_K_LAYER),
00075         CAL_M_COLUMN = ((1 << CAL_K_COLUMN) - 1),
00076         // Log Position (Tower):
00077         CAL_K_TOWER = 4,
00078         CAL_V_TOWER = (CAL_V_COLUMN + CAL_K_COLUMN),
00079         CAL_M_TOWER = ((1 << CAL_K_TOWER) - 1),
00080 
00081         CAL_K_NEWID = (CAL_K_LAYER + CAL_K_COLUMN + CAL_K_TOWER),
00082         CAL_V_NEWID = CAL_V_LAYER,
00083         CAL_M_NEWID = ((1 << CAL_K_ID) - 1),
00084 
00085         // Upper Bounds values for bounded fields:
00086         // NOTE: no bounds limits for fields which use all possible values.
00087         BOUNDS_LAYER = 7,
00088         BOUNDS_COLUMN = 9,
00089         BOUNDS_PIPE = 4
00090     };
00091     UInt_t m_tag;   // Packed word containing log id
00092 
00093     static Bool_t isValidTagStruct(LogId::TAG_STRUCT ts);
00094     static Bool_t isValidTagWord(UInt_t tagWord);
00095     static Bool_t isValidColumn(UInt_t columnVal);
00096     static Bool_t isValidLayer(UInt_t layerVal);
00097 
00098     static UShort_t getTower(UInt_t tagWord);
00099     static UShort_t getColumn(UInt_t tagWord);
00100     static UShort_t getLayer(UInt_t tagWord);
00101 
00102     static UInt_t getId(UInt_t tagWord);
00103     static UShort_t getXY(UInt_t tagWord);
00104 
00105 
00106 public:
00111     typedef enum {
00112         X = 0,
00113         Y
00114     } CALAxes;
00115 
00116     LogId();            
00117     LogId(UInt_t tag);
00118     LogId(UShort_t tower, UShort_t layer, UShort_t column);
00119     virtual ~LogId();
00120 
00121     static UInt_t fillTagWord(LogId::TAG_STRUCT *ts);
00122     static void fillTagStruct(UInt_t tagVal, LogId::TAG_STRUCT *ts);
00123 
00124     UInt_t getTag()         const;
00125     UShort_t getColumn()      const;
00126     UShort_t getLayer()       const;
00127     UShort_t getTower()       const;
00128 
00129     UInt_t getId()          const;
00130     CALAxes getXY()         const;
00131 
00132     Bool_t setTag(UInt_t tagVal);
00133     Bool_t setTag(TAG_STRUCT *ts);
00134     Bool_t setColumn(UInt_t columnVal);
00135     Bool_t setLayer(UInt_t layerVal);
00136     Bool_t setTower(UInt_t towerVal);
00137     Bool_t setXY(CALAxes xyVal);
00138     Bool_t setId(UShort_t tower, UShort_t layer, UShort_t column);
00139 
00140 ClassDef(LogId,3)       // Cal log identification and readout information
00141 };
00142 #endif

Generated at Wed Nov 21 12:22:45 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000