Fix for FMD DA
[u/mrichter/AliRoot.git] / RAW / AliCaloFastAltroFitv0.h
CommitLineData
a65a7e70 1//_________________________________________________________________________
2// Procedure of fast altro fitting
3//
4//*-- Author: Aleksei Pavlinov; IHEP, Protvino, Russia & WSU, Detroit, USA
5
6#ifndef ALICALOFASTALTROFITV0_H
7#define ALICALOFASTALTROFITV0_H
8/* Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
9 * See cxx source for full Copyright notice */
10/* $Id: $ */
11
12/* History of svn commits
13 * $Log$
14 */
15
16#include <TNamed.h>
17// --- ROOT system ---
18class TCanvas;
19class TVirtualPad;
20class TF1;
21class TH1F;
22
23class AliCaloFastAltroFitv0 : public TNamed {
24
25public:
26
27 AliCaloFastAltroFitv0();
28 AliCaloFastAltroFitv0(const char* name, const char* title,
29 const Double_t sig=1.3, const Double_t tau=2.35, const Double_t n=2.);
30 virtual ~AliCaloFastAltroFitv0();
31
32 virtual void FastFit(Int_t* t, Int_t* y, Int_t nPoints, Double_t sig, Double_t tau,
33 Double_t n, Double_t ped, Double_t tMax);
34
35 void FastFit(TH1F* h, Double_t sig, Double_t tau,
36 Double_t n, Double_t ped, Double_t tMax);
37
38 void Reset();
39 void SetSig(const Double_t sig) {fSig = sig;}
40 void SetTau(const Double_t tau) {fTau = tau;}
41 void SetN(const Double_t n) {fN = n;}
42 void SetParameters(const Double_t sig, const Double_t tau, const Double_t n)
43 {fSig = sig; fTau = tau; fN = n;}
44
45 Double_t GetSig() const {return fSig;}
46 Double_t GetTau() const {return fTau;}
47 Double_t GetN() const {return fN;}
48 Double_t GetPed() const {return fPed;}
49
50 Double_t GetEnergy() const {return fAmp;}
51 Double_t GetAmp() const {return GetEnergy();}
52 Double_t GetAmpErr() const {return fAmpErr;}
53 Double_t GetTime() const {return fT0;}
54 Double_t GetT0() const {return GetTime();}
55 Double_t GetT0Err() const {return fT0Err;}
56 Double_t GetChi2() const {return fChi2;}
57 Int_t GetNDF() const {return fNDF;}
58 Int_t GetNfit() const {return fNfit;}
59 Int_t GetNoFit() const {return fNoFit;}
60
61 void GetFitResult(Double_t &amp, Double_t &eamp, Double_t &t0, Double_t &et0,
62 Double_t &chi2,Int_t &ndf) const;
63 void GetFittedPoints(Int_t &nfit, Double_t* ar[2]) const;
64
65 // Drawing for QA
66 TCanvas* DrawFastFunction(); // *MENU*
67 static Double_t StdResponseFunction(const Double_t *x, const Double_t *par);
68
69 static void CutRightPart(Int_t *t,Int_t *y,Int_t nPoints, Double_t tMax, Int_t &ii);
70 static void DeductPedestal(Int_t* t, Int_t* y, Int_t nPointsIn, Double_t ped, Double_t tau,
71 Double_t* tn, Double_t* yn, Int_t &nPointsOut);
72
73 static void FastFit(const Double_t* t, const Double_t* y, const Int_t nPoints,
74 const Double_t sig, const Double_t tau,
75 Double_t &amp, Double_t &eamp, Double_t &t0, Double_t &et0, Double_t &chi2);
76 static Bool_t QuadraticRoots(const Double_t a, const Double_t b, const Double_t c,
77 Double_t &x1, Double_t &x2);
78 static void Amplitude(const Double_t* t, const Double_t* y, const Int_t nPoints,
79 const Double_t sig, const Double_t tau,
80 Double_t t0, Double_t &amp, Double_t &chi2);
81 static void CalculateParsErrors(const Double_t* t, const Double_t* y, const Int_t nPoints,
82 const Double_t sig, const Double_t tau,
83 Double_t &amp, Double_t &t0, Double_t &eamp, Double_t &et0);
84protected:
85 Double_t fSig; // error in amplitude - used in chi2 calculation
86 Double_t fTau; // first fixed parameter od fitting function (should be - filter time response
87 Double_t fN; // second fixed parameter od fitting function (should be positive)
88 Double_t fPed; // pedestal
89
90 Double_t fAmp; // amplitude
91 Double_t fAmpErr; // amplitude error
92 Double_t fT0; // time
93 Double_t fT0Err; // time error
94 Double_t fChi2; // chi square
95 Int_t fNDF; // number degree of freedom
96 Int_t fNoFit; // no solution for square equation
97
98 // Working variable
99 Int_t fNfit; //! number points for fit
100 Double_t* fTfit; //! points for fit after selection - time bins
101 Double_t* fAmpfit; //! - amplitudes
102 //
103 TF1* fStdFun; //! function for drawing
104
105private:
106 AliCaloFastAltroFitv0(const AliCaloFastAltroFitv0 &obj);
107 AliCaloFastAltroFitv0& operator= (const AliCaloFastAltroFitv0 &obj);
108
109 ClassDef(AliCaloFastAltroFitv0,1) // Class for fast altro fitting
110};
111
112#endif // ALICALOFASTALTROFITV0_H