#include <stdio.h>
#include <cmath>
#include <iostream>
#include "TLatex.h"
#include "TGraphErrors.h"
#include "TMarker.h"
#include "TPave.h"
#include "TGraphAsymmErrors.h"
#include "TH1.h"
#include "TLine.h"
Go to the source code of this file.
|
void | ATLAS_LABEL (Double_t x, Double_t y, Color_t color=1) |
|
TGraphErrors * | myTGraphErrorsDivide (TGraphErrors *g1, TGraphErrors *g2) |
|
TGraphAsymmErrors * | myTGraphErrorsDivide (TGraphAsymmErrors *g1, TGraphAsymmErrors *g2) |
|
TGraphAsymmErrors * | myMakeBand (TGraphErrors *g0, TGraphErrors *g1, TGraphErrors *g2) |
|
void | myAddtoBand (TGraphErrors *g1, TGraphAsymmErrors *g2) |
|
TGraphErrors * | TH1TOTGraph (TH1 *h1) |
|
void | myText (Double_t x, Double_t y, Color_t color, char *text) |
|
void | myBoxText (Double_t x, Double_t y, Double_t boxsize, Int_t mcolor, char *text) |
|
void | myMarkerText (Double_t x, Double_t y, Int_t color, Int_t mstyle, char *text) |
|
- Author
- mark sutton
- Date
- Fri 11 Jan 2019 07:06:38 CET
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Definition in file AtlasUtils.h.
◆ ATLAS_LABEL()
void ATLAS_LABEL |
( |
Double_t |
x, |
|
|
Double_t |
y, |
|
|
Color_t |
color = 1 |
|
) |
| |
|
inline |
◆ myAddtoBand()
void myAddtoBand |
( |
TGraphErrors * |
g1, |
|
|
TGraphAsymmErrors * |
g2 |
|
) |
| |
|
inline |
Definition at line 211 of file AtlasUtils.h.
217 if (
g1->GetN()!=
g2->GetN())
218 std::cout <<
" graphs have not the same # of elements " << std::endl;
220 Double_t* EYhigh =
g2-> GetEYhigh();
221 Double_t* EYlow =
g2-> GetEYlow();
223 for (Int_t
i=0;
i<
g1->GetN();
i++) {
235 Double_t eyh=0., eyl=0.;
245 eyh=sqrt(eyh*eyh+y0*y0);
247 g2->SetPointEYhigh(
i,eyh);
250 eyl=sqrt(eyl*eyl+y0*y0);
252 g2->SetPointEYlow (
i,eyl);
◆ myBoxText()
void myBoxText |
( |
Double_t |
x, |
|
|
Double_t |
y, |
|
|
Double_t |
boxsize, |
|
|
Int_t |
mcolor, |
|
|
char * |
text |
|
) |
| |
|
inline |
Definition at line 301 of file AtlasUtils.h.
305 TLatex
l;
l.SetTextAlign(12);
312 Double_t
x1=
x2-boxsize;
314 printf(
"x1= %f x2= %f y1= %f y2= %f \n",
x1,
x2,
y1,
y2);
316 TPave *mbox=
new TPave(
x1,
y1,
x2,
y2,0,
"NDC");
318 mbox->SetFillColor(mcolor);
319 mbox->SetFillStyle(1001);
323 mline.SetLineWidth(4);
324 mline.SetLineColor(1);
325 mline.SetLineStyle(1);
326 Double_t ytmp=(
y1+
y2)/2.;
327 mline.DrawLineNDC(
x1,ytmp,
x2,
y);
◆ myMakeBand()
TGraphAsymmErrors* myMakeBand |
( |
TGraphErrors * |
g0, |
|
|
TGraphErrors * |
g1, |
|
|
TGraphErrors * |
g2 |
|
) |
| |
|
inline |
Definition at line 169 of file AtlasUtils.h.
173 TGraphAsymmErrors* g3=
new TGraphAsymmErrors();
175 Double_t
x1=0.,
y1=0.,
x2=0.,
y2=0.,
y0=0, x3=0.;
178 for (Int_t
i=0;
i<
g1->GetN();
i++) {
179 g0->GetPoint(
i,
x1,y0);
187 else g2->GetPoint(
i+1,
x2,dum);
190 else g2->GetPoint(
i-1,x3,dum);
196 g3->SetPoint(
i,
x1,y3);
198 Double_t binwl=(
x1-x3)/2.;
199 Double_t binwh=(
x2-
x1)/2.;
200 if (binwl==0.) binwl= binwh;
201 if (binwh==0.) binwh= binwl;
202 g3->SetPointError(
i,binwl,binwh,(y3-
y2),(
y1-y3));
◆ myMarkerText()
void myMarkerText |
( |
Double_t |
x, |
|
|
Double_t |
y, |
|
|
Int_t |
color, |
|
|
Int_t |
mstyle, |
|
|
char * |
text |
|
) |
| |
|
inline |
Definition at line 332 of file AtlasUtils.h.
339 marker->SetMarkerStyle(mstyle);
340 marker->SetMarkerSize(2.0);
343 TLatex
l;
l.SetTextAlign(12);
◆ myText()
void myText |
( |
Double_t |
x, |
|
|
Double_t |
y, |
|
|
Color_t |
color, |
|
|
char * |
text |
|
) |
| |
|
inline |
◆ myTGraphErrorsDivide() [1/2]
TGraphAsymmErrors* myTGraphErrorsDivide |
( |
TGraphAsymmErrors * |
g1, |
|
|
TGraphAsymmErrors * |
g2 |
|
) |
| |
|
inline |
Definition at line 100 of file AtlasUtils.h.
104 TGraphAsymmErrors* g3=
new TGraphAsymmErrors();
109 printf(
" vectors do not have same number of entries ! \n");
113 Double_t
x1=0.,
y1=0.,
x2=0.,
y2=0.;
114 Double_t dx1h=0., dx1l=0.;
115 Double_t dy1h=0., dy1l=0.;
116 Double_t dy2h=0., dy2l=0.;
118 Double_t* X1 =
g1->GetX();
119 Double_t* Y1 =
g1->GetY();
120 Double_t* EXhigh1 =
g1->GetEXhigh();
121 Double_t* EXlow1 =
g1->GetEXlow();
122 Double_t* EYhigh1 =
g1->GetEYhigh();
123 Double_t* EYlow1 =
g1->GetEYlow();
125 Double_t* X2 =
g2->GetX();
126 Double_t* Y2 =
g2->GetY();
127 Double_t* EXhigh2 =
g2->GetEXhigh();
128 Double_t* EXlow2 =
g2->GetEXlow();
129 Double_t* EYhigh2 =
g2->GetEYhigh();
130 Double_t* EYlow2 =
g2->GetEYlow();
132 for (Int_t
i=0;
i<
g1->GetN();
i++) {
137 if (
y1!=0.) dy1h = EYhigh1[
i]/
y1;
139 if (
y2!=0.) dy2h = EYhigh2[
i]/
y2;
141 if (
y1!=0.) dy1l = EYlow1 [
i]/
y1;
143 if (
y2!=0.) dy2l = EYlow2 [
i]/
y2;
149 printf(
"%d dy1=%f %f dy2=%f %f sqrt= %f %f \n",
i,dy1l,dy1h,dy2l,dy2h,
150 sqrt(dy1l*dy1l+dy2l*dy2l),sqrt(dy1h*dy1h+dy2h*dy2h));
153 else g3->SetPoint(
i,
x1,
y2);
154 Double_t
el=0.; Double_t eh=0.;
156 if (
y1!=0. &&
y2!=0.)
el=sqrt(dy1l*dy1l+dy2l*dy2l)*(
y1/
y2);
157 if (
y1!=0. &&
y2!=0.) eh=sqrt(dy1h*dy1h+dy2h*dy2h)*(
y1/
y2);
159 if (
debug) printf(
"dx1h=%f dx1l=%f el=%f eh=%f \n",dx1h,dx1l,
el,eh);
160 g3->SetPointError(
i,dx1h,dx1l,
el,eh);
◆ myTGraphErrorsDivide() [2/2]
TGraphErrors* myTGraphErrorsDivide |
( |
TGraphErrors * |
g1, |
|
|
TGraphErrors * |
g2 |
|
) |
| |
|
inline |
Definition at line 38 of file AtlasUtils.h.
42 if (!
g1) printf(
"**myTGraphErrorsDivide: g1 does not exist ! \n");
43 if (!
g2) printf(
"**myTGraphErrorsDivide: g2 does not exist ! \n");
50 printf(
"**myTGraphErrorsDivide: vector do not have same number of entries ! \n");
53 TGraphErrors* g3=
new TGraphErrors();
56 Double_t dx1=0.,dy1=0., dy2=0.;
59 for (Int_t i1=0; i1<
n1; i1++) {
60 for (Int_t i2=0; i2<n2; i2++) {
69 dx1 =
g1->GetErrorX(i1);
70 if (
y1!=0) dy1 =
g1->GetErrorY(i1)/
y1;
71 if (
y2!=0) dy2 =
g2->GetErrorY(i2)/
y2;
74 printf(
"**myTGraphErrorsDivide: %d x1=%f x2=%f y1=%f y2=%f \n",iv,
x1,
x2,
y1,
y2);
76 if (
y2!=0.) g3->SetPoint(iv,
x1,
y1/
y2);
77 else g3->SetPoint(iv,
x1,
y2);
80 if (
y1!=0 &&
y2!=0)
e=std::sqrt(dy1*dy1+dy2*dy2)*(
y1/
y2);
81 g3->SetPointError(iv,dx1,
e);
◆ TH1TOTGraph()
TGraphErrors* TH1TOTGraph |
( |
TH1 * |
h1 | ) |
|
|
inline |
Definition at line 262 of file AtlasUtils.h.
265 if (!
h1) std::cout <<
"TH1TOTGraph: histogram not found !" << std::endl;
267 TGraphErrors*
g1=
new TGraphErrors();
269 Double_t
x,
y, ex, ey;
270 for (Int_t
i=0;
i<
h1->GetNbinsX();
i++) {
271 y=
h1->GetBinContent(
i);
272 ey=
h1->GetBinError(
i);
273 x=
h1->GetBinCenter(
i);
274 ex=
h1->GetBinWidth(
i);
279 g1->SetPointError(
i,ex,ey);