Exemplo n.º 1
0
	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
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
	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
Exemplo n.º 4
0
	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
Exemplo n.º 5
0
	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)
Exemplo n.º 6
0
 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)
Exemplo n.º 7
0
 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()
Exemplo n.º 8
0
	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]
Exemplo n.º 9
0
	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()