1 #ifndef ALIITSUCLUSTERPIX_H
2 #define ALIITSUCLUSTERPIX_H
4 #include "AliCluster.h"
7 // uncomment this to have cluster topology in stored
9 //#define _ClusterTopology_
11 #define CLUSTER_VERSION 2
14 class AliITSUGeomTGeo;
18 class AliITSUClusterPix : public AliCluster
21 enum { // frame in which the track is currently defined
25 ,kFrameBits = kFrameLoc|kFrameTrk|kFrameGlo
29 enum SortMode_t { // various modes
30 kSortIdLocXZ = BIT(0) // sort according to ID, then X,Z of local frame
31 ,kSortIdTrkYZ = BIT(1) // sort according to ID, then Y,Z of tracking frame
32 ,kSortBits = kSortIdLocXZ|kSortIdTrkYZ
34 enum {kOffsNZ=0,kMaskNZ=0xff,kOffsNX=8,kMaskNX=0xff,kOffsNPix=16,kMaskNPix=0x1ff,kOffsClUse=25,kMaskClUse=0x7f};
36 #ifdef _ClusterTopology_
37 enum {kMaxPatternBits=32*16, kMaxPatternBytes=kMaxPatternBits/8,
38 kSpanMask=0x7fff,kTruncateMask=0x8000};
42 AliITSUClusterPix(const AliITSUClusterPix& cluster);
43 AliITSUClusterPix &operator=(const AliITSUClusterPix& cluster);
44 virtual ~AliITSUClusterPix();
46 Bool_t IsFrameLoc() const {return TestBit(kFrameLoc);}
47 Bool_t IsFrameGlo() const {return TestBit(kFrameGlo);}
48 Bool_t IsFrameTrk() const {return TestBit(kFrameTrk);}
50 Bool_t IsSplit() const {return TestBit(kSplit);}
52 void SetFrameLoc() {ResetBit(kFrameBits); SetBit(kFrameLoc);}
53 void SetFrameGlo() {ResetBit(kFrameBits); SetBit(kFrameGlo);}
54 void SetFrameTrk() {ResetBit(kFrameTrk); SetBit(kFrameTrk);}
56 void SetSplit(Bool_t v=kTRUE) {SetBit(kSplit,v);}
61 void GetLocalXYZ(Float_t xyz[3]) const;
62 void GetTrackingXYZ(Float_t xyz[3]) const;
64 void SetNxNzN(UChar_t nx,UChar_t nz,UShort_t n) {fNxNzN = ((n&kMaskNPix)<<kOffsNPix) + ((nx&kMaskNX)<<kOffsNX) + ((nz&kMaskNZ)<<kOffsNZ);}
65 void SetClUsage(Int_t n);
66 void ModClUsage(Bool_t used=kTRUE) {used ? IncClUsage() : DecClUsage();}
67 void IncClUsage() {SetClUsage(GetClUsage()+1); IncreaseClusterUsage();}
69 Int_t GetNx() const {return (fNxNzN>>kOffsNX)&kMaskNX;}
70 Int_t GetNz() const {return (fNxNzN>>kOffsNZ)&kMaskNZ;}
71 Int_t GetNPix() const {return (fNxNzN>>kOffsNPix)&kMaskNPix;}
72 Int_t GetClUsage() const {return (fNxNzN>>kOffsClUse)&kMaskClUse;}
74 void SetQ(UShort_t q) {fCharge = q;}
75 Int_t GetQ() const {return fCharge;}
77 virtual void Print(Option_t* option = "") const;
78 virtual const TGeoHMatrix* GetTracking2LocalMatrix() const;
79 virtual TGeoHMatrix* GetMatrix(Bool_t original = kFALSE) const;
80 virtual Bool_t GetGlobalXYZ(Float_t xyz[3]) const;
81 virtual Bool_t GetGlobalXYZ(Double_t xyz[3]) const;
82 virtual Bool_t GetGlobalCov(Float_t cov[6]) const;
83 virtual Bool_t GetXRefPlane(Float_t &xref) const;
85 virtual Bool_t IsSortable() const {return kTRUE;}
86 virtual Bool_t IsEqual(const TObject* obj) const;
87 virtual Int_t Compare(const TObject* obj) const;
89 UShort_t GetRecoInfo() const {return fRecoInfo;}
90 void SetRecoInfo(UShort_t v) {fRecoInfo = v; ModClUsage(v>0);}
92 Bool_t HasCommonTrack(const AliCluster* cl) const;
94 static void SetGeom(AliITSUGeomTGeo* gm) {fgGeom = gm;}
95 static void SetSortMode(SortMode_t md) {fgMode &= ~kSortBits; fgMode |= md;}
96 static UInt_t GetSortMode() {return fgMode&kSortBits;}
97 static UInt_t GetMode() {return fgMode;}
98 static SortMode_t SortModeIdTrkYZ() {return kSortIdTrkYZ;}
99 static SortMode_t SortModeIdLocXZ() {return kSortIdLocXZ;}
101 #ifdef _ClusterTopology_
102 Int_t GetPatternRowSpan() const {return fPatternNRows&kSpanMask;}
103 Int_t GetPatternColSpan() const {return fPatternNCols&kSpanMask;}
104 Bool_t IsPatternRowsTruncated() const {return fPatternNRows&kTruncateMask;}
105 Bool_t IsPatternColsTruncated() const {return fPatternNRows&kTruncateMask;}
106 Bool_t IsPatternTruncated() const {return IsPatternRowsTruncated()||IsPatternColsTruncated();}
107 void SetPatternRowSpan(UShort_t nr, Bool_t truncated);
108 void SetPatternColSpan(UShort_t nc, Bool_t truncated);
109 void SetPatternMinRow(UShort_t row) {fPatternMinRow = row;}
110 void SetPatternMinCol(UShort_t col) {fPatternMinCol = col;}
112 Bool_t TestPixel(UShort_t row,UShort_t col) const;
113 void SetPixel(UShort_t row,UShort_t col, Bool_t fired=kTRUE);
114 void GetPattern(UChar_t patt[kMaxPatternBytes]) {for(Int_t i=0; i<kMaxPatternBytes; i++) patt[i]=fPattern[i];}
115 Int_t GetPatternMinRow() const {return fPatternMinRow;}
116 Int_t GetPatternMinCol() const {return fPatternMinCol;}
122 UShort_t fCharge; // charge (for MC studies only)
123 UShort_t fRecoInfo; //! space reserved for reco time manipulations
124 Int_t fNxNzN; // effective cluster size in X (1st byte) and Z (2nd byte) directions
125 // and total Npix(next 9 bits). last 7 bits are used for clusters usage counter
126 static UInt_t fgMode; //! general mode (sorting mode etc)
127 static AliITSUGeomTGeo* fgGeom; //! pointer on the geometry data
129 #ifdef _ClusterTopology_
130 UShort_t fPatternNRows; // pattern span in rows
131 UShort_t fPatternNCols; // pattern span in columns
132 UShort_t fPatternMinRow; // pattern start row
133 UShort_t fPatternMinCol; // pattern start column
134 UChar_t fPattern[kMaxPatternBytes]; // cluster topology
136 ClassDef(AliITSUClusterPix,CLUSTER_VERSION+1)
138 ClassDef(AliITSUClusterPix,CLUSTER_VERSION)
142 //______________________________________________________
143 inline void AliITSUClusterPix::DecClUsage() {
144 // decrease cluster usage counter
146 if (n) SetClUsage(--n);
150 //______________________________________________________
151 inline void AliITSUClusterPix::SetClUsage(Int_t n) {
152 // set cluster usage counter
153 fNxNzN &= ~(kMaskClUse<<kOffsClUse);
154 fNxNzN |= (n&kMaskClUse)<<kOffsClUse;
155 if (n<2) SetBit(kShared,kFALSE);
156 if (!n) SetBit(kUsed,kFALSE);