added cluster sharing histogramming
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSUClusterPix.h
CommitLineData
5e375bb4 1#ifndef ALIITSUCLUSTERPIX_H
2#define ALIITSUCLUSTERPIX_H
3
4#include "AliCluster.h"
bdb92766 5#include <TMath.h>
5e375bb4 6
7class TGeoHMatrix;
8class AliITSUGeomTGeo;
9
10
11class AliITSUClusterPix : public AliCluster
12{
13 public:
14 enum { // frame in which the track is currently defined
15 kFrameLoc = BIT(16)
16 ,kFrameTrk = BIT(17)
17 ,kFrameGlo = BIT(18)
18 ,kFrameBits = kFrameLoc|kFrameTrk|kFrameGlo
53870004 19 ,kSplit = BIT(19)
5e375bb4 20 };
21 //
22 enum SortMode_t { // various modes
1f9b6041 23 kSortIdLocXZ = BIT(0) // sort according to ID, then X,Z of local frame
24 ,kSortIdTrkYZ = BIT(1) // sort according to ID, then Y,Z of tracking frame
25 ,kSortBits = kSortIdLocXZ|kSortIdTrkYZ
5e375bb4 26 };
27
28 public:
29 AliITSUClusterPix();
30 AliITSUClusterPix(const AliITSUClusterPix& cluster);
31 AliITSUClusterPix &operator=(const AliITSUClusterPix& cluster);
32 virtual ~AliITSUClusterPix();
33 //
34 Bool_t IsFrameLoc() const {return TestBit(kFrameLoc);}
35 Bool_t IsFrameGlo() const {return TestBit(kFrameGlo);}
36 Bool_t IsFrameTrk() const {return TestBit(kFrameTrk);}
53870004 37 //
38 Bool_t IsSplit() const {return TestBit(kSplit);}
39 //
5e375bb4 40 void SetFrameLoc() {ResetBit(kFrameBits); SetBit(kFrameLoc);}
41 void SetFrameGlo() {ResetBit(kFrameBits); SetBit(kFrameGlo);}
42 void SetFrameTrk() {ResetBit(kFrameTrk); SetBit(kFrameTrk);}
53870004 43 //
44 void SetSplit(Bool_t v=kTRUE) {SetBit(kSplit,v);}
45 //
5e375bb4 46 void GoToFrameGlo();
47 void GoToFrameLoc();
48 void GoToFrameTrk();
29ad4146 49 void GetLocalXYZ(Float_t xyz[3]) const;
50 void GetTrackingXYZ(Float_t xyz[3]) const;
5e375bb4 51 //
bdb92766 52 void SetNxNzN(UChar_t nx,UChar_t nz,UShort_t n) {fNxNzN = ( ((n&0xff)<<16)) + ((nx&0xff)<<8) + (nz&0xff);}
53 void SetClUsage(Int_t n);
54 void ModClUsage(Bool_t used=kTRUE) {used ? IncClUsage() : DecClUsage();}
55 void IncClUsage() {SetClUsage(GetClUsage()+1); IncreaseClusterUsage();}
56 void DecClUsage();
29ad4146 57 Int_t GetNx() const {return (fNxNzN>>8)&0xff;}
58 Int_t GetNz() const {return fNxNzN&0xff;}
bdb92766 59 Int_t GetNPix() const {return (fNxNzN>>16)&0xff;}
60 Int_t GetClUsage() const {return (fNxNzN>>24)&0xff;}
29ad4146 61 //
62 void SetQ(UShort_t q) {fCharge = q;}
63 Int_t GetQ() const {return fCharge;}
5e375bb4 64 //
65 virtual void Print(Option_t* option = "") const;
66 virtual const TGeoHMatrix* GetTracking2LocalMatrix() const;
67 virtual TGeoHMatrix* GetMatrix(Bool_t original = kFALSE) const;
68 virtual Bool_t GetGlobalXYZ(Float_t xyz[3]) const;
69 virtual Bool_t GetGlobalCov(Float_t cov[6]) const;
70 virtual Bool_t GetXRefPlane(Float_t &xref) const;
71 //
72 virtual Bool_t IsSortable() const {return kTRUE;}
73 virtual Bool_t IsEqual(const TObject* obj) const;
74 virtual Int_t Compare(const TObject* obj) const;
75 //
53870004 76 Bool_t HasCommonTrack(const AliCluster* cl) const;
77 //
5e375bb4 78 static void SetGeom(AliITSUGeomTGeo* gm) {fgGeom = gm;}
79 static void SetSortMode(SortMode_t md) {fgMode &= ~kSortBits; fgMode |= md;}
cb50e082 80 static UInt_t GetSortMode() {return fgMode&kSortBits;}
5e375bb4 81 static UInt_t GetMode() {return fgMode;}
3dd9c283 82 static SortMode_t SortModeIdTrkYZ() {return kSortIdTrkYZ;}
83 static SortMode_t SortModeIdLocXZ() {return kSortIdLocXZ;}
5e375bb4 84 //
85 protected:
86 //
29ad4146 87 UShort_t fCharge; // charge (for MC studies only)
88 Int_t fNxNzN; // effective cluster size in X (1st byte) and Z (2nd byte) directions
bdb92766 89 // and total Npix(3d byte). 4th byte is used for clusters usage counter
32d38de2 90 static UInt_t fgMode; //! general mode (sorting mode etc)
91 static AliITSUGeomTGeo* fgGeom; //! pointer on the geometry data
5e375bb4 92
93 ClassDef(AliITSUClusterPix,1)
94};
95
bdb92766 96//______________________________________________________
97inline void AliITSUClusterPix::DecClUsage() {
98 // decrease cluster usage counter
99 int n=GetClUsage();
100 if (n) SetClUsage(--n);
101 //
102}
103
104//______________________________________________________
105inline void AliITSUClusterPix::SetClUsage(Int_t n) {
106 // set cluster usage counter
107 fNxNzN &= ((n&0xff)<<24)&0x00ffffff;
108 if (n<2) SetBit(kShared,kFALSE);
109 if (!n) SetBit(kUsed,kFALSE);
110}
111
5e375bb4 112#endif