1 #ifndef ALIITSUCLUSTERPIX_H
2 #define ALIITSUCLUSTERPIX_H
4 #include "AliCluster.h"
7 // uncomment this to have cluster topology in stored
8 //#define _ClusterTopology_
10 #define CLUSTER_VERSION 2
13 class AliITSUGeomTGeo;
17 class AliITSUClusterPix : public AliCluster
20 enum { // frame in which the track is currently defined
24 ,kFrameBits = kFrameLoc|kFrameTrk|kFrameGlo
28 enum SortMode_t { // various modes
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
33 #ifdef _ClusterTopology_
34 enum {kMaxPatternBits=32*16, kMaxPatternBytes=kMaxPatternBits/8,
35 kSpanMask=0x7fff,kTruncateMask=0x8000};
39 AliITSUClusterPix(const AliITSUClusterPix& cluster);
40 AliITSUClusterPix &operator=(const AliITSUClusterPix& cluster);
41 virtual ~AliITSUClusterPix();
43 Bool_t IsFrameLoc() const {return TestBit(kFrameLoc);}
44 Bool_t IsFrameGlo() const {return TestBit(kFrameGlo);}
45 Bool_t IsFrameTrk() const {return TestBit(kFrameTrk);}
47 Bool_t IsSplit() const {return TestBit(kSplit);}
49 void SetFrameLoc() {ResetBit(kFrameBits); SetBit(kFrameLoc);}
50 void SetFrameGlo() {ResetBit(kFrameBits); SetBit(kFrameGlo);}
51 void SetFrameTrk() {ResetBit(kFrameTrk); SetBit(kFrameTrk);}
53 void SetSplit(Bool_t v=kTRUE) {SetBit(kSplit,v);}
58 void GetLocalXYZ(Float_t xyz[3]) const;
59 void GetTrackingXYZ(Float_t xyz[3]) const;
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();}
66 Int_t GetNx() const {return (fNxNzN>>8)&0xff;}
67 Int_t GetNz() const {return fNxNzN&0xff;}
68 Int_t GetNPix() const {return (fNxNzN>>16)&0xff;}
69 Int_t GetClUsage() const {return (fNxNzN>>24)&0xff;}
71 void SetQ(UShort_t q) {fCharge = q;}
72 Int_t GetQ() const {return fCharge;}
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;
78 virtual Bool_t GetGlobalXYZ(Double_t xyz[3]) const;
79 virtual Bool_t GetGlobalCov(Float_t cov[6]) const;
80 virtual Bool_t GetXRefPlane(Float_t &xref) const;
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;
86 UShort_t GetRecoInfo() const {return fRecoInfo;}
87 void SetRecoInfo(UShort_t v) {fRecoInfo = v; ModClUsage(v>0);}
89 Bool_t HasCommonTrack(const AliCluster* cl) const;
91 static void SetGeom(AliITSUGeomTGeo* gm) {fgGeom = gm;}
92 static void SetSortMode(SortMode_t md) {fgMode &= ~kSortBits; fgMode |= md;}
93 static UInt_t GetSortMode() {return fgMode&kSortBits;}
94 static UInt_t GetMode() {return fgMode;}
95 static SortMode_t SortModeIdTrkYZ() {return kSortIdTrkYZ;}
96 static SortMode_t SortModeIdLocXZ() {return kSortIdLocXZ;}
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;}
109 Bool_t TestPixel(UShort_t row,UShort_t col) const;
110 void SetPixel(UShort_t row,UShort_t col, Bool_t fired=kTRUE);
115 UShort_t fCharge; // charge (for MC studies only)
116 UShort_t fRecoInfo; //! space reserved for reco time manipulations
117 Int_t fNxNzN; // effective cluster size in X (1st byte) and Z (2nd byte) directions
118 // and total Npix(3d byte). 4th byte is used for clusters usage counter
119 static UInt_t fgMode; //! general mode (sorting mode etc)
120 static AliITSUGeomTGeo* fgGeom; //! pointer on the geometry data
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
129 ClassDef(AliITSUClusterPix,CLUSTER_VERSION+1)
131 ClassDef(AliITSUClusterPix,CLUSTER_VERSION)
135 //______________________________________________________
136 inline void AliITSUClusterPix::DecClUsage() {
137 // decrease cluster usage counter
139 if (n) SetClUsage(--n);
143 //______________________________________________________
144 inline void AliITSUClusterPix::SetClUsage(Int_t n) {
145 // set cluster usage counter
146 fNxNzN &= 0x00ffffff;
147 fNxNzN |= (n&0xff)<<24;
148 if (n<2) SetBit(kShared,kFALSE);
149 if (!n) SetBit(kUsed,kFALSE);