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 fire(self, shootingpower): if self.controlActive: weapon = self.inventory.usecurrent(True) if weapon != None: self.shotcounter += 1 weapon(self.turretEndpoint.copy(), self.turretVector.copy(), self.terrain.bounds[0]*0.02*self.shootingratio*shootingpower, self.terrain, self.wind, self.entities, self, 1.0, self.color) particle(self.turretEndpoint.copy(), self.fireorange, 0.5, self.turretVector.copy(), 1.5, 1.0, self.entities[2], True)
def update(self, dt): #this list holds all the forces acting on the missile forces = [self._forcedrag(), self._forcegravity(), self.wind.force] #update position and velocity depeneing on the timestep for i in range(2): self.velocity[i] += (sum([j[i] for j in forces]) / self.m) * dt self.pos[i] += 20.0 * self.velocity[i] * dt #if new pos is outside bounds delete if 0 < self.pos[0] < self.terrain.bounds[0] - 1.0: #if new pos is under ground explode if self.terrain.heightmap[int(self.pos[0])] < self.pos[1]: #set player x position to own x position self.player.pos[0] = self.pos[0] #set player on ground and update turret self.player.setonground() self.player.updateTurret() #white explosion particle at player position radius = 23 surface = pygame.Surface([radius * 2 + 5, radius * 2 + 5]) surface.fill((0, 0, 0)) surface.set_colorkey((0, 0, 0)) pygame.draw.circle(surface, pygame.color.THECOLORS["white"], (int(surface.get_rect().w / 2), int(surface.get_rect().h / 2)), radius) particle(self.player.pos, surface, 2.5, Vector2d(0.0, 0.0), 0.0, 0.0, self.entities[2], True, 0.3) #delete missile self.delete = True else: self.delete = True
def _explosionparticles(self, particlescaling): dirt = pygame.Surface([4, 4]) dirt.fill((0, 0, 0)) dirt.set_colorkey((0, 0, 0)) #pygame.gfxdraw.filled_circle(dirt, int(dirt.get_rect().w/2), int(dirt.get_rect().h/2), 2, self.terrain.groundcolor) pygame.draw.rect(dirt, self.terrain.groundcolor, ((0, 0), (4, 4))) normalvec = self.terrain.normalmap[int(self.pos[0])] surfacevec = self.terrain.normalmap[int(self.pos[0])].getnormalvec() for i in range(int(self.blastradius * particlescaling)): direction = ( normalvec * (random.randint(-50, 400) / 10.0) + (random.randint(-80, 80) / 10.0) * surfacevec).getuvec() velocity = random.randint(0, 1100) / 100.0 bouncyparticle(self.pos.copy(), self.terrain, dirt, 3.0, direction, velocity, self.particlelist, True, 2.0, None, 1000, 0.3) #explosion particle surface surface = pygame.Surface( [self.blastradius * 2 + 10, self.blastradius * 2 + 10]) surface.fill((0, 0, 0)) surface.set_colorkey((0, 0, 0)) pygame.gfxdraw.filled_circle(surface, int(surface.get_rect().w / 2), int(surface.get_rect().h / 2), int(self.blastradius + 2), pygame.color.THECOLORS["orange"]) particle(self.pos, surface, 2.5, Vector2d(0.0, 0.0), 0.0, 0.0, self.particlelist, True, 0.3)
def produce_electron_pair(S123): """A function to produce an electron and positron in opposite directions.""" __cE = constants.cut_off_energy() assert ((type(S123) == float) and (S123 > __cE * __cE)) ##Define beams to be along z: works well for Pythia 8.2. __E = math.sqrt(S123) / 2.0 __pV1 = fourVectors.fourVector(__E, 0.0, 0.0, __E) __pV2 = fourVectors.fourVector(__E, 0.0, 0.0, -__E) __eCode = particleData.knownParticles.get_code_from_name("electron") __p1 = particles.particle(__eCode, __pV1, [0, 0], [3, 4], [0, 0], -1) __p2 = particles.particle(-__eCode, __pV2, [0, 0], [3, 4], [0, 0], -1) __p1.set_unique_ID(1) __p2.set_unique_ID(2) return [__p1, __p2]
def produce_electron_pair(S123): """A function to produce an electron and positron in opposite directions.""" __cE = constants.cut_off_energy() assert ((type(S123) == float) and (S123 > __cE*__cE)) ##Define beams to be along z: works well for Pythia 8.2. __E = math.sqrt(S123)/2.0 __pV1 = fourVectors.fourVector(__E,0.0,0.0,__E) __pV2 = fourVectors.fourVector(__E,0.0,0.0,-__E) __eCode = particleData.knownParticles.get_code_from_name("electron") __p1 = particles.particle(__eCode,__pV1,[0,0],[3,4],[0,0],-1) __p2 = particles.particle(-__eCode,__pV2,[0,0],[3,4],[0,0],-1) __p1.set_unique_ID(1) __p2.set_unique_ID(2) return [__p1,__p2]
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 update(self, dt): if not self.impacted: #this list holds all the forces acting on the missile forces = [self._forcedrag(), self._forcegravity(), self.wind.force] #update position and velocity depeneing on the timestep for i in range(2): self.velocity[i] += (sum([j[i] for j in forces]) / self.m) * dt self.pos[i] += 20.0 * self.velocity[i] * dt #if new pos is outside bounds delete if 0 < self.pos[0] < self.terrain.bounds[0] - 1.0: #if new pos is under ground explode if self.terrain.heightmap[int(self.pos[0])] < self.pos[1]: #delete missile self.impacted = True self.pos[1] = self.terrain.heightmap[int(self.pos[0])] else: self.delete = True else: self.alivetimer += dt if self.alivetimer < self.maxtimealive: self.timesincesmoke += dt if self.timesincesmoke > self.smokeinterval: self.timesincesmoke = 0.0 dir = Vector2d(random.randint(-5, 5), -38.0).getuvec() radius = 5 smoke = pygame.Surface([radius * 2 + 2, radius * 2 + 2]) smoke.fill((0, 0, 0)) smoke.set_colorkey((0, 0, 0)) pygame.draw.circle(smoke, self.color, (int( smoke.get_rect().w / 2), int(smoke.get_rect().h / 2)), radius) particle(self.pos.copy(), smoke, random.randint(2, 5), dir, 1.25, 0.19, self.entities[2], True, 0.0, self.wind, 8.0) if not self.bombsdeployed and self.alivetimer > self.bombdelay: self.bombsdeployed = True distance = 27 for i in range(-2, 3): dropbomb([self.pos[0] + i * distance, -20], Vector2d(0.0, 1.0), random.randint(20, 27), self.terrain, self.wind, self.entities, self.player, 10.0, self.color) else: self.delete = True
def __init__(self, num_of_particles, sigma, epsilon, length_of_box=1e-8, initial_velocity=1.57*1e2, pbc=False): self.sigma = sigma self.epsilon = epsilon self.particles = [] self.box_length = length_of_box self.pbc = pbc for i in range(num_of_particles): self.particles.append(particle(length_of_box=length_of_box,velocity=initial_velocity, mass=6.69*1e-26)) self.num_of_particles = num_of_particles
def update(self, dt): #smoke system if self.destroyed: self.timesincesmoke += dt if self.timesincesmoke > self.smokeinterval: self.timesincesmoke = 0.0 + 0.1 * self.smokeinterval * random.randint(0, 3) dir = Vector2d(random.randint(-5, 5), -38.0).getuvec() smoke = pygame.Surface([7 * 2 + 5, 7 * 2 + 5]) smoke.set_colorkey((0, 0, 0)) smoke.blit(self.smoke, (0, 0)) particle(self.pos.copy(), smoke, random.randint(2, 5), dir, 1.75, 0.19, self.entities[2], True, 0.0, self.wind, 8.0) if self.controlActive: #move in the direction of movedir,if movedir is 0 dont move if self.left: self.move(dt, -1.0) elif self.right: self.move(dt, 1.0) self.updateTurret() return
def produce_quark_pair(S123,posQuarkCodes): """A function to produce a particle and anti-particle in opposite directions.""" __cE = constants.cut_off_energy() __knownQuarks = particleData.knownParticles.get_known_quarks() assert ((type(S123) == float) and (S123 > __cE*__cE)) assert (type(posQuarkCodes) == list) for code in posQuarkCodes: assert (type(code) == int) assert (code in __knownQuarks) __qCode, __qTheta = quarkPairs.get_code_and_theta(S123,posQuarkCodes) quarkCounters[__qCode - 1].count() ##-1 for list index. createdThetas.store(__qTheta) createdQuarkCodes.store(__qCode) __pV1, __pV2 = scaled_quark_directions(S123,__qTheta) __p1 = particles.particle(__qCode,__pV1,[1,2],[0,0],[501,0],1) __p2 = particles.particle(-__qCode,__pV2,[1,2],[0,0],[0,501],1) __p1.set_unique_ID(3) __p2.set_unique_ID(4) __p1.set_produced_at(S123) __p2.set_produced_at(S123) return [__p1,__p2]
def produce_quark_pair(S123, posQuarkCodes): """A function to produce a particle and anti-particle in opposite directions.""" __cE = constants.cut_off_energy() __knownQuarks = particleData.knownParticles.get_known_quarks() assert ((type(S123) == float) and (S123 > __cE * __cE)) assert (type(posQuarkCodes) == list) for code in posQuarkCodes: assert (type(code) == int) assert (code in __knownQuarks) __qCode, __qTheta = quarkPairs.get_code_and_theta(S123, posQuarkCodes) quarkCounters[__qCode - 1].count() ##-1 for list index. createdThetas.store(__qTheta) createdQuarkCodes.store(__qCode) __pV1, __pV2 = scaled_quark_directions(S123, __qTheta) __p1 = particles.particle(__qCode, __pV1, [1, 2], [0, 0], [501, 0], 1) __p2 = particles.particle(-__qCode, __pV2, [1, 2], [0, 0], [0, 501], 1) __p1.set_unique_ID(3) __p2.set_unique_ID(4) __p1.set_produced_at(S123) __p2.set_produced_at(S123) return [__p1, __p2]
def get_event_particle(self,eventIndex,particleIndex): """A function to return a particle object from an LHEF XML file given it's indices.""" __code = self.get_event_particle_ID(eventIndex,particleIndex) __fM = self.get_event_particle_four_momentum(eventIndex,particleIndex) __mothers = self.get_event_particle_mothers(eventIndex,particleIndex) __children = [0,0] ##LHEF doesn't have children; only mothers. __colours = self.get_event_particle_colours(eventIndex,particleIndex) __statusCode = self.get_event_particle_when(eventIndex,particleIndex) __theParticle = particles.particle(__code,__fM,__mothers,__children,__colours,__statusCode) ##Assuming the LHEF file is appropriately ordered: __theParticle.set_unique_ID(particleIndex+1) ##+1 as start at particle 1. return __theParticle
def update(self, dt): #this list holds all the forces acting on the missile forces = [self._forcedrag(), self._forcegravity(), self.wind.force] #update position and velocity depeneing on the timestep for i in range(2): self.velocity[i] += (sum([j[i] for j in forces]) / self.m) * dt self.pos[i] += 20.0 * self.velocity[i] * dt #if new pos is outside bounds delete if 0 < self.pos[0] < self.terrain.bounds[0] - 1.0: #if new pos is under ground explode if self.terrain.heightmap[int(self.pos[0])] < self.pos[1]: explosion(self.pos, self.terrain, self.entities, self.player, 65, 1, 0.4) flash = pygame.Surface([self.terrain.bounds[0], self.terrain.bounds[1]]) flash.fill(pygame.color.THECOLORS["white"]) particle([flash.get_rect().w/2, flash.get_rect().h/2], flash, 2.5, Vector2d(0, 0), 0, 0.0, self.entities[2], True, 0.3) self.delete = True else: self.delete = True
def get_event_particle(self, eventIndex, particleIndex): """A function to return a particle object from an LHEF XML file given it's indices.""" __code = self.get_event_particle_ID(eventIndex, particleIndex) __fM = self.get_event_particle_four_momentum(eventIndex, particleIndex) __mothers = self.get_event_particle_mothers(eventIndex, particleIndex) __children = [0, 0] ##LHEF doesn't have children; only mothers. __colours = self.get_event_particle_colours(eventIndex, particleIndex) __statusCode = self.get_event_particle_when(eventIndex, particleIndex) __theParticle = particles.particle(__code, __fM, __mothers, __children, __colours, __statusCode) ##Assuming the LHEF file is appropriately ordered: __theParticle.set_unique_ID(particleIndex + 1) ##+1 as start at particle 1. return __theParticle
def __init__(self, num_of_particles, sigma, epsilon, length_of_box=1e-8, initial_velocity=1.57 * 1e2, pbc=False): self.sigma = sigma self.epsilon = epsilon self.particles = [] self.box_length = length_of_box self.pbc = pbc for i in range(num_of_particles): self.particles.append( particle(length_of_box=length_of_box, velocity=initial_velocity, mass=6.69 * 1e-26)) self.num_of_particles = num_of_particles
selectionFinished = False elif (not fourVectors.check_different_direction(testVector2,testVector4)): selectionFinished = False elif (not fourVectors.check_different_direction(testVector2,testVector5)): selectionFinished = False elif (not fourVectors.check_different_direction(testVector3,testVector4)): selectionFinished = False elif (not fourVectors.check_different_direction(testVector3,testVector5)): selectionFinished = False elif (not fourVectors.check_different_direction(testVector4,testVector5)): selectionFinished = False else: selectionFinished = True ##Have test chain of: q-g-g-g-q_bar. possibleParticleNos = [1,-1,2,-2,3,-3,4,-4,5,-5,6,-6,21] testParticle1 = particles.particle(possibleParticleNos[random.randrange(0,12)],testVector1) testParticle5 = particles.particle(-1*testParticle1.get_code(),testVector5) ##1 not float as code must be an integer. ##Fill the middle with gluons. testParticle2 = particles.particle(21,testVector2) testParticle3 = particles.particle(21,testVector3) testParticle4 = particles.particle(21,testVector4) pC = counters.counter(1) testParticle1.set_unique_ID(pC.next()) testParticle2.set_unique_ID(pC.next()) testParticle3.set_unique_ID(pC.next()) testParticle4.set_unique_ID(pC.next()) testParticle5.set_unique_ID(pC.next()) testParticles = [testParticle1,testParticle2,testParticle3,testParticle4,testParticle5] testRC1 = resultsContainer() testRC2 = resultsContainer() testRC2.store(testParticle2)
selectionFinished = False elif (not fourVectors.check_different_direction(testVector2,testVector4)): selectionFinished = False elif (not fourVectors.check_different_direction(testVector2,testVector5)): selectionFinished = False elif (not fourVectors.check_different_direction(testVector3,testVector4)): selectionFinished = False elif (not fourVectors.check_different_direction(testVector3,testVector5)): selectionFinished = False elif (not fourVectors.check_different_direction(testVector4,testVector5)): selectionFinished = False else: selectionFinished = True ##Have test chain of: q-g-g-g-q_bar. possibleParticleNos = [1,-1,2,-2,3,-3,4,-4,5,-5,6,-6,21] testParticle1 = particles.particle(possibleParticleNos[random.randrange(0,12)],testVector1) testParticle5 = particles.particle(-1*testParticle1.get_code(),testVector5) ##1 not float as code must be an integer. ##Fill the middle with gluons. testParticle2 = particles.particle(21,testVector2) testParticle3 = particles.particle(21,testVector3) testParticle4 = particles.particle(21,testVector4) ##Create test chains. testChain1 = chain([testParticle1,testParticle5]) testChain2 = chain([testParticle1,testParticle2,testParticle3,testParticle4,testParticle5]) ##Also create loop test chain of centre gluons. testChain3 = chain([testParticle2,testParticle3,testParticle4],True) ##Test check_is_chain:## print "\n--------------------------------------------------\n" print "Testing check_is_chain:\n" print "Calling check_is_chain on instance: " , check_is_chain(testChain2)
def pickupparticle(self, item, amount): text = "+" + str(amount) + " " + item._name textsurface = self.owner.font.render(text, False, self.owner.color) particle([self.owner.pos[0], self.owner.pos[1] - 50], textsurface, 3, Vector2d(0.0, -1.0), 0.7, 0.19, self.owner.entities[2], True, 0.0, None, 8.0)
##Prevent the random vectors being the same as can't boost into frame of massless particle. testVector3, testVector4 = fourVectors.fourVector(0,0,0,0), fourVectors.fourVector(0,0,0,0) ##Required to start while loop. while ((testVector3 == testVector4) or (not fourVectors.check_different_direction(testVector3,testVector4))): for testFourVector in testFourVectors2: ##Random range set so as to produce a vector slower than the speed of light. x1 = random.randrange(1,10)/10.0 x2 = random.randrange(0,int(math.sqrt(1-(x1**2))*10))/10.0 x3 = random.randrange(0,int(math.sqrt(1-(x2**2))*10))/10.0 ##Make them massless. x0 = math.sqrt((x1*x1) + (x2*x2) +(x3*x3)) testFourVectors2[testFourVector] = fourVectors.fourVector(x0,x1,x2,x3) testVector3 = testFourVectors2['a'].copy() testVector4 = testFourVectors2['b'].copy() ##Test code here doesn't care about matching appropriate particles in the test dipoles. possibleParticleNos = [1,-1,2,-2,3,-3,4,-4,5,-5,6,-6,21] testParticle1 = particles.particle(possibleParticleNos[random.randrange(0,13)],testVector1) testParticle2 = particles.particle(possibleParticleNos[random.randrange(0,13)],testVector2) testParticle3 = particles.particle(possibleParticleNos[random.randrange(0,13)],testVector3) testParticle4 = particles.particle(possibleParticleNos[random.randrange(0,13)],testVector4) testDipole1 = dipole(testParticle1,testParticle2) testDipole2 = dipole(testParticle3,testParticle4) testCopyDipole2 = testDipole2.copy() testCopy2Dipole1 = testDipole1.copy() testCopy2Dipole1.set_not_updated() listOfCodes = [1,2,3,4,5,6,-1,-2,-3,-4,-5,-6,21] ##Test check_is_dipole:## print "\n--------------------------------------------------\n" print "Testing check_is_dipole:\n" print "Calling check_is_dipole on instance: " , check_is_dipole(testDipole1) print "Calling check_is_dipole on wrong instance: " , check_is_dipole(testVector1)
print "For qqBar dipole initiated shower:" testPath, eventIndex, particleIndex = None, None, None while ((type(testPath) != str) or (type(eventIndex) != int)): try: testPath = str(raw_input("\nEnter the relative path of the LHEF input or leave blank for default: ")) if testPath == "": testPath = "../Events/belle.lhe" eventIndex = int(raw_input("\nEnter the index of the event in the LHEF file to use: ")) except: pass testReader = LHEFHandlers.LHEFReader(testPath) testPDGID1 = testReader.get_event_particle_ID(eventIndex,2) ##First q, as 1 and 2 are e^+ and e^-. testPDGID2 = testReader.get_event_particle_ID(eventIndex,3) testVector1 = testReader.get_event_particle_four_momentum(eventIndex,2) testVector2 = testReader.get_event_particle_four_momentum(eventIndex,3) testParticle1 = particles.particle(testPDGID1,testVector1) testParticle2 = particles.particle(testPDGID2,testVector2) testShower1 = qqBarShower(testParticle1,testParticle2) ##Test check_is_qqBarShower:## print "\n--------------------------------------------------\n" print "Testing check_is_qqBarShower:\n" print "Calling check_is_qqBarShower on instance: " , check_is_qqBarShower(testShower1) print "Calling check_is_qqBarShower on wrong instance: " , check_is_qqBarShower(testParticle1) print "Calling check_is_qqBarShower on 1.055: " , check_is_qqBarShower(1.055) print "Calling check_is_qqBarShower on 'word': " , check_is_qqBarShower('word') testResults = [check_is_qqBarShower(testShower1),check_is_qqBarShower(testParticle1)] testResults += [check_is_qqBarShower(1.055),check_is_qqBarShower('word')] if (sum(testResults) == 1): print "\nTest successful!" else:
(testVector3 == testVector4) or (not fourVectors.check_different_direction(testVector3, testVector4))): for testFourVector in testFourVectors2: ##Random range set so as to produce a vector slower than the speed of light. x1 = random.randrange(1, 10) / 10.0 x2 = random.randrange(0, int(math.sqrt(1 - (x1**2)) * 10)) / 10.0 x3 = random.randrange(0, int(math.sqrt(1 - (x2**2)) * 10)) / 10.0 ##Make them massless. x0 = math.sqrt((x1 * x1) + (x2 * x2) + (x3 * x3)) testFourVectors2[testFourVector] = fourVectors.fourVector( x0, x1, x2, x3) testVector3 = testFourVectors2['a'].copy() testVector4 = testFourVectors2['b'].copy() ##Test code here doesn't care about matching appropriate particles in the test dipoles. possibleParticleNos = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 21] testParticle1 = particles.particle( possibleParticleNos[random.randrange(0, 13)], testVector1) testParticle2 = particles.particle( possibleParticleNos[random.randrange(0, 13)], testVector2) testParticle3 = particles.particle( possibleParticleNos[random.randrange(0, 13)], testVector3) testParticle4 = particles.particle( possibleParticleNos[random.randrange(0, 13)], testVector4) testDipole1 = dipole(testParticle1, testParticle2) testDipole2 = dipole(testParticle3, testParticle4) testCopyDipole2 = testDipole2.copy() testCopy2Dipole1 = testDipole1.copy() testCopy2Dipole1.set_not_updated() listOfCodes = [1, 2, 3, 4, 5, 6, -1, -2, -3, -4, -5, -6, 21] ##Test check_is_dipole:## print "\n--------------------------------------------------\n"
)) if testPath == "": testPath = "../Events/belle.lhe" eventIndex = int( raw_input( "\nEnter the index of the event in the LHEF file to use: ") ) except: pass testReader = LHEFHandlers.LHEFReader(testPath) testPDGID1 = testReader.get_event_particle_ID( eventIndex, 2) ##First q, as 1 and 2 are e^+ and e^-. testPDGID2 = testReader.get_event_particle_ID(eventIndex, 3) testVector1 = testReader.get_event_particle_four_momentum(eventIndex, 2) testVector2 = testReader.get_event_particle_four_momentum(eventIndex, 3) testParticle1 = particles.particle(testPDGID1, testVector1) testParticle2 = particles.particle(testPDGID2, testVector2) testShower1 = qqBarShower(testParticle1, testParticle2) ##Test check_is_qqBarShower:## print "\n--------------------------------------------------\n" print "Testing check_is_qqBarShower:\n" print "Calling check_is_qqBarShower on instance: ", check_is_qqBarShower( testShower1) print "Calling check_is_qqBarShower on wrong instance: ", check_is_qqBarShower( testParticle1) print "Calling check_is_qqBarShower on 1.055: ", check_is_qqBarShower( 1.055) print "Calling check_is_qqBarShower on 'word': ", check_is_qqBarShower( 'word') testResults = [