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