12 #include "TLegendEntry.h"
14 void combscalingfactor(Char_t *fileall, Char_t *filecomb, Bool_t scalebkg = kFALSE, Float_t scfac=1.) {
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();
35 TFile *fall = new TFile(fileall);
36 TFile *fcomb = new TFile(filecomb);
38 TList *lall = (TList*) fall->Get("cOutput");
39 TList *lcomb = (TList*) fcomb->Get("cOutput");
41 TH2F *hall = (TH2F*) lall->FindObject("fHistSPDdePhideTheta");
42 TH2F *hcomb = (TH2F*) lcomb->FindObject("fHistSPDdePhideTheta");
44 TH1D* hproall = new TH1D("_xall","",2000,-1.,1.);
46 hproall = hall->ProjectionX("_xall",0,-1,"e");
48 TH1D* hprocomb = new TH1D("_xcomb","",2000,-1.,1.);
50 hprocomb = hcomb->ProjectionX("_xcomb",0,-1,"e");
53 TH1D* hratio = new TH1D("ratio","",2000,-1.,1.);
54 hratio->Divide(hproall,hprocomb,1.,1.);
56 TF1 *fleft = new TF1("fleft","pol0",-.8,-0.6); //check values
57 TF1 *fright = new TF1("fright","pol0",0.6,.8);
59 hratio->Fit("fleft","R");
60 hratio->Fit("fright","R");
63 // Projection on DeltaTheta
64 TH1D* hproall = new TH1D("_xall","",1000,-.25,.25);
66 hproall = hall->ProjectionY("_xall",0,-1,"e");
68 TH1D* hprocomb = new TH1D("_xcomb","",1000,-.25,.25);
70 hprocomb = hcomb->ProjectionY("_xcomb",0,-1,"e");
72 TH1D* hratio = new TH1D("ratio","",1000,-.25,.25);
73 hratio->Divide(hproall,hprocomb,1.,1.);
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");
81 TFile *fout= new TFile("scaling.root","RECREATE");
84 hproall->Draw("histo");
86 if (scalebkg) hprocomb->Scale(scfac);
87 hprocomb->Draw("histo,same");
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;
92 hprocomb->SetLineColor(kBlue);