]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGPP/EVCHAR/GlauberSNM/makeCentralityFit.C
code and files for running Glauber+SNM fit to ZDC
[u/mrichter/AliRoot.git] / PWGPP / EVCHAR / GlauberSNM / makeCentralityFit.C
1 void makeCentralityFit(const char * run="188359",const char * system="ZNA", int Rebin=1,int Nevt=1e6)
2 {
3  //load libraries
4   gSystem->SetBuildDir("/tmp/");
5   gSystem->Load("libCore.so");  
6   gSystem->Load("libTree.so");
7   gSystem->Load("libGeom.so");
8   gSystem->Load("libVMC.so");
9   gSystem->Load("libPhysics.so");
10   gSystem->Load("libSTEERBase.so");
11   gROOT->ProcessLine(".include $ALICE_ROOT/include");
12   gROOT->LoadMacro("AliCentralityGlauberFit.cxx+");
13
14   const char *finnameGlau ="GlauberMC_pPb_ntuple_sigma70_mind4_r662_a546_Rpro6.root";
15
16   // data
17   TString finname = Form("Histos%s.root",run);
18   TString foutname = Form("%s_fit_%s.root",system,run);
19   TString foutnameGlau = Form("%s_ntuple_%s.root",system,run);
20
21   const char *histname=("hnSpecn");
22   //const char *histname=("hnSpecp");
23   
24
25   AliCentralityGlauberFit *mPM = new AliCentralityGlauberFit(finnameGlau);
26   mPM->SetInputFile(finname);        
27   mPM->SetInputNtuple(finnameGlau);     
28   mPM->SetOutputFile(foutname);  
29   mPM->SetOutputNtuple(foutnameGlau);
30   mPM->AddHisto(histname);
31
32   mPM->SetRebin(Rebin);
33   mPM->SetNevents(Nevt);
34   mPM->UseChi2(kTRUE);     // If TRUE minimize Chi2
35
36   if (strncmp (system,"ZNA",3) == 0) {
37     mPM->SetRangeToFit(1., 70.);   
38     mPM->SetRangeToScale(1.);  
39     mPM->SetGlauberParam(1,0.00,1., 1,0.97,1., 1,0.95,0.3, 1,0.65,0.8, 1,0.585,0.6);
40   }
41   else if (strncmp (system,"ZPA",3) == 0) {
42     mPM->SetRangeToFit(1., 25.);  2
43     mPM->SetRangeToScale(1.);  
44     mPM->SetGlauberParam(1,0.0,1., 1,0.6,1, 1,0.25,0.3, 1,0.65,0.8, 1,0.585,0.6);
45   }
46   mPM->MakeFits();  
47
48   TFile * f = new TFile (foutname);
49   TH1 * hd = (TH1*) gDirectory->Get(("hnSpecn"));
50   TH1 * hg = (TH1*) gDirectory->Get(("hnSpecn_GLAU"));
51   hg->SetLineColor(kRed);
52   hd->Draw("hist");
53   hg->Draw("histsame");
54
55
56
57 }
58