]>
Commit | Line | Data |
---|---|---|
264b1bb9 | 1 | #include <math.h> |
2 | #include <time.h> | |
3 | #include <stdio.h> | |
4 | #include <stdlib.h> | |
5 | #include <Riostream.h> | |
6 | ||
7 | #include "TVector2.h" | |
8 | #include "TFile.h" | |
9 | #include "TString.h" | |
10 | #include "TF1.h" | |
11 | #include "TH1.h" | |
12 | #include "TH2.h" | |
13 | #include "TH3.h" | |
14 | #include "TProfile.h" | |
15 | #include "TProfile2D.h" | |
16 | #include "TMath.h" | |
17 | #include "TText.h" | |
18 | #include "TRandom3.h" | |
19 | #include "TArray.h" | |
20 | #include "TLegend.h" | |
21 | #include "TStyle.h" | |
22 | #include "TMinuit.h" | |
23 | #include "TCanvas.h" | |
24 | #include "TPad.h" | |
25 | ||
26 | #define BohrR 1963.6885 | |
27 | #define FmToGeV 0.19733 // conversion to fm | |
28 | #define PI 3.1415926 | |
29 | #define masspiC 0.1395702 // pi+ mass (GeV/c^2) | |
30 | ||
31 | using namespace std; | |
32 | ||
33 | const int ChProdBOI=0;// 0=SameCharge, 1=MixedCharge1, 2=MixedCharge2 | |
34 | const int KTBin=0;// Kt3 bin. 0=low Kt3 bin. 1=high Kt3 bin | |
35 | const int MBOI=0;// Centrality bin: 0-9 | |
36 | const int GbinPlot=int( (34) /2. ) + 55;// +5 (Rcoh=0), +25 (Rcoh=Rch) or +55 for extended G range | |
37 | const int Q3binChi2= 4;// 2-5 | |
38 | const int Q4binChi2= 7;// 3-7 | |
39 | ||
40 | // | |
41 | // | |
42 | // | |
43 | int TextFont=42;// 63, or 42 | |
44 | float SizeLabel=0.06;// 20(63 font), 0.08(42 font) | |
45 | float SizeLegend=0.04;// .08 | |
46 | float SizeTitle=0.06;// | |
47 | float SizeSpecif=0.045;// | |
48 | float SF1=2/3.*0.95; | |
49 | float SF2=1/2.*0.95; | |
50 | ||
51 | double RightMargin=0.004;// 0.002 | |
52 | // | |
53 | ||
54 | void Plot_plotsFourPion(){ | |
55 | ||
56 | gStyle->SetOptStat(0); | |
57 | gStyle->SetOptDate(0); | |
58 | ||
59 | int Q3_meanpT[2][5]={{0,213,228,233,237},{0,316,336,354,366}};// low then high KT3 | |
60 | int Q4_meanpT[2][7]={{0,0,221,229,234,238,241},{0,0,325,335,344,351,355}};// low then high KT4 | |
61 | ||
62 | TFile *files[3][2][2][10];// SC/MC1/MC2, +/-, KT, MBINS | |
63 | // | |
64 | ||
65 | ||
66 | TH1D *C3QS[2][2][2][10];// SC/MC, +/-, KT, Mbin | |
67 | TH1D *c3QS[2][2][2][10];// SC/MC, +/-, KT, Mbin | |
68 | TH1D *C3QSBuilt[2][2][10];// +/-, KT, Mbin | |
69 | TH2D *C3QSBuilt2D[2][2][10];// +/-, KT, Mbin | |
70 | TH2D *C3QSNegBuilt2D[2][2][10];// +/-, KT, Mbin | |
71 | // | |
72 | TH1D *C4QS[3][2][2][10];// SC/MC, +/-, KT, Mbin | |
73 | TH1D *c4QS[3][2][2][10];// SC/MC, +/-, KT, Mbin | |
74 | TH1D *c4QSstage1[3][2][2][10];// SC/MC, +/-, KT, Mbin | |
75 | TH1D *c4QSstage2[2][2][10];// +/-, KT, Mbin | |
76 | TH1D *C4QSBuilt[2][2][10];// +/-, KT, Mbin | |
77 | TH2D *C4QSBuilt2D[2][2][10];// +/-, KT, Mbin | |
78 | TH2D *C4QSNegBuilt2D[2][2][10];// +/-, KT, Mbin | |
79 | // | |
80 | TH1D *r3[2][2][10];// +/-, KT, Mbin | |
81 | TH1D *r42[2][2][10];// +/-, KT, Mbin | |
82 | ||
83 | // | |
84 | ////////////////////////////// | |
85 | ||
86 | // Start File access | |
87 | for(int mb=0; mb<10; mb++){ | |
88 | for(int ChComb=0; ChComb<3; ChComb++) {// SC or MC1 or MC2 | |
89 | for(int ch=0; ch<2; ch++) {// - or + | |
90 | for(int KT=0; KT<2; KT++) {// KT bin | |
91 | if(ChComb==2 && ch!=0) continue; | |
92 | ||
93 | TString *name = new TString("OutFiles/OutFile"); | |
94 | if(ChComb==0) name->Append("SC"); | |
95 | else if(ChComb==1) name->Append("MC1"); | |
96 | else name->Append("MC2"); | |
97 | // | |
98 | if(ch==0) name->Append("_Neg_"); | |
99 | else name->Append("_Pos_"); | |
100 | name->Append("KT_"); | |
101 | *name += KT+1; | |
102 | name->Append("_M"); | |
103 | if(mb<10) {*name += mb;} | |
104 | else {*name += 0;} | |
105 | name->Append(".root"); | |
106 | files[ChComb][ch][KT][mb] = new TFile(name->Data(),"READ"); | |
107 | /////////////////////////////// | |
108 | if(ChComb!=2){ | |
109 | C3QS[ChComb][ch][KT][mb]=(TH1D*)files[ChComb][ch][KT][mb]->Get("C3QS"); | |
110 | c3QS[ChComb][ch][KT][mb]=(TH1D*)files[ChComb][ch][KT][mb]->Get("c3QS"); | |
111 | C3QS[ChComb][ch][KT][mb]->SetDirectory(0); c3QS[ChComb][ch][KT][mb]->SetDirectory(0); | |
112 | C3QS[ChComb][ch][KT][mb]->GetXaxis()->SetLabelFont(TextFont); C3QS[ChComb][ch][KT][mb]->GetYaxis()->SetLabelFont(TextFont); | |
113 | c3QS[ChComb][ch][KT][mb]->GetXaxis()->SetLabelFont(TextFont); c3QS[ChComb][ch][KT][mb]->GetYaxis()->SetLabelFont(TextFont); | |
114 | C3QS[ChComb][ch][KT][mb]->GetXaxis()->SetTitleFont(TextFont); C3QS[ChComb][ch][KT][mb]->GetYaxis()->SetTitleFont(TextFont); | |
115 | c3QS[ChComb][ch][KT][mb]->GetXaxis()->SetTitleFont(TextFont); c3QS[ChComb][ch][KT][mb]->GetYaxis()->SetTitleFont(TextFont); | |
116 | C3QS[ChComb][ch][KT][mb]->GetXaxis()->SetTitle("#font[12]{Q}_{3} (GeV/#font[12]{c})"); | |
117 | c3QS[ChComb][ch][KT][mb]->GetXaxis()->SetTitle("#font[12]{Q}_{3} (GeV/#font[12]{c})"); | |
118 | C3QS[ChComb][ch][KT][mb]->GetYaxis()->SetTitle("#font[12]{C}_{3} or #font[12]{#bf{c}}_{3}"); | |
119 | c3QS[ChComb][ch][KT][mb]->GetYaxis()->SetTitle("#font[12]{#bf{c}}_{3}"); | |
120 | } | |
121 | C4QS[ChComb][ch][KT][mb]=(TH1D*)files[ChComb][ch][KT][mb]->Get("C4QS"); | |
122 | c4QS[ChComb][ch][KT][mb]=(TH1D*)files[ChComb][ch][KT][mb]->Get("c4QS"); | |
123 | c4QSstage1[ChComb][ch][KT][mb]=(TH1D*)files[ChComb][ch][KT][mb]->Get("c4QS_RemovalStage1"); | |
124 | C4QS[ChComb][ch][KT][mb]->SetDirectory(0); c4QS[ChComb][ch][KT][mb]->SetDirectory(0); | |
125 | c4QSstage1[ChComb][ch][KT][mb]->SetDirectory(0); | |
126 | C4QS[ChComb][ch][KT][mb]->GetXaxis()->SetTitle("#font[12]{Q}_{4} (GeV/#font[12]{c})"); | |
127 | c4QS[ChComb][ch][KT][mb]->GetXaxis()->SetTitle("#font[12]{Q}_{4} (GeV/#font[12]{c})"); | |
128 | C4QS[ChComb][ch][KT][mb]->GetYaxis()->SetTitle("#font[12]{C}_{4} or #font[12]{#bf{c}}_{4}"); | |
129 | c4QS[ChComb][ch][KT][mb]->GetYaxis()->SetTitle("#font[12]{#bf{c}}_{4}"); | |
130 | ||
131 | if(ChComb==0){ | |
132 | c4QSstage2[ch][KT][mb]=(TH1D*)files[ChComb][ch][KT][mb]->Get("c4QS_RemovalStage2"); | |
133 | C3QSBuilt[ch][KT][mb]=(TH1D*)files[ChComb][ch][KT][mb]->Get("C3QS_built"); | |
134 | C4QSBuilt[ch][KT][mb]=(TH1D*)files[ChComb][ch][KT][mb]->Get("C4QS_built"); | |
135 | C3QSBuilt2D[ch][KT][mb]=(TH2D*)files[ChComb][ch][KT][mb]->Get("C3QS_built2D"); | |
136 | C4QSBuilt2D[ch][KT][mb]=(TH2D*)files[ChComb][ch][KT][mb]->Get("C4QS_built2D"); | |
137 | C3QSNegBuilt2D[ch][KT][mb]=(TH2D*)files[ChComb][ch][KT][mb]->Get("C3QS_Negbuilt2D"); | |
138 | C4QSNegBuilt2D[ch][KT][mb]=(TH2D*)files[ChComb][ch][KT][mb]->Get("C4QS_Negbuilt2D"); | |
139 | // | |
140 | c4QSstage2[ch][KT][mb]->SetDirectory(0); C3QSBuilt[ch][KT][mb]->SetDirectory(0); C4QSBuilt[ch][KT][mb]->SetDirectory(0); | |
141 | C3QSBuilt2D[ch][KT][mb]->SetDirectory(0); C4QSBuilt2D[ch][KT][mb]->SetDirectory(0); | |
142 | C3QSNegBuilt2D[ch][KT][mb]->SetDirectory(0); C4QSNegBuilt2D[ch][KT][mb]->SetDirectory(0); | |
143 | // | |
144 | r3[ch][KT][mb]=(TH1D*)files[ChComb][ch][KT][mb]->Get("r3"); | |
145 | r3[ch][KT][mb]->SetDirectory(0); | |
146 | // | |
147 | r42[ch][KT][mb]=(TH1D*)files[ChComb][ch][KT][mb]->Get("r42"); | |
148 | r42[ch][KT][mb]->SetDirectory(0); | |
149 | // | |
150 | C4QS[ChComb][ch][KT][mb]->SetBinContent(2,100); C4QS[ChComb][ch][KT][mb]->SetBinError(2,100); | |
151 | c4QS[ChComb][ch][KT][mb]->SetBinContent(2,100); c4QS[ChComb][ch][KT][mb]->SetBinError(2,100); | |
152 | c4QSstage1[ChComb][ch][KT][mb]->SetBinContent(2,100); c4QSstage1[ChComb][ch][KT][mb]->SetBinError(2,100); | |
153 | c4QSstage2[ch][KT][mb]->SetBinContent(2,100); c4QSstage2[ch][KT][mb]->SetBinError(2,100); | |
154 | } | |
155 | files[ChComb][ch][KT][mb]->Close(); | |
156 | }// KT | |
157 | }// ch | |
158 | }// ChComb | |
159 | }// mb | |
160 | ||
161 | ||
162 | ||
163 | TF1 *Unity = new TF1("Unity","1",0,100); | |
164 | Unity->SetLineStyle(2); | |
165 | Unity->SetLineColor(1); | |
166 | ||
167 | ||
168 | ||
169 | TH1D *C3QSmerged[2][2][10];// SC/MC, KT, Mbin | |
170 | TH1D *c3QSmerged[2][2][10];// SC/MC, KT, Mbin | |
171 | TH1D *C3QSBuiltmerged[2][10];// KT, Mbin | |
172 | TH2D *C3QSBuiltmerged2D[2][10];// KT, Mbin | |
173 | TH2D *C3QSNegBuiltmerged2D[2][10];// KT, Mbin | |
174 | // | |
175 | TH1D *C4QSmerged[3][2][10];// SC/MC, KT, Mbin | |
176 | TH1D *c4QSmerged[3][2][10];// SC/MC, KT, Mbin | |
177 | TH1D *c4QSstage1merged[3][2][10];// SC/MC, KT, Mbin | |
178 | TH1D *c4QSstage2merged[2][10];// KT, Mbin | |
179 | TH1D *C4QSBuiltmerged[2][10];// KT, Mbin | |
180 | TH2D *C4QSBuiltmerged2D[2][10];// KT, Mbin | |
181 | TH2D *C4QSNegBuiltmerged2D[2][10];// KT, Mbin | |
182 | ||
183 | for(int mb=0; mb<10; mb++){ | |
184 | for(int ChComb=0; ChComb<3; ChComb++) { | |
185 | for(int KT=0; KT<2; KT++) { | |
186 | if(ChComb!=2){ | |
187 | C3QSmerged[ChComb][KT][mb] = (TH1D*)C3QS[ChComb][0][KT][mb]->Clone(); | |
188 | c3QSmerged[ChComb][KT][mb] = (TH1D*)c3QS[ChComb][0][KT][mb]->Clone(); | |
189 | } | |
190 | // | |
191 | C4QSmerged[ChComb][KT][mb] = (TH1D*)C4QS[ChComb][0][KT][mb]->Clone(); | |
192 | c4QSmerged[ChComb][KT][mb] = (TH1D*)c4QS[ChComb][0][KT][mb]->Clone(); | |
193 | c4QSstage1merged[ChComb][KT][mb] = (TH1D*)c4QSstage1[ChComb][0][KT][mb]->Clone(); | |
194 | // | |
195 | if(ChComb==0) { | |
196 | c4QSstage2merged[KT][mb] = (TH1D*)c4QSstage2[0][KT][mb]->Clone(); | |
197 | C3QSBuiltmerged[KT][mb] = (TH1D*)C3QSBuilt[0][KT][mb]->Clone(); | |
198 | C4QSBuiltmerged[KT][mb] = (TH1D*)C4QSBuilt[0][KT][mb]->Clone(); | |
199 | C3QSBuiltmerged2D[KT][mb] = (TH2D*)C3QSBuilt2D[0][KT][mb]->Clone(); | |
200 | C4QSBuiltmerged2D[KT][mb] = (TH2D*)C4QSBuilt2D[0][KT][mb]->Clone(); | |
201 | C3QSNegBuiltmerged2D[KT][mb] = (TH2D*)C3QSNegBuilt2D[0][KT][mb]->Clone(); | |
202 | C4QSNegBuiltmerged2D[KT][mb] = (TH2D*)C4QSNegBuilt2D[0][KT][mb]->Clone(); | |
203 | } | |
204 | ||
205 | if(ChComb!=2){ | |
206 | for(int bin=1; bin<=C3QSmerged[ChComb][KT][mb]->GetNbinsX(); bin++){ | |
207 | double value=0, value_e=0; | |
208 | value = (C3QS[ChComb][0][KT][mb]->GetBinContent(bin) + C3QS[ChComb][1][KT][mb]->GetBinContent(bin)) / 2.; | |
209 | value_e = sqrt(pow(C3QS[ChComb][0][KT][mb]->GetBinError(bin),2) + pow(C3QS[ChComb][1][KT][mb]->GetBinError(bin),2)) / sqrt(2.); | |
210 | C3QSmerged[ChComb][KT][mb]->SetBinContent(bin, value); C3QSmerged[ChComb][KT][mb]->SetBinError(bin, value_e); | |
211 | // | |
212 | value = (c3QS[ChComb][0][KT][mb]->GetBinContent(bin) + c3QS[ChComb][1][KT][mb]->GetBinContent(bin)) / 2.; | |
213 | value_e = sqrt(pow(c3QS[ChComb][0][KT][mb]->GetBinError(bin),2) + pow(c3QS[ChComb][1][KT][mb]->GetBinError(bin),2)) / sqrt(2.); | |
214 | c3QSmerged[ChComb][KT][mb]->SetBinContent(bin, value); c3QSmerged[ChComb][KT][mb]->SetBinError(bin, value_e); | |
215 | // | |
216 | if(ChComb==0){ | |
217 | value = (C3QSBuilt[0][KT][mb]->GetBinContent(bin) + C3QSBuilt[1][KT][mb]->GetBinContent(bin)) / 2.; | |
218 | value_e = 0; | |
219 | C3QSBuiltmerged[KT][mb]->SetBinContent(bin, value); C3QSBuiltmerged[KT][mb]->SetBinError(bin, value_e); | |
220 | // | |
221 | for(int binG=1; binG<=C3QSBuiltmerged2D[KT][mb]->GetNbinsX(); binG++){ | |
222 | value = (C3QSBuilt2D[0][KT][mb]->GetBinContent(binG, bin) + C3QSBuilt2D[1][KT][mb]->GetBinContent(binG, bin)) / 2.; | |
223 | value_e = 0; | |
224 | C3QSBuiltmerged2D[KT][mb]->SetBinContent(binG, bin, value); C3QSBuiltmerged2D[KT][mb]->SetBinError(binG, bin, value_e); | |
225 | // | |
226 | value = (C3QSNegBuilt2D[0][KT][mb]->GetBinContent(binG, bin) + C3QSNegBuilt2D[1][KT][mb]->GetBinContent(binG, bin)) / 2.; | |
227 | value_e = 0; | |
228 | C3QSNegBuiltmerged2D[KT][mb]->SetBinContent(binG, bin, value); C3QSNegBuiltmerged2D[KT][mb]->SetBinError(binG, bin, value_e); | |
229 | } | |
230 | } | |
231 | } | |
232 | } | |
233 | //cout<<ChComb<<" "<<KT<<" "<<mb<<endl; | |
234 | //cout<<C4QS[ChComb][1][KT][mb]->GetBinContent(4)<<endl; | |
235 | // | |
236 | if(ChComb==2) continue; | |
237 | for(int bin=1; bin<=C4QSmerged[ChComb][KT][mb]->GetNbinsX(); bin++){ | |
238 | double value = (C4QS[ChComb][0][KT][mb]->GetBinContent(bin) + C4QS[ChComb][1][KT][mb]->GetBinContent(bin)) / 2.; | |
239 | double value_e = sqrt(pow(C4QS[ChComb][0][KT][mb]->GetBinError(bin),2) + pow(C4QS[ChComb][1][KT][mb]->GetBinError(bin),2)) / sqrt(2.); | |
240 | C4QSmerged[ChComb][KT][mb]->SetBinContent(bin, value); C4QSmerged[ChComb][KT][mb]->SetBinError(bin, value_e); | |
241 | // | |
242 | value = (c4QS[ChComb][0][KT][mb]->GetBinContent(bin) + c4QS[ChComb][1][KT][mb]->GetBinContent(bin)) / 2.; | |
243 | value_e = sqrt(pow(c4QS[ChComb][0][KT][mb]->GetBinError(bin),2) + pow(c4QS[ChComb][1][KT][mb]->GetBinError(bin),2)) / sqrt(2.); | |
244 | c4QSmerged[ChComb][KT][mb]->SetBinContent(bin, value); c4QSmerged[ChComb][KT][mb]->SetBinError(bin, value_e); | |
245 | // | |
246 | value = (c4QSstage1[ChComb][0][KT][mb]->GetBinContent(bin) + c4QSstage1[ChComb][1][KT][mb]->GetBinContent(bin)) / 2.; | |
247 | value_e = sqrt(pow(c4QSstage1[ChComb][0][KT][mb]->GetBinError(bin),2) + pow(c4QSstage1[ChComb][1][KT][mb]->GetBinError(bin),2)) / sqrt(2.); | |
248 | c4QSstage1merged[ChComb][KT][mb]->SetBinContent(bin, value); c4QSstage1merged[ChComb][KT][mb]->SetBinError(bin, value_e); | |
249 | // | |
250 | if(ChComb==0){ | |
251 | value = (c4QSstage2[0][KT][mb]->GetBinContent(bin) + c4QSstage2[1][KT][mb]->GetBinContent(bin)) / 2.; | |
252 | value_e = sqrt(pow(c4QSstage2[0][KT][mb]->GetBinError(bin),2) + pow(c4QSstage2[1][KT][mb]->GetBinError(bin),2)) / sqrt(2.); | |
253 | c4QSstage2merged[KT][mb]->SetBinContent(bin, value); c4QSstage2merged[KT][mb]->SetBinError(bin, value_e); | |
254 | // | |
255 | value = (C4QSBuilt[0][KT][mb]->GetBinContent(bin) + C4QSBuilt[1][KT][mb]->GetBinContent(bin)) / 2.; | |
256 | value_e = 0; | |
257 | C4QSBuiltmerged[KT][mb]->SetBinContent(bin, value); C4QSBuiltmerged[KT][mb]->SetBinError(bin, value_e); | |
258 | // | |
259 | for(int binG=1; binG<=C4QSBuiltmerged2D[KT][mb]->GetNbinsX(); binG++){ | |
260 | value = (C4QSBuilt2D[0][KT][mb]->GetBinContent(binG, bin) + C4QSBuilt2D[1][KT][mb]->GetBinContent(binG, bin)) / 2.; | |
261 | value_e = 0; | |
262 | C4QSBuiltmerged2D[KT][mb]->SetBinContent(binG, bin, value); C4QSBuiltmerged2D[KT][mb]->SetBinError(binG, bin, value_e); | |
263 | // | |
264 | value = (C4QSNegBuilt2D[0][KT][mb]->GetBinContent(binG, bin) + C4QSNegBuilt2D[1][KT][mb]->GetBinContent(binG, bin)) / 2.; | |
265 | value_e = 0; | |
266 | C4QSNegBuiltmerged2D[KT][mb]->SetBinContent(binG, bin, value); C4QSNegBuiltmerged2D[KT][mb]->SetBinError(binG, bin, value_e); | |
267 | } | |
268 | } | |
269 | } | |
270 | ||
271 | }// KT | |
272 | }// ChComb | |
273 | }// mb | |
274 | ||
275 | // merge r3 histogram centralities | |
276 | TH1D *r3merged[2];// KT | |
277 | TH1D *r4merged[2];// KT | |
278 | for(int KT=0; KT<2; KT++) { | |
279 | r3merged[KT]=(TH1D*)r3[0][KT][0]->Clone(); | |
280 | r4merged[KT]=(TH1D*)r42[0][KT][0]->Clone(); | |
281 | } | |
282 | ||
283 | double mergedValue_r3[2][20]={{0}};// KT | |
284 | double mergedError_r3[2][20]={{0}};// KT | |
285 | double ErrorWeightSum_r3[2][20]={{0}};// KT | |
286 | double EnSum_r3[2][20]={{0}};// KT | |
287 | // | |
288 | double mergedValue_r4[2][20]={{0}};// KT | |
289 | double mergedError_r4[2][20]={{0}};// KT | |
290 | double ErrorWeightSum_r4[2][20]={{0}};// KT | |
291 | double EnSum_r4[2][20]={{0}};// KT | |
292 | for(int mb=0; mb<10; mb++){ | |
293 | for(int ch=0; ch<2; ch++) { | |
294 | for(int KT=0; KT<2; KT++) { | |
295 | for(int bin=1; bin<=20; bin++){ | |
296 | if(r3[ch][KT][mb]->GetBinError(bin) == 0) continue; | |
297 | mergedValue_r3[KT][bin] += r3[ch][KT][mb]->GetBinContent(bin) / pow(r3[ch][KT][mb]->GetBinError(bin),2); | |
298 | mergedError_r3[KT][bin] += pow(r3[ch][KT][mb]->GetBinError(bin),2) / pow(r3[ch][KT][mb]->GetBinError(bin),2); | |
299 | ErrorWeightSum_r3[KT][bin] += 1.0 / pow(r3[ch][KT][mb]->GetBinError(bin),2); | |
300 | EnSum_r3[KT][bin]++; | |
301 | }// bin | |
302 | }// KT | |
303 | }// ch | |
304 | }// mb | |
305 | ||
306 | for(int mb=0; mb<10; mb++){ | |
307 | for(int ch=0; ch<2; ch++) { | |
308 | for(int KT=0; KT<2; KT++) { | |
309 | for(int bin=1; bin<=20; bin++){ | |
310 | if(r42[ch][KT][mb]->GetBinError(bin) == 0) continue; | |
311 | mergedValue_r4[KT][bin] += r42[ch][KT][mb]->GetBinContent(bin) / pow(r42[ch][KT][mb]->GetBinError(bin),2); | |
312 | mergedError_r4[KT][bin] += pow(r42[ch][KT][mb]->GetBinError(bin),2) / pow(r42[ch][KT][mb]->GetBinError(bin),2); | |
313 | ErrorWeightSum_r4[KT][bin] += 1.0 / pow(r42[ch][KT][mb]->GetBinError(bin),2); | |
314 | EnSum_r4[KT][bin]++; | |
315 | }// bin | |
316 | }// KT | |
317 | }// ch | |
318 | }// mb | |
319 | ||
320 | ||
321 | for(int bin=1; bin<=20; bin++){ | |
322 | for(int KT=0; KT<2; KT++) { | |
323 | if(ErrorWeightSum_r3[KT][bin] ==0) continue; | |
324 | if(EnSum_r3[KT][bin] == 0) continue; | |
325 | r3merged[KT]->SetBinContent(bin, mergedValue_r3[KT][bin] / ErrorWeightSum_r3[KT][bin]); | |
326 | r3merged[KT]->SetBinError(bin, sqrt(mergedError_r3[KT][bin] / ErrorWeightSum_r3[KT][bin])); | |
327 | } | |
328 | } | |
329 | ||
330 | for(int bin=1; bin<=20; bin++){ | |
331 | for(int KT=0; KT<2; KT++) { | |
332 | if(ErrorWeightSum_r4[KT][bin] ==0) continue; | |
333 | if(EnSum_r4[KT][bin] == 0) continue; | |
334 | r4merged[KT]->SetBinContent(bin, mergedValue_r4[KT][bin] / ErrorWeightSum_r4[KT][bin]); | |
335 | r4merged[KT]->SetBinError(bin, sqrt(mergedError_r4[KT][bin] / ErrorWeightSum_r4[KT][bin]) / sqrt(EnSum_r4[KT][bin])); | |
336 | } | |
337 | } | |
338 | ||
339 | ||
340 | ////////////////////////////////////////////////////////////////////////// | |
341 | // 3-pion | |
342 | if(ChProdBOI!=2){ | |
343 | ||
344 | TCanvas *can1 = new TCanvas("can1", "can1",10,0,700,600);// 11,53,700,500 | |
345 | can1->SetHighLightColor(2); | |
346 | gStyle->SetOptFit(0111); | |
347 | can1->SetFillColor(0);//10 | |
348 | can1->SetBorderMode(0); | |
349 | can1->SetBorderSize(2); | |
350 | can1->SetFrameFillColor(0); | |
351 | can1->SetFrameBorderMode(0); | |
352 | can1->SetFrameBorderMode(0); | |
353 | ||
354 | TPad *pad1 = new TPad("pad1","pad1",0.0,0.0,1.,1.); | |
355 | //gPad->SetGridx(1); | |
356 | //gPad->SetGridy(1); | |
357 | gPad->SetTickx(); | |
358 | gPad->SetTicky(); | |
359 | pad1->SetTopMargin(0.0);//0.05 | |
360 | pad1->SetRightMargin(0.0);//1e-2 | |
361 | pad1->SetBottomMargin(0.0);//0.12 | |
362 | pad1->Draw(); | |
363 | pad1->cd(1); | |
364 | gPad->SetLeftMargin(0.14); gPad->SetRightMargin(0.04); | |
365 | gPad->SetTopMargin(0.03); gPad->SetBottomMargin(0.14); | |
366 | TLegend *legend1 = new TLegend(.42,.5, .92,.8,NULL,"brNDC");//.45 or .4 for x1 | |
367 | legend1->SetBorderSize(0); | |
368 | legend1->SetFillColor(0); | |
369 | legend1->SetTextFont(TextFont); | |
370 | legend1->SetTextSize(SizeLegend); | |
371 | ||
372 | C3QSmerged[ChProdBOI][KTBin][MBOI]->GetXaxis()->SetTitleSize(SizeTitle); | |
373 | C3QSmerged[ChProdBOI][KTBin][MBOI]->GetXaxis()->SetLabelSize(SizeLabel); | |
374 | C3QSmerged[ChProdBOI][KTBin][MBOI]->GetYaxis()->SetTitleSize(SizeTitle); | |
375 | C3QSmerged[ChProdBOI][KTBin][MBOI]->GetYaxis()->SetLabelSize(SizeLabel); | |
376 | C3QSmerged[ChProdBOI][KTBin][MBOI]->GetXaxis()->SetTitleOffset(1.05); | |
377 | C3QSmerged[ChProdBOI][KTBin][MBOI]->GetYaxis()->SetTitleOffset(1.1); | |
378 | C3QSmerged[ChProdBOI][KTBin][MBOI]->GetXaxis()->SetNdivisions(606); | |
379 | C3QSmerged[ChProdBOI][KTBin][MBOI]->GetYaxis()->SetNdivisions(505); | |
380 | // | |
381 | //TH1D *C3QS_Syst = new TH1D("C3QS_Syst","",200,0.,0.2); | |
382 | //TH1D *C3QSBuilt_Syst = new TH1D("C3QSBuilt_Syst","",200,0.,0.2); | |
383 | TH1D *C3QS_Syst = (TH1D*)C3QSmerged[ChProdBOI][KTBin][MBOI]->Clone(); | |
384 | TH1D *C3QSBuilt_Syst = (TH1D*)C3QSBuiltmerged[KTBin][MBOI]->Clone(); | |
385 | ||
386 | for(int bin=1; bin<=C3QS_Syst->GetNbinsX(); bin++){ | |
387 | double q3 = C3QS_Syst->GetXaxis()->GetBinCenter(bin); | |
388 | C3QS_Syst->SetBinContent(bin, 4.7); | |
389 | double syst1 = pow(0.001,2);// cc | |
390 | syst1 += pow(0.002 - 0.002*q3/0.1,2);// 11h to 10h | |
391 | syst1 += pow(0.9913 - 0.2231*q3 - 1,2);// f coefficients, r*<70 | |
392 | syst1 += pow(0.9847 + 0.358*q3 - 2.133*q3*q3 - 1,2);// MRC | |
393 | syst1 += pow(0.975 + 0.4189*q3 - 2.055*q3*q3 - 1,2);// Muon, 92% | |
394 | syst1 += pow(0.936 + 1.194*q3 - 5.912*q3*q3 - 1,2);// fc2 scale | |
395 | syst1 += pow(0.125*exp(-61.38*q3),2);// K factorization | |
396 | syst1 = sqrt(syst1); | |
397 | syst1 *= C3QSmerged[ChProdBOI][KTBin][MBOI]->GetBinContent(bin); | |
398 | C3QS_Syst->SetBinError(bin, syst1); | |
399 | // Built | |
400 | C3QSBuilt_Syst->SetBinContent(bin, 4.7); | |
401 | double syst2 = pow(0.002 - 0.002*q3/0.1,2);// 11h to 10h | |
402 | syst2 += pow(0.9856 + 0.3285*q3 - 1.897*q3*q3 - 1,2);// MRC | |
403 | syst2 += pow(0.9786 + 0.421*q3 - 2.108*q3*q3 - 1,2);// Muon, 92% | |
404 | syst2 += pow(0.946 + 0.849*q3 - 3.316*q3*q3 - 1,2);// fc2 scale | |
405 | syst2 += pow(0.0103*exp(-41.68*q3),2);// Interpolator | |
406 | syst2 = sqrt(syst2); | |
407 | syst2 *= C3QSBuiltmerged[KTBin][MBOI]->GetBinContent(bin); | |
408 | C3QSBuilt_Syst->SetBinError(bin, syst2); | |
409 | } | |
410 | double Syst_forChi2_3[15]={0}; | |
411 | for(int bin=1; bin<=15; bin++){ | |
412 | double q3 = C3QSmerged[ChProdBOI][KTBin][MBOI]->GetXaxis()->GetBinCenter(bin); | |
413 | int SystBin = C3QSBuilt_Syst->GetXaxis()->FindBin(q3); | |
414 | //Syst_forChi2_3[bin-1] = fabs(C3QS_Syst->GetBinError(SystBin) - C3QSBuilt_Syst->GetBinError(SystBin)); | |
415 | double SystPercent_Diff = sqrt(pow(0.125*exp(-61.38*q3*sqrt(2.)),2) + pow(0.9913 - 0.2231*q3 - 1,2) + pow(0.0103*exp(-41.68*q3),2));// K, f coefficients, Interpolator | |
416 | Syst_forChi2_3[bin-1] = SystPercent_Diff * C3QSmerged[ChProdBOI][KTBin][MBOI]->GetBinContent(bin); | |
417 | //cout<<Syst_forChi2_3[bin-1]<<endl; | |
418 | } | |
419 | C3QS_Syst->SetBinContent(1,100); C3QSBuilt_Syst->SetBinContent(1,100); | |
420 | C3QS_Syst->SetMarkerSize(0); C3QS_Syst->SetFillColor(kBlue-10); | |
421 | C3QS_Syst->SetMarkerColor(kBlue-10); | |
422 | C3QSBuilt_Syst->SetMarkerSize(0); C3QSBuilt_Syst->SetFillColor(1); //C3QSBuilt_Syst->SetFillStyle(3004); | |
423 | C3QSBuilt_Syst->SetMarkerColor(1); | |
424 | C3QS_Syst->GetXaxis()->SetRangeUser(0.01,0.2); C3QSBuilt_Syst->GetXaxis()->SetRangeUser(0.01,0.2); | |
425 | // | |
426 | C3QSBuiltmerged[KTBin][MBOI]->GetXaxis()->SetRange(2,15); | |
427 | C3QSmerged[ChProdBOI][KTBin][MBOI]->SetMaximum(5.1); | |
428 | C3QSmerged[ChProdBOI][KTBin][MBOI]->Draw(); | |
429 | C3QS_Syst->Draw("E2 same"); | |
430 | C3QSBuilt_Syst->Draw("E1 same"); | |
431 | ||
432 | C3QSmerged[ChProdBOI][KTBin][MBOI]->Draw("same"); | |
433 | c3QSmerged[ChProdBOI][KTBin][MBOI]->Draw("same"); | |
434 | C3QSBuiltmerged[KTBin][MBOI]->SetLineWidth(1.2); | |
435 | if(ChProdBOI==0) C3QSBuiltmerged[KTBin][MBOI]->Draw("same"); | |
436 | // | |
437 | TString *proName=new TString("C3QSbuilt_G"); TString *proNameNeg=new TString("C3QSNegbuilt_G"); | |
438 | TH1D *C3QSbuilt_G = (TH1D*)C3QSBuiltmerged2D[KTBin][MBOI]->ProjectionY(proName->Data(), GbinPlot, GbinPlot); | |
439 | TH1D *C3QSNegbuilt_G = (TH1D*)C3QSNegBuiltmerged2D[KTBin][MBOI]->ProjectionY(proNameNeg->Data(), GbinPlot, GbinPlot); | |
440 | proName->Append("_FullWeightDen"); proNameNeg->Append("_FullWeightDen"); | |
441 | TH1D *tempDen = (TH1D*)C3QSBuiltmerged2D[KTBin][MBOI]->ProjectionY(proName->Data(), 4, 4); | |
442 | TH1D *tempDenNeg = (TH1D*)C3QSNegBuiltmerged2D[KTBin][MBOI]->ProjectionY(proNameNeg->Data(), 4, 4); | |
443 | // Add Pos with Neg weights | |
444 | tempDen->Add(tempDenNeg); | |
445 | C3QSbuilt_G->Add(C3QSNegbuilt_G); | |
446 | // | |
447 | C3QSbuilt_G->Add(tempDen); | |
448 | C3QSbuilt_G->Divide(tempDen); | |
449 | C3QSbuilt_G->SetLineColor(2); | |
450 | C3QSbuilt_G->GetXaxis()->SetRange(2,15); | |
451 | if(ChProdBOI==0) C3QSbuilt_G->Draw("same"); | |
452 | ||
453 | legend1->AddEntry(C3QSmerged[ChProdBOI][KTBin][MBOI],"#font[12]{C}_{3}^{QS}","p"); | |
454 | legend1->AddEntry(c3QSmerged[ChProdBOI][KTBin][MBOI],"#font[12]{#bf{c}}_{3}^{QS}","p"); | |
455 | if(ChProdBOI==0) legend1->AddEntry(C3QSBuiltmerged[KTBin][MBOI],"Built #font[12]{C}_{3}^{QS} (G=0%)","l"); | |
456 | if(ChProdBOI==0) legend1->AddEntry(C3QSbuilt_G,"Built #font[12]{C}_{3}^{QS} (G=34%, R_{coh}=R_{ch})","l"); | |
457 | legend1->Draw("same"); | |
458 | ||
459 | Unity->Draw("same"); | |
460 | ||
461 | ||
462 | ||
463 | ||
464 | ||
465 | if(ChProdBOI==0){ | |
466 | TCanvas *can2 = new TCanvas("can2", "can2",800,0,700,600);// 11,53,700,500 | |
467 | can2->SetHighLightColor(2); | |
468 | gStyle->SetOptFit(0111); | |
469 | can2->SetFillColor(0);//10 | |
470 | can2->SetBorderMode(0); | |
471 | can2->SetBorderSize(2); | |
472 | can2->SetFrameFillColor(0); | |
473 | can2->SetFrameBorderMode(0); | |
474 | can2->SetFrameBorderMode(0); | |
475 | ||
476 | TPad *pad2 = new TPad("pad2","pad2",0.0,0.0,1.,1.); | |
477 | gPad->SetTickx(); | |
478 | gPad->SetTicky(); | |
479 | pad2->SetTopMargin(0.0);//0.05 | |
480 | pad2->SetRightMargin(0.0);//1e-2 | |
481 | pad2->SetBottomMargin(0.0);//0.12 | |
482 | pad2->Draw(); | |
483 | pad2->cd(1); | |
484 | gPad->SetLeftMargin(0.14); gPad->SetRightMargin(0.04); | |
485 | gPad->SetTopMargin(0.03); gPad->SetBottomMargin(0.14); | |
486 | TLegend *legend2 = new TLegend(.55,.75, .95,.95,NULL,"brNDC");//.45 or .4 for x1 | |
487 | legend2->SetBorderSize(0); | |
488 | legend2->SetFillColor(0); | |
489 | legend2->SetTextFont(TextFont); | |
490 | legend2->SetTextSize(SizeLegend); | |
491 | ||
492 | ||
493 | //TH1D *chi2_PointSize_3 = new TH1D("chi2_PointSize_3","",40,-0.5,39.5); | |
494 | //TH1D *chi2_FullSize_3 = new TH1D("chi2_FullSize_3","",40,-0.5,39.5); | |
495 | TH1D *chi2_PointSize_3 = new TH1D("chi2_PointSize_3","",100,-0.5,99.5); | |
496 | TH1D *chi2_FullSize_3 = new TH1D("chi2_FullSize_3","",100,-0.5,99.5); | |
497 | chi2_PointSize_3->SetLineColor(4); chi2_FullSize_3->SetLineColor(2); | |
498 | chi2_PointSize_3->SetMarkerColor(4); chi2_FullSize_3->SetMarkerColor(2); | |
499 | chi2_PointSize_3->GetXaxis()->SetTitle("Coherent fraction (%)"); chi2_PointSize_3->GetYaxis()->SetTitle("#sqrt{#chi^{2}}"); | |
500 | chi2_PointSize_3->GetXaxis()->SetTitleSize(SizeTitle); chi2_PointSize_3->GetYaxis()->SetTitleSize(SizeTitle); | |
501 | chi2_PointSize_3->GetXaxis()->SetLabelSize(SizeLabel); chi2_PointSize_3->GetYaxis()->SetLabelSize(SizeLabel); | |
502 | TH2D *chi2_2D_3 = new TH2D("chi2_2D_3","",5,0.5,5.5, 100,-0.5,99.5); | |
503 | ||
504 | TH1D *tempDen = (TH1D*)C3QSBuiltmerged2D[KTBin][MBOI]->ProjectionY("TPFullWeight3_Den", 4, 4); | |
505 | TH1D *tempDenNeg = (TH1D*)C3QSNegBuiltmerged2D[KTBin][MBOI]->ProjectionY("TPNegFullWeight3_Den", 4, 4); | |
506 | tempDen->Add(tempDenNeg);// Add Pos and Neg Den | |
507 | ||
508 | for(int binG=5; binG<=104; binG++){// 44 | |
509 | TString *proName=new TString("TPFullWeight3_"); | |
510 | *proName += binG; | |
511 | TH1D *tempNum = (TH1D*)C3QSBuiltmerged2D[KTBin][MBOI]->ProjectionY(proName->Data(), binG, binG); | |
512 | proName->Append("_Neg"); | |
513 | TH1D *tempNumNeg = (TH1D*)C3QSNegBuiltmerged2D[KTBin][MBOI]->ProjectionY(proName->Data(), binG, binG); | |
514 | // | |
515 | // Add Pos and Neg Num | |
516 | tempNum->Add(tempNumNeg); | |
517 | // | |
518 | tempNum->Add(tempDen); | |
519 | tempNum->Divide(tempDen); | |
520 | //lowBin = C3QS->GetXaxis()->FindBin(Cutoff_FullWeight_Q3[Mbin]); | |
521 | //highBin = C3QS->GetXaxis()->FindBin(Cutoff_FullWeight_Q3[Mbin]); | |
522 | //SF=C3QS->Integral(lowBin, highBin); | |
523 | //SF /= tempNum->Integral(lowBin, highBin); | |
524 | //tempNum->Scale(SF); | |
525 | ||
526 | double value = C3QSmerged[ChProdBOI][KTBin][MBOI]->GetBinContent(Q3binChi2) - tempNum->GetBinContent(Q3binChi2); | |
527 | double err = pow(C3QSmerged[ChProdBOI][KTBin][MBOI]->GetBinError(Q3binChi2),2);// stat | |
528 | err += pow(Syst_forChi2_3[Q3binChi2-1],2);// syst | |
529 | err = sqrt(err); | |
530 | if(err <=0) continue; | |
531 | double Chi2 = pow(value / err,2); | |
532 | // | |
533 | ||
534 | //if(binG<25) {chi2_PointSize_3->SetBinContent(1 + 2*(binG-5), sqrt(Chi2)); chi2_PointSize_3->SetBinError(1 + 2*(binG-5), 0.001);} | |
535 | //else {chi2_FullSize_3->SetBinContent(1 + 2*(binG-25), sqrt(Chi2)); chi2_FullSize_3->SetBinError(1 + 2*(binG-25), 0.001);} | |
536 | if(binG<55) {chi2_PointSize_3->SetBinContent(1 + 2*(binG-5), sqrt(Chi2)); chi2_PointSize_3->SetBinError(1 + 2*(binG-5), 0.001);} | |
537 | else {chi2_FullSize_3->SetBinContent(1 + 2*(binG-55), sqrt(Chi2)); chi2_FullSize_3->SetBinError(1 + 2*(binG-55), 0.001);} | |
538 | // | |
539 | Chi2=0; | |
540 | double NDF=0; | |
541 | for(int binQ3=2; binQ3<=5; binQ3++){ | |
542 | if(tempNum->GetBinContent(binQ3) <=0) continue; | |
543 | double value = C3QSmerged[ChProdBOI][KTBin][MBOI]->GetBinContent(binQ3) - tempNum->GetBinContent(binQ3); | |
544 | double err = pow(C3QSmerged[ChProdBOI][KTBin][MBOI]->GetBinError(binQ3),2);// stat | |
545 | err += pow(Syst_forChi2_3[binQ3-1],2);// syst | |
546 | err = sqrt(err); | |
547 | if(err <=0) continue; | |
548 | Chi2 = pow(value / err,2); | |
549 | // | |
550 | chi2_2D_3->SetBinContent(binQ3, binG-4, sqrt(Chi2)); | |
551 | } | |
552 | ||
553 | ||
554 | } | |
555 | chi2_PointSize_3->SetMarkerStyle(20); chi2_FullSize_3->SetMarkerStyle(20); | |
556 | chi2_PointSize_3->SetMinimum(0); chi2_PointSize_3->SetMaximum(13); | |
557 | chi2_PointSize_3->Draw(); | |
558 | chi2_FullSize_3->Draw("same"); | |
559 | TString *Q3binName = new TString("0.0"); | |
560 | *Q3binName += Q3binChi2-1; | |
561 | Q3binName->Append(" < #font[12]{Q_{3}} < 0.0"); | |
562 | *Q3binName += Q3binChi2; | |
563 | Q3binName->Append(" GeV/#font[12]{c}"); | |
564 | legend2->SetHeader(Q3binName->Data()); | |
565 | legend2->AddEntry(chi2_PointSize_3,"R_{coh}=0","p"); | |
566 | legend2->AddEntry(chi2_FullSize_3,"R_{coh}=R_{ch}","p"); | |
567 | legend2->Draw("same"); | |
568 | ||
569 | TString *meanpTName3 = new TString("#LT #font[12]{p}_{T} #GT = 0."); | |
570 | *meanpTName3 += Q3_meanpT[KTBin][Q3binChi2-1]; | |
571 | meanpTName3->Append(" GeV/#font[12]{c}"); | |
572 | TLatex *Specif_pT3 = new TLatex(0.15,0.9,meanpTName3->Data()); | |
573 | Specif_pT3->SetNDC(); | |
574 | Specif_pT3->SetTextFont(TextFont); | |
575 | Specif_pT3->SetTextSize(SizeSpecif); | |
576 | Specif_pT3->Draw("same"); | |
577 | ||
578 | TString *SaveNameChi2_3 = new TString("ChiSq_C3_bin"); | |
579 | *SaveNameChi2_3 += Q3binChi2; | |
580 | SaveNameChi2_3->Append("_K"); | |
581 | *SaveNameChi2_3 += KTBin; | |
582 | SaveNameChi2_3->Append("_M"); | |
583 | *SaveNameChi2_3 += MBOI; | |
584 | SaveNameChi2_3->Append(".eps"); | |
585 | //can2->SaveAs(SaveNameChi2_3->Data()); | |
586 | ||
587 | ||
588 | ||
589 | ||
590 | /////////////////////////////////////////////////////////////////////////// | |
591 | // G versus Q3 | |
592 | ||
593 | TCanvas *can2_2 = new TCanvas("can2_2", "can2_2",1300,0,700,600);// 11,53,700,500 | |
594 | can2_2->SetHighLightColor(2); | |
595 | gStyle->SetOptFit(0111); | |
596 | can2_2->SetFillColor(0);//10 | |
597 | can2_2->SetBorderMode(0); | |
598 | can2_2->SetBorderSize(2); | |
599 | can2_2->SetFrameFillColor(0); | |
600 | can2_2->SetFrameBorderMode(0); | |
601 | can2_2->SetFrameBorderMode(0); | |
602 | ||
603 | TPad *pad2_2 = new TPad("pad2_2","pad2_2",0.0,0.0,1.,1.); | |
604 | gPad->SetTickx(); | |
605 | gPad->SetTicky(); | |
606 | pad2_2->SetTopMargin(0.0);//0.05 | |
607 | pad2_2->SetRightMargin(0.0);//1e-2 | |
608 | pad2_2->SetBottomMargin(0.0);//0.12 | |
609 | pad2_2->Draw(); | |
610 | pad2_2->cd(1); | |
611 | gPad->SetLeftMargin(0.14); gPad->SetRightMargin(0.04); | |
612 | gPad->SetTopMargin(0.03); gPad->SetBottomMargin(0.14); | |
613 | TLegend *legend2_2 = new TLegend(.15,.15, .35,.35,NULL,"brNDC");//.45 or .4 for x1 | |
614 | legend2_2->SetBorderSize(0); | |
615 | legend2_2->SetFillColor(0); | |
616 | legend2_2->SetTextFont(TextFont); | |
617 | legend2_2->SetTextSize(SizeLegend); | |
618 | ||
619 | TH1D *GversusQ3_Point = new TH1D("GversusQ3_Point","",5,0,0.05); | |
620 | TH1D *GversusQ3_Full = new TH1D("GversusQ3_Full","",5,0,0.05); | |
621 | for(int binQ3=2; binQ3<=5; binQ3++){ | |
622 | double minG = 0; | |
623 | double minG_e1=0, minG_e2=0; | |
624 | double minChi=100; | |
625 | // Point Source | |
626 | for(int binG=1; binG<=50; binG++){// min | |
627 | if(minChi > chi2_2D_3->GetBinContent(binQ3, binG)) { | |
628 | minChi = chi2_2D_3->GetBinContent(binQ3, binG); | |
629 | minG = 2*(binG-1); | |
630 | } | |
631 | } | |
632 | //cout<<binQ3<<" "<<minChi<<" "<<minG<<endl; | |
633 | for(int binG=1; binG<=50; binG++){// error | |
634 | if(minG > 0) { | |
635 | if(fabs(minChi - chi2_2D_3->GetBinContent(binQ3, binG)) < 1.) { | |
636 | if(minG>2*(binG-1)) minG_e1 = fabs(minG - 2*(binG-1)); | |
637 | else minG_e2 = fabs(minG - 2*(binG-1)); | |
638 | } | |
639 | }else{ | |
640 | if(fabs(minChi - chi2_2D_3->GetBinContent(binQ3, binG)) < 1.) { | |
641 | minG_e1 = fabs(minG - 2*(binG-1)); | |
642 | } | |
643 | } | |
644 | } | |
645 | GversusQ3_Point->SetBinContent(binQ3, minG); | |
646 | if(minG_e1 > minG_e2) GversusQ3_Point->SetBinError(binQ3, minG_e1); | |
647 | else GversusQ3_Point->SetBinError(binQ3, minG_e2); | |
648 | // | |
649 | // Full Source | |
650 | minG = 0; | |
651 | minG_e1 = 0, minG_e2=0; | |
652 | minChi=100; | |
653 | for(int binG=51; binG<=100; binG++){// min | |
654 | if(minChi > chi2_2D_3->GetBinContent(binQ3, binG)) { | |
655 | minChi = chi2_2D_3->GetBinContent(binQ3, binG); | |
656 | minG = 2*(binG-51); | |
657 | } | |
658 | } | |
659 | for(int binG=51; binG<=100; binG++){// error | |
660 | if(minG > 0) { | |
661 | if(fabs(minChi - chi2_2D_3->GetBinContent(binQ3, binG)) < 1.) { | |
662 | if(minG>2*(binG-51)) minG_e1 = fabs(minG - 2*(binG-51)); | |
663 | else minG_e2 = fabs(minG - 2*(binG-51)); | |
664 | } | |
665 | }else{ | |
666 | if(fabs(minChi - chi2_2D_3->GetBinContent(binQ3, binG)) < 1.) { | |
667 | minG_e1 = fabs(minG - 2*(binG-51)); | |
668 | } | |
669 | } | |
670 | } | |
671 | //cout<<binQ3<<" "<<minG<<" "<<minG_e<<endl; | |
672 | GversusQ3_Full->SetBinContent(binQ3, minG); | |
673 | if(minG_e1 > minG_e2) GversusQ3_Full->SetBinError(binQ3, minG_e1); | |
674 | else GversusQ3_Full->SetBinError(binQ3, minG_e2); | |
675 | } | |
676 | // | |
677 | GversusQ3_Point->SetMarkerStyle(20); GversusQ3_Point->SetMarkerColor(4); GversusQ3_Point->SetLineColor(4); | |
678 | GversusQ3_Full->SetMarkerStyle(20); GversusQ3_Full->SetMarkerColor(2); GversusQ3_Full->SetLineColor(2); | |
679 | GversusQ3_Point->SetMinimum(0); GversusQ3_Point->SetMaximum(80); | |
680 | GversusQ3_Point->GetXaxis()->SetTitle("#font[12]{Q_{3}} (GeV/#font[12]{c})"); GversusQ3_Point->GetYaxis()->SetTitle("Coherent fraction (%)"); | |
681 | GversusQ3_Point->GetXaxis()->SetTitleSize(SizeTitle); GversusQ3_Point->GetYaxis()->SetTitleSize(SizeTitle); | |
682 | GversusQ3_Point->GetXaxis()->SetLabelSize(SizeLabel); GversusQ3_Point->GetYaxis()->SetLabelSize(SizeLabel); | |
683 | GversusQ3_Point->GetXaxis()->SetNdivisions(404); GversusQ3_Point->GetYaxis()->SetNdivisions(505); | |
684 | GversusQ3_Point->Draw(); | |
685 | GversusQ3_Full->Draw("same"); | |
686 | // | |
687 | legend2_2->AddEntry(GversusQ3_Point,"R_{coh}=0","p"); | |
688 | legend2_2->AddEntry(GversusQ3_Full,"R_{coh}=R_{ch}","p"); | |
689 | legend2_2->Draw("same"); | |
690 | ||
691 | ||
692 | } | |
693 | }// ChProdBOI!=2 | |
694 | ||
695 | ||
696 | ||
697 | ||
698 | ////////////////////////////////////////////////////////////////////////// | |
699 | // 4-pion | |
700 | TCanvas *can3 = new TCanvas("can3", "can3",10,700,700,600);// 11,53,700,500 | |
701 | can3->SetHighLightColor(2); | |
702 | gStyle->SetOptFit(0111); | |
703 | can3->SetFillColor(0);//10 | |
704 | can3->SetBorderMode(0); | |
705 | can3->SetBorderSize(2); | |
706 | can3->SetFrameFillColor(0); | |
707 | can3->SetFrameBorderMode(0); | |
708 | can3->SetFrameBorderMode(0); | |
709 | ||
710 | TPad *pad3 = new TPad("pad3","pad3",0.0,0.0,1.,1.); | |
711 | //gPad->SetGridx(1); | |
712 | //gPad->SetGridy(1); | |
713 | gPad->SetTickx(); | |
714 | gPad->SetTicky(); | |
715 | pad3->SetTopMargin(0.0);//0.05 | |
716 | pad3->SetRightMargin(0.0);//1e-2 | |
717 | pad3->SetBottomMargin(0.0);//0.12 | |
718 | pad3->Draw(); | |
719 | pad3->cd(1); | |
720 | gPad->SetLeftMargin(0.14); gPad->SetRightMargin(0.04); | |
721 | gPad->SetTopMargin(0.03); gPad->SetBottomMargin(0.14); | |
722 | ||
723 | TLegend *legend3 = new TLegend(.45,.4, .85,.8,NULL,"brNDC");//.45 or .4 for x1 | |
724 | legend3->SetBorderSize(0); | |
725 | legend3->SetFillColor(0); | |
726 | legend3->SetTextFont(TextFont); | |
727 | legend3->SetTextSize(SizeLegend); | |
728 | ||
729 | ||
730 | C4QSmerged[ChProdBOI][KTBin][MBOI]->GetXaxis()->SetTitleSize(SizeTitle); | |
731 | C4QSmerged[ChProdBOI][KTBin][MBOI]->GetXaxis()->SetLabelSize(SizeLabel); | |
732 | C4QSmerged[ChProdBOI][KTBin][MBOI]->GetYaxis()->SetTitleSize(SizeTitle); | |
733 | C4QSmerged[ChProdBOI][KTBin][MBOI]->GetYaxis()->SetLabelSize(SizeLabel); | |
734 | C4QSmerged[ChProdBOI][KTBin][MBOI]->GetXaxis()->SetTitleOffset(1.05); | |
735 | C4QSmerged[ChProdBOI][KTBin][MBOI]->GetYaxis()->SetTitleOffset(1.1); | |
736 | C4QSmerged[ChProdBOI][KTBin][MBOI]->GetXaxis()->SetNdivisions(606); | |
737 | C4QSmerged[ChProdBOI][KTBin][MBOI]->GetYaxis()->SetNdivisions(505); | |
738 | // | |
739 | TString *proName4=new TString("C4QSbuilt_G"); TString *proNameNeg4=new TString("C4QSNegbuilt_G"); | |
740 | TH1D *C4QSbuilt_G = (TH1D*)C4QSBuiltmerged2D[KTBin][MBOI]->ProjectionY(proName4->Data(), GbinPlot, GbinPlot); | |
741 | TH1D *C4QSNegbuilt_G = (TH1D*)C4QSNegBuiltmerged2D[KTBin][MBOI]->ProjectionY(proNameNeg4->Data(), GbinPlot, GbinPlot); | |
742 | proName4->Append("_FullWeightDen"); proNameNeg4->Append("_FullWeightDen"); | |
743 | TH1D *tempDen4 = (TH1D*)C4QSBuiltmerged2D[KTBin][MBOI]->ProjectionY(proName4->Data(), 4, 4); | |
744 | TH1D *tempDenNeg4 = (TH1D*)C4QSNegBuiltmerged2D[KTBin][MBOI]->ProjectionY(proNameNeg4->Data(), 4, 4); | |
745 | // Add Pos with Neg weights | |
746 | tempDen4->Add(tempDenNeg4); | |
747 | C4QSbuilt_G->Add(C4QSNegbuilt_G); | |
748 | // | |
749 | C4QSbuilt_G->Add(tempDen4); | |
750 | C4QSbuilt_G->Divide(tempDen4); | |
751 | C4QSbuilt_G->SetLineColor(2); | |
752 | // | |
753 | ||
754 | C4QSmerged[ChProdBOI][KTBin][MBOI]->SetMaximum(8.8); | |
755 | C4QSBuiltmerged[KTBin][MBOI]->GetXaxis()->SetRange(3,15); | |
756 | C4QSbuilt_G->GetXaxis()->SetRange(3,15); | |
757 | // | |
758 | //TH1D *C4QS_Syst = new TH1D("C4QS_Syst","",200,0.,0.2); | |
759 | //TH1D *C4QSBuilt_Syst = new TH1D("C4QSBuilt_Syst","",200,0.,0.2); | |
760 | TH1D *C4QS_Syst = (TH1D*)C4QSmerged[ChProdBOI][KTBin][MBOI]->Clone(); | |
761 | TH1D *C4QSBuilt_Syst = (TH1D*)C4QSBuiltmerged[KTBin][MBOI]->Clone(); | |
762 | ||
763 | for(int bin=1; bin<=C4QS_Syst->GetNbinsX(); bin++){ | |
764 | double q4 = C4QS_Syst->GetXaxis()->GetBinCenter(bin); | |
765 | C4QS_Syst->SetBinContent(bin, 8.); | |
766 | double syst1 = pow(0.001,2);// cc | |
767 | syst1 += pow(0.004 - 0.004*q4/0.18,2);// 11h to 10h | |
768 | syst1 += pow(0.9975 - 0.09*q4 - 1,2);// f coefficients, r*<70 | |
769 | syst1 += pow(0.9814 + 0.2471*q4 - 0.8312*q4*q4 - 1,2);// MRC | |
770 | syst1 += pow(0.9635 + 0.3475*q4 - 0.9729*q4*q4 - 1,2);// Muon, 92% | |
771 | syst1 += pow(0.900 + 1.126*q4 - 3.354*q4*q4 - 1,2);// fc2 scale | |
772 | syst1 += pow(0.125*exp(-61.38*q4),2);// K factorization | |
773 | syst1 = sqrt(syst1); | |
774 | syst1 *= C4QSmerged[ChProdBOI][KTBin][MBOI]->GetBinContent(bin); | |
775 | C4QS_Syst->SetBinError(bin, syst1); | |
776 | // Built | |
777 | C4QSBuilt_Syst->SetBinContent(bin, 8.); | |
778 | double syst2 = pow(0.004 - 0.004*q4/0.18,2);// 11h to 10h | |
779 | syst2 += pow(0.9793 + 0.2857*q4 - 0.9888*q4*q4 - 1,2);// MRC | |
780 | syst2 += pow(0.9725 + 0.2991*q4 - 0.8058*q4*q4 - 1,2);// Muon, 92% | |
781 | syst2 += pow(0.905 + 1.03*q4 - 2.977*q4*q4 - 1,2);// fc2 scale | |
782 | syst2 += pow(0.0379*exp(-42.82*q4),2);// Interpolator | |
783 | syst2 = sqrt(syst2); | |
784 | syst2 *= C4QSBuiltmerged[KTBin][MBOI]->GetBinContent(bin); | |
785 | C4QSBuilt_Syst->SetBinError(bin, syst2); | |
786 | } | |
787 | C4QS_Syst->SetBinContent(2,100); C4QSBuilt_Syst->SetBinContent(2,100); | |
788 | C4QS_Syst->SetMarkerSize(0); C4QS_Syst->SetFillColor(kBlue-10); | |
789 | C4QS_Syst->SetMarkerColor(kBlue-10); | |
790 | C4QSBuilt_Syst->SetMarkerSize(0); C4QSBuilt_Syst->SetFillColor(1); //C4QSBuilt_Syst->SetFillStyle(3004); | |
791 | C4QSBuilt_Syst->SetMarkerColor(1); | |
792 | C4QS_Syst->GetXaxis()->SetRangeUser(0.03,0.2); C4QSBuilt_Syst->GetXaxis()->SetRangeUser(0.03,0.2); | |
793 | double Syst_forChi2_4[15]={0}; | |
794 | for(int bin=1; bin<=15; bin++){ | |
795 | double q4 = C4QSmerged[ChProdBOI][KTBin][MBOI]->GetXaxis()->GetBinCenter(bin); | |
796 | int SystBin = C4QSBuilt_Syst->GetXaxis()->FindBin(q4); | |
797 | //Syst_forChi2_4[bin-1] = fabs(C4QS_Syst->GetBinError(SystBin) - C4QSBuilt_Syst->GetBinError(SystBin)); | |
798 | double SystPercent_Diff = sqrt(pow(0.125*exp(-61.38*q4),2) + pow(0.9975 - 0.09*q4 - 1,2) + pow(0.0379*exp(-42.82*q4),2));// K, f coefficients, Interpolator | |
799 | Syst_forChi2_4[bin-1] = SystPercent_Diff * C4QSmerged[ChProdBOI][KTBin][MBOI]->GetBinContent(bin); | |
800 | } | |
801 | // | |
802 | /*for(int bin=1; bin<=C4QSmerged[ChProdBOI][KTBin][MBOI]->GetNbinsX(); bin++){ | |
803 | C4QSmerged[ChProdBOI][KTBin][MBOI]->SetBinContent(bin, fabs(C4QSmerged[ChProdBOI][KTBin][MBOI]->GetBinContent(bin) - 1)); | |
804 | C4QSBuiltmerged[KTBin][MBOI]->SetBinContent(bin, fabs(C4QSBuiltmerged[KTBin][MBOI]->GetBinContent(bin) - 1)); | |
805 | }*/ | |
806 | C4QSmerged[ChProdBOI][KTBin][MBOI]->SetBinContent(1,100); C4QSmerged[ChProdBOI][KTBin][MBOI]->SetBinError(1,100); | |
807 | C4QSmerged[ChProdBOI][KTBin][MBOI]->Draw(); | |
808 | C4QS_Syst->Draw("E2 same"); | |
809 | C4QSBuilt_Syst->Draw("E1 same"); | |
810 | C4QSmerged[ChProdBOI][KTBin][MBOI]->Draw("same"); | |
811 | ||
812 | c4QSstage1merged[ChProdBOI][KTBin][MBOI]->Draw("same"); | |
813 | if(ChProdBOI==0) c4QSstage2merged[KTBin][MBOI]->Draw("same"); | |
814 | c4QSmerged[ChProdBOI][KTBin][MBOI]->Draw("same"); | |
815 | C4QSBuiltmerged[KTBin][MBOI]->SetLineWidth(1.2); | |
816 | if(ChProdBOI==0) C4QSBuiltmerged[KTBin][MBOI]->Draw("same"); | |
817 | ||
818 | if(ChProdBOI==0) C4QSbuilt_G->Draw("same"); | |
819 | ||
820 | legend3->AddEntry(C4QSmerged[ChProdBOI][KTBin][MBOI],"#font[12]{C}_{4}^{QS}","p"); | |
821 | legend3->AddEntry(c4QSstage1merged[ChProdBOI][KTBin][MBOI],"#font[12]{#bf{c}}_{4}^{QS} 2-pion removal","p"); | |
822 | if(ChProdBOI==0) legend3->AddEntry(c4QSstage2merged[KTBin][MBOI],"#font[12]{#bf{c}}_{4}^{QS} 2-pion + 2-pair removal","p"); | |
823 | legend3->AddEntry(c4QSmerged[ChProdBOI][KTBin][MBOI],"#font[12]{#bf{c}}_{4}^{QS}","p"); | |
824 | if(ChProdBOI==0) legend3->AddEntry(C4QSBuiltmerged[KTBin][MBOI],"Built #font[12]{C}_{4}^{QS} (G=0%)","l"); | |
825 | if(ChProdBOI==0) legend3->AddEntry(C4QSbuilt_G,"Built #font[12]{C}_{4}^{QS} (G=34%, R_{coh}=R_{ch})","l"); | |
826 | legend3->Draw("same"); | |
827 | ||
828 | /*TF1 *Gauss_c4Fit=new TF1("Gauss_c4Fit","[0]*(1+[1]*exp(-pow(x*[2]/0.19733,2)/3.))",0,1); | |
829 | Gauss_c4Fit->SetParameter(0,1); Gauss_c4Fit->SetParameter(1,3); Gauss_c4Fit->SetParameter(2,8); | |
830 | Gauss_c4Fit->SetParName(0,"N"); Gauss_c4Fit->SetParName(1,"#lambda_{4}"); Gauss_c4Fit->SetParName(2,"R"); | |
831 | c4QSmerged[ChProdBOI][KTBin][MBOI]->Fit(Gauss_c4Fit,"IME","",0.03,0.14); | |
832 | Gauss_c4Fit->Draw("same");*/ | |
833 | ||
834 | // hight KT4 reference | |
835 | double y_ref[12]={0, 0, 1.00133, 0.980848, 0.988251, 0.994434, 0.999677, 1.00269, 1.00642, 1.00881, 1.01082, 1.01554}; | |
836 | double y_ref_e[12]={0, 0, 0.054465, 0.00678447, 0.00194947, 0.000799564, 0.00039767, 0.000222628, 0.000135335, 8.75305e-05, 6.31392e-05, 5.53329e-05}; | |
837 | ||
838 | TH1D *Ratio=(TH1D*)C4QSmerged[ChProdBOI][KTBin][MBOI]->Clone(); | |
839 | Ratio->Divide(C4QSBuiltmerged[KTBin][MBOI]); | |
840 | Ratio->GetYaxis()->SetTitle("#font[12]{C_{4}^{QS}} / #font[12]{C_{4}^{QS}}(built)"); | |
841 | Ratio->SetMinimum(0.85); Ratio->SetMaximum(1.05); | |
842 | TH1D *DoubleRatio =(TH1D*)Ratio->Clone(); | |
843 | DoubleRatio->GetYaxis()->SetTitle("Low K_{T,4} ratio / High K_{T,4} ratio"); | |
844 | ||
845 | for(int bin=1; bin<=12; bin++){ | |
846 | if(y_ref[bin-1]==0) continue; | |
847 | double value = Ratio->GetBinContent(bin) / y_ref[bin-1]; | |
848 | double value_e = sqrt(pow(Ratio->GetBinError(bin) / y_ref[bin-1],2) + pow(y_ref_e[bin-1]*Ratio->GetBinContent(bin) /y_ref[bin-1]/y_ref[bin-1],2)); | |
849 | DoubleRatio->SetBinContent(bin, value); | |
850 | DoubleRatio->SetBinError(bin, value_e); | |
851 | } | |
852 | //Ratio->Draw(); | |
853 | //DoubleRatio->Draw(); | |
854 | ||
855 | //for(int bin=1; bin<=12; bin++) cout<<Ratio->GetBinContent(bin)<<", "; | |
856 | //cout<<endl; | |
857 | //for(int bin=1; bin<=12; bin++) cout<<Ratio->GetBinError(bin)<<", "; | |
858 | //cout<<endl; | |
859 | ||
860 | Unity->Draw("same"); | |
861 | ||
862 | ||
863 | if(ChProdBOI==0){// chi2 | |
864 | TCanvas *can4 = new TCanvas("can4", "can4",800,700,700,600);// 11,53,700,500 | |
865 | can4->SetHighLightColor(2); | |
866 | gStyle->SetOptFit(0111); | |
867 | can4->SetFillColor(0);//10 | |
868 | can4->SetBorderMode(0); | |
869 | can4->SetBorderSize(2); | |
870 | can4->SetFrameFillColor(0); | |
871 | can4->SetFrameBorderMode(0); | |
872 | can4->SetFrameBorderMode(0); | |
873 | ||
874 | TPad *pad4 = new TPad("pad4","pad4",0.0,0.0,1.,1.); | |
875 | gPad->SetTickx(); | |
876 | gPad->SetTicky(); | |
877 | pad4->SetTopMargin(0.0);//0.05 | |
878 | pad4->SetRightMargin(0.0);//1e-2 | |
879 | pad4->SetBottomMargin(0.0);//0.12 | |
880 | pad4->Draw(); | |
881 | pad4->cd(1); | |
882 | gPad->SetLeftMargin(0.14); gPad->SetRightMargin(0.04); | |
883 | gPad->SetTopMargin(0.03); gPad->SetBottomMargin(0.14); | |
884 | ||
885 | TLegend *legend4 = new TLegend(.15,.65, .4,.85,NULL,"brNDC");//.45 or .4 for x1 | |
886 | legend4->SetBorderSize(0); | |
887 | legend4->SetFillColor(0); | |
888 | legend4->SetTextFont(TextFont); | |
889 | legend4->SetTextSize(SizeLegend); | |
890 | ||
891 | //TH1D *chi2_PointSize_4 = new TH1D("chi2_PointSize_4","",40,-0.5,39.5); | |
892 | //TH1D *chi2_FullSize_4 = new TH1D("chi2_FullSize_4","",40,-0.5,39.5); | |
893 | TH1D *chi2_PointSize_4 = new TH1D("chi2_PointSize_4","",100,-0.5,99.5); | |
894 | TH1D *chi2_FullSize_4 = new TH1D("chi2_FullSize_4","",100,-0.5,99.5); | |
895 | chi2_PointSize_4->SetLineColor(4); chi2_FullSize_4->SetLineColor(2); | |
896 | chi2_PointSize_4->SetMarkerColor(4); chi2_FullSize_4->SetMarkerColor(2); | |
897 | chi2_PointSize_4->GetXaxis()->SetTitle("Coherent fraction (%)"); chi2_PointSize_4->GetYaxis()->SetTitle("#sqrt{#chi^{2}}"); | |
898 | chi2_PointSize_4->GetXaxis()->SetTitleSize(SizeTitle); chi2_PointSize_4->GetYaxis()->SetTitleSize(SizeTitle); | |
899 | chi2_PointSize_4->GetXaxis()->SetLabelSize(SizeLabel); chi2_PointSize_4->GetYaxis()->SetLabelSize(SizeLabel); | |
900 | chi2_PointSize_4->GetYaxis()->SetNdivisions(505); | |
901 | TH2D *chi2_2D_4 = new TH2D("chi2_2D_4","",7,0.5,7.5, 100,-0.5,99.5); | |
902 | ||
903 | ||
904 | TH1D *tempDen = (TH1D*)C4QSBuiltmerged2D[KTBin][MBOI]->ProjectionY("TPFullWeight4_Den", 4, 4); | |
905 | TH1D *tempDenNeg = (TH1D*)C4QSNegBuiltmerged2D[KTBin][MBOI]->ProjectionY("TPNegFullWeight4_Den", 4, 4); | |
906 | tempDen->Add(tempDenNeg);// Add Pos and Neg Weight | |
907 | ||
908 | for(int binG=5; binG<=104; binG++){// 44 | |
909 | TString *proName=new TString("TPFullWeight4_"); | |
910 | *proName += binG; | |
911 | TH1D *tempNum = (TH1D*)C4QSBuiltmerged2D[KTBin][MBOI]->ProjectionY(proName->Data(), binG, binG); | |
912 | proName->Append("_Neg"); | |
913 | TH1D *tempNumNeg = (TH1D*)C4QSNegBuiltmerged2D[KTBin][MBOI]->ProjectionY(proName->Data(), binG, binG); | |
914 | // | |
915 | // Add Pos and Neg Weights | |
916 | tempNum->Add(tempNumNeg); | |
917 | // | |
918 | tempNum->Add(tempDen); | |
919 | tempNum->Divide(tempDen); | |
920 | //lowBin = C4QS->GetXaxis()->FindBin(Cutoff_FullWeight_Q4[Mbin]); | |
921 | //highBin = C4QS->GetXaxis()->FindBin(Cutoff_FullWeight_Q4[Mbin]); | |
922 | //SF=C4QS->Integral(lowBin, highBin); | |
923 | //SF /= tempNum->Integral(lowBin, highBin); | |
924 | //tempNum->Scale(SF); | |
925 | ||
926 | ||
927 | if(tempNum->GetBinContent(Q4binChi2) <=0) continue; | |
928 | double value = C4QSmerged[ChProdBOI][KTBin][MBOI]->GetBinContent(Q4binChi2) - tempNum->GetBinContent(Q4binChi2); | |
929 | double err = pow(C4QSmerged[ChProdBOI][KTBin][MBOI]->GetBinError(Q4binChi2),2); | |
930 | err += pow(Syst_forChi2_4[Q4binChi2-1],2); | |
931 | err = sqrt(err); | |
932 | if(err<=0) continue; | |
933 | double Chi2 = pow(value / err,2); | |
934 | // | |
935 | ||
936 | //if(binG<25) {chi2_PointSize_4->SetBinContent(1 + 2*(binG-5), sqrt(fabs(Chi2))); chi2_PointSize_4->SetBinError(1 + 2*(binG-5), 0.001);} | |
937 | //else {chi2_FullSize_4->SetBinContent(1 + 2*(binG-25), sqrt(fabs(Chi2))); chi2_FullSize_4->SetBinError(1 + 2*(binG-25), 0.001);} | |
938 | if(binG<55) {chi2_PointSize_4->SetBinContent(1 + 2*(binG-5), sqrt(fabs(Chi2))); chi2_PointSize_4->SetBinError(1 + 2*(binG-5), 0.001);} | |
939 | else {chi2_FullSize_4->SetBinContent(1 + 2*(binG-55), sqrt(fabs(Chi2))); chi2_FullSize_4->SetBinError(1 + 2*(binG-55), 0.001);} | |
940 | // | |
941 | ||
942 | for(int binQ4=3; binQ4<=7; binQ4++){ | |
943 | if(tempNum->GetBinContent(binQ4) <=0) continue; | |
944 | double value = C4QSmerged[ChProdBOI][KTBin][MBOI]->GetBinContent(binQ4) - tempNum->GetBinContent(binQ4); | |
945 | double err = pow(C4QSmerged[ChProdBOI][KTBin][MBOI]->GetBinError(binQ4),2); | |
946 | err += pow(Syst_forChi2_4[binQ4-1],2); | |
947 | err = sqrt(err); | |
948 | if(err<=0) continue; | |
949 | Chi2 = pow(value / err,2); | |
950 | // | |
951 | chi2_2D_4->SetBinContent(binQ4, binG-4, sqrt(fabs(Chi2))); | |
952 | } | |
953 | ||
954 | } | |
955 | chi2_PointSize_4->SetMarkerStyle(20); chi2_FullSize_4->SetMarkerStyle(20); | |
956 | chi2_PointSize_4->SetMinimum(0); chi2_PointSize_4->SetMaximum(13); | |
957 | ||
958 | TString *Q4binName = new TString("0.0"); | |
959 | ||
960 | if(int((Q4binChi2-1)*1.5*10)%10 == 0) *Q4binName += int((Q4binChi2-1)*1.5); | |
961 | else {*Q4binName += int((Q4binChi2-1)*1.5); *Q4binName += 5;} | |
962 | Q4binName->Append(" < #font[12]{Q_{4}} < 0.0"); | |
963 | if(int((Q4binChi2)*1.5*10)%10 == 0) *Q4binName += int((Q4binChi2)*1.5); | |
964 | else {*Q4binName += int((Q4binChi2)*1.5); *Q4binName += 5;} | |
965 | Q4binName->Append(" GeV/#font[12]{c}"); | |
966 | legend4->SetHeader(Q4binName->Data()); | |
967 | chi2_PointSize_4->Draw(); | |
968 | chi2_FullSize_4->Draw("same"); | |
969 | legend4->AddEntry(chi2_PointSize_4,"R_{coh}=0","p"); | |
970 | legend4->AddEntry(chi2_FullSize_4,"R_{coh}=R_{ch}","p"); | |
971 | legend4->Draw("same"); | |
972 | ||
973 | TString *meanpTName = new TString("#LT #font[12]{p}_{T} #GT = 0."); | |
974 | *meanpTName += Q4_meanpT[KTBin][Q4binChi2-1]; | |
975 | meanpTName->Append(" GeV/#font[12]{c}"); | |
976 | TLatex *Specif_pT = new TLatex(0.15,0.9,meanpTName->Data()); | |
977 | Specif_pT->SetNDC(); | |
978 | Specif_pT->SetTextFont(TextFont); | |
979 | Specif_pT->SetTextSize(SizeSpecif); | |
980 | Specif_pT->Draw("same"); | |
981 | ||
982 | ||
983 | TString *SaveNameChi2_4 = new TString("ChiSq_C4_bin"); | |
984 | *SaveNameChi2_4 += Q4binChi2; | |
985 | SaveNameChi2_4->Append("_K"); | |
986 | *SaveNameChi2_4 += KTBin; | |
987 | SaveNameChi2_4->Append("_M"); | |
988 | *SaveNameChi2_4 += MBOI; | |
989 | SaveNameChi2_4->Append(".eps"); | |
990 | //can4->SaveAs(SaveNameChi2_4->Data()); | |
991 | ||
992 | ||
993 | ||
994 | ||
995 | /////////////////////////////////////////////////////////////////////////// | |
996 | // G versus Q4 | |
997 | ||
998 | TCanvas *can5 = new TCanvas("can5", "can5",1300,700,700,600);// 11,53,700,500 | |
999 | can5->SetHighLightColor(2); | |
1000 | gStyle->SetOptFit(0111); | |
1001 | can5->SetFillColor(0);//10 | |
1002 | can5->SetBorderMode(0); | |
1003 | can5->SetBorderSize(2); | |
1004 | can5->SetFrameFillColor(0); | |
1005 | can5->SetFrameBorderMode(0); | |
1006 | can5->SetFrameBorderMode(0); | |
1007 | ||
1008 | TPad *pad5 = new TPad("pad5","pad5",0.0,0.0,1.,1.); | |
1009 | gPad->SetTickx(); | |
1010 | gPad->SetTicky(); | |
1011 | pad5->SetTopMargin(0.0);//0.05 | |
1012 | pad5->SetRightMargin(0.0);//1e-2 | |
1013 | pad5->SetBottomMargin(0.0);//0.12 | |
1014 | pad5->Draw(); | |
1015 | pad5->cd(1); | |
1016 | gPad->SetLeftMargin(0.14); gPad->SetRightMargin(0.04); | |
1017 | gPad->SetTopMargin(0.03); gPad->SetBottomMargin(0.14); | |
1018 | ||
1019 | TLegend *legend5 = new TLegend(.15,.75, .3,.95,NULL,"brNDC");//.45 or .4 for x1 | |
1020 | legend5->SetBorderSize(0); | |
1021 | legend5->SetFillColor(0); | |
1022 | legend5->SetTextFont(TextFont); | |
1023 | legend5->SetTextSize(SizeLegend); | |
1024 | ||
1025 | TH1D *GversusQ4_Point = new TH1D("GversusQ4_Point","",7,0,0.105); | |
1026 | TH1D *GversusQ4_Full = new TH1D("GversusQ4_Full","",7,0,0.105); | |
1027 | for(int binQ4=3; binQ4<=7; binQ4++){ | |
1028 | double minG = 0; | |
1029 | double minG_e1 = 0, minG_e2=0; | |
1030 | double minChi=100; | |
1031 | // Point Source | |
1032 | for(int binG=1; binG<=50; binG++){// min | |
1033 | if(minChi > chi2_2D_4->GetBinContent(binQ4, binG)) { | |
1034 | minChi = chi2_2D_4->GetBinContent(binQ4, binG); | |
1035 | minG = 2*(binG-1); | |
1036 | } | |
1037 | } | |
1038 | //cout<<binQ4<<" "<<minChi<<endl; | |
1039 | for(int binG=1; binG<=50; binG++){// error | |
1040 | if(minG > 0) { | |
1041 | if(fabs(minChi - chi2_2D_4->GetBinContent(binQ4, binG)) < 1.) { | |
1042 | if(minG>2*(binG-1)) minG_e1 = fabs(minG - 2*(binG-1)); | |
1043 | else minG_e2 = fabs(minG - 2*(binG-1)); | |
1044 | } | |
1045 | }else{ | |
1046 | if(fabs(minChi - chi2_2D_4->GetBinContent(binQ4, binG)) < 1.) { | |
1047 | minG_e1 = fabs(minG - 2*(binG-1)); | |
1048 | } | |
1049 | } | |
1050 | } | |
1051 | GversusQ4_Point->SetBinContent(binQ4, minG); | |
1052 | if(minG_e1>minG_e2) GversusQ4_Point->SetBinError(binQ4, minG_e1); | |
1053 | else GversusQ4_Point->SetBinError(binQ4, minG_e2); | |
1054 | // | |
1055 | // Full Source | |
1056 | minG = 0; | |
1057 | minG_e1 = 0, minG_e2=0; | |
1058 | minChi=100; | |
1059 | for(int binG=51; binG<=100; binG++){// min | |
1060 | if(minChi > chi2_2D_4->GetBinContent(binQ4, binG)) { | |
1061 | minChi = chi2_2D_4->GetBinContent(binQ4, binG); | |
1062 | minG = 2*(binG-51); | |
1063 | } | |
1064 | } | |
1065 | for(int binG=51; binG<=100; binG++){// error | |
1066 | if(minG > 0) { | |
1067 | if(fabs(minChi - chi2_2D_4->GetBinContent(binQ4, binG)) < 1.) { | |
1068 | if(minG>2*(binG-51)) minG_e1 = fabs(minG - 2*(binG-51)); | |
1069 | else minG_e2 = fabs(minG - 2*(binG-51)); | |
1070 | } | |
1071 | }else{ | |
1072 | if(fabs(minChi - chi2_2D_4->GetBinContent(binQ4, binG)) < 1.) { | |
1073 | minG_e1 = fabs(minG - 2*(binG-51)); | |
1074 | } | |
1075 | } | |
1076 | } | |
1077 | //cout<<binQ4<<" "<<minG<<" "<<minG_e<<endl; | |
1078 | GversusQ4_Full->SetBinContent(binQ4, minG); | |
1079 | if(minG_e1>minG_e2) GversusQ4_Full->SetBinError(binQ4, minG_e1); | |
1080 | else GversusQ4_Full->SetBinError(binQ4, minG_e2); | |
1081 | } | |
1082 | // | |
1083 | GversusQ4_Point->SetMarkerStyle(20); GversusQ4_Point->SetMarkerColor(4); GversusQ4_Point->SetLineColor(4); | |
1084 | GversusQ4_Full->SetMarkerStyle(20); GversusQ4_Full->SetMarkerColor(2); GversusQ4_Full->SetLineColor(2); | |
1085 | GversusQ4_Point->SetMinimum(0); GversusQ4_Point->SetMaximum(40); | |
1086 | GversusQ4_Point->GetXaxis()->SetTitle("#font[12]{Q_{4}} (GeV/#font[12]{c})"); GversusQ4_Point->GetYaxis()->SetTitle("Coherent fraction (%)"); | |
1087 | GversusQ4_Point->GetXaxis()->SetTitleSize(SizeTitle); GversusQ4_Point->GetYaxis()->SetTitleSize(SizeTitle); | |
1088 | GversusQ4_Point->GetXaxis()->SetLabelSize(SizeLabel); GversusQ4_Point->GetYaxis()->SetLabelSize(SizeLabel); | |
1089 | GversusQ4_Point->GetYaxis()->SetNdivisions(505); | |
1090 | GversusQ4_Point->Draw(); | |
1091 | GversusQ4_Full->Draw("same"); | |
1092 | // | |
1093 | legend5->AddEntry(GversusQ4_Point,"R_{coh}=0","p"); | |
1094 | legend5->AddEntry(GversusQ4_Full,"R_{coh}=R_{ch}","p"); | |
1095 | legend5->Draw("same"); | |
1096 | ||
1097 | } | |
1098 | ||
1099 | ||
1100 | ||
1101 | ||
1102 | ////////////////////////////////////////////////////////////////////////// | |
1103 | // r3 | |
1104 | /* TCanvas *can1 = new TCanvas("can1", "can1",10,0,600,600);// 11,53,700,500 | |
1105 | can1->SetHighLightColor(2); | |
1106 | gStyle->SetOptFit(0111); | |
1107 | can1->SetFillColor(0);//10 | |
1108 | can1->SetBorderMode(0); | |
1109 | can1->SetBorderSize(2); | |
1110 | can1->SetFrameFillColor(0); | |
1111 | can1->SetFrameBorderMode(0); | |
1112 | can1->SetFrameBorderMode(0); | |
1113 | ||
1114 | TPad *pad1 = new TPad("pad1","pad1",0.0,0.0,1.,1.); | |
1115 | gPad->SetGridx(1); | |
1116 | gPad->SetGridy(1); | |
1117 | gPad->SetTickx(); | |
1118 | gPad->SetTicky(); | |
1119 | pad1->SetTopMargin(0.02);//0.05 | |
1120 | pad1->SetRightMargin(0.01);//1e-2 | |
1121 | pad1->SetBottomMargin(0.07);//0.12 | |
1122 | pad1->Draw(); | |
1123 | pad1->cd(1); | |
1124 | gPad->SetLeftMargin(0.14); | |
1125 | gPad->SetRightMargin(0.03); | |
1126 | ||
1127 | r3merged[0]->SetMinimum(1.45); r3merged[0]->SetMaximum(2.45); | |
1128 | r3merged[1]->SetMarkerColor(2); r3merged[1]->SetLineColor(2); | |
1129 | //r3merged[0]->Draw(); | |
1130 | //r3merged[1]->Draw("same"); | |
1131 | // | |
1132 | r4merged[0]->SetMinimum(1.45); r4merged[0]->SetMaximum(10.45); | |
1133 | r4merged[1]->SetMarkerColor(2); r4merged[1]->SetLineColor(2); | |
1134 | r4merged[0]->Draw(); | |
1135 | r4merged[1]->Draw("same"); | |
1136 | */ | |
1137 | ||
1138 | } | |
1139 |