]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/STRANGENESS/LambdaK0PbPb/MainStreamAnalysis/AliMassFitControl.h
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / STRANGENESS / LambdaK0PbPb / MainStreamAnalysis / AliMassFitControl.h
1 #ifndef ALIMASSFITCONTROL_H
2 #define ALIMASSFITCONTROL_H
3 #include "TMath.h"
4
5 //-------------------------------------------------------------------------
6 // AliMassFitControl
7 // This class controls the parameters (fit range, polynomial order, rebinning fact)
8 // for fitting an invariant mass histogram.
9 // A typical use is for fitting a number of pt bins projected from a 2D pt-M histo.
10 //-------------------------------------------------------------------------
11 class AliMassFitControl : public TObject {
12  public:
13   AliMassFitControl(){
14     fPtUpper=0.0; fPtLower=0.0; fPolyOrder = 2; fRebinFactor = 1;
15     fBinLower=0;fBinUpper=0;
16   };
17   AliMassFitControl(Float_t ptLo, Float_t ptUp, Int_t polyO, Int_t RBF){
18     fPtUpper=ptUp; fPtLower=ptLo; fPolyOrder = polyO; fRebinFactor = RBF;
19     fBinLower=0;fBinUpper=0;
20   };
21   AliMassFitControl(Double_t ptLo, Double_t ptUp, Int_t polyO, Int_t RBF){
22     fPtUpper=ptUp; fPtLower=ptLo; fPolyOrder = polyO; fRebinFactor = RBF;
23     fMinMass=1.085; fMaxMass=1.17;
24     fBinLower=0;fBinUpper=0;
25   };
26   ///// the minimum value of parameter have to be zero with this constructor
27   AliMassFitControl(Double_t ptLo, Double_t ptUp, Int_t polyO, Int_t RBF, Double_t m1, Double_t m2){
28     fPtUpper=ptUp; fPtLower=ptLo; fPolyOrder = polyO; fRebinFactor = RBF;
29     fMinMass=m1; fMaxMass=m2; fhistMin = 0;
30     fBinLower=0;fBinUpper=0;
31   };
32   ///// the minimum value of (QA) parameter don't have to be zero. can by arbitrary value "histMin"
33   AliMassFitControl(Double_t histMin, Double_t ptLo, Double_t ptUp, Int_t polyO, Int_t RBF, Double_t m1, Double_t m2){
34     fhistMin = histMin; fPtUpper=ptUp; fPtLower=ptLo; fPolyOrder = polyO; fRebinFactor = RBF;
35     fMinMass=m1; fMaxMass=m2;
36     fBinLower=0;fBinUpper=0;
37   };
38   AliMassFitControl(Int_t BinLo, Int_t BinUp, Int_t polyO, Int_t RBF){
39     fPtUpper=0.0; fPtLower=0.0; fPolyOrder = polyO; fRebinFactor = RBF;
40     fBinLower=BinLo;fBinUpper=BinUp;
41   };
42   ~AliMassFitControl(){;};
43
44   // Functions for sorting
45   Bool_t IsEqual(const TObject *obj) const {return fPtLower == ((AliMassFitControl*)obj)->fPtLower;}; //Not sure whether this one reqd for sorting
46   Bool_t IsSortable() const { return kTRUE; };
47   Int_t Compare(const TObject *obj) const
48     {
49     if ( fPtLower < ((AliMassFitControl*)obj)->fPtLower) return -1;
50     if (fPtLower > ((AliMassFitControl*)obj)->fPtLower) return 1;
51     return 0;
52   };
53
54   Int_t RebinFactor() const {return fRebinFactor;};
55   Int_t BinLower() const {return fBinLower;};
56   Int_t BinUpper() const {return fBinUpper;};
57   Double_t PtUpper() const {return fPtUpper;};
58   Double_t PtLower() const {return fPtLower;};
59   Double_t MinMass() const {return fMinMass;};
60   Double_t MaxMass() const {return fMaxMass;};
61
62
63   Bool_t FixedQuad() const {if(fPolyOrder < 2) {return kTRUE;}
64   else {return kFALSE;};
65   };
66   Bool_t FixedLin() const {if(fPolyOrder < 1) {return kTRUE;}
67   else {return kFALSE;};
68   };
69   Double_t DPt() const {return fPtUpper-fPtLower;};
70   void CalcBinLimits(Int_t BinsPerGeV){
71 //    fBinLower = TMath::Nint(1.+fPtLower*BinsPerGeV); //this assumes that histogram allways start from zero. not true for QA
72     fBinLower = TMath::Nint(1.+(fPtLower-fhistMin)*BinsPerGeV); //this is valid if hist. doesn't start from zero but from number: histMin
73     fBinUpper = TMath::Nint((fPtUpper-fhistMin)*BinsPerGeV); //this is valid if hist. doesn't start from zero but from number: histMin    
74   };
75
76 protected:
77   Double_t fhistMin; //value of the first bin for QA parameter
78   Double_t fPtUpper; // Upper pt limit
79   Double_t fPtLower; // Lower pt limit. This was previously public due to use in sorting functions but it seems OK here.
80   Int_t fBinUpper; // Upper bin limit
81   Int_t fBinLower; // Lower bin limit
82   Int_t fPolyOrder; // Polynomial order - 0=constant, 1=linear, 2=quadratic, others not supported
83   Int_t fRebinFactor; // Rebinning factor
84   Double_t fMinMass; // Minimum to use as fitting range
85   Double_t fMaxMass; // Maximum to use as fitting range
86     
87   
88   ClassDef(AliMassFitControl,1);
89 };
90 #endif