Style.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file Style.cxx
3 //
4 /// \version $Id: Style.cxx,v 1.1.1.1 2010/11/10 19:44:54 p-novaart Exp $
5 /// \author messier@indiana.edu
6 ////////////////////////////////////////////////////////////////////////
8 #include "TLine.h"
9 
10 namespace gar {
11 namespace evd{
12 
13  /// Convert PDG code to a latex string (root-style)
14  const char* Style::LatexName(int pdgcode)
15  {
16  switch (pdgcode) {
17  case 22: return "#gamma";
18  case -11: return "e^{+}";
19  case 11: return "e^{-}";
20  case 13: return "#mu";
21  case -15: return "#bar{#tau}";
22  case 15: return "#tau";
23  case -13: return "#bar{#mu}";
24  case 12: return "#nu_{e}";
25  case 14: return "#nu_{#mu}";
26  case 16: return "#nu_{#tau}";
27  case -12: return "#bar{#nu}_{e}";
28  case -14: return "#bar{#nu}_{#mu}";
29  case -16: return "#bar{#nu}_{#tau}";
30  case 111: return "#pi^{0}";
31  case 211: return "#pi^{+}";
32  case -211: return "#pi^{-}";
33  case 321: return "K^{+}";
34  case -321: return "K^{-}";
35  case 130: return "K^{0}_{L}";
36  case 310: return "K^{0}_{S}";
37  case 2112: return "n";
38  case 2212: return "p";
39  case -2112: return "#bar{n}";
40  case -2212: return "#bar{p}";
41  case 2224: return "#Delta^{++}";
42  case 1000060120: return "^{12}C";
43  case 1000170350: return "^{35}Cl";
44  case 1000260560: return "^{56}Fe";
45  case 1000220480: return "^{48}Ti";
46  case 1000080160: return "^{16}O";
47  case 1000070140: return "^{14}N";
48  case 1000110230: return "^{23}Na";
49  case 1000130270: return "^{27}Al";
50  case 1000140280: return "^{28}Si";
51  case 1000200400: return "^{40}Ca";
52  case 1000561370: return "^{137}Ba";
53  case 1000180400: return "^{40}Ar";
54  case 1000180390: return "^{39}Ar";
55  case 2000000001: return "GENIE_{1}";
56  case 2000000002: return "GENIE_{2}";
57  default:
58  static char buff[256];
59  sprintf(buff,"X_{%d}",pdgcode);
60  return buff;
61  }
62  return 0;
63  }
64 
65  //......................................................................
66 
68  switch (pdgcode) {
69  case 11:
70  case -11:
71  case 12:
72  case -12:
73  return kRed;
74  case 13:
75  case -13:
76  case 14:
77  case -14:
78  return kBlue;
79  case 15:
80  case -15:
81  case 16:
82  case -16:
83  return kGreen;
84  case 22:
85  return kYellow-1;
86  case 111:
87  case 211:
88  case -211:
89  case 321:
90  case -321:
91  case 130:
92  case 310:
93  return kMagenta-3;
94  case 2112:
95  case 2212:
96  return kMagenta+3;
97  default:
98  return kBlack;
99  }
100  }
101 
102  //............................................................
103 
105  if (pdgcode == 2112 || pdgcode == 2212) return 4;
106  return 2;
107  }
108 
109  //............................................................
110 
112  switch (pdgcode) {
113  case 11:
114  case -11:
115  case 13:
116  case -13:
117  case 15:
118  case -15:
119  case 211:
120  case -211:
121  case 2212:
122  return kSolid;
123  case 12:
124  case -12:
125  case 14:
126  case -14:
127  case 16:
128  case -16:
129  case 22:
130  case 2112:
131  return kDotted;
132  case 111:
133  return kDashed;
134  }
135  return 0;
136  }
137 
138  //............................................................
139 
140  void Style::FromPDG(TLine& line, int pdgcode)
141  {
142  // Many cases handled here for most common particles. Extend list as
143  // needed
144  int kSolid = 1;
145  int kDashed = 2;
146  int kDotted = 3; /* kDashDot=4 */
147  int c = kGray;
148  int s = kDotted;
149  int w = 1;
150 
151  switch (pdgcode) {
152  case 11: c=kRed; s=kSolid; w=2; break; // e-
153  case -11: c=kRed; s=kSolid; w=2; break; // e+
154  case 12: c=kRed; s=kDotted; w=2; break; // nue
155  case -12: c=kRed; s=kDotted; w=2; break; // nue-bar
156  case 13: c=kBlue; s=kSolid; w=2; break; // mu+
157  case -13: c=kBlue; s=kSolid; w=2; break; // mu-
158  case 14: c=kBlue; s=kDotted; w=2; break; // numu
159  case -14: c=kBlue; s=kDotted; w=2; break; // numu-bar
160  case 15: c=kGreen; s=kSolid; w=2; break; // tau+
161  case -15: c=kGreen; s=kSolid; w=2; break; // tau-
162  case 16: c=kGreen; s=kDotted; w=2; break; // nutau
163  case -17: c=kGreen; s=kDotted; w=2; break; // nutau-bar
164  case 22: c=kYellow-1; s=kDotted; w=2; break; // gamma
165  case 111: c=kMagenta-3; s=kDashed; w=3; break; // pi0
166  case 211: c=kMagenta-3; s=kSolid; w=3; break; // pi+
167  case -211: c=kMagenta-3; s=kSolid; w=3; break; // pi-
168  case 2212: c=kMagenta+3; s=kSolid; w=4; break; // proton
169  case 2112: c=kMagenta+3; s=kDotted; w=4; break; // neutron
170  default: break;
171  };
172  line.SetLineColor(c);
173  line.SetLineStyle(s);
174  line.SetLineWidth(w);
175  }
176 }
177 }//namespace
178 ////////////////////////////////////////////////////////////////////////
static const char * LatexName(int pdgcode)
Convert PDG code to a latex string (root-style)
Definition: Style.cxx:14
static int LineStyleFromPDG(int pdgcode)
Definition: Style.cxx:111
LArSoft includes.
Definition: InfoTransfer.h:33
static int ColorFromPDG(int pdgcode)
Definition: Style.cxx:67
General GArSoft Utilities.
static int LineWidthFromPDG(int pdgcode)
Definition: Style.cxx:104
void line(double t, double *p, double &x, double &y, double &z)
static void FromPDG(TLine &line, int pdgcode)
Definition: Style.cxx:140
static QCString * s
Definition: config.cpp:1042