1
2 invisible_list = [12,14,16,18]
3 invisible_list += [1000012,1000014,1000016,1000022,1000023,1000024,1000025,1000035]
4
6
7 - def __init__(self,MG_num,pid,fuse=0):
8 if fuse:
9 self.MG=str(MG_num)
10 else:
11 self.MG=int(MG_num)
12 self.pid=int(pid)
13 self.mass=0
14 self.mother=0
15 self.level=0
16 self.twin=0
17 self.neutrino=0
18 self.external=0
19
20
21 - def add_mother(self,obj):
23
25 """ not use anymore: define the twin for the particle if not defined """
26 print 'WARNING: Particle.def_twin() is an old routine. This routine hasn\'t been updated since 1/2/08'
27
28
29 if self.twin!=0:
30 return self.twin
31 else:
32 if self.mother:
33 if self.mother.des[0].MG==self.MG:
34 self.twin=self.mother.des[1]
35 self.mother.des[1].twin=self
36 else:
37 self.twin=self.mother.des[0]
38 self.mother.des[0].twin=self
39 else:
40 self.twin=0
41 return self.twin
42
43 - def def_mass(self,info):
44 """definition of the mass of the particle"""
45
46 try:
47 self.mass=float(info['mass'][str(abs(self.pid))])
48 except:
49 self.mass=0
50
51
52 - def def_all_mother(self):
53 "define list containing all mother of the particle"
54 try:
55 if self.all_mother_:
56 return self.all_mother_
57 except:
58 pass
59
60 mother=self.mother
61 if mother==0:
62 self.all_mother_=[]
63
64 else:
65 self.all_mother_=[mother]+mother.def_all_mother()
66
67 return self.all_mother_
68
69
70 - def all_mother(self):
71 """convinient alias"""
72 return self.def_all_mother()
73
75 """ detect the nearest neutrino in the decay branch
76 return this neutrino and its level compare to this particle """
77
78 analyse_list=list(self.des)
79 level_list=[1,1]
80 while analyse_list:
81 particle=analyse_list.pop(0)
82 level=level_list.pop(0)
83
84 if particle.neutrino:
85 return particle,level
86 elif particle.external==0:
87 analyse_list.append(particle.des)
88 level_list.append(level+1)
89 level_list.append(level+1)
90
91 return 0,0
92
93
94
95
96
98 """ print routine """
99
100 text='particle: '+str(self.MG)+'\tpid : '
101 if self.pid<10 and self.pid>0:
102 text+=' '
103 elif self.pid>9:
104 text+=' '
105 text+=str(self.pid)+'\tlevel: '+str(self.level)
106 try:
107 text+='\tmother: '+str(self.mother.MG)
108 except:
109 pass
110 try:
111 text+='\ttwin: '+str(self.twin.MG)
112 except:
113 pass
114 return text
115
116
118
124
125
126
127
128
130 "detect if the external particle is visible in the detector or not"
131
132 if (abs(self.pid) in invisible_list):
133 self.neutrino=1
134 else:
135 self.neutrino=0
136
137 return self.neutrino
138
140 tf_width={}
141 tf_width['p']=float(W_p)
142 tf_width['eta']=float(W_eta)
143 tf_width['phi']=float(W_phi)
144
145 self.tf_width=tf_width
146
148 """ compute the number of propa in common
149 return the total number of propagator before the two particle (default)
150 in addtion it can give the number of uncorelated propagator for the two particle (put total=0)
151 """
152 not_defined_mother=[]
153 if part.mother in self.all_mother():
154 if total:
155 return self.level
156 else:
157 return self.level, self.level-part.level,0
158
159 if self.mother in part.all_mother():
160 if total:
161 return part.level
162 else:
163 print part.level,self.level
164 return part.level, 0, part.level-self.level
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183 common=0
184 for propa in self.all_mother():
185 if propa in part.all_mother() and propa.channel[0]=='S':
186 common+=1
187
188
189 if total:
190 return self.level+part.level-common
191 else:
192 return self.level+part.level-common,self.level-common,part.level-common
193
195
202
204 "define mother/child/twin relation: the two entry are the child object"
205
206 try:
207 self.des.append(obj)
208
209 obj.twin=self.des[0]
210 self.des[0].twin=obj
211 except:
212 self.des=[obj]
213
214 obj.mother=self
215
216
227
228
229
230
231
232
233
234
236 """ print lot of information """
237
238 text='particle: '+str(self.MG)+'\tpid : '
239 if self.pid<10 and self.pid>0:
240 text+=' '
241 elif self.pid>9:
242 text+=' '
243 text+=str(self.pid)+'\tlevel: '+str(self.level)
244 text+='\tchannel: '+str(self.channel)
245 try:
246 text+='\tdes: '+str(self.des[0].MG)+' '+str(self.des[1].MG)
247 except:
248 try:
249 text+='\tdes: '+str(self.des[0].MG)
250 except:
251 pass
252 try:
253 text+='\tmother: '+str(self.mother.MG)
254 except:
255 text+='\t\t'
256
257 text+='\tmass/width: '+str(self.mass)+'/'+str(self.width)
258 return text
259