]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCCalROC.h
Add local fitting method (Marian)
[u/mrichter/AliRoot.git] / TPC / AliTPCCalROC.h
1 #ifndef ALITPCCALROC_H
2 #define ALITPCCALROC_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id: AliTPCCalROC.h,v */
7
8 //////////////////////////////////////////////////
9 //                                              //
10 //  TPC calibration base class for one ROC      //
11 //                                              //
12 //////////////////////////////////////////////////
13
14 #include <TObject.h>
15 #include <TMath.h>
16 #include <AliTPCROC.h>
17 class TH1F;
18 class TH2F;
19 class TArrayI;
20 class TLinearFitter;
21 //_____________________________________________________________________________
22 class AliTPCCalROC : public TObject {
23
24  public:
25   
26   AliTPCCalROC();
27   AliTPCCalROC(UInt_t sector);
28   AliTPCCalROC(const AliTPCCalROC &c);
29  AliTPCCalROC &operator = (const AliTPCCalROC & param);
30   virtual           ~AliTPCCalROC();  
31   UInt_t        GetNrows() const               { return fNRows;};
32   UInt_t        GetNchannels()       const     { return fNChannels;};
33   UInt_t        GetNPads(UInt_t row)  const     { return (row<fNRows)? AliTPCROC::Instance()->GetNPads(fSector,row):0;};
34   Float_t      GetValue(UInt_t row, UInt_t pad) const { return ( (row<fNRows) && (fIndexes[row]+pad)<fNChannels)? fData[fIndexes[row]+pad]: 0; };
35   Float_t      GetValue(UInt_t channel) const { return  fData[channel]; };
36   void         SetValue(UInt_t row, UInt_t pad, Float_t vd) { if ( row<fNRows && (fIndexes[row]+pad)<fNChannels)fData[fIndexes[row]+pad]= vd; };
37   void         SetValue(UInt_t channel, Float_t vd) {fData[channel]= vd; };
38   virtual void Draw(Option_t* option = "");
39   //
40   // algebra
41   void Add(Float_t c1);
42   void Multiply(Float_t c1);
43   void Add(const AliTPCCalROC * roc, Double_t c1 = 1);
44   void Multiply(const AliTPCCalROC * roc);   
45   void Divide(const AliTPCCalROC * roc);   
46   // statistic
47   //
48   Double_t GetMean(){return TMath::Mean(fNChannels, fData);}
49   Double_t GetRMS() {return TMath::RMS(fNChannels, fData);}
50   Double_t GetMedian() {return TMath::Median(fNChannels, fData);}
51   Double_t GetLTM(Double_t *sigma=0, Double_t fraction=0.9);
52   TH1F * MakeHisto1D(Float_t min=4, Float_t max=-4, Int_t type=0);     
53   TH2F * MakeHisto2D(Float_t min=4, Float_t max=-4, Int_t type=0);   
54   TH2F * MakeHistoOutliers(Float_t delta=4, Float_t fraction=0.7, Int_t mode=0);
55
56   AliTPCCalROC * LocalFit(Int_t rowRadius, Int_t padRadius, AliTPCCalROC* ROCoutliers = 0, Bool_t robust = kFALSE);
57   
58   
59   static void Test();
60  protected:
61   
62   Double_t GetNeighbourhoodValue(TLinearFitter* fitterQ, Int_t row, Int_t pad, Int_t rRadius, Int_t pRadius, AliTPCCalROC* ROCoutliers, Bool_t robust);
63   void GetNeighbourhood(TArrayI* &rowArray, TArrayI* &padArray, Int_t row, Int_t pad, Int_t rRadius, Int_t pRadius);
64   
65   
66   UInt_t     fSector;          // sector number
67   UInt_t     fNChannels;       // number of channels
68   UInt_t     fNRows;           // number of rows
69   const UInt_t* fIndexes;      //!indexes
70   Float_t  *fData;            //[fNChannels] Data
71   ClassDef(AliTPCCalROC,1)    //  TPC ROC calibration class
72
73 };
74
75 #endif