98 fRed = TColor::GetColor(226, 0, 26);
99 fYellow = TColor::GetColor(238, 125, 17);
100 fPink = TColor::GetColor(202, 71, 67);
101 fBlue = TColor::GetColor(40, 58, 68);
113 if (what.Contains(
"l3", TString::kIgnoreCase)) col |=
kL3;
114 if (what.Contains(
"text", TString::kIgnoreCase)) col |=
kText;
115 if (what.Contains(
"part", TString::kIgnoreCase)) col |=
kParticles;
116 if (what.Contains(
"many", TString::kIgnoreCase)) col |=
kMany;
117 if (what.Contains(
"pad", TString::kIgnoreCase)) col |=
kPad;
118 if (what.Contains(
"rever", TString::kIgnoreCase)) col |=
kReverse;
131 if (what.BeginsWith(
"pre", TString::kIgnoreCase)) tag =
kPreliminary;
132 else if (what.BeginsWith(
"per", TString::kIgnoreCase)) tag =
kPerformance;
165 Error(
"AliceLogo::Draw",
"No pad to draw in");
169 Printf(
"Pad to draw logo in: %s", p->GetName());
171 Int_t pH = p->YtoPixel(0);
173 Int_t pW = p->XtoPixel(1);
175 Printf(
"pA=%d/%d=%lf", pW, pH, pA);
191 Int_t xP = p->XtoPixel(x);
196 Int_t yP = p->YtoPixel(y);
198 Printf(
"(x,y)=(%d,%d) hP=%d wP=%d xP=%d yP=%d rP=%d tP=%d",
199 xP, yP, hP, wP, xP, yP, rP, tP);
201 if (topX > 1 || topY > 1) {
202 Warning(
"AliceLogo::Draw",
"with (x,y)=(%f,%f) and h=%f -> top=(%f,%f)",
203 x, y, h, topX, topY);
204 topX = TMath::Min(topX, 1.);
205 topY = TMath::Min(topY, 1.);
209 fPad =
new TPad(
"logo",
"logo", x, y, topX, topY);
210 fPad->SetFixedAspectRatio(
true);
217 fPad->SetTopMargin(0);
218 fPad->SetBottomMargin(0);
219 fPad->SetLeftMargin(0);
220 fPad->SetRightMargin(0);
223 Printf(
"(x,y)=(%f,%f) (tx,ty)=(%f,%f) (x1,y1)=(%f,%f) (x2,y2)=(%f,%f)",
230 Printf(
"ppA=%d/%d=%lf A=%lf",ppW, ppH, ppA,
fAspect);
238 Int_t txtFg = kBlack;
255 printf(
"Drawing L3 image ");
258 TVirtualPad* pad =
new TPad(
"l3",
"L3",o, 1-
fL3Height,
260 pad->SetFixedAspectRatio(
true);
261 pad->SetFillColor(
fDebug ? kGreen-4 : 0);
262 pad->SetFillStyle(
fDebug ? 4030 : 0);
263 pad->SetBorderSize(
fDebug ? 1 : 0);
264 pad->SetBorderMode(
fDebug ? 1 : 0);
265 pad->SetLineColor(
fDebug ? kRed+1 : 0);
266 pad->SetLineWidth(
fDebug ? 1 : 0);
267 pad->SetTopMargin(0);
268 pad->SetBottomMargin(0);
269 pad->SetLeftMargin(0);
270 pad->SetRightMargin(0);
274 if (color &
kReverse && lcol == kBlack) lcol = kWhite;
277 Double_t ro = .5 + .5 * (1 - TMath::Cos(dA/2));
283 gi->SetName(
"L3_inner");
284 go->SetName(
"L3_outer");
287 for (
Int_t i = 0; i < 9; i++) {
289 go->SetPoint(i, x0 + ro * TMath::Cos(a), y0 + ro * TMath::Sin(a));
290 gi->SetPoint(i, x0 + ri * TMath::Cos(a), y0 + ri * TMath::Sin(a));
301 for (
Int_t i = 0; i < 36; i++) {
304 case 1:
case 5:
case 10:
case 20:
case 24:
case 27:
case 33:
case 34:
306 case 3:
case 4:
case 8:
case 16:
case 19:
case 23:
case 29:
case 30:
309 case 9:
case 12:
case 14:
case 18:
case 25:
case 28:
case 35:
316 case 1:
case 9:
case 8:
case 10:
case 19:
case 21:
case 33:
318 case 2:
case 7:
case 11:
case 12:
case 15:
case 16:
case 20:
case 34:
320 case 3:
case 6:
case 13:
case 17:
case 25:
case 29:
322 case 23:
case 27:
case 28:
334 if (bg != kWhite) col = kWhite;
335 for (
Int_t i = 0; i < 18; i++) {
340 case 1:
case 6:
case 8:
343 case 3:
case 4:
case 5:
case 7:
case 12:
375 Double_t rad = TMath::Pi() / 180 * ang;
376 Double_t xtl = .5 + xx * TMath::Cos(rad) - yy * TMath::Sin(rad);
377 Double_t ytl = .5 + xx * TMath::Sin(rad) + yy * TMath::Cos(rad);
378 Double_t xbl = .5 + xx * TMath::Cos(rad) + yy * TMath::Sin(rad);
379 Double_t ybl = .5 + xx * TMath::Sin(rad) - yy * TMath::Cos(rad);
380 Double_t xtr = .5 + xl * TMath::Cos(rad) - yy * TMath::Sin(rad);
381 Double_t ytr = .5 + xl * TMath::Sin(rad) + yy * TMath::Cos(rad);
382 Double_t xbr = .5 + xl * TMath::Cos(rad) + yy * TMath::Sin(rad);
383 Double_t ybr = .5 + xl * TMath::Sin(rad) - yy * TMath::Cos(rad);
387 tri->SetName(Form(
"spoke_tr_%03d", ang));
388 tri->SetPoint(0, 0.5,0.5);
389 tri->SetPoint(3, 0.5,0.5);
390 tri->SetPoint(1, xtl, ytl);
391 tri->SetPoint(2, xbl, ybl);
392 tri->Draw(
"same lf");
396 lne->SetName(Form(
"spoke_ln_%03d", ang));
397 lne->SetPoint(0, xtl, ytl);
398 lne->SetPoint(1, xbl, ybl);
399 lne->SetPoint(2, xbr, ybr);
400 lne->SetPoint(3, xtr, ytr);
401 lne->SetPoint(4, xtl, ytl);
402 lne->Draw(
"same lf");
411 printf(
"Drawing ALICE title ");
415 Double_t t = r*TMath::Sin(TMath::Pi()/8-.05);
416 Double_t t2 = r*TMath::Sin(TMath::Pi()/8+.05);
424 Double_t a = (blY - mblY) / (blX - mblX);
426 Double_t b = mblY + a * (.5 - mblX);
430 Double_t bot = TMath::Max(top - hh,0.);
431 TVirtualPad* pad =
new TPad(
"alice",
"alice", o, bot+.005,
432 TMath::Min(o+
fL3Width,1.), top+.005);
433 pad->SetFixedAspectRatio(
true);
434 pad->SetFillColor(
fDebug ? kGreen-4 : 0);
435 pad->SetFillStyle(
fDebug ? 4030 : 0);
436 pad->SetBorderSize(
fDebug ? 1 : 0);
437 pad->SetBorderMode(
fDebug ? 1 : 0);
438 pad->SetLineColor(
fDebug ? kMagenta+1 : 0);
439 pad->SetLineWidth(
fDebug ? 1 : 0);
440 pad->SetTopMargin(0);
441 pad->SetBottomMargin(0);
442 pad->SetLeftMargin(0);
443 pad->SetRightMargin(0);
453 DrawA(0, 0.01, w, a, fg, bg);
455 DrawL(.5 - 5.8*a*w, 0.01, w, a, fg);
457 DrawI(.5 - 1.5*a*w, 0.01, w, a, fg);
459 DrawC(.5 + 2.6*a*w, 0.00, a, fg, bg);
461 DrawE(1 - 3.5*a*w, 0.01, w, a, fg);
481 TBox* b1 =
new TBox(x, y, x + a * w, y + 1 - r);
484 b1->DrawBox(x + (u-w) * a, y, x + u * a, y + 1 - r);
485 b1->DrawBox(x, y+1-r-2*w, x + u * a, y + 1 - r -w);
486 TEllipse* a1 =
new TEllipse(x+u*a/2, y+1-r-.01, (r-.005)*a, r, 0, 180);
489 TEllipse* a2 =
new TEllipse(x+u*a/2, y+1-r-.01, (r-w-.005)*a, r-w, 0, 180);
495 Int_t lw = w*gPad->YtoPixel(0);
499 TLine* l1 =
new TLine(x1, y, x1, y+1-r);
500 l1->SetLineWidth(lw);
501 l1->SetLineColor(kBlue);
503 l1->DrawLine(x2, y,x2, y+1-r);
504 l1->DrawLine(x1, y1,x2, y1);
506 TEllipse* a3 =
new TEllipse(x+u*a/2, y+1-r-.01,
507 (r-w/2-.005)*a, r-w/2, 0, 180);
511 Printf(
"Setting line width to %d", lw);
512 a3->SetLineWidth(lw);
513 a3->SetLineColor(kBlue);
528 TBox* b1 =
new TBox(x, y, x+3.1 * a * w, y + w);
531 b1->DrawBox(x, y , x + a * w,y+.99);
544 TBox* b1 =
new TBox(x, y, x+3 * a * w, y + w);
547 b1->DrawBox(x+a*w,y,x+2*a*w,y+.99);
548 b1->DrawBox(x,y+1-w,x+3*a*w,y+.99);
564 0.698245 +dx, 0.271355,
565 0.590204 +dx, 0.0755058,
567 0.220343 +dx, 0.015668+.005,
568 0.0629551 +dx, 0.15668,
569 0.00786939+dx, 0.329027,
571 0.00786939+dx, 1-0.329027,
572 0.0629551 +dx, 1-0.15668,
573 0.220343 +dx, 1-0.015668-.005,
575 0.590204 +dx, 1-0.0755058,
576 0.6982450 +dx, 1-0.271355, 0 };
578 gO->SetName(
"c_ext");
579 gO->SetLineColor(
fDebug ? kGreen+1 : fg);
580 gO->SetLineWidth(
fDebug ? 1 : 0);
581 gO->SetFillColor(
fDebug ? kGreen+1 : fg);
582 gO->SetFillStyle(
fDebug ? 0 : 1001);
583 for (
Int_t i = 0; i < nO; i++)
584 gO->SetPoint(i, x+pO[2*i]*a,y+pO[2*i+1]);
588 0.551869, 1-0.713617,
589 0.481045, 1-0.821127,
590 0.363004, 1-0.853799,
591 0.213486, 1-0.783625,
592 0.158508, 1-0.635277,
598 0.551869, 0.713617, 0 };
600 gI->SetName(
"c_int");
601 gI->SetLineColor(
fDebug ? kGreen+1 : bg);
602 gI->SetLineWidth(
fDebug ? 1 : 0);
603 gI->SetFillColor(
fDebug ? kGreen+1 : bg);
604 gI->SetFillStyle(
fDebug ? 0 : 1001);
605 for (
Int_t i = 0; i < nI; i++)
606 gI->SetPoint(i, x+pI[2*i]*a,y+pI[2*i+1]);
611 gC->SetName(
"c_cut");
613 gC->SetPoint(0, gO->GetX()[0], gO->GetY()[0]);
614 gC->SetPoint(1, gI->GetX()[0], gI->GetY()[0]);
615 gC->SetPoint(2, gI->GetX()[nI-1], gI->GetY()[nI-1]);
616 gC->SetPoint(3, gO->GetX()[nO-1], gO->GetY()[nO-1]);
617 gC->SetPoint(4, gO->GetX()[0], gO->GetY()[0]);
632 TBox* b1 =
new TBox(x, y, x + a * w, y + .99);
635 b1->DrawBox(x, y, x + u*a*w, y+w);
636 b1->DrawBox(x, y+.99-w, x + u*a*w, y+.99);
637 b1->DrawBox(x, y+.5-w/2+.02, x + (u-.1)*a*w, y+.5+w/2+.02);
651 TBox* b1 =
new TBox(x, y, x + a * w, y + .99);
654 b1->DrawBox(x, y+.99-w, x + u*a*w, y+.99);
655 b1->DrawBox(x, y+.5-w/2+.02, x + (u-.1)*a*w, y+.5+w/2+.02);
666 printf(
"Drawing stamp ");
671 TVirtualPad* pad =
new TPad(
"label",
"label", 0, bot, 1, top);
672 pad->SetFixedAspectRatio(
true);
673 pad->SetFillColor(
fDebug ? kGreen-4 : 0);
674 pad->SetFillStyle(
fDebug ? 4030 : 0);
675 pad->SetBorderSize(
fDebug ? 1 : 0);
676 pad->SetBorderMode(
fDebug ? 1 : 0);
677 pad->SetLineColor(
fDebug ? kCyan+2 : 0);
678 pad->SetLineWidth(
fDebug ? 1 : 0);
679 pad->SetTopMargin(0);
680 pad->SetBottomMargin(0);
681 pad->SetLeftMargin(0);
682 pad->SetRightMargin(0);
692 printf(
".");
DrawP(0, 0.01, w, a, fg, bg);
693 printf(
".");
DrawR(6.3 * w * a, 0.01, w, a, fg, bg);
694 printf(
".");
DrawE(13 * w * a, 0.01, w, a, fg);
695 printf(
".");
DrawL(18.7 * w * a, 0.01, w, a, fg);
696 printf(
".");
DrawI(23.3 * w * a, 0.01, w, a, fg);
697 printf(
".");
DrawM(29 * w * a, 0.01, w, a, fg);
698 printf(
".");
DrawI(37.2 * w * a, 0.01, w, a, fg);
699 printf(
".");
DrawN(42.5 * w * a, 0.01, w, a, fg);
700 printf(
".");
DrawA(49.4 * w * a, 0.01, w, a, fg, bg);
701 printf(
".");
DrawR(56.4 * w * a, 0.01, w, a, fg, bg);
702 printf(
".");
DrawY(62.3 * w * a, 0.01, w, a, fg);
705 printf(
".");
DrawP(0, 0.01, w, a, fg, bg);
706 printf(
".");
DrawE(6.3 * w * a, 0.01, w, a, fg);
707 printf(
".");
DrawR(12 * w * a, 0.01, w, a, fg, bg);
708 printf(
".");
DrawF(18.7 * w * a, 0.01, w, a, fg);
709 printf(
".");
DrawO(24 * w * a, 0.01, w, a, fg, bg);
710 printf(
".");
DrawR(30.7 * w * a, 0.01, w, a, fg, bg);
711 printf(
".");
DrawM(37.5 * w * a, 0.01, w, a, fg);
712 printf(
".");
DrawA(45.5 * w * a, 0.01, w, a, fg, bg);
713 printf(
".");
DrawN(52.4 * w * a, 0.01, w, a, fg);
714 printf(
".");
DrawC(58.7 * w * a, 0.01, a, fg, bg);
715 printf(
".");
DrawE(64.8 * w * a, 0.01, w, a, fg);
735 TEllipse* a1 =
new TEllipse(x+fw/2*a*w, y + .495, a*w*fw/2, .495, 0, 360);
738 TEllipse* a2 =
new TEllipse(x+fw/2*a*w, y + .495, a*w*(fw/2-1), .495-w);
757 TBox* b1 =
new TBox(x, y, x + a * w, y + .99);
760 b1->DrawBox(x + a * w, y + .99 - w, x + 2.5 * a * w, y + .99);
761 b1->DrawBox(x + a * w, y + .99 - u, x + 2.5 * a * w, y + .99 - u + w);
762 TEllipse* a1 =
new TEllipse(x+2.5*a*w, y + .99 - r, a*r, r-.01, -90, 90);
765 TEllipse* a2 =
new TEllipse(x+2.5*a*w, y + .99 - r, a*(r-w), r-w-.01,
782 DrawP(x, y, w, a, fg, bg);
786 Double_t ang = 60 * TMath::Pi() / 180;
792 g->SetPoint(0, x+a*(2*w+o), y+1-u+.01);
794 g->SetPoint(1, x+a*2*w, y+1-u+.01);
796 g->SetPoint(2, x+a*(fw*w-o+.06), y);
798 g->SetPoint(3, x+a*(fw*w+.06), y);
799 g->SetPoint(4, g->GetX()[0], g->GetY()[0]);
813 TBox* b1 =
new TBox(x, y, x + a * w, y + 1);
816 b1->DrawBox(x+4.8*a*w, y, x+5.8*a*w, y+1);
818 Double_t ang = 28 * TMath::Pi() / 180;
823 gl->SetPoint(0, x+a*w, y+1);
824 gl->SetPoint(1, x+a*w, y+1-o);
825 gl->SetPoint(2, x+a*w*(1+3.8/2), y+w);
826 gl->SetPoint(3, x+a*w*4.8, y+1-o);
827 gl->SetPoint(4, x+a*w*4.8, y+1);
828 gl->SetPoint(5, x+a*w*(1+3.8/2), y+w+o);
829 gl->SetPoint(6, x+a*w, y+1);
845 TBox* b1 =
new TBox(x, y, x + a * w, y + 1);
848 b1->DrawBox(x+a*w*(fw-1), y, x+a*w*(fw), y+1);
850 Double_t ang = 28 * TMath::Pi() / 180;
854 gl->SetLineColor(
fDebug ? kGreen+1 : fg);
855 gl->SetLineWidth(
fDebug ? 1 : 0);
856 gl->SetFillColor(
fDebug ? kGreen+1 : fg);
857 gl->SetFillStyle(
fDebug ? 0 : 1001);
858 gl->SetPoint(0, x+a*w, y+1);
859 gl->SetPoint(1, x+a*w, y+1-o);
860 gl->SetPoint(2, x+a*w*(fw-1), y);
861 gl->SetPoint(3, x+a*w*(fw-1), y+o);
862 gl->SetPoint(4, x+a*w, y+1);
879 TBox* b1 =
new TBox(x+a*w*(fw/2-.5), y, x + a * w *(fw/2+.5), y + 1 - u);
880 b1->SetLineColor(
fDebug ? kGreen+1 : fg);
881 b1->SetFillColor(
fDebug ? 0 : fg);
882 b1->SetFillStyle(
fDebug ? 0 : 1001);
885 Double_t ang = 40 * TMath::Pi() / 180;
892 g->SetPoint(0, x+a*w*(fw/2-.5), y + 1-u);
893 g->SetPoint(1, x, y + 1);
894 g->SetPoint(2, x+a*o2, y + 1);
895 g->SetPoint(3, x+a*w*fw/2, y + 1 - u + o);
896 g->SetPoint(4, x+a*w*fw-a*o2, y+1);
897 g->SetPoint(5, x+a*w*fw, y+1);
898 g->SetPoint(6, x+a*w*(fw/2+.5), y + 1-u);
899 g->SetPoint(7, x+a*w*(fw/2-.5), y + 1-u);
914 lne->SetLineColor(
fDebug ? kGreen+1 : col);
915 lne->SetLineWidth(
fDebug ? 1 : 0);
918 fll->SetFillColor(
fDebug ? kGreen+1 : col);
919 fll->SetFillStyle(
fDebug ? 0 : 1001);
936 what.Contains(
"debug", TString::kIgnoreCase));
947 TCanvas*
c =
new TCanvas(
"test",
"Test of AliceLogo");
948 c->SetFillColor(kYellow-10);
949 TH1* h =
new TH1F(
"h",
"h", 60, -3, 3);
950 h->SetFillColor(kRed+1);
951 h->SetFillStyle(3001);
952 h->FillRandom(
"gaus");
956 dut->
Draw(c, .75, .4, .25, tag, col);
958 c->SaveAs(
"test.png");
959 c->SaveAs(
"test.pdf");
960 c->SaveAs(
"test.svg");
970 what.Contains(
"debug", TString::kIgnoreCase));
982 TImage* img = TImage::Create();
983 TString imgName =
"2012-Jul-04-Base_Logo.png";
990 imgName =
"2012-Jul-04-Preliminary_Logo.png";
993 imgName =
"2012-Jul-04-Performance_Logo.png";
997 imgName =
"2012-Jul-04-4_Color_Logo_CB.png";
999 imgName =
"2012-Jul-04-Base_Logo.png";
1001 Printf(
"Reading %s", imgName.Data());
1002 img->ReadImage(imgName);
1003 Int_t logoW = img->GetWidth();
1004 Int_t logoH = img->GetHeight();
1007 Printf(
"Logo dimensions (wxh): (%d x %d)", logoW, logoH);
1008 Int_t myHeight = 800;
1009 TCanvas*
c =
new TCanvas(
"check",
"Check of AliceLogo",
1010 (myHeight-22)/logoA, myHeight);
1012 c->SetRightMargin(0);
1013 c->SetBottomMargin(0);
1014 c->SetLeftMargin(0);
1015 c->SetFillColor(
debug ? kRed-4 : kWhite);
1016 c->SetBorderSize(0);
1017 c->SetBorderMode(0);
1019 c->SetFillColor(kBlack);
1021 if (
debug) img->Draw();
1024 dut->
Draw(c, 0, 0, 1, tag, col);
1026 c->SaveAs(
"check.svg");
Int_t color[]
print message on plot with ok/not ok
AliceLogo(Bool_t debug=false)
void DrawI(Double_t x, Double_t y, Double_t w, Double_t a, Int_t fg)
void DrawC(Double_t x, Double_t y, Double_t a, Int_t fg, Int_t bg)
void Draw(TVirtualPad *p, Double_t x, Double_t y, Double_t h, UShort_t tag, UInt_t color)
void DrawM(Double_t x, Double_t y, Double_t w, Double_t a, Int_t fg)
void DrawL3(UInt_t color, Int_t bg)
static void Test(const TString &what)
void DrawN(Double_t x, Double_t y, Double_t w, Double_t a, Int_t fg)
void DrawLabel(Int_t fg, Int_t bg, bool preliminary=true)
void DrawF(Double_t x, Double_t y, Double_t w, Double_t a, Int_t fg)
void Draw(TVirtualPad *p, Double_t x=.77, Double_t y=.35, Double_t h=.25, const TString &tag="", const TString &colors="")
void DrawP(Double_t x, Double_t y, Double_t w, Double_t a, Int_t fg, Int_t bg)
void DrawO(Double_t x, Double_t y, Double_t w, Double_t a, Int_t fg, Int_t bg)
static UShort_t ParseTag(const TString &what)
void DrawA(Double_t x, Double_t y, Double_t w, Double_t a, Int_t fg, Int_t bg)
void DrawY(Double_t x, Double_t y, Double_t w, Double_t a, Int_t fg)
void DrawALICE(Int_t fg, Int_t bg)
static UInt_t ParseColors(const TString &what)
static void Check(const TString &what)
void DrawR(Double_t x, Double_t y, Double_t w, Double_t a, Int_t fg, Int_t bg)
void DrawE(Double_t x, Double_t y, Double_t w, Double_t a, Int_t fg)
void DrawSpoke(Int_t ang, Double_t w, Double_t len, Int_t fg)
static void Test(UShort_t tag, UInt_t col, Bool_t debug)
void DrawL(Double_t x, Double_t y, Double_t w, Double_t a, Int_t fg)
void SetAttr(TAttLine *lne, TAttFill *fll, Int_t col)
static void Check(UShort_t tag, UInt_t col, Bool_t debug=true)