ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
mass_spectrum.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_graphics
3 /// This macro makes use of some basic graphics primitives such as line, arrow
4 /// and text. It as been written using the TCanvas ToolBar to produce a first
5 /// draft and was then modified for fine adjustments. Note also the use
6 /// of C functions. They allow to simplify the macro reading and editing by
7 /// avoiding code repetition or defining some graphics attributes in one single
8 /// place. This technique to generate drawings may appear not very user friendly
9 /// compare to all the "wysiwyg" graphics editors available. In some cases it can
10 /// be more powerful than a GUI interface because it allows to generate very
11 /// precise drawing and using computation to generate them.
12 ///
13 /// \macro_image
14 /// \macro_code
15 ///
16 /// \author Olivier Couet
17 
18 void hline (Double_t x, Double_t y)
19 {
20  Double_t dx = 0.1;
21  TLine *l = new TLine(x,y,x+dx,y);
22  l->Draw();
23  l->SetLineWidth(4);
24 }
25 
26 void arrow (Double_t x1, Double_t y1, Double_t x2, Double_t y2, Int_t ls)
27 {
28  TArrow *arr = new TArrow(x1,y1,x2,y2,0.025,"|>");
29  arr->SetFillColor(1);
30  arr->SetFillStyle(1001);
31  arr->SetLineStyle(ls);
32  arr->SetAngle(19);
33  arr->Draw();
34 }
35 
36 void mass_spectrum()
37 {
38  TCanvas *C = new TCanvas("C","C",800,500);
39 
40  hline (0.10,0.25);
41  hline (0.10,0.80);
42  hline (0.30,0.90);
43  hline (0.30,0.35);
44  hline (0.45,0.60);
45  hline (0.58,0.68);
46  hline (0.73,0.70);
47  hline (0.89,0.75);
48 
49  arrow(0.32, 0.90, 0.32, 0.35, 1);
50  arrow(0.34, 0.90, 0.34, 0.35, 1);
51  arrow(0.36, 0.90, 0.36, 0.60, 1);
52  arrow(0.38, 0.90, 0.38, 0.70, 1);
53 
54  arrow(0.30, 0.90, 0.18, 0.25, 1);
55  arrow(0.30, 0.35, 0.19, 0.25, 1);
56  arrow(0.40, 0.90, 0.47, 0.61, 1);
57 
58  arrow(0.15, 0.25, 0.15, 0.19, 1);
59  arrow(0.15, 0.80, 0.15, 0.74, 1);
60 
61  arrow(0.50, 0.60, 0.50, 0.54, 1);
62  arrow(0.60, 0.68, 0.60, 0.62, 1);
63  arrow(0.94, 0.75, 0.94, 0.69, 1);
64 
65  arrow(0.32, 0.35, 0.32, 0.19, 1);
66  arrow(0.36, 0.35, 0.36, 0.19, 1);
67  arrow(0.38, 0.35, 0.38, 0.19, 1);
68 
69  arrow(0.40, 0.90, 0.60, 0.68, 1);
70  arrow(0.40, 0.90, 0.90, 0.75, 1);
71  arrow(0.45, 0.60, 0.35, 0.35, 1);
72  arrow(0.30, 0.90, 0.18, 0.80, 2);
73  arrow(0.67, 0.68, 0.36, 0.35, 1);
74  arrow(0.78, 0.70, 0.37, 0.35, 2);
75  arrow(0.91, 0.75, 0.39, 0.35, 1);
76 
77  TLatex l1;
78  l1.SetTextSize(0.035);
79  l1.SetTextAlign(22);
80  l1.SetTextFont(132);
81  l1.DrawLatex(0.15, 0.73, "hadrons");
82  l1.DrawLatex(0.15, 0.18, "hadrons");
83  l1.DrawLatex(0.32, 0.18, "hadrons");
84  l1.DrawLatex(0.38, 0.59, "hadrons");
85  l1.DrawLatex(0.50, 0.53, "hadrons");
86  l1.DrawLatex(0.94, 0.68, "hadrons");
87  l1.DrawLatex(0.58, 0.62, "hadrons");
88  l1.DrawLatex(0.41, 0.18, "radiative");
89 
90  TLatex l2;
91  l2.SetTextSize(0.038);
92  l2.SetTextAlign(22);
93  l2.SetTextFont(132);
94  l2.DrawLatex(0.07, 0.08, "#font[12]{J^{PC}} =");
95  l2.DrawLatex(0.15, 0.08, "0^{-+}");
96  l2.DrawLatex(0.35, 0.08, "1^{--}");
97  l2.DrawLatex(0.50, 0.08, "0^{++}");
98  l2.DrawLatex(0.62, 0.08, "1^{++}");
99  l2.DrawLatex(0.77, 0.08, "1^{+-}");
100  l2.DrawLatex(0.93, 0.08, "2^{++}");
101  l2.DrawLatex(0.15, 0.83, "#eta_{c}(2S)");
102  l2.DrawLatex(0.15, 0.28, "#eta_{c}(1S)");
103  l2.DrawLatex(0.35, 0.93, "#psi(2S)");
104  l2.DrawLatex(0.45, 0.35, "#font[12]{J}/#psi(1S)");
105  l2.DrawLatex(0.51, 0.63, "#chi_{c0}(1P)");
106  l2.DrawLatex(0.63, 0.71, "#chi_{c1}(1P)");
107  l2.DrawLatex(0.78, 0.73, "h_{c1}(1P)");
108  l2.DrawLatex(0.94, 0.78, "#chi_{c2}(1P)");
109 
110  TLatex l3;
111  l3.SetTextSize(0.037);
112  l3.SetTextAlign(11);
113  l3.SetTextFont(132);
114  l3.DrawLatex(0.23, 0.86, "#font[152]{g}");
115  l3.DrawLatex(0.23, 0.57, "#font[152]{g}");
116  l3.DrawLatex(0.44, 0.77, "#font[152]{g}");
117  l3.DrawLatex(0.40, 0.50, "#font[152]{g}");
118  l3.DrawLatex(0.45, 0.46, "#font[152]{g}");
119  l3.DrawLatex(0.71, 0.61, "#font[152]{g}");
120  l3.DrawLatex(0.24, 0.31, "#font[152]{g}");
121  l3.DrawLatex(0.38, 0.81, "#font[152]{g^{*}}");
122  l3.DrawLatex(0.355, 0.16, "#font[152]{g^{*}}");
123  l3.DrawLatex(0.295, 0.50, "#pi#pi");
124  l3.DrawLatex(0.345, 0.53, "#eta,#pi^{0}");
125  l3.DrawLatex(0.70, 0.65, "#pi^{0}");
126 }
virtual void SetLineWidth(Width_t lwidth)
Definition: TAttLine.h:57
int Int_t
Definition: RtypesCore.h:41
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:254
virtual void SetFillStyle(Style_t fstyle)
Definition: TAttFill.h:52
virtual void SetTextFont(Font_t tfont=62)
Definition: TAttText.h:59
TArrow * arrow
virtual void Draw(Option_t *option="")
Draw this arrow with its current attributes.
Definition: TArrow.cxx:121
To draw Mathematical Formula.
Definition: TLatex.h:33
TLine l1(2.5, 4.5, 15.5, 4.5)
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:1901
virtual void SetTextAlign(Short_t align=11)
Definition: TAttText.h:55
virtual void SetFillColor(Color_t fcolor)
Definition: TAttFill.h:50
A simple line.
Definition: TLine.h:41
The Canvas class.
Definition: TCanvas.h:48
double Double_t
Definition: RtypesCore.h:55
virtual void SetLineStyle(Style_t lstyle)
Definition: TAttLine.h:56
virtual void SetTextSize(Float_t tsize=1)
Definition: TAttText.h:60
Draw all kinds of Arrows.
Definition: TArrow.h:35
virtual void SetAngle(Float_t angle=60)
Definition: TArrow.h:64