]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/SPECTRA/LambdaK0PbPb/FitControl.h
Fitting code from Lee and updated scripts
[u/mrichter/AliRoot.git] / PWG2 / SPECTRA / LambdaK0PbPb / FitControl.h
1 #include "TMath.h"
2
3 class FitControl : public TObject {
4  protected:
5   Double_t mPtUpper; // Upper and lower pt limits
6   Int_t mBinUpper; // Upper and lower bin limits
7   Int_t mBinLower;
8   Int_t mPolyOrder; // Polynomial order - 0=constant, 1=linear, 2=quadratic, others not supported
9   Int_t mRebinFactor; // Rebinning factor
10   Double_t mMinMass; // Min and max to use as fitting range
11   Double_t mMaxMass;
12
13  public:
14   // This data member moved here due to use in sorting functions
15   Double_t mPtLower;
16
17   FitControl(){
18     mPtUpper=0.0; mPtLower=0.0; mPolyOrder = 2; mRebinFactor = 1;
19     mBinLower=0;mBinUpper=0;
20   };
21   FitControl(Float_t ptLo, Float_t ptUp, Int_t polyO, Int_t RBF){
22     mPtUpper=ptUp; mPtLower=ptLo; mPolyOrder = polyO; mRebinFactor = RBF;
23     mBinLower=0;mBinUpper=0;
24   };
25   FitControl(Double_t ptLo, Double_t ptUp, Int_t polyO, Int_t RBF){
26     mPtUpper=ptUp; mPtLower=ptLo; mPolyOrder = polyO; mRebinFactor = RBF;
27     mMinMass=1.085; mMaxMass=1.17;
28     mBinLower=0;mBinUpper=0;
29   };
30   FitControl(Double_t ptLo, Double_t ptUp, Int_t polyO, Int_t RBF, Double_t m1, Double_t m2){
31     mPtUpper=ptUp; mPtLower=ptLo; mPolyOrder = polyO; mRebinFactor = RBF;
32     mMinMass=m1; mMaxMass=m2;
33     mBinLower=0;mBinUpper=0;
34   };
35   FitControl(Int_t BinLo, Int_t BinUp, Int_t polyO, Int_t RBF){
36     mPtUpper=0.0; mPtLower=0.0; mPolyOrder = polyO; mRebinFactor = RBF;
37     mBinLower=BinLo;mBinUpper=BinUp;
38   };
39   ~FitControl(){;};
40
41   // Functions for sorting
42   Bool_t IsEqual(const TObject *obj) const {return mPtLower == ((FitControl*)obj)->mPtLower;}; //Not sure whether this one reqd for sorting
43   Bool_t IsSortable() const { return kTRUE; };
44   Int_t Compare(const TObject *obj) const
45     {
46     if ( mPtLower < ((FitControl*)obj)->mPtLower) return -1;
47     if (mPtLower > ((FitControl*)obj)->mPtLower) return 1;
48     return 0;
49   };
50
51   Int_t RebinFactor(){return mRebinFactor;};
52   Int_t BinLower(){return mBinLower;};
53   Int_t BinUpper(){return mBinUpper;};
54   Double_t PtUpper(){return mPtUpper;};
55   Double_t PtLower(){return mPtLower;};
56   Double_t MinMass(){return mMinMass;};
57   Double_t MaxMass(){return mMaxMass;};
58
59
60   Bool_t FixedQuad(){if(mPolyOrder < 2) {return kTRUE;}
61   else {return kFALSE;};
62   };
63   Bool_t FixedLin(){if(mPolyOrder < 1) {return kTRUE;}
64   else {return kFALSE;};
65   };
66   Double_t DPt(){return mPtUpper-mPtLower;};
67   void CalcBinLimits(Int_t BinsPerGeV){
68     mBinLower = TMath::Nint(1.+mPtLower*BinsPerGeV);
69     mBinUpper = TMath::Nint(mPtUpper*BinsPerGeV);
70   };
71
72   ClassDef(FitControl,1);
73 };