changes from fzhou
[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 {
3044dfe5 19 friend class AliHLTTRDCluster;
9dcc64cc 20 friend class AliTRDtrackletOflHelper;
762571f0 21
3044dfe5 22public:
5843e420 23 enum ETRDclusterStatus {
24 kInChamber = BIT(16) // Out of fiducial volume of chamber (signal tails)
25 ,kFivePad = BIT(17) // Deconvoluted clusters
b72f4eaf 26 ,kLUT = BIT(18)
27 ,kGAUS = BIT(19)
28 ,kCOG = BIT(20)
8fc736d7 29 ,kXcorr = BIT(21) // steer efficient vd corrections
07897df4 30 ,kRawSignals= BIT(22) // toggle raw digits storage
5843e420 31 };
32 enum ETRDclusterMask {
33 kMaskedLeft = 0
34 ,kMaskedCenter = 1
35 ,kMaskedRight = 2
f5375dcb 36 };
0e09df31 37
bdb68f8c 38 AliTRDcluster();
b72f4eaf 39 AliTRDcluster(Int_t det, UChar_t col, UChar_t row, UChar_t time, const Short_t *sig, UShort_t volid);
04e58504 40 AliTRDcluster(Int_t det, Float_t q, const Float_t *pos, const Float_t *sig
41 , const Int_t *tracks, Char_t npads, Short_t * const signals
762571f0 42 , UChar_t col, UChar_t row, UChar_t time
43 , Char_t timebin, Float_t center, UShort_t volid);
a5b99acd 44 AliTRDcluster(const AliTRDtrackletWord *const tracklet, Int_t det, UShort_t volid);
a2b90f83 45 AliTRDcluster(const AliTRDcluster &c);
acc49af9 46 virtual ~AliTRDcluster() {};
762571f0 47 AliTRDcluster &operator=(const AliTRDcluster &c);
a2b90f83 48
762571f0 49 virtual void AddTrackIndex(const Int_t * const i);
50 void Clear(Option_t *o="");
203967fc 51
762571f0 52 Bool_t IsEqual(const TObject *otherCluster) const;
53 Bool_t IsInChamber() const { return TestBit(kInChamber); }
54 Bool_t IsMasked() const { return fClusterMasking ? kTRUE : kFALSE; }
55 Bool_t IsShared() const { return IsClusterShared(); }
56 Bool_t IsUsed() const { return IsClusterUsed(); }
57 Bool_t IsFivePad() const { return TestBit(kFivePad); }
58 inline Bool_t IsRPhiMethod(ETRDclusterStatus m) const;
07897df4 59 inline Bool_t IsMCcluster() const;
8fc736d7 60 Bool_t HasXcorr() const { return TestBit(kXcorr); }
07897df4 61 Bool_t HasRawSignals() const { return TestBit(kRawSignals); }
762571f0 62
63 UChar_t GetPadMaskedPosition() const { return fClusterMasking & 7; }
64 UChar_t GetPadMaskedStatus() const { return fClusterMasking >> 3; }
65 Int_t GetDetector() const { return fDetector; }
66 Int_t GetLocalTimeBin() const { return fLocalTimeBin; }
67 Float_t GetQ() const { return fQ; }
07897df4 68 Short_t GetRawQ() const { return TestBit(kRawSignals)?(Short_t)GetSumS():0;}
762571f0 69 Int_t GetNPads() const { return fNPads; }
70 Float_t GetCenter() const { return fCenter; }
71 Int_t GetPadCol() const { return fPadCol; }
72 Int_t GetPadRow() const { return fPadRow; }
73 Int_t GetPadTime() const { return fPadTime; }
74 Short_t *GetSignals() { return fSignals; }
75 Float_t GetSumS() const;
76
77 static Double_t GetSX(Int_t tb, Double_t z=-1);
78 static Double_t GetSYdrift(Int_t tb, Int_t ly=0, Double_t z=-1);
79 static Double_t GetSYcharge(Float_t q);
80 static Double_t GetSYprf(Int_t ly, Double_t center, Double_t s2);
81 static Double_t GetXcorr(Int_t tb, Double_t z=-1);
82 static Double_t GetYcorr(Int_t ly, Float_t y);
83 Float_t GetXloc(Double_t t0, Double_t vd
84 , const Double_t *const q = 0x0
85 , const Double_t *const xq = 0x0
86 , Double_t z = 0.2);
87 Float_t GetYloc(Double_t y0, Double_t s2, Double_t W, Double_t *const y1=0x0, Double_t *const y2=0x0);
88
89 void Print(Option_t* o="") const;
90
91 void SetLocalTimeBin(Char_t t) { fLocalTimeBin = t; }
92 void SetNPads(Int_t n) { fNPads = n; }
93 void SetPadCol(UChar_t inPadCol) { fPadCol = inPadCol; }
94 void SetPadRow(UChar_t inPadRow) { fPadRow = inPadRow; }
95 void SetPadTime(UChar_t inPadTime) { fPadTime = inPadTime; }
96 void SetDetector(Short_t inDetector) { fDetector = inDetector; }
97 void SetQ(Float_t inQ) { fQ = inQ; }
98 void SetClusterMasking(UChar_t inClusterMasking) { fClusterMasking = inClusterMasking; }
99 void SetShared(Bool_t sh = kTRUE) { SetBit(AliCluster::kShared,sh); }
100 void SetFivePad(Bool_t b = kTRUE) { SetBit(kFivePad,b); }
101 void SetInChamber(Bool_t in = kTRUE) { SetBit(kInChamber,in); }
102 void SetPadMaskedPosition(UChar_t position);
103 void SetPadMaskedStatus(UChar_t status);
104 void SetSigmaY2(Float_t s2, Float_t dt, Float_t exb, Float_t x0, Float_t z=-1., Float_t tgp=0.);
07897df4 105 void SetSignals(Short_t sig[7], Bool_t raw=kTRUE){ memcpy(fSignals, sig, 7*sizeof(Short_t)); SetBit(kRawSignals, raw);}
b72f4eaf 106 inline void SetRPhiMethod(ETRDclusterStatus m);
8fc736d7 107 void SetXcorr(Bool_t xc = kTRUE) { SetBit(kXcorr,xc); }
762571f0 108
109 void Use(Int_t u = 1) { SetBit(AliCluster::kUsed, u ? kTRUE : kFALSE); }
af26ce80 110
5843e420 111protected:
762571f0 112
5843e420 113 UChar_t fPadCol; // Central pad number in column direction
114 UChar_t fPadRow; // Central pad number in row direction
115 UChar_t fPadTime; // Uncalibrated time bin number
116 Char_t fLocalTimeBin; // T0-calibrated time bin number
117 UChar_t fNPads; // Number of pads in cluster
118 UChar_t fClusterMasking; // Bit field containing cluster status information;
119 Short_t fDetector; // TRD detector number
07897df4 120 Short_t fSignals[7]; // Raw signals if HasRawSignals() returns true. Otherwise calibrated.
121 Float_t fQ; // Calibrated cluster charge
5843e420 122 Float_t fCenter; // Center of the cluster relative to the pad
0e09df31 123
b72f4eaf 124private:
762571f0 125
126 Float_t GetDYcog(const Double_t *const y1=0x0, const Double_t *const y2=0x0);
127 Float_t GetDYlut(const Double_t *const y1=0x0, const Double_t *const y2=0x0);
128 Float_t GetDYgauss(Double_t sw, Double_t *const y1=0x0, Double_t *const y2=0x0);
b72f4eaf 129 static void FillLUT();
130
131 static const Int_t fgkNlut; //! Number of bins of the LUT
132 static Double_t *fgLUT; //! The lookup table
133
762571f0 134 ClassDef(AliTRDcluster, 7) // Cluster for the TRD
135
46d29e70 136};
b72f4eaf 137
07897df4 138//________________________________________________
139inline Bool_t AliTRDcluster::IsMCcluster() const
9dcc64cc 140{
07897df4 141 if( GetLabel(0) == fPadRow &&
142 GetLabel(1) == fPadCol &&
143 GetLabel(2) == fPadTime) return kFALSE;
144 return kTRUE;
9dcc64cc 145}
146
b72f4eaf 147//________________________________________________
148inline Bool_t AliTRDcluster::IsRPhiMethod(ETRDclusterStatus m) const
149{
150 if(m==kLUT && TestBit(kLUT)) return kTRUE;
151 else if(m==kGAUS && TestBit(kGAUS)) return kTRUE;
152 else if(m==kCOG && (!TestBit(kLUT)&&!TestBit(kGAUS))) return kTRUE;
153
154 return kFALSE;
155}
156
157//________________________________________________
158inline void AliTRDcluster::SetRPhiMethod(ETRDclusterStatus m)
159{
a8d5c885 160 SetBit(kCOG,0);SetBit(kLUT,0);SetBit(kGAUS,0);
b72f4eaf 161 switch(m){
162 case kCOG: SetBit(kCOG); break;
163 case kLUT: SetBit(kLUT); break;
164 case kGAUS: SetBit(kGAUS); break;
a8d5c885 165 default: SetBit(kLUT); break;
b72f4eaf 166 }
167}
168
46d29e70 169#endif