Added option for initialization of peak position (Francesco) + new parameterization...
[u/mrichter/AliRoot.git] / PWG2 / SPECTRA / AliITSsadEdxFitter.h
... / ...
CommitLineData
1#ifndef ALIITSSADEDXFITTER_H
2#define ALIITSSADEDXFITTER_H
3/* Copyright(c) 2007-2011, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7
8///////////////////////////////////////////////////////////////////////
9// Class with the fits algorithms to be used in the identified //
10// spectra analysis using the ITS in stand-alone mode //
11// Author: E.Biolcati, biolcati@to.infn.it //
12// F.Prino, prino@to.infn.it //
13///////////////////////////////////////////////////////////////////////
14
15#include <TObject.h>
16#include "AliITSPIDResponse.h"
17
18class TGraph;
19
20class AliITSsadEdxFitter : public TObject {
21
22 public:
23 AliITSsadEdxFitter();
24 AliITSsadEdxFitter(Bool_t isMC);
25 virtual ~AliITSsadEdxFitter(){
26 delete fITSpid;
27 };
28
29 Double_t CalcSigma(Int_t code,Float_t x) const;
30 Int_t InitializeMeanPosParam(Int_t code,Float_t x);
31 Int_t InitializeMeanPosBB(Int_t code,Float_t x);
32 void Initialize(TH1F* h,Int_t code,Int_t bin);
33
34 void GetFitPar(Double_t *fitpar, Double_t *fitparerr) const;
35 Double_t GetFitPar(Int_t nparam) const {
36 if(nparam<9) return fFitPars[nparam];
37 return -1.;
38 }
39 Double_t GetFitParError(Int_t nparam) const {
40 if(nparam<9) return fFitParErrors[nparam];
41 return -1.;
42 }
43
44 void DoFitTail(TH1F *h, Int_t bin, Int_t code);
45 void DoFit(TH1F *h, Int_t bin, Int_t code, TGraph *gres);
46 void DoFitProton(TH1F *h, Int_t bin, Int_t code, TGraph *gres);
47 void DoFitOnePeak(TH1F *h, Int_t bin, Int_t signedcode);
48 void DoFitProtonFirst(TH1F *h, Int_t bin, Int_t signedcode, TGraph *gres);
49 void FillHisto(TH1F *hsps, Int_t bin, Float_t binsize, Int_t code);
50 void FillHistoMC(TH1F *hsps, Int_t bin, Int_t code, TH1F *h);
51 Bool_t IsGoodBin(Int_t bin,Int_t code);
52
53 void SetMCConfig(){
54 fIsMC=kTRUE;
55 if(fITSpid) delete fITSpid;
56 fITSpid=new AliITSPIDResponse(kTRUE);
57 }
58 void SetDataConfig(){
59 fIsMC=kFALSE;
60 if(fITSpid) delete fITSpid;
61 fITSpid=new AliITSPIDResponse(kFALSE);
62 }
63
64 void SetInitializationOption(Char_t opt){
65 fOptInit=opt;
66 }
67
68 void SetRangeStep1(Double_t dxlow=-0.2, Double_t dxup=0.3){
69 fRangeStep1[0]=dxlow;
70 fRangeStep1[1]=dxup;
71 }
72 void SetRangeStep2(Double_t dxlow=-0.1, Double_t dxup=0.4){
73 fRangeStep2[0]=dxlow;
74 fRangeStep2[1]=dxup;
75 }
76 void SetRangeStep3(Double_t dxlow=-0.1, Double_t dxup=2.5){
77 fRangeStep3[0]=dxlow;
78 fRangeStep3[1]=dxup;
79 }
80 void SetRangeFinalStep(Double_t dxlow=-3.5, Double_t dxup=3.5){
81 fRangeStep4[0]=dxlow;
82 fRangeStep4[1]=dxup;
83 }
84 void SetLimitsOnSigmaPion(Double_t smin=0.95, Double_t smax=1.05){
85 fLimitsOnSigmaPion[0]=smin;
86 fLimitsOnSigmaPion[1]=smax;
87 }
88 void SetLimitsOnSigmaKaon(Double_t smin=0.95, Double_t smax=1.05){
89 fLimitsOnSigmaKaon[0]=smin;
90 fLimitsOnSigmaKaon[1]=smax;
91 }
92 void SetLimitsOnSigmaProton(Double_t smin=0.95, Double_t smax=1.05){
93 fLimitsOnSigmaProton[0]=smin;
94 fLimitsOnSigmaProton[1]=smax;
95 }
96 void SetBinsUsedPion(Int_t bmin=2, Int_t bmax=14){
97 fBinsUsedPion[0]=bmin;
98 fBinsUsedPion[1]=bmax;
99 }
100 void SetBinsUsedKaon(Int_t bmin=7, Int_t bmax=12){
101 fBinsUsedKaon[0]=bmin;
102 fBinsUsedKaon[1]=bmax;
103 }
104 void SetBinsUsedProton(Int_t bmin=8, Int_t bmax=17){
105 fBinsUsedProton[0]=bmin;
106 fBinsUsedProton[1]=bmax;
107 }
108
109 void PrintAll() const;
110 void PrintInitialValues() const;
111 void CalcResidual(TH1F *h,TF1 *fun,TGraph *gres) const;
112 Double_t GausPlusTail(const Double_t x, const Double_t mean, Double_t rms, Double_t c, Double_t slope, Double_t cut ) const;
113 Double_t GausOnBackground(const Double_t* x, const Double_t *par) const;
114 void DrawFitFunction(TF1 *fun) const;
115
116 private:
117 AliITSsadEdxFitter(const AliITSsadEdxFitter& s);
118 AliITSsadEdxFitter& operator=(const AliITSsadEdxFitter& s);
119
120 Double_t fFitPars[9]; // array with fit parameters
121 Double_t fFitParErrors[9]; // array with fit parameter errors
122 Double_t fFitpar[3]; // array with fit parameters for sel. peak
123 Double_t fFitparErr[3]; // array with fit parameter errors for sel. peak
124 Double_t fRangeStep1[2]; // Range for Step1 (w.r.t pion peak)
125 Double_t fRangeStep2[2]; // Range for Step2 (w.r.t kaon/proton peak)
126 Double_t fRangeStep3[2]; // Range for Step3 (w.r.t proton/kaon peak)
127 Double_t fRangeStep4[2]; // Range for Last Fit
128 Double_t fLimitsOnSigmaPion[2]; // limits on sigma pions
129 Double_t fLimitsOnSigmaKaon[2]; // limits on sigma kaons
130 Double_t fLimitsOnSigmaProton[2]; // limits on sigma protons
131
132 Double_t fExpPionMean; // expected mean for pion peak
133 Double_t fExpKaonMean; // expected mean for kaon peak
134 Double_t fExpProtonMean; // expected mean for proton peak
135 Double_t fExpPionMeanRange; // expected range for pion peak mean
136 Double_t fExpKaonMeanRange; // expected range for kaon peak mean
137 Double_t fExpProtonMeanRange; // expected range for proton peak mean
138 Double_t fExpPionSigma; // expected sigma for pion peak
139 Double_t fExpKaonSigma; // expected sigma for kaon peak
140 Double_t fExpProtonSigma; // expected sigma for proton peak
141 Double_t fExpPionAmpl; // epxeted area under pion peak
142
143 Int_t fBinsUsedPion[2]; // limits on bins used pions
144 Int_t fBinsUsedKaon[2]; // limits on bins used kaons
145 Int_t fBinsUsedProton[2]; // limits on bins used protons
146
147 Bool_t fIsMC; // flag MC/data
148 Char_t fOptInit; // option for initialization
149 AliITSPIDResponse* fITSpid; // ITS pid object
150
151
152 ClassDef(AliITSsadEdxFitter,4);
153};
154
155#endif
156