Line data Source code
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 : /// \class AliTPCCalROC
7 : /// \brief TPC calibration base class for one ROC
8 :
9 : #include <TObject.h>
10 : #include <TMath.h>
11 : #include <AliTPCROC.h>
12 : #include "TLinearFitter.h"
13 :
14 : class TH1F;
15 : class TH2F;
16 : class TArrayI;
17 : class TF1;
18 :
19 : //_____________________________________________________________________________
20 : class AliTPCCalROC : public TNamed {
21 :
22 : public:
23 : enum EStatType {kMean=0, kMedian=1, kRMS=2, kMinElement=3, kMaxElement=4};
24 : enum EPadType {kAll=0, kOROCmedium=1, kOROClong=2};
25 :
26 : AliTPCCalROC();
27 : AliTPCCalROC(UInt_t sector);
28 : AliTPCCalROC(const AliTPCCalROC &c);
29 : AliTPCCalROC &operator = (const AliTPCCalROC & param);
30 : virtual ~AliTPCCalROC();
31 : virtual void Print(Option_t* option="") const;
32 0 : UInt_t GetSector() const { return fSector;}
33 34776 : UInt_t GetNrows() const { return fNRows;};
34 3345840 : UInt_t GetNchannels() const { return fNChannels;};
35 0 : UInt_t GetNchannelsMedium() const { return (fSector<36)? 0: fkIndexes[64];};
36 0 : Bool_t IsInRange(UInt_t row, UInt_t pad) { return (row<fNRows)? (fkIndexes[row]+pad)<fNChannels:kFALSE;}
37 6759504 : UInt_t GetNPads(UInt_t row) const { return (row<fNRows)? AliTPCROC::Instance()->GetNPads(fSector,row):0;};
38 22331854433 : Float_t GetValue(UInt_t row, UInt_t pad) const { return ( (row<fNRows) && (fkIndexes[row]+pad)<fNChannels)? fData[fkIndexes[row]+pad]: 0; };
39 3345408 : Float_t GetValue(UInt_t channel) const { return fData[channel]; };
40 8374710 : void SetValue(UInt_t row, UInt_t pad, Float_t vd) { if ( row<fNRows && (fkIndexes[row]+pad)<fNChannels)fData[fkIndexes[row]+pad]= vd; }
41 0 : void SetValue(UInt_t channel, Float_t vd) {fData[channel]= vd; }
42 : void Reset();
43 : virtual void Draw(Option_t* option = "");
44 : //
45 : Bool_t MedianFilter(Int_t deltaRow, Int_t deltaPad, AliTPCCalROC*outlierROC=0, Bool_t doEdge=kTRUE);
46 : Bool_t LTMFilter(Int_t deltaRow, Int_t deltaPad, Float_t fraction, Int_t type, AliTPCCalROC*outlierROC=0, Bool_t doEdge=kTRUE);
47 : Bool_t Convolute(Double_t sigmaPad, Double_t sigmaRow, AliTPCCalROC*outlierPad=0, TF1 *fpad=0, TF1 *frow=0 );
48 : //
49 : // algebra
50 : void Add(Float_t c1); // add c1 to each channel of the ROC
51 : void Multiply(Float_t c1); // multiply each channel of the ROC with c1
52 : void Add(const AliTPCCalROC * roc, Double_t c1 = 1); // multiply AliTPCCalROC roc by c1 and add each channel to the coresponing channel in the ROC
53 : void Multiply(const AliTPCCalROC * roc); // multiply each channel of the ROC with the coresponding channel of 'roc'
54 : void Divide(const AliTPCCalROC * roc); // divide each channel of the ROC by the coresponding value of 'roc'
55 : // statistic
56 : //
57 : Double_t GetStats(EStatType statType, AliTPCCalROC *const outlierROC = 0, EPadType padType=kAll) const;
58 : Double_t GetMean (AliTPCCalROC *const outlierROC = 0, EPadType padType=kAll) const;
59 : Double_t GetRMS (AliTPCCalROC *const outlierROC = 0, EPadType padType=kAll) const;
60 : Double_t GetMedian (AliTPCCalROC *const outlierROC = 0, EPadType padType=kAll) const;
61 : Double_t GetMinElement(AliTPCCalROC *const outlierROC = 0, EPadType padType=kAll) const;
62 : Double_t GetMaxElement(AliTPCCalROC *const outlierROC = 0, EPadType padType=kAll) const;
63 : Double_t GetLTM (Double_t *const sigma=0, Double_t fraction=0.9, AliTPCCalROC *const outlierROC = 0, EPadType padType=kAll);
64 :
65 : TH1F * MakeHisto1D(Float_t min=4, Float_t max=-4, Int_t type=0);
66 : TH2F * MakeHisto2D(Float_t min=4, Float_t max=-4, Int_t type=0);
67 : TH2F * MakeHistoOutliers(Float_t delta=4, Float_t fraction=0.7, Int_t mode=0);
68 :
69 : AliTPCCalROC * LocalFit(Int_t rowRadius, Int_t padRadius, AliTPCCalROC* ROCoutliers = 0, Bool_t robust = kFALSE, Double_t chi2Threshold = 5, Double_t robustFraction = 0.7);
70 : void GlobalFit(const AliTPCCalROC* ROCoutliers, Bool_t robust, TVectorD &fitParam, TMatrixD &covMatrix, Float_t & chi2, Int_t fitType = 1, Double_t chi2Threshold = 5, Double_t robustFraction = 0.7, Double_t err=1, EPadType padType=kAll);
71 :
72 : static AliTPCCalROC* CreateGlobalFitCalROC(TVectorD &fitParam, Int_t sector, EPadType padType=kAll, AliTPCCalROC *oldTPCCalROC = 0);
73 :
74 : static void Test();
75 : protected:
76 :
77 : Double_t GetNeighbourhoodValue(TLinearFitter* fitterQ, Int_t row, Int_t pad, Int_t rRadius, Int_t pRadius, AliTPCCalROC *const ROCoutliers, Bool_t robust, Double_t chi2Threshold, Double_t robustFraction);
78 : void GetNeighbourhood(TArrayI* &rowArray, TArrayI* &padArray, Int_t row, Int_t pad, Int_t rRadius, Int_t pRadius);
79 :
80 : UInt_t fSector; ///< sector number
81 : UInt_t fNChannels; ///< number of channels
82 : UInt_t fNRows; ///< number of rows
83 : const UInt_t* fkIndexes; //!<! indexes
84 : /// Data
85 : Float_t *fData; //[fNChannels]
86 :
87 : /// \cond CLASSIMP
88 9822 : ClassDef(AliTPCCalROC,2) // TPC ROC calibration class
89 : /// \endcond
90 :
91 : };
92 :
93 : #endif
|