LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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  switch (pdgcode) {
67  case 11:
68  case -11:
69  case 12:
70  case -12:
71  return kRed;
72  case 13:
73  case -13:
74  case 14:
75  case -14:
76  return kBlue;
77  case 15:
78  case -15:
79  case 16:
80  case -16:
81  return kGreen;
82  case 22:
83  return kYellow-1;
84  case 111:
85  case 211:
86  case -211:
87  case 321:
88  case -321:
89  case 130:
90  case 310:
91  return kMagenta-3;
92  case 2112:
93  case 2212:
94  return kMagenta+3;
95  default:
96  return kBlack;
97  }
98  }
99 
100  //............................................................
101 
102  int Style::LineWidthFromPDG(int pdgcode) {
103  if (pdgcode == 2112 || pdgcode == 2212) return 4;
104  return 2;
105  }
106 
107  //............................................................
108 
109  int Style::LineStyleFromPDG(int pdgcode) {
110  switch (pdgcode) {
111  case 11:
112  case -11:
113  case 13:
114  case -13:
115  case 15:
116  case -15:
117  case 211:
118  case -211:
119  case 2212:
120  return kSolid;
121  case 12:
122  case -12:
123  case 14:
124  case -14:
125  case 16:
126  case -16:
127  case 22:
128  case 2112:
129  return kDotted;
130  case 111:
131  return kDashed;
132  }
133  return 0;
134  }
135 
136  //............................................................
137 
138  void Style::FromPDG(TLine& line, int pdgcode)
139  {
140  // Many cases handled here for most common particles. Extend list as
141  // needed
142  int kSolid=1, kDashed=2, kDotted=3 /* kDashDot=4 */;
143  int c = kGray;
144  int s = kDotted;
145  int w = 1;
146 
147  switch (pdgcode) {
148  case 11: c=kRed; s=kSolid; w=2; break; // e-
149  case -11: c=kRed; s=kSolid; w=2; break; // e+
150  case 12: c=kRed; s=kDotted; w=2; break; // nue
151  case -12: c=kRed; s=kDotted; w=2; break; // nue-bar
152  case 13: c=kBlue; s=kSolid; w=2; break; // mu+
153  case -13: c=kBlue; s=kSolid; w=2; break; // mu-
154  case 14: c=kBlue; s=kDotted; w=2; break; // numu
155  case -14: c=kBlue; s=kDotted; w=2; break; // numu-bar
156  case 15: c=kGreen; s=kSolid; w=2; break; // tau+
157  case -15: c=kGreen; s=kSolid; w=2; break; // tau-
158  case 16: c=kGreen; s=kDotted; w=2; break; // nutau
159  case -17: c=kGreen; s=kDotted; w=2; break; // nutau-bar
160  case 22: c=kYellow-1; s=kDotted; w=2; break; // gamma
161  case 111: c=kMagenta-3; s=kDashed; w=3; break; // pi0
162  case 211: c=kMagenta-3; s=kSolid; w=3; break; // pi+
163  case -211: c=kMagenta-3; s=kSolid; w=3; break; // pi-
164  case 2212: c=kMagenta+3; s=kSolid; w=4; break; // proton
165  case 2112: c=kMagenta+3; s=kDotted; w=4; break; // neutron
166  default: break;
167  };
168  line.SetLineColor(c);
169  line.SetLineStyle(s);
170  line.SetLineWidth(w);
171  }
172 }//namespace
Float_t s
Definition: plot.C:23
static void FromPDG(TLine &line, int pdgcode)
Definition: Style.cxx:138
static int LineWidthFromPDG(int pdgcode)
Definition: Style.cxx:102
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:109
Float_t w
Definition: plot.C:23