Logo ROOT  
Reference Guide
quarks.C File Reference

Detailed Description

View in nbviewer Open in SWAN Example illustrating divided pads and Latex.

void quarks () {
TCanvas *c1 = new TCanvas("c1", "c1",10,10,630,760);
c1->SetFillColor(kBlack);
Int_t quarkColor = 50;
Int_t leptonColor = 16;
Int_t forceColor = 38;
Int_t titleColor = kYellow;
Int_t border = 8;
TLatex *texf = new TLatex(0.90,0.455,"Force Carriers");
texf->SetTextColor(forceColor);
texf->SetTextAlign(22); texf->SetTextSize(0.07);
texf->SetTextAngle(90);
texf->Draw();
TLatex *texl = new TLatex(0.11,0.288,"Leptons");
texl->SetTextColor(leptonColor);
texl->SetTextAlign(22); texl->SetTextSize(0.07);
texl->SetTextAngle(90);
texl->Draw();
TLatex *texq = new TLatex(0.11,0.624,"Quarks");
texq->SetTextColor(quarkColor);
texq->SetTextAlign(22); texq->SetTextSize(0.07);
texq->SetTextAngle(90);
texq->Draw();
TLatex tex(0.5,0.5,"u");
tex.SetTextColor(titleColor); tex.SetTextFont(32);
tex.SetTextAlign(22);
tex.SetTextSize(0.14);
tex.DrawLatex(0.5,0.93,"Elementary");
tex.SetTextSize(0.12);
tex.DrawLatex(0.5,0.84,"Particles");
tex.SetTextSize(0.05);
tex.DrawLatex(0.5,0.067,"Three Generations of Matter");
// Create main pad and its subdivisions
TPad *pad = new TPad("pad", "pad",0.15,0.11,0.85,0.79);
pad->Draw();
pad->cd();
pad->Divide(4,4,0.0003,0.0003);
pad->cd(1); gPad->SetFillColor(quarkColor);
gPad->SetBorderSize(border);
tex.DrawLatex(.5,.5,"u");
pad->cd(2); gPad->SetFillColor(quarkColor);
gPad->SetBorderSize(border);
tex.DrawLatex(.5,.5,"c");
pad->cd(3); gPad->SetFillColor(quarkColor);
gPad->SetBorderSize(border);
tex.DrawLatex(.5,.5,"t");
pad->cd(4); gPad->SetFillColor(forceColor);
gPad->SetBorderSize(border);
tex.DrawLatex(.5,.55,"#gamma");
pad->cd(5); gPad->SetFillColor(quarkColor);
gPad->SetBorderSize(border);
tex.DrawLatex(.5,.5,"d");
pad->cd(6); gPad->SetFillColor(quarkColor);
gPad->SetBorderSize(border);
tex.DrawLatex(.5,.5,"s");
pad->cd(7); gPad->SetFillColor(quarkColor);
gPad->SetBorderSize(border);
tex.DrawLatex(.5,.5,"b");
pad->cd(8); gPad->SetFillColor(forceColor);
gPad->SetBorderSize(border);
tex.DrawLatex(.5,.55,"g");
pad->cd(9); gPad->SetFillColor(leptonColor);
gPad->SetBorderSize(border);
tex.DrawLatex(.5,.5,"#nu_{e}");
pad->cd(10); gPad->SetFillColor(leptonColor);
gPad->SetBorderSize(border);
tex.DrawLatex(.5,.5,"#nu_{#mu}");
pad->cd(11); gPad->SetFillColor(leptonColor);
gPad->SetBorderSize(border);
tex.DrawLatex(.5,.5,"#nu_{#tau}");
pad->cd(12); gPad->SetFillColor(forceColor);
gPad->SetBorderSize(border);
tex.DrawLatex(.5,.5,"Z");
pad->cd(13); gPad->SetFillColor(leptonColor);
gPad->SetBorderSize(border);
tex.DrawLatex(.5,.5,"e");
pad->cd(14); gPad->SetFillColor(leptonColor);
gPad->SetBorderSize(border);
tex.DrawLatex(.5,.56,"#mu");
pad->cd(15); gPad->SetFillColor(leptonColor);
gPad->SetBorderSize(border);
tex.DrawLatex(.5,.5,"#tau");
pad->cd(16); gPad->SetFillColor(forceColor);
gPad->SetBorderSize(border);
tex.DrawLatex(.5,.5,"W");
c1->cd();
}
Author
Rene Brun

Definition in file quarks.C.

TPad
The most important graphics class in the ROOT system.
Definition: TPad.h:26
TAttText::SetTextColor
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
Definition: TAttText.h:43
Int_t
int Int_t
Definition: RtypesCore.h:45
TAttText::SetTextSize
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Definition: TAttText.h:46
TLatex::DrawLatex
TLatex * DrawLatex(Double_t x, Double_t y, const char *text)
Make a copy of this object with the new parameters And copy object attributes.
Definition: TLatex.cxx:1941
TLatex
To draw Mathematical Formula.
Definition: TLatex.h:18
kBlack
@ kBlack
Definition: Rtypes.h:65
TPad::cd
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
Definition: TPad.cxx:604
TAttText::SetTextAlign
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Definition: TAttText.h:41
TObject::Draw
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:197
TCanvas
The Canvas class.
Definition: TCanvas.h:23
gPad
#define gPad
Definition: TVirtualPad.h:287
TPad::Divide
void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0) override
Automatic pad generation by division.
Definition: TPad.cxx:1178
TPad::Draw
void Draw(Option_t *option="") override
Draw Pad in Current pad (re-parent pad if necessary).
Definition: TPad.cxx:1300
TAttText::SetTextAngle
virtual void SetTextAngle(Float_t tangle=0)
Set the text angle.
Definition: TAttText.h:42
kYellow
@ kYellow
Definition: Rtypes.h:66
TAttText::SetTextFont
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
Definition: TAttText.h:45
c1
return c1
Definition: legend1.C:41