LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
Style.cxx
Go to the documentation of this file.
1 //
7 #include "TLine.h"
8 
9 namespace evd {
10 
12  const char* Style::LatexName(int pdgcode)
13  {
14  switch (pdgcode) {
15  case 22: return "#gamma";
16  case -11: return "e^{+}";
17  case 11: return "e^{-}";
18  case 13: return "#mu";
19  case -15: return "#bar{#tau}";
20  case 15: return "#tau";
21  case -13: return "#bar{#mu}";
22  case 12: return "#nu_{e}";
23  case 14: return "#nu_{#mu}";
24  case 16: return "#nu_{#tau}";
25  case -12: return "#bar{#nu}_{e}";
26  case -14: return "#bar{#nu}_{#mu}";
27  case -16: return "#bar{#nu}_{#tau}";
28  case 111: return "#pi^{0}";
29  case 211: return "#pi^{+}";
30  case -211: return "#pi^{-}";
31  case 321: return "K^{+}";
32  case -321: return "K^{-}";
33  case 130: return "K^{0}_{L}";
34  case 310: return "K^{0}_{S}";
35  case 2112: return "n";
36  case 2212: return "p";
37  case -2112: return "#bar{n}";
38  case -2212: return "#bar{p}";
39  case 2224: return "#Delta^{++}";
40  case 1000060120: return "^{12}C";
41  case 1000170350: return "^{35}Cl";
42  case 1000260560: return "^{56}Fe";
43  case 1000220480: return "^{48}Ti";
44  case 1000080160: return "^{16}O";
45  case 1000070140: return "^{14}N";
46  case 1000110230: return "^{23}Na";
47  case 1000130270: return "^{27}Al";
48  case 1000140280: return "^{28}Si";
49  case 1000200400: return "^{40}Ca";
50  case 1000561370: return "^{137}Ba";
51  case 1000180400: return "^{40}Ar";
52  case 1000180390: return "^{39}Ar";
53  case 2000000001: return "GENIE_{1}";
54  case 2000000002: return "GENIE_{2}";
55  default:
56  static char buff[256];
57  sprintf(buff, "X_{%d}", pdgcode);
58  return buff;
59  }
60  return 0;
61  }
62 
63  //......................................................................
64 
65  int Style::ColorFromPDG(int pdgcode)
66  {
67  switch (pdgcode) {
68  case 11:
69  case -11:
70  case 12:
71  case -12: return kRed;
72  case 13:
73  case -13:
74  case 14:
75  case -14: return kBlue;
76  case 15:
77  case -15:
78  case 16:
79  case -16: return kGreen;
80  case 22: return kYellow - 1;
81  case 111:
82  case 211:
83  case -211:
84  case 321:
85  case -321:
86  case 130:
87  case 310: return kMagenta - 3;
88  case 2112:
89  case 2212: return kMagenta + 3;
90  default: return kBlack;
91  }
92  }
93 
94  //............................................................
95 
96  int Style::LineWidthFromPDG(int pdgcode)
97  {
98  if (pdgcode == 2112 || pdgcode == 2212) return 3;
99  return 2;
100  }
101 
102  //............................................................
103 
104  int Style::LineStyleFromPDG(int pdgcode)
105  {
106  switch (pdgcode) {
107  case 11:
108  case -11: return kDotted;
109  case 13:
110  case -13:
111  case 15:
112  case -15:
113  case 211:
114  case -211:
115  case 2212: return kSolid;
116  case 12:
117  case -12:
118  case 14:
119  case -14:
120  case 16:
121  case -16:
122  case 22:
123  case 2112: return kDotted;
124  case 111: return kDashed;
125  }
126  return 0;
127  }
128 
129  //............................................................
130 
131  void Style::FromPDG(TLine& line, int pdgcode)
132  {
133  // Many cases handled here for most common particles. Extend list as
134  // needed
135  int kSolid = 1, kDashed = 2, kDotted = 3 /* kDashDot=4 */;
136  int c = kGray;
137  int s = kDotted;
138  int w = 1;
139 
140  switch (pdgcode) {
141  case 11:
142  c = kRed;
143  s = kSolid;
144  w = 2;
145  break; // e-
146  case -11:
147  c = kRed;
148  s = kSolid;
149  w = 2;
150  break; // e+
151  case 12:
152  c = kRed;
153  s = kDotted;
154  w = 2;
155  break; // nue
156  case -12:
157  c = kRed;
158  s = kDotted;
159  w = 2;
160  break; // nue-bar
161  case 13:
162  c = kBlue;
163  s = kSolid;
164  w = 2;
165  break; // mu+
166  case -13:
167  c = kBlue;
168  s = kSolid;
169  w = 2;
170  break; // mu-
171  case 14:
172  c = kBlue;
173  s = kDotted;
174  w = 2;
175  break; // numu
176  case -14:
177  c = kBlue;
178  s = kDotted;
179  w = 2;
180  break; // numu-bar
181  case 15:
182  c = kGreen;
183  s = kSolid;
184  w = 2;
185  break; // tau+
186  case -15:
187  c = kGreen;
188  s = kSolid;
189  w = 2;
190  break; // tau-
191  case 16:
192  c = kGreen;
193  s = kDotted;
194  w = 2;
195  break; // nutau
196  case -17:
197  c = kGreen;
198  s = kDotted;
199  w = 2;
200  break; // nutau-bar
201  case 22:
202  c = kYellow - 1;
203  s = kDotted;
204  w = 2;
205  break; // gamma
206  case 111:
207  c = kMagenta - 3;
208  s = kDashed;
209  w = 3;
210  break; // pi0
211  case 211:
212  c = kMagenta - 3;
213  s = kSolid;
214  w = 3;
215  break; // pi+
216  case -211:
217  c = kMagenta - 3;
218  s = kSolid;
219  w = 3;
220  break; // pi-
221  case 2212:
222  c = kMagenta + 3;
223  s = kSolid;
224  w = 4;
225  break; // proton
226  case 2112:
227  c = kMagenta + 3;
228  s = kDotted;
229  w = 4;
230  break; // neutron
231  default: break;
232  };
233  line.SetLineColor(c);
234  line.SetLineStyle(s);
235  line.SetLineWidth(w);
236  }
237 } //namespace
static void FromPDG(TLine &line, int pdgcode)
Definition: Style.cxx:131
static int LineWidthFromPDG(int pdgcode)
Definition: Style.cxx:96
LArSoft includes.
static int ColorFromPDG(int pdgcode)
Definition: Style.cxx:65
static const char * LatexName(int pdgcode)
Convert PDG code to a latex string (root-style)
Definition: Style.cxx:12
static int LineStyleFromPDG(int pdgcode)
Definition: Style.cxx:104
Float_t w
Definition: plot.C:20