68 double step = (
int) (2.0/k * 10000.0 )/10000.0;
71 TGraph *ihres =
new TGraph(1);
72 ihres->SetMarkerStyle(20);
73 ihres->SetMarkerSize(1.5);
74 ihres->SetMarkerColor(kPink-2);
75 ihres->SetPoint(0, 1.99, 1.66);
77 TGraph *lores =
new TGraph(1);
78 lores->SetMarkerStyle(20);
79 lores->SetMarkerSize(1.5);
80 lores->SetMarkerColor(kPink-2);
81 lores->SetPoint(0, 1.99, 1.17);
83 for (
auto &hname:{
"ihrej",
"lorej"}){
86 c->SetLeftMargin(0.14);
87 c->SetBottomMargin(0.15);
89 if (
tag ==
"delta2025NHUO") up = 9.55;
90 string htitle =
";#delta_{CP} / #pi;#sqrt{LL_{IH}-LL_{NH}}";
91 if (hname ==
"lorej") htitle =
";#delta_{CP} / #pi;#sqrt{LL_{LO}-LL_{UO}}";
92 TH2F*
h =
new TH2F(
"", htitle.c_str(),
n, -.0166,step*(k+1)+0.0166, 100, 0, up);
93 h->GetXaxis()->CenterTitle();
94 h->GetYaxis()->CenterTitle();
99 h->GetXaxis()->SetTitleOffset(0.8);
100 h->GetYaxis()->SetTitleOffset(0.8);
102 TGraph *
means =
new TGraph(n);
103 means->SetMarkerColor(kPink-2);
104 means->SetMarkerStyle(20);
106 TGraph *minsigma =
new TGraph(n);
107 minsigma->SetMarkerColor(kPink-2);
108 minsigma->SetMarkerStyle(20);
109 TGraph *min2sigma =
new TGraph(n);
110 min2sigma->SetMarkerColor(kPink-2);
111 min2sigma->SetMarkerStyle(20);
113 TGraph *plsigma =
new TGraph(n);
114 plsigma->SetMarkerColor(kPink-2);
115 plsigma->SetMarkerStyle(20);
116 TGraph *pl2sigma =
new TGraph(n);
117 pl2sigma->SetMarkerColor(kPink-2);
118 pl2sigma->SetMarkerStyle(20);
120 for (
int k=0; k<
n; k++){
124 TH1F* tmp_for_delta =
new TH1F(
"tmp",
"tmp", 100, 0, up);
126 if (
tag ==
"delta2025NHUO") num = 50;
128 for (
int j = 1;
j<=20;
j++){
132 for (
int j =0;
j<
num;
j++){
137 double chi_ihlo = ihlo[0];
138 double chi_ihuo = ihuo[0];
139 double chi_nhlo = nhlo[0];
140 double chi_nhuo = nhuo[0];
141 double lobf =
min(chi_nhlo, chi_ihlo);
142 double ihbf =
min(chi_ihlo, chi_ihuo);
144 double uobf =
min(chi_nhuo, chi_ihuo);
145 double nhbf =
min(chi_nhlo, chi_nhuo);
146 double ihrej =
sqrt(
fabs(ihbf-nhbf));
147 double lorej =
sqrt(
fabs(lobf-uobf));
148 if (hname==
"ihrej") {
149 h->Fill(delta, ihrej);
150 tmp_for_delta->Fill(ihrej);
152 if (hname==
"lorej") {
153 h->Fill(delta, lorej);
154 tmp_for_delta->Fill(lorej);}
160 cout<<
" for delta n. bin is "<<h->GetXaxis()->FindBin(delta)<<
endl;
162 means->SetPoint(k, delta, mean);
164 double plus =
sigma(tmp_for_delta, 0.84);
165 double minus2 =
sigma(tmp_for_delta, 0.024);
166 double plus2 =
sigma(tmp_for_delta, 0.976);
167 minsigma->SetPoint(k, delta, minus);
168 plsigma->SetPoint(k, delta, plus);
169 min2sigma->SetPoint(k, delta, minus2);
170 pl2sigma->SetPoint(k, delta, plus2);
171 cout<<
"entries in the hist "<<tmp_for_delta->GetEntries()<<
" mean "<<mean<<
" th1 integral "<<tmp_for_delta->Integral()<<
" minus sigma "<<minus<<
endl;
172 cout<<
"entries in the th2 hist"<<h->GetEntries()<<
endl;
174 means->SetLineColor(kPink-2);
175 minsigma->SetLineColor(
kViolet+2);
176 plsigma->SetLineColor(
kViolet+2);
179 means->Draw(
"C same");
180 minsigma->Draw(
"C same");
181 plsigma->Draw(
"C same");
182 if (
tag ==
"delta2025NHUO") min2sigma->Draw(
"C same");
183 if (
tag ==
"delta2025NHUO") pl2sigma->Draw(
"C same");
184 gPad->Print((
"sens_exp_"+
tag+
"_"+hname+
"_"+hie+
".pdf").c_str());
188 c2->SetLeftMargin(0.14);
189 c2->SetBottomMargin(0.15);
190 string htitle3 =
";best fit #delta_{CP};#sqrt{LL_{IH}-LL_{NH}}";
191 if (hname ==
"lorej") htitle3 =
";best fit #delta_{CP};#sqrt{LL_{LO}-LL_{UO}}";
192 TH2F* axis2 =
new TH2F(
"3", htitle3.c_str(),
n, 0, 2, 100, 0, up-1);
193 axis2->GetXaxis()->CenterTitle();
194 axis2->GetYaxis()->CenterTitle();
199 axis2->GetXaxis()->SetTitleOffset(0.8);
200 axis2->GetYaxis()->SetTitleOffset(0.8);
203 means->Draw(
"C same");
204 minsigma->Draw(
"C same");
205 plsigma->Draw(
"C same");
206 if (
tag ==
"delta2025NHUO") min2sigma->Draw(
"C same");
207 if (
tag ==
"delta2025NHUO") pl2sigma->Draw(
"C same");
208 gPad->Print((
"sens_beforesmooth_"+
tag+
"_"+hname+
"_"+hie+
".pdf").c_str());
212 c1->SetLeftMargin(0.14);
213 c1->SetBottomMargin(0.15);
214 string htitle2 =
";best fit #delta_{CP};#sqrt{LL_{IH}-LL_{NH}}";
215 if (hname ==
"lorej") htitle2 =
";best fit #delta_{CP};#sqrt{LL_{LO}-LL_{UO}}";
216 TH2F*
axis =
new TH2F(
"2", htitle2.c_str(),
n, 0, 2, 100, 0, up-1);
217 axis->GetXaxis()->CenterTitle();
218 axis->GetYaxis()->CenterTitle();
223 axis->GetXaxis()->SetTitleOffset(0.8);
224 axis->GetYaxis()->SetTitleOffset(0.8);
227 TColor *c_coral =
new TColor(100, 255/255.0, 228/255.0, 218/255.0);
228 TColor *c_coral2 =
new TColor(102, 255/255.0, 169/255.0, 155/255.0);
229 TColor *c_wave =
new TColor(101, 0/255.0, 167/255.0, 200/255.0);
230 Color_t kFillTestColor = ((hie==
"NH")? 101:102);
231 Int_t kColor1 = TColor::GetColorTransparent(kFillTestColor, 0.3);
232 Int_t kColor2 = TColor::GetColorTransparent(
kBlue-10, 0.6);
233 if (
tag ==
"delta2025NHUO") kColor1 = TColor::GetColorTransparent(kFillTestColor, 0.7);
234 if (hie==
"IH") kColor1 = 100;
236 TGraphSmooth *minsigma_smooth =
new TGraphSmooth(
"normal");
237 TGraph * m_sm = minsigma_smooth->SmoothKern(minsigma,
"normal",0.2);
238 m_sm->SetLineColor(kColor1);
239 m_sm->DrawClone(
"l");
240 TGraphSmooth *min2sigma_smooth =
new TGraphSmooth(
"normal");
241 TGraph * m2_sm = min2sigma_smooth->SmoothKern(min2sigma,
"normal",0.2);
242 m2_sm->SetLineColor(kColor1);
243 TGraphSmooth *plsigma_smooth =
new TGraphSmooth(
"normal");
244 TGraph * p_sm = plsigma_smooth->SmoothKern(plsigma,
"normal",0.2);
245 p_sm->SetLineColor(kColor1);
246 p_sm->DrawClone(
"l");
247 TGraphSmooth *pl2sigma_smooth =
new TGraphSmooth(
"normal");
248 TGraph * p2_sm = pl2sigma_smooth->SmoothKern(pl2sigma,
"normal",0.2);
249 p2_sm->SetLineColor(kColor1);
250 cout<<
" N bins after smooth "<<p_sm->GetN()<<
" "<<m_sm->GetN()<<
endl;
251 double diff_array[p_sm->GetN()];
252 double diff_array2[p2_sm->GetN()];
253 for (
int i=0;i<p_sm->GetN();i++) diff_array[i] = p_sm->GetY()[
i] - m_sm->GetY()[
i];
254 for (
int i=0;i<p2_sm->GetN();i++) diff_array2[i] = p2_sm->GetY()[
i] - m2_sm->GetY()[
i];
255 TGraphAsymmErrors*
band =
new TGraphAsymmErrors(p_sm->GetN(), p_sm->GetX(), p_sm->GetY(), 0, 0, diff_array, 0 );
256 TGraphAsymmErrors* band2 =
new TGraphAsymmErrors(p2_sm->GetN(), p2_sm->GetX(), p2_sm->GetY(), 0, 0, diff_array2, 0 );
257 band->SetFillColor(kColor1);
258 band->Draw(
"E3 same");
260 TGraphSmooth *mean_smooth =
new TGraphSmooth(
"normal");
261 TGraph * mean_sm = mean_smooth->SmoothKern(means,
"normal",0.2);
262 mean_sm->SetLineColor(kBlack);
263 mean_sm->DrawClone(
"L");
265 double val2018 = 1.57;
266 if(hname ==
"lorej") val2018 = 1.88;
268 if (hname ==
"ihrej") ihres->Draw(
"lp+ same");
269 if (hname ==
"lorej") lores->Draw(
"lp+ same");
271 auto line =
new TLine(0, val2018, 2, val2018);
272 line->SetLineColor(kColor2);
273 line->SetLineWidth(2);
274 mean_sm->SetLineWidth(2);
275 mean_sm->DrawClone(
"L same");
277 TLegend *
leg =
new TLegend(0.16,0.8,0.88,0.88);
279 leg->SetFillStyle(0);
280 leg->SetMargin(1.3*leg->GetMargin());
282 leg->SetMargin(1.4*leg->GetMargin());
283 TGraph *
dummy =
new TGraph;
284 dummy->SetLineWidth(3);
285 dummy->SetLineColor(kColor2);
286 dummy->SetLineColor(kBlack);
287 leg->AddEntry(dummy->Clone(),
"median",
"l");
288 dummy->SetFillColor(kColor1);
289 leg->AddEntry(dummy->Clone(),
"68\% exp",
"f");
290 if (
tag ==
"delta2025NHUO") {
291 dummy->SetFillColor(kColor2);
292 leg->AddEntry(dummy->Clone(),
"95\% exp",
"f");
294 leg->AddEntry(ihres,
"2019 fit",
"p");
300 gPad->Print((
"sens_smooth_"+
tag+
"_"+hname+
"_"+hie+
".pdf").c_str());
fvar< T > fabs(const fvar< T > &x)
void XAxisDeltaCPLabels(TH1 *axes, bool t2kunits)
Label the x-axis with fractions of pi.
double sigma(TH1F *hist, double percentile)
static float min(const float a, const float b, const float c)
bool is_file_exist(const char *fileName)
const Float_t kBlessedLabelFontSize
std::string to_string(ModuleType mt)
const Float_t kBlessedTitleFontSize
std::string UniqueName()
Return a different string each time, for creating histograms.