def __setitem__(self,listIndexToUpdate,updatedParticle): """A function to update a dipole, e.g after a recoil from another dipole has occured.""" assert assertions.valid_dipole_index(listIndexToUpdate) assert particles.check_is_particle(updatedParticle) assert updatedParticle.__nonzero__() self.__dipoleList[listIndexToUpdate] = updatedParticle.copy() self.update_dipole_mass_squared() self.__updated = True
def __setitem__(self, listIndexToUpdate, updatedParticle): """A function to update a dipole, e.g after a recoil from another dipole has occured.""" assert assertions.valid_dipole_index(listIndexToUpdate) assert particles.check_is_particle(updatedParticle) assert updatedParticle.__nonzero__() self.__dipoleList[listIndexToUpdate] = updatedParticle.copy() self.update_dipole_mass_squared() self.__updated = True
def set_colour(self,index,newValue): """A function to update a colour of the particle given its index and a new value.""" assert (type(index) == int) assert assertions.valid_dipole_index(index) ##As a list of the same dimensions. assert (type(newValue) == int) self.__colours[index] = newValue if newValue != 0: self.__colourSetList[index] = True else: self.__colourSetList[index] = False
def set_child(self,index,newValue): """A function to update a child of the particle given its index and a new value.""" assert (type(index) == int) assert assertions.valid_dipole_index(index) ##As a list of the same dimensions. assert (type(newValue) == int) self.__children[index] = newValue if (newValue != 0): self.__historyList[index+2] = True else: self.__historyList[index+2] = False
def __init__(self,pV1,pV2,numToRecoil): """A function to initialise the joint boost and rotation.""" assert fourVectors.check_is_fourVector(pV1) assert fourVectors.check_is_fourVector(pV2) assert (pV1.__nonzero__() and pV2.__nonzero__()) assert assertions.valid_dipole_index(numToRecoil) ##Use as the same convention as dipoles of 0,1. self.__vector1, self.__vector2 = pV1.copy(), pV2.copy() self.__momentumOfCMF = self.__vector1 + self.__vector2 self.__theBoost = lorentzBoost(self.__momentumOfCMF) ##numToRecoil used to decide which to rotate onto the -ve z-axis (i.e recoiling). if (numToRecoil == 0): ##Opposite of numToRecoil used, as to be on +ve z-axis self.__boostedVector = self.__theBoost*self.__vector2 self.__theRotation = lorentzRotation(self.__boostedVector) else: self.__boostedVector = self.__theBoost*self.__vector1 self.__theRotation = lorentzRotation(self.__boostedVector)
def __init__(self, pV1, pV2, numToRecoil): """A function to initialise the joint boost and rotation.""" assert fourVectors.check_is_fourVector(pV1) assert fourVectors.check_is_fourVector(pV2) assert (pV1.__nonzero__() and pV2.__nonzero__()) assert assertions.valid_dipole_index( numToRecoil) ##Use as the same convention as dipoles of 0,1. self.__vector1, self.__vector2 = pV1.copy(), pV2.copy() self.__momentumOfCMF = self.__vector1 + self.__vector2 self.__theBoost = lorentzBoost(self.__momentumOfCMF) ##numToRecoil used to decide which to rotate onto the -ve z-axis (i.e recoiling). if (numToRecoil == 0 ): ##Opposite of numToRecoil used, as to be on +ve z-axis self.__boostedVector = self.__theBoost * self.__vector2 self.__theRotation = lorentzRotation(self.__boostedVector) else: self.__boostedVector = self.__theBoost * self.__vector1 self.__theRotation = lorentzRotation(self.__boostedVector)
def __getitem__(self, listIndexOfParticle): """A function to return one of the particles in the dipole using its dipole-list index.""" ##No set_particle as update used instead. assert assertions.valid_dipole_index(listIndexOfParticle) return self.__dipoleList[listIndexOfParticle].copy()
def get_colour(self,index): """A function to return a colour of the particle given its index.""" assert (type(index) == int) assert assertions.valid_dipole_index(index) ##As a list of the same dimensions. return self.__colours[index]
def __getitem__(self,listIndexOfParticle): """A function to return one of the particles in the dipole using its dipole-list index.""" ##No set_particle as update used instead. assert assertions.valid_dipole_index(listIndexOfParticle) return self.__dipoleList[listIndexOfParticle].copy()