]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/EVCHAR/combscalingfactor.C
AliESDCentrality replaced by AliCentrality
[u/mrichter/AliRoot.git] / PWG2 / EVCHAR / combscalingfactor.C
CommitLineData
c6788f58 1#include "Riostream.h"
2#include "TROOT.h"
3#include "TStyle.h"
4#include "TMath.h"
5#include "TH1.h"
6#include "TH2.h"
7#include "TF1.h"
8#include "TFile.h"
9#include "TList.h"
10#include "TTree.h"
11#include "TLegend.h"
12#include "TLegendEntry.h"
13#include "TCanvas.h"
14void combscalingfactor(Char_t *fileall, Char_t *filecomb, Bool_t scalebkg = kFALSE, Float_t scfac=1.) {
15
16 // gStyle->SetOptStat(kFALSE);
17 gStyle->SetOptTitle(kFALSE);
18// gStyle->SetOptLogy(kFALSE);
19 gStyle->SetFrameLineWidth(2.5);
20 gStyle->SetCanvasColor(0);
21 gStyle->SetPadColor(0);
22 gStyle->SetHistLineWidth(2.5);
23 gStyle->SetLabelSize(0.05, "x");
24 gStyle->SetLabelSize(0.05, "y");
25 gStyle->SetTitleSize(0.05, "x");
26 gStyle->SetTitleSize(0.05, "y");
27 gStyle->SetTitleOffset(1.1, "x");
28 gStyle->SetPadBottomMargin(0.14);
29 gStyle->SetFrameFillColor(0);
30 gStyle->SetFillColor(0);
31// gROOT->ForceStyle();
32
33
34
35 TFile *fall = new TFile(fileall);
36 TFile *fcomb = new TFile(filecomb);
37
38 TList *lall = (TList*) fall->Get("cOutput");
39 TList *lcomb = (TList*) fcomb->Get("cOutput");
40
41 TH2F *hall = (TH2F*) lall->FindObject("fHistSPDdePhideTheta");
42 TH2F *hcomb = (TH2F*) lcomb->FindObject("fHistSPDdePhideTheta");
43
44 TH1D* hproall = new TH1D("_xall","",2000,-1.,1.);
45 hproall->Sumw2();
46 hproall = hall->ProjectionX("_xall",0,-1,"e");
47
48 TH1D* hprocomb = new TH1D("_xcomb","",2000,-1.,1.);
49 hprocomb->Sumw2();
50 hprocomb = hcomb->ProjectionX("_xcomb",0,-1,"e");
51
52
53 TH1D* hratio = new TH1D("ratio","",2000,-1.,1.);
54 hratio->Divide(hproall,hprocomb,1.,1.);
55
56 TF1 *fleft = new TF1("fleft","pol0",-.8,-0.6); //check values
57 TF1 *fright = new TF1("fright","pol0",0.6,.8);
58
59 hratio->Fit("fleft","R");
60 hratio->Fit("fright","R");
61
62/*
63 // Projection on DeltaTheta
64 TH1D* hproall = new TH1D("_xall","",1000,-.25,.25);
65 hproall->Sumw2();
66 hproall = hall->ProjectionY("_xall",0,-1,"e");
67
68 TH1D* hprocomb = new TH1D("_xcomb","",1000,-.25,.25);
69 hprocomb->Sumw2();
70 hprocomb = hcomb->ProjectionY("_xcomb",0,-1,"e");
71
72 TH1D* hratio = new TH1D("ratio","",1000,-.25,.25);
73 hratio->Divide(hproall,hprocomb,1.,1.);
74
75 TF1 *fleft = new TF1("fleft","pol0",-.8,-0.6); //check values
76 TF1 *fright = new TF1("fright","pol0",0.6,.8);
77 hratio->Fit("fleft","R");
78 hratio->Fit("fright","R");
79*/
80
81 TFile *fout= new TFile("scaling.root","RECREATE");
82
83 new TCanvas();
84 hproall->Draw("histo");
85
86 if (scalebkg) hprocomb->Scale(scfac);
87 hprocomb->Draw("histo,same");
88
89 cout<<"Percentage of background"<< hprocomb->Integral(1,1000)/hproall->Integral(1,1000)<<endl;
90 cout<<"Percentage of background in |#D#phi|<0.08"<< hprocomb->Integral(921,1080)/hproall->Integral(921,1080)<<endl;
91 hproall->Write();
92 hprocomb->SetLineColor(kBlue);
93 hprocomb->Write();
94 fout->Write();
95 fout->Close();
96
97}