]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/UPGRADE/ITSUpgradeRec/AliITSUClusterPix.h
ITS UPGRADE
[u/mrichter/AliRoot.git] / ITS / UPGRADE / ITSUpgradeRec / AliITSUClusterPix.h
CommitLineData
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
b7e5fec5 8
d61bec56 9//#define _ClusterTopology_
6f54924d 10
11#define CLUSTER_VERSION 2
12
5e375bb4 13class TGeoHMatrix;
14class AliITSUGeomTGeo;
15
16
6f54924d 17
5e375bb4 18class AliITSUClusterPix : public AliCluster
19{
20 public:
21 enum { // frame in which the track is currently defined
22 kFrameLoc = BIT(16)
23 ,kFrameTrk = BIT(17)
24 ,kFrameGlo = BIT(18)
25 ,kFrameBits = kFrameLoc|kFrameTrk|kFrameGlo
53870004 26 ,kSplit = BIT(19)
5e375bb4 27 };
28 //
29 enum SortMode_t { // various modes
1f9b6041 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
5e375bb4 33 };
b7e5fec5 34 enum {kOffsNZ=0,kMaskNZ=0xff,kOffsNX=8,kMaskNX=0xff,kOffsNPix=16,kMaskNPix=0x1ff,kOffsClUse=25,kMaskClUse=0x7f};
35 //
6f54924d 36#ifdef _ClusterTopology_
37 enum {kMaxPatternBits=32*16, kMaxPatternBytes=kMaxPatternBits/8,
38 kSpanMask=0x7fff,kTruncateMask=0x8000};
39#endif
5e375bb4 40 public:
41 AliITSUClusterPix();
42 AliITSUClusterPix(const AliITSUClusterPix& cluster);
43 AliITSUClusterPix &operator=(const AliITSUClusterPix& cluster);
44 virtual ~AliITSUClusterPix();
45 //
46 Bool_t IsFrameLoc() const {return TestBit(kFrameLoc);}
47 Bool_t IsFrameGlo() const {return TestBit(kFrameGlo);}
48 Bool_t IsFrameTrk() const {return TestBit(kFrameTrk);}
53870004 49 //
50 Bool_t IsSplit() const {return TestBit(kSplit);}
51 //
5e375bb4 52 void SetFrameLoc() {ResetBit(kFrameBits); SetBit(kFrameLoc);}
53 void SetFrameGlo() {ResetBit(kFrameBits); SetBit(kFrameGlo);}
54 void SetFrameTrk() {ResetBit(kFrameTrk); SetBit(kFrameTrk);}
53870004 55 //
56 void SetSplit(Bool_t v=kTRUE) {SetBit(kSplit,v);}
57 //
5e375bb4 58 void GoToFrameGlo();
59 void GoToFrameLoc();
60 void GoToFrameTrk();
29ad4146 61 void GetLocalXYZ(Float_t xyz[3]) const;
62 void GetTrackingXYZ(Float_t xyz[3]) const;
5e375bb4 63 //
b7e5fec5 64 void SetNxNzN(UChar_t nx,UChar_t nz,UShort_t n) {fNxNzN = ((n&kMaskNPix)<<kOffsNPix) + ((nx&kMaskNX)<<kOffsNX) + ((nz&kMaskNZ)<<kOffsNZ);}
bdb92766 65 void SetClUsage(Int_t n);
66 void ModClUsage(Bool_t used=kTRUE) {used ? IncClUsage() : DecClUsage();}
67 void IncClUsage() {SetClUsage(GetClUsage()+1); IncreaseClusterUsage();}
68 void DecClUsage();
b7e5fec5 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;}
29ad4146 73 //
74 void SetQ(UShort_t q) {fCharge = q;}
75 Int_t GetQ() const {return fCharge;}
5e375bb4 76 //
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;
b429829e 81 virtual Bool_t GetGlobalXYZ(Double_t xyz[3]) const;
5e375bb4 82 virtual Bool_t GetGlobalCov(Float_t cov[6]) const;
83 virtual Bool_t GetXRefPlane(Float_t &xref) const;
84 //
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;
88 //
08419930 89 UShort_t GetRecoInfo() const {return fRecoInfo;}
90 void SetRecoInfo(UShort_t v) {fRecoInfo = v; ModClUsage(v>0);}
91 //
53870004 92 Bool_t HasCommonTrack(const AliCluster* cl) const;
93 //
5e375bb4 94 static void SetGeom(AliITSUGeomTGeo* gm) {fgGeom = gm;}
95 static void SetSortMode(SortMode_t md) {fgMode &= ~kSortBits; fgMode |= md;}
cb50e082 96 static UInt_t GetSortMode() {return fgMode&kSortBits;}
5e375bb4 97 static UInt_t GetMode() {return fgMode;}
3dd9c283 98 static SortMode_t SortModeIdTrkYZ() {return kSortIdTrkYZ;}
99 static SortMode_t SortModeIdLocXZ() {return kSortIdLocXZ;}
5e375bb4 100 //
6f54924d 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;}
111 void ResetPattern();
112 Bool_t TestPixel(UShort_t row,UShort_t col) const;
113 void SetPixel(UShort_t row,UShort_t col, Bool_t fired=kTRUE);
b7e5fec5 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;}
117
6f54924d 118#endif
119 //
5e375bb4 120 protected:
121 //
29ad4146 122 UShort_t fCharge; // charge (for MC studies only)
08419930 123 UShort_t fRecoInfo; //! space reserved for reco time manipulations
29ad4146 124 Int_t fNxNzN; // effective cluster size in X (1st byte) and Z (2nd byte) directions
b7e5fec5 125 // and total Npix(next 9 bits). last 7 bits are used for clusters usage counter
32d38de2 126 static UInt_t fgMode; //! general mode (sorting mode etc)
127 static AliITSUGeomTGeo* fgGeom; //! pointer on the geometry data
5e375bb4 128
6f54924d 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
b7e5fec5 134 UChar_t fPattern[kMaxPatternBytes]; // cluster topology
6f54924d 135 //
136 ClassDef(AliITSUClusterPix,CLUSTER_VERSION+1)
137#else
138 ClassDef(AliITSUClusterPix,CLUSTER_VERSION)
139#endif
5e375bb4 140};
141
bdb92766 142//______________________________________________________
143inline void AliITSUClusterPix::DecClUsage() {
144 // decrease cluster usage counter
145 int n=GetClUsage();
146 if (n) SetClUsage(--n);
147 //
148}
149
150//______________________________________________________
151inline void AliITSUClusterPix::SetClUsage(Int_t n) {
152 // set cluster usage counter
b7e5fec5 153 fNxNzN &= ~(kMaskClUse<<kOffsClUse);
154 fNxNzN |= (n&kMaskClUse)<<kOffsClUse;
bdb92766 155 if (n<2) SetBit(kShared,kFALSE);
156 if (!n) SetBit(kUsed,kFALSE);
157}
158
5e375bb4 159#endif