Merge with TRDdev.2.0
[u/mrichter/AliRoot.git] / TRD / AliTRDCalibraVdriftLinearFit.h
1 #ifndef ALITRDCALIBRAVDRIFTLINEARFIT_H
2 #define ALITRDCALIBRAVDRIFTLINEARFIT_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 /* $Id$ */
8
9 ///////////////////////////////////////////////////////////////////////////////
10 //                                                                           //
11 //  TRD calibration class for online calibration                             //
12 //                                                                           //
13 ///////////////////////////////////////////////////////////////////////////////
14
15 //#include "TObjArray.h"
16 #include "TObject.h"
17
18 //class TVectorD;
19 class TObjArray;
20 class TH2S;
21 class TH2;
22 class TTreeSRedirector;
23 class TString;
24 class TGraphErrors;
25 class TLinearFitter;
26 class TTreeSRedirector;
27
28 class AliTRDCalibraVdriftLinearFit : public TObject {
29
30  public:
31
32   AliTRDCalibraVdriftLinearFit();
33   AliTRDCalibraVdriftLinearFit(const AliTRDCalibraVdriftLinearFit &ped);
34   AliTRDCalibraVdriftLinearFit(const TObjArray &obja);
35   virtual ~AliTRDCalibraVdriftLinearFit();
36   virtual Long64_t Merge(const TCollection* list);
37   virtual void Copy(TObject &c) const;
38
39   AliTRDCalibraVdriftLinearFit& operator = (const  AliTRDCalibraVdriftLinearFit &source);
40
41   void            Update(Int_t detector, Float_t tnp, Float_t pars1);
42   void            FillPEArray();
43   void            FillPEArray2();
44   void            SetNameCalibUsed(const char*name)          { fNameCalibUsed = name;};
45   const char*     GetNameCalibUsed() const                   { return fNameCalibUsed;};
46   void            Add(const AliTRDCalibraVdriftLinearFit *ped);
47   TH2S           *GetLinearFitterHisto(Int_t detector, Bool_t force=kFALSE);
48   TH2S           *GetLinearFitterHistoForce(Int_t detector);
49   TH2S           *GetLinearFitterHistoNoForce(Int_t detector) const   { return (TH2S*)fLinearFitterHistoArray.UncheckedAt(detector);};
50   Bool_t          GetParam(Int_t detector, TVectorD *param);
51   Bool_t          GetError(Int_t detector, TVectorD *error);
52   Int_t           GetMinNumberOfPointsForFit() const         { return fMinNpointsFit;};
53   TH2S           *AddAll();
54   TGraphErrors   *DrawMS(const TH2 *const h2, Int_t &nEntries);
55
56   TObjArray      *GetPArray()                    { return &fLinearFitterPArray;       };
57   TObjArray      *GetEArray()                    { return &fLinearFitterEArray;       };
58   TObjArray       GetHistoArray() const          { return fLinearFitterHistoArray;    };
59   void            SetRobustFit(Bool_t robustFit) { fRobustFit = robustFit;            };
60   void            SetMinNumberOfPointsForFit(Int_t minNpointsFit) { fMinNpointsFit = minNpointsFit;};
61
62   void            SetNbBindx(Short_t nbBindx)    { fNbBindx = nbBindx;                };
63   void            SetNbBindy(Short_t nbBindy)    { fNbBindy = nbBindy;                }
64   void            SetRangedx(Double_t rangedx)   { fRangedx = rangedx;                };
65   void            SetRangedy(Double_t rangedy)   { fRangedy = rangedy;                };
66
67   // Debug
68   void     SetDebugLevel(Short_t level)          { fDebugLevel = level;               };
69   void     SetSeeDetector(Int_t seeDetector)     { fSeeDetector = seeDetector;        };
70
71 private:
72   
73
74   Int_t           fVersion;                 // Version of the object
75   TString         fNameCalibUsed;           // Info of the version, subversion, firstrun of the calib used
76
77   TObjArray       fLinearFitterHistoArray;  // TObjArray of histo2D for debugging Linear Fitters
78   TObjArray       fLinearFitterPArray;      // Array of result parameters from linear fitters for the detectors
79   TObjArray       fLinearFitterEArray;      // Array of result errors from linear fitters for the detectors
80   Bool_t          fRobustFit;               // Robust fit or not
81   Int_t           fMinNpointsFit;           // Min number of points for the fit  
82
83   Short_t         fNbBindx;                 // Nb of bin in x
84   Short_t         fNbBindy;                 // Nb of bin in y
85   Double_t        fRangedx;                 // Range in x
86   Double_t        fRangedy;                 // Range in y
87   
88
89  //For debugging
90   TTreeSRedirector *fDebugStreamer;         //!Debug streamer
91   Short_t           fDebugLevel;            // Flag for debugging
92   Int_t             fSeeDetector;           // Detector to see
93  
94   ClassDef(AliTRDCalibraVdriftLinearFit,5)  // Online Vdrift calibration
95
96 };
97
98
99
100 #endif
101