CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ParticleDataList.py
Go to the documentation of this file.
2  """ Class for holding particle data such as charge.
3  """
4  def __init__(self, charge=0):
5  self.charge=charge
6 
7  def __repr__(self):
8  return "charge="+str(self.charge)
9 
11  """ Class for generic handling particle ids, names and properties.
12 
13  Multiple ids can be mapped to multiple names of particle.
14  First name/id in the list is the default name. But additional names/ids can be given.
15  An examples can be found in the defaultParticleDataList.
16  """
17  def __init__(self, list=None):
18  """ A list of particle ids and names can be given to the constructor.
19  """
20  self._list = []
21  if list != None:
22  self._list = list
23 
24  def setList(self, list):
25  self._list = list
26 
27  def getList(self):
28  return self._list
29 
30  def addParticle(self, ids, names, particleData):
31  """ Add a paricle with (multiple) ids and names to the list.
32  """
33  if not (isinstance(ids,list) and isinstance(names,list)):
34  raise TypeError("addParticle needs to lists as input: e.g. [1,-1],['d','dbar']")
35  self._list += [(ids, names, particleData)]
36 
37  def getDefaultName(self, name):
38  """ Return the default (first in list) name given any of the particle's names.
39  """
40  for items in self._list:
41  if name in items[1]:
42  return items[1][0]
43  return name
44 
45  def getDefaultId(self, id):
46  """ Return the default (first in list) id given any of the particle's ids.
47  """
48  for items in self._list:
49  if id in items[0]:
50  return items[0][0]
51  return id
52 
53  def getIdFromName(self, name):
54  """ Return the default (first in list) id given any of the particle's names.
55  """
56  for items in self._list:
57  if name in items[1]:
58  return items[0][0]
59  return 0
60 
61  def getNameFromId(self, id):
62  """ Return the default (first in list) name given any of the particle's ids.
63  """
64  for items in self._list:
65  if id in items[0]:
66  return items[1][0]
67  return "unknown"
68 
69  def getParticleDataFromId(self, id):
70  for items in self._list:
71  if id in items[0]:
72  return items[2]
73 
74  def isQuarkId(self, id):
75  return abs(id) in [1, 2, 3, 4, 5, 6]
76 
77  def isLeptonId(self, id):
78  return abs(id) in [11, 12, 13, 14, 15, 16]
79 
80  def isGluonId(self, id):
81  return abs(id) in [21, 9]
82 
83  def isBosonId(self, id):
84  return abs(id) in [21, 9, 22, 23, 24, 25, 32, 33, 34, 35, 36, 37]
85 
86  def isPhotonId(self, id):
87  return id == 22
88 
89  def isHiggsId(self, id):
90  return abs(id) in [25, 35, 36, 37]
91 
92  def isSusyId(self, id):
93  return abs(id) in [1000001, 1000002, 1000003, 1000004, 1000005, 1000006, 1000011, 1000012, 1000013, 1000014, 1000015, 1000016, 2000001, 2000002, 2000003, 2000004, 2000005, 2000006, 2000011, 2000013, 1000021, 1000022, 1000023, 1000024, 1000025, 1000035, 1000037, 1000039]
94 
95 defaultQuarkDataList = ParticleDataList([
96 ([1, - 1], ["d", "d_quark", "dbar"], ParticleData(1.0/3.0)),
97 ([2, - 2], ["u", "u_quark", "ubar"], ParticleData(2.0/3.0)),
98 ([3, - 3], ["s", "s_quark", "sbar"], ParticleData(1.0/3.0)),
99 ([4, - 4], ["c", "c_quark", "cbar"], ParticleData(2.0/3.0)),
100 ([5, - 5], ["b", "b_quark", "bbar"], ParticleData(1.0/3.0)),
101 ([6, - 6], ["t", "t_quark", "tbar"], ParticleData(2.0/3.0))
102 ])
103 
104 defaultLeptonDataList = ParticleDataList([
105 ([11, - 11], ["e","electron", "Electron", "e+", "e-"], ParticleData(1)),
106 ([12, - 12], ["nu_e", "Electron_neutrino", "electron_neutrino", "nu_electron"], ParticleData(0)),
107 ([13, - 13], ["mu", "Muon", "muon", "mu+", "mu-"], ParticleData(1)),
108 ([14, - 14], ["nu_mu", "nu_muon", "Muon_neutrino", "muon_neutrino"], ParticleData(0)),
109 ([15, - 15], ["tau", "Tau", "tau+", "tau-"], ParticleData(1)),
110 ([16, - 16], ["nu_tau", "Tau_neutrino", "tau_neutrino"], ParticleData(0))
111 ])
112 
113 defaultBosonDataList = ParticleDataList([
114 ([21, 9], ["g", "Gluon", "gluon"], ParticleData(0)),
115 ([22], ["gamma", "Photon", "photon"], ParticleData(0)),
116 ([23], ["Z", "Z_boson"], ParticleData(0)),
117 ([24, - 24], ["W", "W_boson", "W+", "W-"], ParticleData(1)),
118 ([25], ["h", "Higgs_boson", "Higgs", "higgs_boson"], ParticleData(0))
119 ])
120 
121 defaultHadronDataList = ParticleDataList([
122 ([111], ["pi0", "Pi0"], ParticleData(0)),
123 ([112], ["pi+", "Pi+"], ParticleData(1)),
124 ([221], ["eta", "Eta"], ParticleData(0)),
125 ([130], ["K0_L"], ParticleData(0)),
126 ([310], ["K0_S"], ParticleData(0)),
127 ([311], ["K0"], ParticleData(0)),
128 ([321], ["K+"], ParticleData(1)),
129 ([411], ["D0"], ParticleData(0)),
130 ([421], ["D+"], ParticleData(1)),
131 ([511], ["B0"], ParticleData(0)),
132 ([521], ["B+"], ParticleData(1)),
133 ([2212], ["p","Proton","proton"], ParticleData(1)),
134 ([2112], ["n","Neutron","neutron"], ParticleData(0)),
135 ([2224], ["Delta++"], ParticleData(2)),
136 ([2214], ["Delta+"], ParticleData(1)),
137 ([2114], ["Delta0"], ParticleData(0)),
138 ([1114], ["Delta-"], ParticleData(1))
139 ])
140 
141 defaultExtensionDataList = ParticleDataList([
142 ([32], ["Z'", "Z_prime"], ParticleData(0)),
143 ([33], ["Z''", "Z_primeprime"], ParticleData(0)),
144 ([34, - 34], ["W'", "W_prime", "W'+", "W'-"], ParticleData(1)),
145 ([37, - 37], ["H+", "Charged_Higgs", "H+", "H-"], ParticleData(1)),
146 ([35], ["H0", "Neutral_Higgs_H", "H"], ParticleData(0)),
147 ([36], ["A0", "Neutral_Higgs_A", "A"], ParticleData(0))
148 ])
149 
150 defaultSusyDataList = ParticleDataList([
151 ([1000001, - 1000001], ["d_squark_L", "d~_L", "d~_L_bar"], ParticleData(1.0/3.0)),
152 ([1000002, - 1000002], ["u_squark_L", "u~_L", "u~_L_bar"], ParticleData(2.0/3.0)),
153 ([1000003, - 1000003], ["s_squark_L", "s~_L", "s~_L_bar"], ParticleData(1.0/3.0)),
154 ([1000004, - 1000004], ["c_squark_L", "c~_L", "c~_L_bar"], ParticleData(2.0/3.0)),
155 ([1000005, - 1000005], ["sbottom_L", "b~_1", "b~_1_bar"], ParticleData(1.0/3.0)),
156 ([1000006, - 1000006], ["stop_L", "t~_1", "t~_1_bar"], ParticleData(2.0/3.0)),
157 
158 ([1000011, - 1000011], ["Selectron_L", "selectron_L", "e~_L", "e~_L+", "e~_L-"], ParticleData(1)),
159 ([1000012, - 1000012], ["Electron_sneutrino", "electron_sneutrino", "nu~_e_L"], ParticleData(0)),
160 ([1000013, - 1000013], ["Smuon_L", "smuon_L", "mu~_L", "mu~_L+", "mu~_L-"], ParticleData(1)),
161 ([1000014, - 1000014], ["Muon_sneutrino", "muon_sneutrino", "nu~_mu_L"], ParticleData(0)),
162 ([1000015, - 1000015], ["Stau_1", "stau_1", "tau~_1+", "tau~_1-"], ParticleData(1)),
163 ([1000016, - 1000016], ["Tau_sneutrino", "tau_sneutrino", "nu~_tau_L"], ParticleData(0)),
164 
165 ([2000001, - 2000001], ["d_squark_R", "d~_L", "d~_L_bar"], ParticleData(1.0/3.0)),
166 ([2000002, - 2000002], ["u_squark_R", "u~_L", "u~_L_bar"], ParticleData(2.0/3.0)),
167 ([2000003, - 2000003], ["s_squark_R", "s~_L", "s~_L_bar"], ParticleData(1.0/3.0)),
168 ([2000004, - 2000004], ["c_squark_R", "c~_L", "c~_L_bar"], ParticleData(2.0/3.0)),
169 ([2000005, - 2000005], ["sbottom_R", "b~_2", "b~_2_bar"], ParticleData(1.0/3.0)),
170 ([2000006, - 2000006], ["stop_R", "t~_2", "t~_2_bar"], ParticleData(2.0/3.0)),
171 
172 ([2000011, - 2000011], ["Selectron_R", "selectron_R", "e~_R", "e~_R+", "e~_R-"], ParticleData(1)),
173 ([1000013, - 1000013], ["Smuon_R", "smuon_R", "mu~_L", "mu~_R+", "mu~_R-"], ParticleData(1)),
174 ([1000015, - 1000015], ["Stau_2", "stau_2", "tau~_2+", "tau~_2 -"], ParticleData(1)),
175 
176 ([1000021], ["Gluino", "gluino", "g~"], ParticleData(0)),
177 ([1000022, - 1000022], ["Neutralino_1", "neutralino_1", "chi~_1"], ParticleData(0)),
178 ([1000023, - 1000023], ["Neutralino_2", "neutralino_2", "chi~_2"], ParticleData(0)),
179 ([1000025, - 1000025], ["Neutralino_3", "neutralino_3", "chi~_3"], ParticleData(0)),
180 ([1000035, - 1000035], ["Neutralino_4", "neutralino4", "chi~_4"], ParticleData(0)),
181 
182 ([1000024, - 1000024], ["Chargino_1", "chargino_1", "chi~_1+", "chi~_1-"], ParticleData(1)),
183 ([1000037, - 1000037], ["Chargino_2", "chargino_2", "chi~_2+", "chi~_2-"], ParticleData(1)),
184 
185 ([1000039], ["Gravitino", "gravitino", "G"], ParticleData(0))
186 ])
187 
188 defaultParticleDataList = ParticleDataList(
189 defaultQuarkDataList.getList() +
190 defaultLeptonDataList.getList() +
191 defaultBosonDataList.getList() +
192 defaultHadronDataList.getList() +
193 defaultExtensionDataList.getList() +
194 defaultSusyDataList.getList())
195 
196 partonParticleDataList = ParticleDataList([
197 ([1, - 1, 2, - 2, 3, - 3, 4, - 4, 21, 9], ["parton", "d", "dbar", "u", "ubar", "s", "sbar", "c", "cbar", "b", "bbar", "t", "tbar", "gluon", "g"], ParticleData())
198 ] +
199 defaultLeptonDataList.getList() + [
200 ([22], ["gamma", "Photon", "photon"], ParticleData(0)),
201 ([23], ["Z", "Z_boson"], ParticleData(0)),
202 ([24, - 24], ["W", "W_boson", "W+", "W-"], ParticleData(1)),
203 ([25], ["h", "Higgs_boson", "Higgs", "higgs_boson"], ParticleData(1))
204 ])
#define abs(x)
Definition: mlp_lapack.h:159
list object
Definition: dbtoconf.py:77