]>
Commit | Line | Data |
---|---|---|
4f42a9d7 | 1 | // E. Sicking, CERN |
2 | // macro for analysing output of AliAnalysisTaskHardSoft | |
3 | ||
4 | void plotSignalBackground(){ | |
5 | ||
6 | gROOT->SetStyle("Plain"); | |
7 | gStyle->SetOptStat(0); | |
8 | gStyle->SetPalette(1); | |
9 | ||
10 | Float_t piHalf = TMath::Pi()/2.; | |
11 | ||
12 | TFile *file0 = TFile::Open(Form("Clean.root")); | |
13 | TList *l1 = (TList *)file0->Get("HardSoftHists"); | |
14 | ||
15 | ||
16 | //histograms with entries how often a trigger particle | |
17 | //is found at given Nch | |
18 | TH1F *trigger = (TH1F*)l1->FindObject("fTriggerESD"); | |
19 | TCanvas * c0= new TCanvas("c0", "c0", 100, 100, 620, 480); | |
20 | c0->cd(); | |
21 | trigger->Draw(); | |
22 | // for(Int_t i=0;i<100;i++){ | |
23 | // cout << i << " : "<< trigger->GetBinContent(i+1) << endl; | |
24 | // } | |
25 | ||
26 | ||
27 | //delta phi histograms for each Nch bin | |
28 | TH1D *dp[100]; | |
29 | TF1 *f[100]; // fit function for background region around pi/2 | |
30 | Float_t fAtPiHalf[100]; // value f(pi/2) | |
31 | ||
32 | for(Int_t i=0;i<100;i++){ | |
33 | dp[i]= (TH1D*)l1->FindObject(Form("fDPhiLeadingNchBinESD%02d",i)); | |
34 | //normalize to number of triggers | |
35 | if(dp[i]->GetEntries()>0)dp[i]->Scale(1./trigger->GetBinContent(i+1)); | |
36 | ||
37 | //define fit function | |
38 | f[i]= new TF1(Form("fun%2d",i), "pol2", TMath::Pi()/2-1, TMath::Pi()/2+1); | |
39 | f[i]->SetLineColor(kRed); | |
40 | fAtPiHalf[i]=0; | |
41 | ||
42 | } | |
43 | ||
44 | TGraphErrors *tge = new TGraphErrors(); // of side band = background | |
45 | tge->SetMarkerStyle(4); | |
46 | tge->SetMarkerColor(kRed); | |
47 | tge->SetLineColor(kRed); | |
48 | ||
49 | TGraphErrors *tgeSignal = new TGraphErrors(); //integral of dphi<0.7 | |
50 | tgeSignal->SetMarkerStyle(4); | |
51 | tgeSignal->SetMarkerColor(kBlue); | |
52 | tgeSignal->SetLineColor(kBlue); | |
53 | ||
54 | TGraphErrors *tgeSignalWOB = new TGraphErrors();//integral of dphi<0.7 | |
55 | //- background | |
56 | tgeSignalWOB->SetMarkerStyle(4); | |
57 | tgeSignalWOB->SetMarkerColor(kGreen); | |
58 | tgeSignalWOB->SetLineColor(kGreen); | |
59 | ||
60 | ||
61 | ||
62 | TCanvas * c= new TCanvas("c", "c", 150, 150, 820, 620); | |
63 | c->Divide(7,7); | |
64 | for(Int_t i=0;i<49;i++){ | |
65 | c->cd(i+1); | |
66 | if(dp[i]->GetEntries()>0) { | |
67 | dp[i]->Fit(f[i],"R"); | |
68 | dp[i]->SetMinimum(0); | |
69 | } | |
70 | ||
71 | // get value of fit function at pi/2 -> side band | |
72 | fAtPiHalf[i]=f[i]->Eval(piHalf,0,0); | |
73 | ||
74 | Double_t integral07=dp[i]->Integral(1,40);// bin 40 -> dphi=07 | |
75 | ||
76 | ||
77 | ||
78 | Float_t radius=0.7; | |
79 | Float_t DeltaPhiBinWith = TMath::Pi()/180.; | |
80 | Float_t bkgSampleSize = DeltaPhiBinWith*1.8; | |
81 | Float_t halfCircle = TMath::Pi()*(radius)*(radius)/2; | |
82 | Float_t akzeptanz =0.8; | |
83 | Float_t ratio= akzeptanz*halfCircle/bkgSampleSize; | |
84 | ||
85 | ||
86 | tge->SetPoint(i,i,fAtPiHalf[i] ); //side band | |
87 | tgeSignal->SetPoint(i,i, integral07); // integral | |
88 | tgeSignalWOB->SetPoint(i,i, integral07-fAtPiHalf[i]*40);//integral - bkg | |
89 | ||
90 | ||
91 | } | |
92 | ||
93 | ||
94 | //define legend | |
95 | TLegend *legp; | |
96 | TF1 *fun1p; | |
97 | TF1 *fun2p; | |
98 | TF1 *fun3p; | |
99 | TF1 *fun4p; | |
100 | TF1 *fun5p; | |
101 | fun1p= new TF1("fun1p","gaus",-5.0,5.0); | |
102 | fun2p= new TF1("fun2p","gaus",-5.0,5.0); | |
103 | fun3p= new TF1("fun3p","gaus",-5.0,5.0); | |
104 | fun4p= new TF1("fun4p","gaus",-5.0,5.0); | |
105 | fun5p= new TF1("fun5p","gaus",-5.0,5.0); | |
106 | fun1p->SetMarkerColor(kBlue); | |
107 | fun1p->SetMarkerStyle(4); | |
108 | fun2p->SetMarkerColor(kGreen); | |
109 | fun2p->SetMarkerStyle(4); | |
110 | fun3p->SetMarkerColor(kMagenta); | |
111 | fun3p->SetMarkerStyle(4); | |
112 | fun4p->SetMarkerColor(kRed); | |
113 | fun4p->SetMarkerStyle(4); | |
114 | legp= new TLegend(0.1,0.7,0.75,0.9); | |
115 | legp->SetFillColor(kWhite); | |
116 | legp->AddEntry(fun1p,"integral dphi<0.7","p"); | |
117 | legp->AddEntry(fun4p,"background in side band","p"); | |
118 | legp->AddEntry(fun2p,"integral dphi<0.7 - background","p"); | |
119 | legp->AddEntry(fun5p,"Ntracks around trigger in R<0.7","l"); | |
120 | legp->AddEntry(fun3p,"Ntracks around trigger in R<0.7 - background","p"); | |
121 | ||
122 | ||
123 | //define histogram with name of axes | |
124 | TCanvas * c1= new TCanvas("c1", "c1", 200, 200, 620, 480); | |
125 | c1->cd(); | |
126 | TH1F * histo = new TH1F("histo", "",100,-0.5,99.5 ); | |
127 | histo->SetMaximum(10); | |
128 | histo->SetMinimum(0.01); | |
129 | histo->GetXaxis()->SetRangeUser(0,50); | |
130 | histo->SetXTitle("N_{charge}"); | |
131 | histo->SetTitle(""); | |
132 | histo->SetYTitle(""); | |
133 | histo->Draw(); | |
134 | legp->Draw(); | |
135 | ||
136 | //draw output | |
137 | tgeSignal->Draw("p"); | |
138 | tge->Draw("p"); | |
139 | tgeSignalWOB->Draw("p"); | |
140 | ||
141 | ||
142 | //number of associate particles within R<0.7 around trigger | |
143 | TProfile *pSignal= (TProfile*)l1->FindObject("fNchAssInRESD"); | |
144 | pSignal->Draw("same"); | |
145 | ||
146 | TGraphErrors *t = new TGraphErrors(); | |
147 | t->SetMarkerStyle(4); | |
148 | t->SetMarkerColor(kMagenta); | |
149 | t->SetLineColor(kMagenta); | |
150 | t->SetLineStyle(2); | |
151 | for(Int_t i=0;i<49;i++){ | |
152 | t->SetPoint(i,i,pSignal->GetBinContent(i+1)-fAtPiHalf[i]*ratio); | |
153 | } | |
154 | ||
155 | t->Draw("p"); | |
156 | ||
157 | // TCanvas * c5= new TCanvas("c5", "c5", 300, 300, 620, 480); | |
158 | // c5->cd(); | |
159 | // t->Draw("ap"); | |
160 | ||
161 | // TCanvas * c6= new TCanvas("c6", "c6", 400, 400, 620, 480); | |
162 | // c6->cd(); | |
163 | // tge->Draw("ap"); | |
164 | ||
165 | } |