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