def get_particles(part,target='p+'): finalstate = [part,target] part_list = [] for item in ParticleDataToolFetcher.getOriginParticles(finalstate): energythreshold = ParticleDataSource.getMass(item[1][0])-ParticleDataSource.getMass(target) part_list.append([energythreshold,item]) return part_list
def breit_wigner(part0,virtpart): E = ParticleDataSource.getMass(part0)**2 M = ParticleDataSource.getMass(virtpart)**2 T = ParticleDataSource.getWidth(virtpart)**2 gamma = math.sqrt((M+T)*M) k = 2*math.sqrt(2*M*T)*gamma/(math.pi*math.sqrt(M+gamma)) result = k/((E-M)**2 + M*T) return result
def build_2body_file(): particle_array = ['pi+','pi-','pi0','K+','K-','K0','J/psi','phi','Upsilon','B0','B+','B-','B_s0','B_c+','D+','D-','D0','D_s+','n0','p+','pbar-','Omega-','Omegabar+','Omega_c0','Omega_b-','Omega_bbar+','Xi0','Xi-','Xibar+','Xi_b0','Xi_b-','Xi_bbar+','Xi_cbar0','Xi_cbar-','Xi_c+','Sigma-','Sigma+','Sigma_b-','Sigma_b+','Sigma_cbar-','Sigma_cbar--','Sigma_c+','Sigma_c++','Delta++','Delta-','Deltabar--'] inelastic_2body_data={} for target in ['p+','n0']: inelastic_2body_data[target] = {} for particle in particle_array: inelastic_output =Inelastic2BodyFile(particle,target)._particle_list if inelastic_output != []: inelastic_2body_data[target][particle] = [] for output in inelastic_output: mass = round(ParticleDataSource.getMass(output[0]) + ParticleDataSource.getMass(output[1]) - ParticleDataSource.getMass(target),4) inelastic_2body_data[target][particle].append([mass,output]) print (inelastic_2body_data) with open('./inelastic_2body_data.json', 'w') as f: f.write(json.dumps(inelastic_2body_data,indent=2, sort_keys=True, ensure_ascii=False))
def _buildVirtualChannels(self): assert self._channel.length == 3 virtualchannels = [] for index, item in enumerate(self._channel.names): output1 = item output23 = self._channel.names[:index] + self._channel.names[ index + 1:] virtuallist = self._alldecays.getParticlesfromDecay(output23) for item in virtuallist: BR1 = item.BR virtual = item.name if item.BR != 0.0 and not any(obj.particles[1].name == virtual for obj in virtualchannels): BRW = VirtualParticleChannel.breit_wigner( self._particle.name, virtual) try: BR2 = ParticleDataToolFetcher.getBR( virtual, [ self._particle.name, ParticleDataSource.getAnti(output1) ]) prob = BR1 * BR2 * BRW mass = ParticleDataSource.getMass( virtual ) #VirtualParticleChannel.totalMass(output23) # ri = RealInfo(output1) vi = VirtualInfo(virtual, mass, output23) vc = VirtualChannel(prob, [ri, vi]) virtualchannels.append(vc) except: pass return virtualchannels
def _setMassArray(mass, decay): masses = [ mass ] # array of masses 0: parent particle, 1: first decay particle, ... for particle in decay: masses.append(ParticleDataSource.getMass(particle)) return masses
def _set_decay_masses(self): decay_masses = [] for part in self._decay: decay_masses.append(ParticleDataSource.getMass(part)) self._decay_masses = decay_masses
def totalMass(self): mass = 0. for name in self.names: mass += ParticleDataSource.getMass(name) return mass
def getmass(name): return ParticleDataSource.getMass(name)
def _set_mass(self): self._mass = ParticleDataSource.getMass(self._name)
def totalMass(particlelist): mass = 0. for name in particlelist: mass += ParticleDataSource.getMass(name) return mass