]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGPP/EVCHAR/GlauberSNM/makeCentralityFit.C
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGPP / EVCHAR / GlauberSNM / makeCentralityFit.C
CommitLineData
1665860d 1#if !defined(__CINT__) || defined(__MAKECINT__)
2
3#include <cstdlib>
4#include <stdio.h>
5#include <stdlib.h>
6#include <TROOT.h>
7#include <Riostream.h>
8#include <TSystem.h>
9#include <TClassTable.h>
10#include <TStyle.h>
11#include <TMath.h>
12#include <TFile.h>
13#include <TCanvas.h>
14#include <TPad.h>
15#include <TH1.h>
16#include <TH2.h>
17#include <TH1F.h>
18#include <TH1D.h>
19#include <TH2F.h>
20#include <TProfile.h>
21#include <TLine.h>
22#include <TNtuple.h>
23#include <TLatex.h>
24#include <TGraphErrors.h>
25#include "AliCentralityGlauberFit.h"
26
27#endif
28
29void makeCentralityFit(const char * run="188359", const char *system = "ZNA", int Rebin=1, int Nevt=1e6)
704dfdbd 30{
31 //load libraries
32 gSystem->SetBuildDir("/tmp/");
33 gSystem->Load("libCore.so");
34 gSystem->Load("libTree.so");
35 gSystem->Load("libGeom.so");
36 gSystem->Load("libVMC.so");
37 gSystem->Load("libPhysics.so");
38 gSystem->Load("libSTEERBase.so");
39 gROOT->ProcessLine(".include $ALICE_ROOT/include");
40 gROOT->LoadMacro("AliCentralityGlauberFit.cxx+");
41
42 const char *finnameGlau ="GlauberMC_pPb_ntuple_sigma70_mind4_r662_a546_Rpro6.root";
1665860d 43 char histname[8];
44
45 if((strncmp(system,"ZNA",3))==0){
46 printf("\n Glauber fit on ZNA spectrum\n\n");
47 sprintf(histname,"hZNA");
48 }
49 else if((strncmp (system,"ZNs",3)) == 0){
50 printf("\n Glauber fit on ZNA spectrum subtracting ZNC contribution (~SD)\n\n");
51 sprintf(histname,"hZPA");
52 }
53 else if((strncmp (system,"ZPA",3)) == 0){
54 printf("\n Glauber fit on ZPA spectrum\n\n");
55 sprintf(histname,"hZPA");
56 }
57
704dfdbd 58 TString finname = Form("Histos%s.root",run);
59 TString foutname = Form("%s_fit_%s.root",system,run);
60 TString foutnameGlau = Form("%s_ntuple_%s.root",system,run);
61
704dfdbd 62
704dfdbd 63 AliCentralityGlauberFit *mPM = new AliCentralityGlauberFit(finnameGlau);
64 mPM->SetInputFile(finname);
65 mPM->SetInputNtuple(finnameGlau);
66 mPM->SetOutputFile(foutname);
67 mPM->SetOutputNtuple(foutnameGlau);
68 mPM->AddHisto(histname);
69
70 mPM->SetRebin(Rebin);
71 mPM->SetNevents(Nevt);
72 mPM->UseChi2(kTRUE); // If TRUE minimize Chi2
73
1665860d 74 if (strncmp(system,"ZNA",3) == 0) {
75 mPM->SetIsZN();
76 mPM->SetRangeToFit(1., 300.);
77 mPM->SetRangeToScale(0);
78 mPM->SetGlauberParam(1,0.,1., 1,0.96,1., 2,0.22,0.25, 1,0.65,0.7, 1,0.56,0.585);
704dfdbd 79 }
1665860d 80 else if (strncmp(system,"ZPA",3) == 0) {
81 mPM->SetIsZP();
82 mPM->SetRangeToFit(1., 25.);
704dfdbd 83 mPM->SetRangeToScale(1.);
1665860d 84 mPM->SetGlauberParam(1,0.0,1., 1,0.6,1, 1,0.25,0.3, 1,0.65,0.8, 1,0.58,0.59);
704dfdbd 85 }
86 mPM->MakeFits();
87
1665860d 88 char hnam[10], hnamg[20];
89 double xt=0;
90 if(strncmp(system,"ZNA",3) == 0){
91 sprintf(hnam,"hZNA");
92 sprintf(hnamg,"hZNA_GLAU");
93 xt=20.;
94 }
95 else if(strncmp(system,"ZPA",3) == 0) {
96 sprintf(hnam,"hZPA");
97 sprintf(hnamg,"hZPA_GLAU");
98 xt=5.;
99 }
100
101 TFile *f = TFile::Open(foutname);
102 TH1 * hd = dynamic_cast<TH1*> (f->Get((hnam)));
103 TH1 * hg = dynamic_cast<TH1*> (f->Get((hnamg)));
104 hg->SetLineColor(kPink-2);
105 hg->SetLineWidth(2);
106 hd->SetMarkerStyle(20);
107 //hd->SetMarkerSize(1.2);
108 hd->SetMarkerColor(kBlue+3);
109 hd->SetLineWidth(2);
110 //hd->SetMinimum(10.);
111 hg->Draw("E");
112 hd->Draw("PEsame");
113 hd->SetXTitle("E_{ZNA} (TeV)");
114 hg->Draw("Esame");
115 gPad->SetLogy(1);
116
117 TLatex text0;
118 text0.SetTextSize(0.04);
119 text0.SetTextColor(kBlue+3);
120 char ch[60];
121 sprintf(ch,"<E_{ZNA}> DATA = %1.2f TeV ",hd->GetMean());
122 text0.DrawLatex(xt,10.,ch);
123 char chd[60];
124 sprintf(chd,"<E_{ZNA}> Glauber = %1.2f TeV",hg->GetMean());
125 text0.SetTextColor(kPink-2);
126 text0.DrawLatex(xt,5.,chd);
704dfdbd 127
1665860d 128 char ct[60];
129 sprintf(ct,"RUN %s",run);
130 text0.SetTextColor(kAzure);
131 text0.DrawLatex(xt,1.,ct);
704dfdbd 132
133}
134