StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StRichPixel.h
1 
5 /***************************************************************************
6  *
7  * $Id: StRichPixel.h,v 2.6 2002/02/22 22:56:50 jeromel Exp $
8  *
9  * Author: Thomas Ullrich, Aug 1999
10  ***************************************************************************
11  *
12  * Description:
13  *
14  ***************************************************************************
15  *
16  * $Log: StRichPixel.h,v $
17  * Revision 2.6 2002/02/22 22:56:50 jeromel
18  * Doxygen basic documentation in all header files. None of this is required
19  * for QM production.
20  *
21  * Revision 2.5 2001/04/05 04:00:41 ullrich
22  * Replaced all (U)Long_t by (U)Int_t and all redundant ROOT typedefs.
23  *
24  * Revision 2.4 2001/02/07 16:04:05 lasiuk
25  * check the 11th bit for overflow.
26  * Overflow is 1024
27  *
28  * Revision 2.3 2000/01/13 21:06:22 lasiuk
29  * add rich pixel info/containers
30  *
31  * Revision 2.2 2000/01/10 17:12:21 lasiuk
32  * remove dst_rch_pixel dependency;
33  * change stored data to a single long;
34  * modify unpacking routines;
35  *
36  * Revision 2.1 1999/10/13 19:43:36 ullrich
37  * Initial Revision
38  *
39  **************************************************************************/
40 #ifndef StRichPixel_hh
41 #define StRichPixel_hh
42 
43 #include "StObject.h"
44 #include "StEnumerations.h"
45 
46 class StRichPixel : public StObject {
47 public:
48  StRichPixel();
49  StRichPixel(unsigned int packedData);
50  // StRichPixel(const StRichPixel&); use default
51  // StRichPixel& operator=(const StRichPixel&); use default
52  ~StRichPixel();
53 
54  int operator==(const StRichPixel&) const;
55  int operator!=(const StRichPixel&) const;
56 
57  void setPackedData(unsigned int);
58 
59  unsigned short pad() const;
60  unsigned short row() const;
61  unsigned short adc() const;
62 
63 protected:
64  UInt_t mPackedData;
65 
66  ClassDef(StRichPixel,1)
67 };
68 
69 inline void
70 StRichPixel::setPackedData(unsigned int pixel)
71 {
72  mPackedData = pixel;
73 }
74 
75 inline unsigned short
76 StRichPixel::pad() const
77 {
78  return (mPackedData & 0xff); // first 8 bits
79 }
80 
81 inline unsigned short
82 StRichPixel::row() const
83 {
84  return ( (mPackedData>>8) & 0xff); // second 8 bits
85 }
86 
87 inline unsigned short
88 StRichPixel::adc() const
89 {
90  //
91  // 11 bits are stored. The 11th bit is the overflow
92  // if the 11th bit is set, return saturated
93  // otherwise, return the 10 bit value
94  //return ( (mPackedData>>16) & 0x3ff); // 10bits
95 
96  return ( ( (mPackedData>>26) & 0x1) ? 1024 : ( (mPackedData>>16) & 0x3ff) );
97 
98 }
99 
100 #endif