Bug fix by Theodor
[u/mrichter/AliRoot.git] / TRD / AliTRDcluster.h
CommitLineData
46d29e70 1#ifndef ALITRDCLUSTER_H
2#define ALITRDCLUSTER_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7
6d50f529 8///////////////////////////////////////////////////////////////////////////////
9// //
10// TRD cluster //
11// //
12///////////////////////////////////////////////////////////////////////////////
5443e65e 13
5843e420 14#include "AliCluster.h"
46d29e70 15
a5b99acd 16class AliTRDtrackletWord;
17
5443e65e 18class AliTRDcluster : public AliCluster {
5843e420 19public:
5843e420 20 enum ETRDclusterStatus {
21 kInChamber = BIT(16) // Out of fiducial volume of chamber (signal tails)
22 ,kFivePad = BIT(17) // Deconvoluted clusters
b72f4eaf 23 ,kLUT = BIT(18)
24 ,kGAUS = BIT(19)
25 ,kCOG = BIT(20)
5843e420 26 };
27 enum ETRDclusterMask {
28 kMaskedLeft = 0
29 ,kMaskedCenter = 1
30 ,kMaskedRight = 2
f5375dcb 31 };
0e09df31 32
bdb68f8c 33 AliTRDcluster();
b72f4eaf 34 AliTRDcluster(Int_t det, UChar_t col, UChar_t row, UChar_t time, const Short_t *sig, UShort_t volid);
203967fc 35 AliTRDcluster(
36 Int_t det, Float_t q, Float_t *pos, Float_t *sig,
37 Int_t *tracks, Char_t npads, Short_t *signals,
38 UChar_t col, UChar_t row, UChar_t time,
39 Char_t timebin, Float_t center, UShort_t volid);
a5b99acd 40 AliTRDcluster(const AliTRDtrackletWord *const tracklet, Int_t det, UShort_t volid);
a2b90f83 41 AliTRDcluster(const AliTRDcluster &c);
acc49af9 42 virtual ~AliTRDcluster() {};
a2b90f83 43
6d50f529 44 virtual void AddTrackIndex(Int_t *i);
203967fc 45 void Clear(Option_t *o="");
46
47 Bool_t IsEqual(const TObject *otherCluster) const;
48 Bool_t IsInChamber() const { return TestBit(kInChamber); }
49 Bool_t IsMasked() const { return fClusterMasking ? kTRUE : kFALSE; }
de777ccb 50 Bool_t IsShared() const { return IsClusterShared();}
51 Bool_t IsUsed() const { return IsClusterUsed(); }
5843e420 52 Bool_t IsFivePad() const { return TestBit(kFivePad);}
b72f4eaf 53 inline Bool_t IsRPhiMethod(ETRDclusterStatus m) const;
a2b90f83 54
203967fc 55 UChar_t GetPadMaskedPosition() const { return fClusterMasking & 7; }
56 UChar_t GetPadMaskedStatus() const { return fClusterMasking >> 3; }
57 Int_t GetDetector() const { return fDetector; }
58 Int_t GetLocalTimeBin() const { return fLocalTimeBin; }
59 Float_t GetQ() const { return fQ; }
60 Int_t GetNPads() const { return fNPads; }
61 Float_t GetCenter() const { return fCenter; }
62 Int_t GetPadCol() const { return fPadCol; }
63 Int_t GetPadRow() const { return fPadRow; }
64 Int_t GetPadTime() const { return fPadTime; }
65 Short_t *GetSignals() { return fSignals; }
66 Float_t GetSumS() const;
b72f4eaf 67 static Double_t GetSX(Int_t tb, Double_t z=-1);
1fd9389f 68 static Double_t GetSYdrift(Int_t tb, Int_t ly=0, Double_t z=-1);
69 static Double_t GetSYcharge(Float_t q);
70 static Double_t GetSYprf(Int_t ly, Double_t center, Double_t s2);
b72f4eaf 71 static Double_t GetXcorr(Int_t tb, Double_t z=-1);
72 static Double_t GetYcorr(Int_t ly, Float_t y);
834ac2c9 73 Float_t GetXloc(Double_t t0, Double_t vd, Double_t *const q=0x0, Double_t *const xq=0x0, Double_t z = 0.2);
b72f4eaf 74 Float_t GetYloc(Double_t y0, Double_t s2, Double_t W, Double_t *const y1=0x0, Double_t *const y2=0x0);
5843e420 75
203967fc 76 void Print(Option_t* o="") const;
f5375dcb 77
203967fc 78 void SetLocalTimeBin(Char_t t) { fLocalTimeBin = t; }
79 void SetInChamber(Bool_t in = kTRUE) { SetBit(kInChamber,in); }
b72f4eaf 80 void SetNPads(Int_t n) { fNPads = n; }
203967fc 81 void SetPadMaskedPosition(UChar_t position);
82 void SetPadMaskedStatus(UChar_t status);
bee2b41e 83 void SetPadCol(UChar_t inPadCol){ fPadCol = inPadCol;}
84 void SetPadRow(UChar_t inPadRow){ fPadRow = inPadRow;}
85 void SetPadTime(UChar_t inPadTime){ fPadTime = inPadTime;}
b72f4eaf 86 inline void SetRPhiMethod(ETRDclusterStatus m);
bee2b41e 87 void SetDetector(Short_t inDetector){ fDetector = inDetector;}
88 void SetQ(Float_t inQ){ fQ = inQ;}
89 void SetClusterMasking(UChar_t inClusterMasking){ fClusterMasking = inClusterMasking;}
de777ccb 90 void SetShared(Bool_t sh = kTRUE) { SetBit(AliCluster::kShared,sh); }
1fd9389f 91 void SetSigmaY2(Float_t s2, Float_t dt, Float_t exb, Float_t x0, Float_t z=-1., Float_t tgp=0.);
07bbc13c 92 void Use(Int_t u = 1) { SetBit(AliCluster::kUsed, u ? kTRUE : kFALSE); }
5843e420 93 void SetFivePad(Bool_t b = kTRUE) { SetBit(kFivePad,b);}
af26ce80 94
5843e420 95protected:
96 UChar_t fPadCol; // Central pad number in column direction
97 UChar_t fPadRow; // Central pad number in row direction
98 UChar_t fPadTime; // Uncalibrated time bin number
99 Char_t fLocalTimeBin; // T0-calibrated time bin number
100 UChar_t fNPads; // Number of pads in cluster
101 UChar_t fClusterMasking; // Bit field containing cluster status information;
102 Short_t fDetector; // TRD detector number
103 Short_t fSignals[7]; // Signals in the cluster
104 Float_t fQ; // Amplitude
105 Float_t fCenter; // Center of the cluster relative to the pad
0e09df31 106
b72f4eaf 107private:
108 Float_t GetDYcog(Double_t *const y1=0x0, Double_t *const y2=0x0);
109 Float_t GetDYlut(Double_t *const y1=0x0, Double_t *const y2=0x0);
110 Float_t GetDYgauss(Double_t sw, Double_t *const y1=0x0, Double_t *const y2=0x0);
111 static void FillLUT();
112
113 static const Int_t fgkNlut; //! Number of bins of the LUT
114 static Double_t *fgLUT; //! The lookup table
115
116 ClassDef(AliTRDcluster, 7) // Cluster for the TRD
46d29e70 117};
b72f4eaf 118
119//________________________________________________
120inline Bool_t AliTRDcluster::IsRPhiMethod(ETRDclusterStatus m) const
121{
122 if(m==kLUT && TestBit(kLUT)) return kTRUE;
123 else if(m==kGAUS && TestBit(kGAUS)) return kTRUE;
124 else if(m==kCOG && (!TestBit(kLUT)&&!TestBit(kGAUS))) return kTRUE;
125
126 return kFALSE;
127}
128
129//________________________________________________
130inline void AliTRDcluster::SetRPhiMethod(ETRDclusterStatus m)
131{
a8d5c885 132 SetBit(kCOG,0);SetBit(kLUT,0);SetBit(kGAUS,0);
b72f4eaf 133 switch(m){
134 case kCOG: SetBit(kCOG); break;
135 case kLUT: SetBit(kLUT); break;
136 case kGAUS: SetBit(kGAUS); break;
a8d5c885 137 default: SetBit(kLUT); break;
b72f4eaf 138 }
139}
140
46d29e70 141#endif