]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGPP/EVCHAR/AliCentralityGlauberFit.h
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGPP / EVCHAR / AliCentralityGlauberFit.h
1 #ifndef ALICENTRALITYGLAUBERFIT_H
2 #define ALICENTRALITYGLAUBERFIT_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6 /*   Origin: Alberica Toia, CERN, Alberica.Toia@cern.ch                   */
7
8 ///////////////////////////////////////////////////////////////////////////////
9 //                                                                           //
10 //  class to determine centrality percentiles from 1D distributions          // 
11 //                                                                           //
12 ///////////////////////////////////////////////////////////////////////////////
13
14 #include <vector>
15 #include <TObject.h>
16 #include <TString.h>
17
18 class TNtuple;
19 class TFile;
20
21 class AliCentralityGlauberFit : public TObject {
22
23  public:
24   
25   AliCentralityGlauberFit(const char * filename);
26   virtual ~AliCentralityGlauberFit() {}
27
28   void     AddHisto(TString name)      { fHistnames.push_back(name);  }
29   TH1F    *GetGlauberHist()            { return fGlauberHist;         } 
30   TH1F    *GetTempHist()               { return fTempHist;            } 
31   void     MakeFits();
32   void     MakeFitsMinuitNBD(Double_t alpha=-1, Double_t mu=-1, Double_t k=-1);
33   void     SetAncestorMode(Int_t f)  { fAncestor=f; }
34   void     SetFastFitMode(Int_t f)  { fFastFit=f; }
35   void     SetGlauberParam(Int_t Nmu, Double_t mulow, Double_t muhigh, Int_t Nk, Double_t klow, 
36                           Double_t khigh, Int_t Nalpha, Double_t alphalow, Double_t alphahigh); 
37   void     SetInputFile(TString filename)         { fInrootfilename = filename;   }
38   void     SetInputNtuple(TString ntuplename)     { fInntuplename   = ntuplename; }
39   void     SetAncFile(TString name)               { fAncfilename    = name;       }
40   void     SetNevents(Int_t f) { fNevents=f; }
41   void     SetNtrials(Int_t f) { fNtrials=f; }
42   void     SetOutputFile(TString filename)        { fOutrootfilename = filename;  }
43   void     SetOutputNtuple(TString ntuplename)    { fOutntuplename   = ntuplename;}
44   void     SetRangeToFit(Double_t multmin, Double_t multmax);
45   void     SetRangeToScale(Double_t scalemin);
46   void     SetRebin(Int_t f)  { fRebinFactor=f; }
47   void     UseAverage(Bool_t f)  { fUseAverage=f; }
48   void     UseChi2(Bool_t f)  { fUseChi2=f; }
49
50  private:
51   Int_t   fNmu;           // mu points
52   Double_t fMulow;        // mu low 
53   Double_t fMuhigh;       // mu high
54   Int_t   fNk;            // k points
55   Double_t fKlow;         // k low
56   Double_t fKhigh;        // k high
57   Int_t   fNalpha;        // alpha points
58   Double_t fAlphalow;     // alpha low
59   Double_t fAlphahigh;    // alpha high
60   Int_t   fRebinFactor;   // rebin factor
61   Double_t fScalemin;     // mult min where to scale
62   Double_t fMultmin;      // mult min
63   Double_t fMultmax;      // mult max
64   TNtuple *fGlauntuple;   // glauber ntuple
65   Float_t fNpart;         // number participants
66   Float_t fNcoll;         // number collisions
67   Float_t fB;             // impact parameter
68   Float_t fTaa;           // taa
69   Float_t fEffi;          // efficiency
70   TH1F   *fhEffi;         // efficiency histogram
71   TH1F  *fTempHist;       // Temporary pointer to data histo, to be used in minimization 
72   TH1F  *fGlauberHist;    // Glauber histogram
73   Int_t fFastFit;         // If 1 or 2 use cruder approximation to compute curve faster 1:NBD, 2:Gauss
74   Int_t fAncestor;        // If 1 use Npart**alpha, if 2 use alpha*Npart + (1-alpha)*Ncoll
75   TF1 * fNBD;             // NBD function
76   Bool_t fUseChi2;        // If true, use chi2
77   Bool_t fUseAverage;     // If true, use average
78   TH1F *fhAncestor;       // histo for the ancestor distribution
79   Int_t fNevents;         // Number of events to use in the glauber ntuple
80   Int_t fNtrials;         // Number of trials to use for the average
81
82   TString fInrootfilename;          // input root file
83   TString fInntuplename;            // input Gauber ntuple
84   TString fOutrootfilename;         // output root file
85   TString fOutntuplename;           // output Glauber ntuple
86   TString fAncfilename;             // ancestor file name
87   std::vector<TString> fHistnames;  // histogram names
88
89   Double_t  CalculateChi2(TH1F *hDATA, TH1F *thistGlau);
90   TH1F     *GetTriggerEfficiencyFunction(TH1F *hist1, TH1F *hist2);
91   Double_t  GetTriggerEfficiencyIntegral(TH1F *hist1, TH1F *hist2); 
92   TH1F     *GlauberHisto(Double_t mu, Double_t k, Double_t alpha, TH1F *hDATA, Bool_t save=kFALSE); 
93   TH1F     *MakeAncestor(Double_t alpha);
94   Double_t  NBD(Int_t n, Double_t mu, Double_t k) const;
95   TH1F     *NBDhist(Double_t mu, Double_t k);
96   TH1F     *NormalizeHisto(TString hdistributionName);
97   void      SaveHisto(TH1F *hist1,TH1F *hist2,TH1F *heffi, TFile *outrootfile);
98
99   static void     MinuitFcnNBD(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag);
100   static Double_t NBDFunc(const Double_t *p, const Double_t * x);
101
102   AliCentralityGlauberFit(const AliCentralityGlauberFit&);
103   AliCentralityGlauberFit &operator=(const AliCentralityGlauberFit&);
104
105   ClassDef(AliCentralityGlauberFit, 1)  
106 };
107 #endif