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 */
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 ///////////////////////////////////////////////////////////////////////
16 #include "AliITSPIDResponse.h"
20 class AliITSsadEdxFitter : public TObject {
24 AliITSsadEdxFitter(Bool_t isMC);
25 virtual ~AliITSsadEdxFitter(){
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);
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];
39 Double_t GetFitParError(Int_t nparam) const {
40 if(nparam<9) return fFitParErrors[nparam];
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);
55 if(fITSpid) delete fITSpid;
56 fITSpid=new AliITSPIDResponse(kTRUE);
60 if(fITSpid) delete fITSpid;
61 fITSpid=new AliITSPIDResponse(kFALSE);
64 void SetInitializationOption(Char_t opt){
68 void SetUseLoglikelihoodFit(){
71 void SetUseChisquareFit(){
74 void SetUseMinuitImproveFit(){
78 void SetRangeStep1(Double_t dxlow=-0.2, Double_t dxup=0.3){
82 void SetRangeStep2(Double_t dxlow=-0.1, Double_t dxup=0.4){
86 void SetRangeStep3(Double_t dxlow=-0.1, Double_t dxup=2.5){
90 void SetRangeFinalStep(Double_t dxlow=-3.5, Double_t dxup=3.5){
94 void SetLimitsOnSigmaPion(Double_t smin=0.95, Double_t smax=1.05){
95 fLimitsOnSigmaPion[0]=smin;
96 fLimitsOnSigmaPion[1]=smax;
98 void SetLimitsOnSigmaKaon(Double_t smin=0.95, Double_t smax=1.05){
99 fLimitsOnSigmaKaon[0]=smin;
100 fLimitsOnSigmaKaon[1]=smax;
102 void SetLimitsOnSigmaProton(Double_t smin=0.95, Double_t smax=1.05){
103 fLimitsOnSigmaProton[0]=smin;
104 fLimitsOnSigmaProton[1]=smax;
106 void SetBinsUsedPion(Int_t bmin=2, Int_t bmax=14){
107 fBinsUsedPion[0]=bmin;
108 fBinsUsedPion[1]=bmax;
110 void SetBinsUsedKaon(Int_t bmin=7, Int_t bmax=12){
111 fBinsUsedKaon[0]=bmin;
112 fBinsUsedKaon[1]=bmax;
114 void SetBinsUsedProton(Int_t bmin=8, Int_t bmax=17){
115 fBinsUsedProton[0]=bmin;
116 fBinsUsedProton[1]=bmax;
119 void PrintAll() const;
120 void PrintInitialValues() const;
121 void CalcResidual(TH1F *h,TF1 *fun,TGraph *gres) const;
122 Double_t GausPlusTail(const Double_t x, const Double_t mean, Double_t rms, Double_t c, Double_t slope, Double_t cut ) const;
123 Double_t GausOnBackground(const Double_t* x, const Double_t *par) const;
124 void DrawFitFunction(TF1 *fun) const;
127 AliITSsadEdxFitter(const AliITSsadEdxFitter& s);
128 AliITSsadEdxFitter& operator=(const AliITSsadEdxFitter& s);
130 Double_t fFitPars[9]; // array with fit parameters
131 Double_t fFitParErrors[9]; // array with fit parameter errors
132 Double_t fFitpar[3]; // array with fit parameters for sel. peak
133 Double_t fFitparErr[3]; // array with fit parameter errors for sel. peak
134 Double_t fRangeStep1[2]; // Range for Step1 (w.r.t pion peak)
135 Double_t fRangeStep2[2]; // Range for Step2 (w.r.t kaon/proton peak)
136 Double_t fRangeStep3[2]; // Range for Step3 (w.r.t proton/kaon peak)
137 Double_t fRangeStep4[2]; // Range for Last Fit
138 Double_t fLimitsOnSigmaPion[2]; // limits on sigma pions
139 Double_t fLimitsOnSigmaKaon[2]; // limits on sigma kaons
140 Double_t fLimitsOnSigmaProton[2]; // limits on sigma protons
142 Double_t fExpPionMean; // expected mean for pion peak
143 Double_t fExpKaonMean; // expected mean for kaon peak
144 Double_t fExpProtonMean; // expected mean for proton peak
145 Double_t fExpPionMeanRange; // expected range for pion peak mean
146 Double_t fExpKaonMeanRange; // expected range for kaon peak mean
147 Double_t fExpProtonMeanRange; // expected range for proton peak mean
148 Double_t fExpPionSigma; // expected sigma for pion peak
149 Double_t fExpKaonSigma; // expected sigma for kaon peak
150 Double_t fExpProtonSigma; // expected sigma for proton peak
151 Double_t fExpPionAmpl; // epxeted area under pion peak
153 Int_t fBinsUsedPion[2]; // limits on bins used pions
154 Int_t fBinsUsedKaon[2]; // limits on bins used kaons
155 Int_t fBinsUsedProton[2]; // limits on bins used protons
157 Bool_t fIsMC; // flag MC/data
158 Char_t fOptInit; // option for initialization
159 TString fFitOption; // option for fitting
160 AliITSPIDResponse* fITSpid; // ITS pid object
163 ClassDef(AliITSsadEdxFitter,4);