6 <<
" USAGE: PandaSmartLabel(\"align\",xpos,ypos,scale,\"str\",scale2);" << endl
7 <<
" Prints the official BaBar label on the active ROOT pad" << endl
8 <<
" align R or L, optionally with additional 'prel' or 'front': str is aligned to the right (default) or left edge of the \"PANDA\" label" << endl
9 <<
" xpos X position of the \"PANDA\" label\'s bottom right (align==R)/left (==L) corner, 0 < xpos < 1, defaults to (L) left margin + 0.02 or (R) 1.0 - right margin - 0.02" << endl
10 <<
" ypos Y position of the \"PANDA\" label\'s bottom right (align==R)/left (==L) corner, 0 < ypos < 1, defaults to 1 - top margin - 0.08" << endl
11 <<
" scale relative size of the label, defaults to 0.9" << endl
12 <<
" str LaTeX-style text that goes under the PANDA label." << endl
13 <<
" scale2 relative size of the second line of text, defaults to 0.45" << endl;
15 <<
" Examples: " << endl
16 <<
" PandaSmartLabel(\"H\") -> Prints out this help text" << endl
17 <<
" PandaSmartLabel() -> Label 'PANDA//MC simulation' in top right corner" << endl
18 <<
" PandaSmartLabel(\"L\") -> Label 'PANDA//MC simulation' in top left corner" << endl
19 <<
" PandaSmartLabel(\"-1\",-1,-1,-1,\"preliminary\",0.4) -> Label 'PANDA//preliminary' in top right corner " << endl
20 <<
" PandaSmartLabel(\"Rprel\") -> Label 'PANDA' in top right corner with a large 'PRELIMINARY' across the plot behind histograms (works only with gStyle->SetFrameFillStyle(0))" << endl
21 <<
" PandaSmartLabel(\"Lprelfront\")-> Label 'PANDA' in top left corner with a large 'PRELIMINARY' across the plot behind histograms (works only with gStyle->SetFrameFillStyle(0))" << endl << endl;
28 if (align==
"") align=
"R";
30 bool rightalign = !(align.Contains(
"L"));
31 bool preliminary = align.Contains(
"prel");
32 bool front = align.Contains(
"front");
34 double mt = gPad->GetTopMargin();
35 double mb = gPad->GetBottomMargin();
36 double ml = gPad->GetLeftMargin();
37 double mr = gPad->GetRightMargin();
39 if (ypos==-1) ypos = 1.0 - mt - 0.08;
43 if (xpos==-1) xpos = 1.0 - mr - 0.02;
47 if (xpos==-1) xpos = ml + 0.02;
50 if (scale == -1) scale = 0.9;
51 if (str ==
"-1") str =
"MC simulation";
52 if (scale2 == -1) scale2 = 0.45;
56 TLatex *panda =
new TLatex();
58 double fcx=1., fcy=1.,
dx=1.0-xpos,
dy = 1.0-ypos;
60 double padSizeX = gPad->GetWw()*gPad->GetWNDC();
61 double padSizeY = gPad->GetWh()*gPad->GetHNDC();
71 panda->SetTextFont(42);
72 panda->SetTextColor(17);
73 panda->SetTextSize(0.17*(1.-ml-mr));
74 panda->SetTextAlign(22);
75 double sizeX = padSizeX*(1. - ml - mr);
76 double sizeY = padSizeY*(1. - mt - mb);
77 double posX = (ml+(1.-mr))*0.5;
78 double posY = (mb+(1.-mt))*0.42;
79 panda->SetTextAngle(atan(sizeY/sizeX)/3.1415*142.);
80 panda->DrawLatex(posX,posY,
"PRELIMINARY");
82 TList *ll=gPad->GetListOfPrimitives();
83 if (!front) ll->AddAt(ll->RemoveAt(ll->GetEntries()-1),0);
86 panda->SetTextColor(13);
87 panda->SetTextAngle(0);
89 panda->SetTextFont(62);
90 if (rightalign) panda->SetTextAlign(31);
91 else panda->SetTextAlign(11);
92 panda->SetTextSize(0.07*scale);
93 panda->DrawLatex(xpos*fcy,ypos*fcx,
"#bar{P}ANDA");
95 panda->SetTextFont(42);
96 if (rightalign) panda->SetTextAlign(33);
97 else panda->SetTextAlign(13);
98 panda->SetTextSize(0.08*scale2);
99 panda->DrawLatex(xpos*fcx,ypos*fcy*0.99,str);