]>
Commit | Line | Data |
---|---|---|
5e375bb4 | 1 | #ifndef ALIITSUCLUSTERPIX_H |
2 | #define ALIITSUCLUSTERPIX_H | |
3 | ||
4 | #include "AliCluster.h" | |
bdb92766 | 5 | #include <TMath.h> |
5e375bb4 | 6 | |
6f54924d | 7 | // uncomment this to have cluster topology in stored |
8 | //#define _ClusterTopology_ | |
9 | ||
10 | #define CLUSTER_VERSION 2 | |
11 | ||
5e375bb4 | 12 | class TGeoHMatrix; |
13 | class AliITSUGeomTGeo; | |
14 | ||
15 | ||
6f54924d | 16 | |
5e375bb4 | 17 | class AliITSUClusterPix : public AliCluster |
18 | { | |
19 | public: | |
20 | enum { // frame in which the track is currently defined | |
21 | kFrameLoc = BIT(16) | |
22 | ,kFrameTrk = BIT(17) | |
23 | ,kFrameGlo = BIT(18) | |
24 | ,kFrameBits = kFrameLoc|kFrameTrk|kFrameGlo | |
53870004 | 25 | ,kSplit = BIT(19) |
5e375bb4 | 26 | }; |
27 | // | |
28 | enum SortMode_t { // various modes | |
1f9b6041 | 29 | kSortIdLocXZ = BIT(0) // sort according to ID, then X,Z of local frame |
30 | ,kSortIdTrkYZ = BIT(1) // sort according to ID, then Y,Z of tracking frame | |
31 | ,kSortBits = kSortIdLocXZ|kSortIdTrkYZ | |
5e375bb4 | 32 | }; |
6f54924d | 33 | #ifdef _ClusterTopology_ |
34 | enum {kMaxPatternBits=32*16, kMaxPatternBytes=kMaxPatternBits/8, | |
35 | kSpanMask=0x7fff,kTruncateMask=0x8000}; | |
36 | #endif | |
5e375bb4 | 37 | public: |
38 | AliITSUClusterPix(); | |
39 | AliITSUClusterPix(const AliITSUClusterPix& cluster); | |
40 | AliITSUClusterPix &operator=(const AliITSUClusterPix& cluster); | |
41 | virtual ~AliITSUClusterPix(); | |
42 | // | |
43 | Bool_t IsFrameLoc() const {return TestBit(kFrameLoc);} | |
44 | Bool_t IsFrameGlo() const {return TestBit(kFrameGlo);} | |
45 | Bool_t IsFrameTrk() const {return TestBit(kFrameTrk);} | |
53870004 | 46 | // |
47 | Bool_t IsSplit() const {return TestBit(kSplit);} | |
48 | // | |
5e375bb4 | 49 | void SetFrameLoc() {ResetBit(kFrameBits); SetBit(kFrameLoc);} |
50 | void SetFrameGlo() {ResetBit(kFrameBits); SetBit(kFrameGlo);} | |
51 | void SetFrameTrk() {ResetBit(kFrameTrk); SetBit(kFrameTrk);} | |
53870004 | 52 | // |
53 | void SetSplit(Bool_t v=kTRUE) {SetBit(kSplit,v);} | |
54 | // | |
5e375bb4 | 55 | void GoToFrameGlo(); |
56 | void GoToFrameLoc(); | |
57 | void GoToFrameTrk(); | |
29ad4146 | 58 | void GetLocalXYZ(Float_t xyz[3]) const; |
59 | void GetTrackingXYZ(Float_t xyz[3]) const; | |
5e375bb4 | 60 | // |
bdb92766 | 61 | void SetNxNzN(UChar_t nx,UChar_t nz,UShort_t n) {fNxNzN = ( ((n&0xff)<<16)) + ((nx&0xff)<<8) + (nz&0xff);} |
62 | void SetClUsage(Int_t n); | |
63 | void ModClUsage(Bool_t used=kTRUE) {used ? IncClUsage() : DecClUsage();} | |
64 | void IncClUsage() {SetClUsage(GetClUsage()+1); IncreaseClusterUsage();} | |
65 | void DecClUsage(); | |
29ad4146 | 66 | Int_t GetNx() const {return (fNxNzN>>8)&0xff;} |
67 | Int_t GetNz() const {return fNxNzN&0xff;} | |
bdb92766 | 68 | Int_t GetNPix() const {return (fNxNzN>>16)&0xff;} |
69 | Int_t GetClUsage() const {return (fNxNzN>>24)&0xff;} | |
29ad4146 | 70 | // |
71 | void SetQ(UShort_t q) {fCharge = q;} | |
72 | Int_t GetQ() const {return fCharge;} | |
5e375bb4 | 73 | // |
74 | virtual void Print(Option_t* option = "") const; | |
75 | virtual const TGeoHMatrix* GetTracking2LocalMatrix() const; | |
76 | virtual TGeoHMatrix* GetMatrix(Bool_t original = kFALSE) const; | |
77 | virtual Bool_t GetGlobalXYZ(Float_t xyz[3]) const; | |
b429829e | 78 | virtual Bool_t GetGlobalXYZ(Double_t xyz[3]) const; |
5e375bb4 | 79 | virtual Bool_t GetGlobalCov(Float_t cov[6]) const; |
80 | virtual Bool_t GetXRefPlane(Float_t &xref) const; | |
81 | // | |
82 | virtual Bool_t IsSortable() const {return kTRUE;} | |
83 | virtual Bool_t IsEqual(const TObject* obj) const; | |
84 | virtual Int_t Compare(const TObject* obj) const; | |
85 | // | |
08419930 | 86 | UShort_t GetRecoInfo() const {return fRecoInfo;} |
87 | void SetRecoInfo(UShort_t v) {fRecoInfo = v; ModClUsage(v>0);} | |
88 | // | |
53870004 | 89 | Bool_t HasCommonTrack(const AliCluster* cl) const; |
90 | // | |
5e375bb4 | 91 | static void SetGeom(AliITSUGeomTGeo* gm) {fgGeom = gm;} |
92 | static void SetSortMode(SortMode_t md) {fgMode &= ~kSortBits; fgMode |= md;} | |
cb50e082 | 93 | static UInt_t GetSortMode() {return fgMode&kSortBits;} |
5e375bb4 | 94 | static UInt_t GetMode() {return fgMode;} |
3dd9c283 | 95 | static SortMode_t SortModeIdTrkYZ() {return kSortIdTrkYZ;} |
96 | static SortMode_t SortModeIdLocXZ() {return kSortIdLocXZ;} | |
5e375bb4 | 97 | // |
6f54924d | 98 | #ifdef _ClusterTopology_ |
99 | Int_t GetPatternRowSpan() const {return fPatternNRows&kSpanMask;} | |
100 | Int_t GetPatternColSpan() const {return fPatternNCols&kSpanMask;} | |
101 | Bool_t IsPatternRowsTruncated() const {return fPatternNRows&kTruncateMask;} | |
102 | Bool_t IsPatternColsTruncated() const {return fPatternNRows&kTruncateMask;} | |
103 | Bool_t IsPatternTruncated() const {return IsPatternRowsTruncated()||IsPatternColsTruncated();} | |
104 | void SetPatternRowSpan(UShort_t nr, Bool_t truncated); | |
105 | void SetPatternColSpan(UShort_t nc, Bool_t truncated); | |
106 | void SetPatternMinRow(UShort_t row) {fPatternMinRow = row;} | |
107 | void SetPatternMinCol(UShort_t col) {fPatternMinCol = col;} | |
108 | void ResetPattern(); | |
109 | Bool_t TestPixel(UShort_t row,UShort_t col) const; | |
110 | void SetPixel(UShort_t row,UShort_t col, Bool_t fired=kTRUE); | |
111 | #endif | |
112 | // | |
5e375bb4 | 113 | protected: |
114 | // | |
29ad4146 | 115 | UShort_t fCharge; // charge (for MC studies only) |
08419930 | 116 | UShort_t fRecoInfo; //! space reserved for reco time manipulations |
29ad4146 | 117 | Int_t fNxNzN; // effective cluster size in X (1st byte) and Z (2nd byte) directions |
bdb92766 | 118 | // and total Npix(3d byte). 4th byte is used for clusters usage counter |
32d38de2 | 119 | static UInt_t fgMode; //! general mode (sorting mode etc) |
120 | static AliITSUGeomTGeo* fgGeom; //! pointer on the geometry data | |
5e375bb4 | 121 | |
6f54924d | 122 | #ifdef _ClusterTopology_ |
123 | UShort_t fPatternNRows; // pattern span in rows | |
124 | UShort_t fPatternNCols; // pattern span in columns | |
125 | UShort_t fPatternMinRow; // pattern start row | |
126 | UShort_t fPatternMinCol; // pattern start column | |
127 | UChar_t fPattern[kMaxPatternBytes]; // cluster topology | |
128 | // | |
129 | ClassDef(AliITSUClusterPix,CLUSTER_VERSION+1) | |
130 | #else | |
131 | ClassDef(AliITSUClusterPix,CLUSTER_VERSION) | |
132 | #endif | |
5e375bb4 | 133 | }; |
134 | ||
bdb92766 | 135 | //______________________________________________________ |
136 | inline void AliITSUClusterPix::DecClUsage() { | |
137 | // decrease cluster usage counter | |
138 | int n=GetClUsage(); | |
139 | if (n) SetClUsage(--n); | |
140 | // | |
141 | } | |
142 | ||
143 | //______________________________________________________ | |
144 | inline void AliITSUClusterPix::SetClUsage(Int_t n) { | |
145 | // set cluster usage counter | |
8c9d1b4c | 146 | fNxNzN &= 0x00ffffff; |
147 | fNxNzN |= (n&0xff)<<24; | |
bdb92766 | 148 | if (n<2) SetBit(kShared,kFALSE); |
149 | if (!n) SetBit(kUsed,kFALSE); | |
150 | } | |
151 | ||
5e375bb4 | 152 | #endif |