def produce_new_vectors(v1, v3, PperpSquared, y): """A function to boost two vectors, perform the kinematics and return the tResults after boosting back.""" ##Requires v3 to be the recoiling vector, consistent with all kinematics in this project. assert (fourVectors.check_is_fourVector(v1) and fourVectors.check_is_fourVector(v3)) assert (v1.__nonzero__() and v3.__nonzero__()) assert assertions.all_are_numbers([PperpSquared, y]) __energyIn = v1[0] + v3[ 0] ##This is in the 'lab frame' as these are never actually boosted in the code. __S123, __Pperp = Sijk([v1.copy(), v3.copy()]), math.sqrt(PperpSquared) __boostRotate = lorentz.boostAndRotate( v1.copy(), v3.copy(), 1) ##Given v3 as vector to recoil so need index 1 here. __nBRV1, __nBRV2, __nBRV3 = calculate_split_ps(__S123, __Pperp, y) assert precision.check_numbers_equal(0.0, __nBRV1[3] + __nBRV2[3] + __nBRV3[3]) __nV1, __nV2, __nV3 = __boostRotate / __nBRV1, __boostRotate / __nBRV2, __boostRotate / __nBRV3 ##Must also check energy out in the 'lab' frame too as not a Lorentz invariant quantity. __energyOut = __nV1[0] + __nV2[0] + __nV3[0] __energyDifference = __energyIn - __energyOut __nV2 = fix_energy_difference(__energyDifference, __nV2) ##Check conservation rules: assert precision.check_numbers_equal(__energyIn, __energyOut) assert precision.check_numbers_equal( __S123, Sijk([__nV1.copy(), __nV2.copy(), __nV3.copy()])) ##No check for any momentums here as no longer have to sum to zero in this frame. return __nV1, __nV2, __nV3
def Pperp_squared(p1, p2, p3): ##Using p1' + p3' -> p1 + p2 + p3 """A function to calculate the lorentz invariant transverse momentum squared given the correct P1,2,3 vectors.""" assert (fourVectors.check_is_fourVector(p1) and fourVectors.check_is_fourVector(p2) and fourVectors.check_is_fourVector(p3)) assert (p1.__nonzero__() and p2.__nonzero__() and p3.__nonzero__()) __S12, __S23, __S123 = Sijk([p1, p2]), Sijk([p2, p3]), Sijk([p1, p2, p3]) __pPerpSquared = __S12 * __S23 / __S123 return __pPerpSquared
def rapidity(p1, p2, p3): ##Using p1' + p3' -> p1 + p2 + p3 """A function to calculate the rapidity given the correct P1,2,3 vectors.""" assert (fourVectors.check_is_fourVector(p1) and fourVectors.check_is_fourVector(p2) and fourVectors.check_is_fourVector(p3)) assert (p1.__nonzero__() and p2.__nonzero__() and p3.__nonzero__()) __S12, __S23 = Sijk([p1, p2]), Sijk([p2, p3]) __y = 0.5 * math.log(__S23 / __S12) return __y
def __init__(self, initialisingVector): """A function to initialise the lorentzRotation class.""" assert fourVectors.check_is_fourVector(initialisingVector) assert initialisingVector.__nonzero__() self.__initialisingVector = initialisingVector.copy() self.__r = self.__initialisingVector.calculate_cartesian_magnitude() self.calculate_angles()
def __init__(self,lookUpCodeOrName,fourMomentum = fourVectors.fourVector(),mothers = [0,0],children = [0,0],colours = [0,0], statusCode = 1): """A function to initiate a particle.""" ##Allow initiation via name or code but then works from the code. ##StatusCode: -1 initial, 0 = intermediate, 1 = final state. 1 chosen by default as this is currently a final state shower. assert ((type(lookUpCodeOrName) == int) or (type(lookUpCodeOrName) == str)) assert fourVectors.check_is_fourVector(fourMomentum) assert ((type(mothers) == list) and (type(mothers[0]) == int) and (type(mothers[1]) == int)) assert ((type(children) == list) and (type(children[0]) == int) and (type(children[1]) == int)) assert ((type(colours) == list) and (type(colours[0]) == int) and (type(colours[1]) == int)) assert (type(statusCode) == int) assert assertions.valid_particle_status_code(statusCode) if (type(lookUpCodeOrName) == int): assert particleData.knownParticles.has_key(lookUpCodeOrName) self.__lookUpCode = lookUpCodeOrName elif (type(lookUpCodeOrName) == str): assert particleData.knownParticles.has_name(lookUpCodeOrName) self.__lookUpCode = particleData.knownParticles.get_code_from_name(lookUpCodeOrName) self.__fourMomentum = fourMomentum self.__mothers = mothers self.__children = children self.__colours = colours self.__statusCode = statusCode self.__historyList = [False,False,False,False] ##Mothers then children (if set) self.__colourSetList = [False, False] for __i, __a in enumerate(self.__mothers+self.__children): ##Do both at once. if __a != 0: self.__historyList[__i] = True for __i, __a in enumerate(self.__colours): if __a != 0: self.__colourSetList[__i]= True self.__uniqueID = 0 self.__producedAt = -1 ##Default value for not set, as 0 is actually used.
def update_dipoles_g_prod_RHS_recoil(self,pC,cC,nV1,nV2,nV3): """A function to update the relevant dipoles when a gluon is produced with the RHS recoiling.""" assert ((counters.check_is_counter(pC)) and (counters.check_is_counter(cC))) for nV in [nV1,nV2,nV3]: assert fourVectors.check_is_fourVector(nV) assert (self.__maxPperpSquared > self.__cutOff) __p1 = self.__chainList[self.__nextIndex][0].copy() __p2 = particles.particle('gluon',nV2,[0,0],[0,0],[0,0],1) __p3 = self.__chainList[self.__nextIndex][1].copy() __p1.set_four_momentum(nV1) __p3.set_four_momentum(nV3) __p2.set_unique_ID(pC.next()) ##Set unique particle ID when produced. __p2.set_produced_at(self.__maxPperpSquared) ##As now set to that of this produced particle. __p2.set_mother(0,__p1.get_unique_ID()) __p2.set_mother(1,__p3.get_unique_ID()) if __p1.get_child(1) != 0: ##i.e don't overwrite __p1.set_child(1,__p2.get_unique_ID()) if __p3.get_child(0) != 0: ##i.e don't overwrite __p3.set_child(0,__p2.get_unique_ID()) __p1, __p2, __p3 = self.set_new_colours_g_prod(cC,__p1,__p2,__p3) __nDPLHS = self.__chainList[self.__nextIndex].copy() __nDPRHS = self.__chainList[self.__nextIndex].copy() __nDPLHS[0], __nDPLHS[1] = __p1.copy(), __p2.copy() __nDPRHS[0], __nDPRHS[1] = __p2.copy(), __p3.copy() self.update_dipole_values(__p1.copy(),__nDPLHS,__nDPRHS,__p3.copy())
def check_timelike(pV): """A function to check whether a momentum vector is time-like (i.e P.P = M^2 > 0).""" assert fourVectors.check_is_fourVector(pV) assert pV.__nonzero__() __MinkowskiSP = pV * pV __MinkowskiSP = precision.round_python_errors(__MinkowskiSP) return (__MinkowskiSP > 0.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)
def update_dipoles_g_split_RHS_recoil(self,pC,cC,nV1,nV2,nV3): """A function to update the relevant dipoles when a gluon is split with the RHS recoiling.""" assert ((counters.check_is_counter(pC)) and (counters.check_is_counter(cC))) for nV in [nV1,nV2,nV3]: assert fourVectors.check_is_fourVector(nV) assert (self.__maxPperpSquared > self.__cutOff) __p1B = self.__chainList[self.__nextIndex][0].copy() __p1BMs, __p1BCs = [__p1B.get_mother(0),__p1B.get_mother(1)], [__p1B.get_child(0),__p1B.get_child(1)] __qCode = quarkPairs.get_quark_code(self.__maxPperpSquared,self.__activeQCodes) ##As maxPperpSquared now set to S123 of splitting. producedQuarkCodes.store(__qCode) __p1C0B, __p1C1B = __p1B.get_colour(0), __p1B.get_colour(1) __p1 = particles.particle(-__qCode,__p1B.get_four_momentum(),__p1BMs,__p1BCs,[0,0],__p1B.get_status_code()) __p2 = particles.particle(__qCode,nV2,[0,0],[0,0],[0,0],1) __p3 = self.__chainList[self.__nextIndex][1].copy() __p1.set_four_momentum(nV1) __p3.set_four_momentum(nV3) __p1.set_unique_ID(pC.next()) ##Set unique particle IDs when produced. __p2.set_unique_ID(pC.next()) __p1.set_produced_at(self.__maxPperpSquared) ##As now set to that of this produced particle. __p2.set_produced_at(self.__maxPperpSquared) __p1.set_mother(0,__p3.get_unique_ID()) __p2.set_mother(1,__p3.get_unique_ID()) if __p3.get_child(0) != 0: ##i.e don't overwrite. __p3.set_child(0,__p2.get_unique_ID()) __p1, __p2, __p3 = self.set_new_colours_g_split(cC,__p1,__p2,__p3, __p1C0B, __p1C1B,"RHS") __nDPLHS = self.__chainList[self.__nextIndex].copy() __nDPRHS = self.__chainList[self.__nextIndex].copy() __nDPLHS[0], __nDPLHS[1] = __p1.copy(), __p2.copy() __nDPRHS[0], __nDPRHS[1] = __p2.copy(), __p3.copy() self.update_dipole_values(__p1.copy(),__nDPLHS,__nDPRHS,__p3.copy()) self.__sideOfSplit = "RHS"
def p_vector_to_v(pV): """A function to return the velocity four-vector from a momentum four-vector.""" assert fourVectors.check_is_fourVector(pV) assert pV.__nonzero__() assert check_timelike(pV) __mass = calculate_m_from_p_vector(pV) __velocityResult = pV.copy() __velocityResult /= __mass return __velocityResult
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,momentumOfCMF): """A function to initiate a Lorentz boost to and from a centre of mass frame (E,p).""" assert fourVectors.check_is_fourVector(momentumOfCMF) assert momentumOfCMF.__nonzero__() assert (check_timelike(momentumOfCMF) or check_lightlike(momentumOfCMF)) self.__momentumOfCMF = momentumOfCMF.copy() self.__reverseMomentumOfCMF = momentumOfCMF.copy() for __i1 in range(3): self.__reverseMomentumOfCMF[__i1+1] *= (-1.0) self.__massOfCMF = calculate_m_from_p_vector(momentumOfCMF)
def update_dipoles_g_split(self,pC,cC,nV1,nV2,nV3): """A function to update the relevant dipoles when a gluon is split.""" assert ((counters.check_is_counter(pC)) and (counters.check_is_counter(cC))) for nV in [nV1,nV2,nV3]: assert fourVectors.check_is_fourVector(nV) assert (self.__maxPperpSquared > self.__cutOff) if (self.__dipoleRecoilIndex == 0): ##LHS recoiling. self.update_dipoles_g_split_LHS_recoil(pC,cC,nV1,nV2,nV3) else: ##RHS recoiling. self.update_dipoles_g_split_RHS_recoil(pC,cC,nV1,nV2,nV3)
def update_dipoles_p_prod(self,pC,nV1,nV2,nV3): """A function to update the relevant dipoles when a photon is emitted.""" assert counters.check_is_counter(pC) for nV in [nV1,nV2,nV3]: assert fourVectors.check_is_fourVector(nV) assert (self.__maxPperpSquared > self.__cutOff) if (self.__dipoleRecoilIndex == 0): ##LHS recoiling. self.update_dipoles_p_prod_LHS_recoil(pC,nV1,nV2,nV3) else: ##RHS recoiling. self.update_dipoles_p_prod_RHS_recoil(pC,nV1,nV2,nV3)
def Sijk(listOfMomentumFourVectors): """A function to calculate the invariant quantity Sijk for Pi's in the given list.""" assert type(listOfMomentumFourVectors) == list __sqrtSijk = fourVectors.fourVector(0.0, 0.0, 0.0, 0.0) for __Pi in listOfMomentumFourVectors: assert fourVectors.check_is_fourVector(__Pi) assert __Pi.__nonzero__() __sqrtSijk += __Pi __Sikj = __sqrtSijk * __sqrtSijk return __Sikj
def __init__(self, momentumOfCMF): """A function to initiate a Lorentz boost to and from a centre of mass frame (E,p).""" assert fourVectors.check_is_fourVector(momentumOfCMF) assert momentumOfCMF.__nonzero__() assert (check_timelike(momentumOfCMF) or check_lightlike(momentumOfCMF)) self.__momentumOfCMF = momentumOfCMF.copy() self.__reverseMomentumOfCMF = momentumOfCMF.copy() for __i1 in range(3): self.__reverseMomentumOfCMF[__i1 + 1] *= (-1.0) self.__massOfCMF = calculate_m_from_p_vector(momentumOfCMF)
def inverse_rotate(self,vectorToInverseRotate): """A function to apply the backwards rotation to the given four-vector.""" ##This is the rotation initialising four-vector from the z-axis. assert fourVectors.check_is_fourVector(vectorToInverseRotate) assert vectorToInverseRotate.__nonzero__() __v2R, __c, __s, __t, __p, = vectorToInverseRotate.copy(), math.cos , math.sin, self.__theta, self.__phi __rotatedResult = vectorToInverseRotate.copy() __rotatedResult[1] = __c(__p)*__c(__t)*__v2R[1] + __s(__p)*__v2R[2] - __c(__p)*__s(__t)*__v2R[3] __rotatedResult[2] = -__s(__p)*__c(__t)*__v2R[1] + __c(__p)*__v2R[2] + __s(__p)*__s(__t)*__v2R[3] __rotatedResult[3] = __s(__t)*__v2R[1] + __c(__t)*__v2R[3] return __rotatedResult
def fix_energy_difference(difference, v2): """A function to fix any energy difference between the two particles in and three out caused by code errors.""" assert (type(difference) == float) assert fourVectors.check_is_fourVector(v2) assert v2.__nonzero__() ##Place all of the energy change required into the new particle's vector, v2. __magIn = v2.calculate_cartesian_magnitude() __pFactor = math.sqrt((difference / (__magIn * __magIn)) + 1.0) __nV2 = v2.copy() __nV2 *= __pFactor __nV2[0] = math.sqrt((v2[0] * v2[0]) + difference) return __nV2
def inverse_rotate(self, vectorToInverseRotate): """A function to apply the backwards rotation to the given four-vector.""" ##This is the rotation initialising four-vector from the z-axis. assert fourVectors.check_is_fourVector(vectorToInverseRotate) assert vectorToInverseRotate.__nonzero__() __v2R, __c, __s, __t, __p, = vectorToInverseRotate.copy( ), math.cos, math.sin, self.__theta, self.__phi __rotatedResult = vectorToInverseRotate.copy() __rotatedResult[1] = __c(__p) * __c(__t) * __v2R[1] + __s( __p) * __v2R[2] - __c(__p) * __s(__t) * __v2R[3] __rotatedResult[2] = -__s(__p) * __c(__t) * __v2R[1] + __c( __p) * __v2R[2] + __s(__p) * __s(__t) * __v2R[3] __rotatedResult[3] = __s(__t) * __v2R[1] + __c(__t) * __v2R[3] return __rotatedResult
def inverse_boost(self,pVIn): """A function to perform the inverse lorentz boost on a given (E,p) four-vector.""" assert fourVectors.check_is_fourVector(pVIn) assert pVIn.__nonzero__() ##Make sure it's not space-like: assert (check_timelike(pVIn) or check_lightlike(pVIn)) __pVOut = fourVectors.fourVector() __energyOut = (self.__reverseMomentumOfCMF * pVIn)/self.__massOfCMF __alpha = (pVIn[0]+__energyOut)/(self.__massOfCMF + self.__momentumOfCMF[0]) __pVOut[0] = __energyOut for __i3 in range(3): __pVOut[__i3+1] = pVIn[__i3+1] - __alpha * self.__reverseMomentumOfCMF[__i3+1] ##Make sure its still not space-like after the boost: assert (check_timelike(__pVOut) or check_lightlike(__pVOut)) return __pVOut
def inverse_boost(self, pVIn): """A function to perform the inverse lorentz boost on a given (E,p) four-vector.""" assert fourVectors.check_is_fourVector(pVIn) assert pVIn.__nonzero__() ##Make sure it's not space-like: assert (check_timelike(pVIn) or check_lightlike(pVIn)) __pVOut = fourVectors.fourVector() __energyOut = (self.__reverseMomentumOfCMF * pVIn) / self.__massOfCMF __alpha = (pVIn[0] + __energyOut) / (self.__massOfCMF + self.__momentumOfCMF[0]) __pVOut[0] = __energyOut for __i3 in range(3): __pVOut[__i3 + 1] = pVIn[ __i3 + 1] - __alpha * self.__reverseMomentumOfCMF[__i3 + 1] ##Make sure its still not space-like after the boost: assert (check_timelike(__pVOut) or check_lightlike(__pVOut)) return __pVOut
def boost(self,pVIn): """A function to perform the lorentz boost on a given (E,p) four-vector.""" assert fourVectors.check_is_fourVector(pVIn) assert pVIn.__nonzero__() ##Make sure it's not space-like: __pVIn = pVIn.copy() assert (check_timelike(__pVIn) or check_lightlike(__pVIn)) ##Make sure not trying to boost into its own CMF: if check_lightlike(__pVIn): assert (__pVIn != self.__momentumOfCMF) __pVOut = fourVectors.fourVector() __energyPrime = (self.__momentumOfCMF * __pVIn)/self.__massOfCMF __alpha = (__pVIn[0]+__energyPrime)/(self.__massOfCMF + self.__momentumOfCMF[0]) __pVOut[0] = __energyPrime for __i2 in range(3): __pVOut[__i2+1] = __pVIn[__i2+1] - __alpha * self.__momentumOfCMF[__i2+1] ##Make sure its still not space-like after the boost: assert (check_timelike(__pVOut) or check_lightlike(__pVOut)) return __pVOut
def boost(self, pVIn): """A function to perform the lorentz boost on a given (E,p) four-vector.""" assert fourVectors.check_is_fourVector(pVIn) assert pVIn.__nonzero__() ##Make sure it's not space-like: __pVIn = pVIn.copy() assert (check_timelike(__pVIn) or check_lightlike(__pVIn)) ##Make sure not trying to boost into its own CMF: if check_lightlike(__pVIn): assert (__pVIn != self.__momentumOfCMF) __pVOut = fourVectors.fourVector() __energyPrime = (self.__momentumOfCMF * __pVIn) / self.__massOfCMF __alpha = (__pVIn[0] + __energyPrime) / (self.__massOfCMF + self.__momentumOfCMF[0]) __pVOut[0] = __energyPrime for __i2 in range(3): __pVOut[__i2 + 1] = __pVIn[__i2 + 1] - __alpha * self.__momentumOfCMF[__i2 + 1] ##Make sure its still not space-like after the boost: assert (check_timelike(__pVOut) or check_lightlike(__pVOut)) return __pVOut
def __mul__(self,vectorIn): """A function to call a lorentz boost and rotation on the four-vector multiplied by.""" assert fourVectors.check_is_fourVector(vectorIn) assert vectorIn.__nonzero__() __vectorIn = vectorIn.copy() return self.boost_rotate(__vectorIn)
def calculate_m_from_p_vector(pV): """A function to calculate the mass of a particle from its momentum four-vector.""" assert fourVectors.check_is_fourVector(pV) assert pV.__nonzero__() return math.sqrt(pV * pV)
def check_lightlike(pV): """A function to check whether a momentum vector is light-like (i.e P.P = M^2 = 0).""" assert fourVectors.check_is_fourVector(pV) assert pV.__nonzero__() __MinkowskiSP = pV * pV return precision.check_numbers_equal(__MinkowskiSP, 0.0)
def __div__(self,vectorOut): """A function to call an inverse lorentz boost and rotation on the four-vector divided by.""" assert fourVectors.check_is_fourVector(vectorOut) assert vectorOut.__nonzero__() __vectorOut = vectorOut.copy() return self.inverse_boost_rotate(__vectorOut)
def __mul__(self,vectorToRotate): """A function to call a lorentz rotation on the four-vector multiplied by.""" assert fourVectors.check_is_fourVector(vectorToRotate) assert vectorToRotate.__nonzero__() return self.rotate(vectorToRotate)
def __mul__(self,pVToBoost): """A function to call a lorentz boost on the four-vector multiplied by.""" assert fourVectors.check_is_fourVector(pVToBoost) assert pVToBoost.__nonzero__() return self.boost(pVToBoost)
def __div__(self,pVToInverseBoost): """A function to call an inverse lorentz boost on the four-vector divided by.""" assert fourVectors.check_is_fourVector(pVToInverseBoost) assert pVToInverseBoost.__nonzero__() return self.inverse_boost(pVToInverseBoost)
def boost_rotate(self, vectorIn): """A function to apply the forward boost and rotation to the given four-vector.""" assert fourVectors.check_is_fourVector(vectorIn) assert vectorIn.__nonzero__() __vectorIn = vectorIn.copy() return self.__theRotation * (self.__theBoost * __vectorIn)
def check_lightlike(pV): """A function to check whether a momentum vector is light-like (i.e P.P = M^2 = 0).""" assert fourVectors.check_is_fourVector(pV) assert pV.__nonzero__() __MinkowskiSP = pV * pV return precision.check_numbers_equal(__MinkowskiSP,0.0)
def __div__(self, vectorToInverseRotate): """A function to call an inverse lorentz rotation on the four-vector divided by.""" assert fourVectors.check_is_fourVector(vectorToInverseRotate) assert vectorToInverseRotate.__nonzero__() return self.inverse_rotate(vectorToInverseRotate)
def __mul__(self, vectorToRotate): """A function to call a lorentz rotation on the four-vector multiplied by.""" assert fourVectors.check_is_fourVector(vectorToRotate) assert vectorToRotate.__nonzero__() return self.rotate(vectorToRotate)
def set_four_momentum(self,fourMomentumToSet): """A function to set the four-momentum of a particle.""" assert fourVectors.check_is_fourVector(fourMomentumToSet) assert fourMomentumToSet.__nonzero__() self.__fourMomentum = fourMomentumToSet.copy()
def __div__(self, pVToInverseBoost): """A function to call an inverse lorentz boost on the four-vector divided by.""" assert fourVectors.check_is_fourVector(pVToInverseBoost) assert pVToInverseBoost.__nonzero__() return self.inverse_boost(pVToInverseBoost)
def inverse_boost_rotate(self,vectorOut): """A function to apply the backwards boost and rotation to the given four-vector.""" assert fourVectors.check_is_fourVector(vectorOut) assert vectorOut.__nonzero__() __vectorOut = vectorOut.copy() return self.__theBoost / (self.__theRotation / __vectorOut)
def boost_rotate(self,vectorIn): """A function to apply the forward boost and rotation to the given four-vector.""" assert fourVectors.check_is_fourVector(vectorIn) assert vectorIn.__nonzero__() __vectorIn = vectorIn.copy() return self.__theRotation*(self.__theBoost*__vectorIn)
def inverse_boost_rotate(self, vectorOut): """A function to apply the backwards boost and rotation to the given four-vector.""" assert fourVectors.check_is_fourVector(vectorOut) assert vectorOut.__nonzero__() __vectorOut = vectorOut.copy() return self.__theBoost / (self.__theRotation / __vectorOut)
def __div__(self,vectorToInverseRotate): """A function to call an inverse lorentz rotation on the four-vector divided by.""" assert fourVectors.check_is_fourVector(vectorToInverseRotate) assert vectorToInverseRotate.__nonzero__() return self.inverse_rotate(vectorToInverseRotate)
def __mul__(self, vectorIn): """A function to call a lorentz boost and rotation on the four-vector multiplied by.""" assert fourVectors.check_is_fourVector(vectorIn) assert vectorIn.__nonzero__() __vectorIn = vectorIn.copy() return self.boost_rotate(__vectorIn)
def __mul__(self, pVToBoost): """A function to call a lorentz boost on the four-vector multiplied by.""" assert fourVectors.check_is_fourVector(pVToBoost) assert pVToBoost.__nonzero__() return self.boost(pVToBoost)
def __div__(self, vectorOut): """A function to call an inverse lorentz boost and rotation on the four-vector divided by.""" assert fourVectors.check_is_fourVector(vectorOut) assert vectorOut.__nonzero__() __vectorOut = vectorOut.copy() return self.inverse_boost_rotate(__vectorOut)