Exemple #1
0
 def __init__(self, particle1, particle2, activeQCodes, history=False):
     """A function to initiate a qqBar shower."""
     assert particles.check_is_particle(particle1)
     assert particles.check_is_particle(particle2)
     assert (particle1.get_code() == -1 * particle2.get_code())
     assert (type(activeQCodes) == list)
     for qCode in activeQCodes:
         assert qCode in particleData.knownParticles.get_known_quarks()
     self.__activeQCodes = activeQCodes
     ##Provide unique particle identifiers for produced particles per event.
     self.__particleCounter = counters.counter(
         5)  ##Start at 4 as e+,e-,q,qBar will be 1,2,3,4 for qqBar shower.
     self.__colourCounter = counters.counter(
         502
     )  ##Start at 501 to differentiate but 501 taken already by qqBar.
     ##Prepare particles etc.
     self.__startParticle1 = particle1.copy()
     self.__startParticle2 = particle2.copy()
     self.__startDipole = dipoles.dipole(self.__startParticle1.copy(),
                                         self.__startParticle2.copy())
     self.__startChain = chains.chain(
         [self.__startParticle1.copy(),
          self.__startParticle2.copy()])
     self.__container = resultsContainers.resultsContainer()
     self.__isRun = False
     self.__showerList = [
         chains.chain([self.__startParticle1, self.__startParticle2])
     ]
     self.__photonList = []
     self.__showerHistory = []
Exemple #2
0
	def __init__(self,particle1,particle2):
		"""A function to initialise a dipole."""
		##Stored and accessed in the order given to enable order management in chains.
		##Can't have a 'zero dipole' so no check present; creation requires both particles non-zero.
		assert (particles.check_is_particle(particle1) and particles.check_is_particle(particle2))
		assert (particle1.__nonzero__() and particle2.__nonzero__())
		__particle1, __particle2 = particle1.copy(), particle2.copy()
		self.__dipoleList = [__particle1,__particle2]
		self.update_dipole_mass_squared() #Set mass squared and also COM four-vector.
		self.__updated = True
Exemple #3
0
 def __init__(self, particle1, particle2):
     """A function to initialise a dipole."""
     ##Stored and accessed in the order given to enable order management in chains.
     ##Can't have a 'zero dipole' so no check present; creation requires both particles non-zero.
     assert (particles.check_is_particle(particle1)
             and particles.check_is_particle(particle2))
     assert (particle1.__nonzero__() and particle2.__nonzero__())
     __particle1, __particle2 = particle1.copy(), particle2.copy()
     self.__dipoleList = [__particle1, __particle2]
     self.update_dipole_mass_squared(
     )  #Set mass squared and also COM four-vector.
     self.__updated = True
Exemple #4
0
	def update_dipole_values_p_prod(self,nPLHS,uDDP,nPRHS):
		"""A function to update the values in the surrounding dipoles for photon emission."""
		assert particles.check_is_particle(nPLHS)
		assert dipoles.check_is_dipole(uDDP)
		assert particles.check_is_particle(nPRHS)
		if ((not self.__isLoop) and (self.__nextIndex == 0)): ##No particle of dipole to left to update.
			pass
		else:
			__uLHIndex = self.get_chain_index(self.__nextIndex - 1)
			self.__chainList[__uLHIndex][1] = nPLHS.copy()
		if ((not self.__isLoop) and (self.__nextIndex == (len(self.__chainList) - 1))): ##-1 for list index from length.
			pass ##No particle of dipole to right to update.
		else:
			__uRHIndex = self.get_chain_index(self.__nextIndex + 1)
			self.__chainList[__uRHIndex][0] = nPRHS.copy()
		self.__chainList[self.__nextIndex] = uDDP.copy()
Exemple #5
0
	def __init__(self,orderedListOfParticles,isLoop = False,maxPperpSquaredFromSplit = None):
		"""A function to initialise a chain using the ordered list of particles given."""
		##Accepting an ordered list of particles allows the initialisation of a chain of any length at any stage.
		for particle in orderedListOfParticles:
			assert particles.check_is_particle(particle)
		assert (isLoop or not(isLoop))
		assert ((maxPperpSquaredFromSplit == None) or (assertions.all_are_numbers([maxPperpSquaredFromSplit])))
		self.__chainList = []
		for i in range(len(orderedListOfParticles) - 1): ##Iterate through all particle pairs.
			self.__chainList.append(dipoles.dipole(orderedListOfParticles[i],orderedListOfParticles[i+1]))
		self.__isLoop = isLoop
		if (maxPperpSquaredFromSplit == None):
			if (len(self.__chainList) == 1):
				self.__maxPperpSquared = self.__chainList[0].get_mass_squared()
			else:
				print "\n! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"
				print "Not sure what to do here yet!"
				#assert False
				self.__maxPperpSquared = self.__chainList[0].get_mass_squared()
				assertions.pause_loading_module()
				##Or do you find that of the entire chain. Or do you find that of each -> Need list?
		else:
			self.__maxPperpSquared = maxPperpSquaredFromSplit
		self.__cutOff = constants.cut_off_energy()*constants.cut_off_energy()
		self.__nextPperpSquared = None ##Initiation value.
		self.__showeringCompleted = False
Exemple #6
0
	def set_new_colours_g_split(self,cC,p1,p2,p3,p1C0B,p1C1B,hS):
		"""A function to set the new colours of the produced particles."""
		assert counters.check_is_counter(cC)
		for p in [p1,p2,p3]:
			assert particles.check_is_particle(p)
			assert p.__nonzero__()
		assert ((type(p1C0B) == int) and (type(p1C1B) == int))
		assert ((hS == "LHS") or (hS == "RHS"))
		__kQs = particleData.knownParticles.get_known_quarks()
		__gC = particleData.knownParticles.get_code_from_name('gluon')
		if (hS == "LHS"):
			if (p1.get_code() > 0): ##Q
				p1.set_colour(0,p1C0B)
				p2.set_colour(1,p1C1B)
			else: ##QBar
				p1.set_colour(0,p1C0B)
				p2.set_colour(1,p1C1B)
		elif (hS == "RHS"):
			if (p1.get_code() > 0): ##Q
				p1.set_colour(1,p1C0B)
				p2.set_colour(0,p1C1B)
			else: ##QBar
				p1.set_colour(1,p1C1B)
				p2.set_colour(0,p1C0B)
		return p1, p2, p3
Exemple #7
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
Exemple #8
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
Exemple #9
0
	def __init__(self,particle1,particle2,activeQCodes,history=False):
		"""A function to initiate a qqBar shower."""
		assert particles.check_is_particle(particle1)
		assert particles.check_is_particle(particle2)
		assert (particle1.get_code() == -1*particle2.get_code())
		assert (type(activeQCodes) == list)
		for qCode in activeQCodes:
			assert qCode in particleData.knownParticles.get_known_quarks()
		self.__activeQCodes = activeQCodes
		##Provide unique particle identifiers for produced particles per event.
		self.__particleCounter = counters.counter(5) ##Start at 4 as e+,e-,q,qBar will be 1,2,3,4 for qqBar shower.
		self.__colourCounter = counters.counter(502) ##Start at 501 to differentiate but 501 taken already by qqBar.
		##Prepare particles etc.
		self.__startParticle1 = particle1.copy()
		self.__startParticle2 = particle2.copy()
		self.__startDipole = dipoles.dipole(self.__startParticle1.copy(),self.__startParticle2.copy())
		self.__startChain = chains.chain([self.__startParticle1.copy(),self.__startParticle2.copy()])
		self.__container = resultsContainers.resultsContainer()
		self.__isRun = False
		self.__showerList = [chains.chain([self.__startParticle1,self.__startParticle2])]
		self.__photonList = []
		self.__showerHistory = []
Exemple #10
0
	def add_event(self,trials,muf2,mur2,processID,weight,scale,alphaEM,alphaS,particlesIn,particlesOut):
		"""A function to convert a produced particles data to LHEF and add to the writer."""
		assert ((type(trials) == int) or (isinstance(trials, basestring)))
		assert ((type(muf2) == int) or (type(muf2) == float) or (isinstance(muf2, basestring)))
		assert ((type(mur2) == int) or (type(mur2) == float) or (isinstance(mur2, basestring)))
		assert ((type(processID) == int) or (isinstance(processID, basestring)))
		assert ((type(weight) == float) or (type(weight) == int) or (isinstance(weight, basestring)))
		assert ((type(scale) == float) or (isinstance(scale, basestring)))
		assert ((type(alphaEM) == float) or (isinstance(alphaEM, basestring)))
		assert ((type(alphaS) == float) or (isinstance(alphaS, basestring)))
		self.__numProdLogger.store(len(particlesOut) - 2) ##Log number of produced partons per event.
		if (self.__topWritten == False):
			self.write_top()
			self.__haveEvents = True ##Only called once here.
		__listOfParticles = particlesIn + particlesOut
		#Currently not sorting by order of production.
		#__listOfIDs = [x.get_unique_ID() for x in __listOfParticles]
		#__sortedListOfParticles = [x for (y,x) in sorted(zip(__listOfIDs,__listOfParticles), key=lambda pair: pair[0])]
		__sortedListOfParticles = __listOfParticles ##Replacement line to keep the chain ordering.
		for particle in __sortedListOfParticles:
			assert particles.check_is_particle(particle)
			assert particle.__nonzero__()
		__numberParticles = len(particlesIn) + len(particlesOut)
		__line1 = "\n<event>" # trials='" + str(trials) + "' muf2='" + str(muf2) + "' mur2='" + str(mur2) + "'>"
		__line2 = ("\n\t\t" + str(__numberParticles) + "\t" + str(processID) + "\t" + str(weight) + "\t" + str(scale))
		__line2 += ("\t" + str(alphaEM) + "\t" + str(alphaS))
		__inLines, __outLines = "", ""
		__endLine = "\n</event>"
		__zO = zero_or
		__pHS = "{:." + str(constants.LHEF_DS_number_decimal_places()) + "e}"
		for i, p in enumerate(__sortedListOfParticles): ##Iterate through both at once, but with particlesIn first!
			if not precision.check_numbers_equal(p.get_four_momentum()*p.get_four_momentum(),0.0):
				fFV = kinematics.fix_not_massless(p.get_four_momentum()) ##Adjust to make sure they are exactly massless for Pythia.
			else:
				fFV = p.get_four_momentum()
			if i <= 1: ##Carry on as normal for first two (initial-state) particles.
				__mum1, __mum2 = p.get_mother(0), p.get_mother(1)
			else: ##Set all mother values to 1 and 2 as required by Pythia 8.2.
				__mum1, __mum2 = 1, 2
			__newLine = ("\n\t\t\t" + str(p.get_code()) + "\t" + str(p.get_status_code()) + "\t" + str(__mum1))
			__newLine += ("\t" + str(__mum2) + "\t" + str(p.get_colour(0)) + "\t\t" + str(p.get_colour(1)))
			__newLine += ("\t\t" + __pHS.format(__zO(fFV[1])) + "\t" + __pHS.format(__zO(fFV[2])) + "\t")
			__newLine += (__pHS.format(__zO(fFV[3])) + "\t" + __pHS.format(__zO(fFV[0])) + "\t")
			__newLine += (__pHS.format(__zO(p.get_mass())) + "\t" + str(__zO(p.get_width())) + "\t\t" + str(p.get_spin()))
			__inLines += __newLine
		__toSave = __line1 + __line2 + __inLines + __outLines + __endLine
		__file = open(self.__saveName,'a') ##'a' means append to.
		__file.write(__toSave)
		__file.close()
		self.__numberEventsSaved += 1
Exemple #11
0
	def add_event(self,trials,muf2,mur2,processID,weight,scale,alphaEM,alphaS,particlesIn,particlesOut):
		"""A function to convert a produced particles data to LHEF and add to the writer."""
		assert ((type(trials) == int) or (isinstance(trials, basestring)))
		assert ((type(muf2) == int) or (type(muf2) == float) or (isinstance(muf2, basestring)))
		assert ((type(mur2) == int) or (type(mur2) == float) or (isinstance(mur2, basestring)))
		assert ((type(processID) == int) or (isinstance(processID, basestring)))
		assert ((type(weight) == float) or (type(weight) == int) or (isinstance(weight, basestring)))
		assert ((type(scale) == float) or (isinstance(scale, basestring)))
		assert ((type(alphaEM) == float) or (isinstance(alphaEM, basestring)))
		assert ((type(alphaS) == float) or (isinstance(alphaS, basestring)))
		if (self.__topWritten == False):
			self.write_top()
			self.__haveEvents = True ##Only called once here.
		__listOfParticles = particlesIn + particlesOut
		__listOfIDs = [x.get_unique_ID() for x in __listOfParticles]
		__sortedListOfParticles = [x for (y,x) in sorted(zip(__listOfIDs,__listOfParticles), key=lambda pair: pair[0])]
		for particle in __sortedListOfParticles:
			assert particles.check_is_particle(particle)
			assert particle.__nonzero__()
		__numberParticles = len(particlesIn) + len(particlesOut)
		__line1 = "\n<event>" #trials='" + str(trials) + "' muf2='" + str(muf2) + "' mur2='" + str(mur2) + "'>"
		__line2 = ("\n\t\t" + str(__numberParticles) + "\t" + str(processID) + "\t" + str(weight) + "\t" + str(scale))
		__line2 += ("\t" + str(alphaEM) + "\t" + str(alphaS))
		__inLines, __outLines = "", ""
		__endLine = "\n</event>"
		__zO = zero_or
		__pHS = "{:." + str(constants.LHEF_ME_number_decimal_places()) + "e}"
		for p in __sortedListOfParticles: ##Iterate through both at once, but with particlesIn first!
			if not precision.check_numbers_equal(p.get_four_momentum()*p.get_four_momentum(),0.0): ##Shouldn't ever need to call it.
				fFV = kinematics.fix_not_massless(p.get_four_momentum()) ##Adjust to make sure they are exactly massless for Pythia.
			else:
				fFV = p.get_four_momentum()
			__newLine = ("\n\t\t\t" + str(p.get_code()) + "\t" + str(p.get_status_code()) + "\t" + str(p.get_mother(0)))
			__newLine += ("\t" + str(p.get_mother(1)) + "\t" + str(p.get_colour(0)) + "\t\t" + str(p.get_colour(1)))
			__newLine += ("\t\t" + __pHS.format(__zO(fFV[1])) + "\t" + __pHS.format(__zO(fFV[2])) + "\t")
			__newLine += (__pHS.format(__zO(fFV[3])) + "\t" + __pHS.format(__zO(fFV[0])) + "\t")
			__newLine += (__pHS.format(__zO(p.get_mass())) + "\t" + str(__zO(p.get_width())) + "\t\t" + str(p.get_spin()))
			__inLines += __newLine
		__toSave = __line1 + __line2 + __inLines + __outLines + __endLine
		__file = open(self.__saveName,'a') ##'a' means append to.
		__file.write(__toSave)
		__file.close()
		self.__numberEventsSaved += 1
	def store(self,particleIn):
		"""A function to store a particle in a results container."""
		assert particles.check_is_particle(particleIn)
		self.__containerList.append(particleIn)
Exemple #13
0
	def set_new_colours_g_prod(self,cC,p1,p2,p3):
		"""A function to set the new colours of the produced particles."""
		assert counters.check_is_counter(cC)
		for p in [p1,p2,p3]:
			assert particles.check_is_particle(p)
			assert p.__nonzero__()
		__kQs = particleData.knownParticles.get_known_quarks()
		__gC = particleData.knownParticles.get_code_from_name('gluon')
		if ((p1.get_code() in __kQs) and ((-p3.get_code()) in __kQs)): ##qqBar.
			__nC = cC.next()
			p2.set_colour(0,__nC)
			p2.set_colour(1,p1.get_colour(0))
			p3.set_colour(1,__nC)
		elif (((-p1.get_code()) in __kQs) and (p3.get_code() in __kQs)): ##qBarq.
			__nC = cC.next()
			p1.set_colour(1,__nC)
			p2.set_colour(0,__nC)
			p2.set_colour(1,p3.get_colour(0))
		elif ((p1.get_code() in __kQs) and (p3.get_code() == __gC)): ##qg.
			__nC = cC.next()
			p2.set_colour(0,__nC)
			p2.set_colour(1,p1.get_colour(0))
			p3.set_colour(1,__nC)
		elif (((-p1.get_code()) in __kQs) and (p3.get_code() == __gC)): ##qBarg.
			__nC = cC.next()
			p2.set_colour(0,p1.get_colour(1))
			p2.set_colour(1,__nC)
			p3.set_colour(0,__nC)
		elif ((p1.get_code() == __gC) and (p3.get_code() in __kQs)): ##gq.
			__nC = cC.next()
			p1.set_colour(1,__nC)
			p2.set_colour(0,__nC)
			p2.set_colour(1,p3.get_colour(0))
		elif ((p1.get_code() == __gC) and ((-p3.get_code()) in __kQs)): ##gqBar.
			__nC = cC.next()
			p1.set_colour(0,__nC)
			p2.set_colour(0,p3.get_colour(1))
			p2.set_colour(1,__nC)
		elif ((p1.get_code() == __gC) and (p3.get_code() == __gC)): ##gg.
			##Two possibilities so randomly choose which keeps colour code.
			__R = random.random()
			if (self.__dipoleRecoilIndex == 0): ##qBar at p3 end, i.e LHS.
				if (__R < 0.5): ##Choose option A.
					__nC = cC.next()
					p1.set_colour(1,__nC)
					p2.set_colour(0,__nC)
					p2.set_colour(1,p3.get_colour(0))
				else: ##Choose option B.
					__nC = cC.next()
					p2.set_colour(0,p1.get_colour(1))
					p2.set_colour(1,__nC)
					p3.set_colour(0,__nC)
			else: ##q at p3 end, i.e RHS.
				if (__R < 0.5): ##Choose option A.
					__nC = cC.next()
					p2.set_colour(0,__nC)
					p2.set_colour(1,p1.get_colour(0))
					p3.set_colour(1,__nC)
				else: ##Choose option B.
					__nC = cC.next()
					p1.set_colour(0,__nC)
					p2.set_colour(0,p3.get_colour(1))
					p2.set_colour(1,__nC)
		return p1, p2, p3
Exemple #14
0
 def add_event(self, trials, muf2, mur2, processID, weight, scale, alphaEM,
               alphaS, particlesIn, particlesOut):
     """A function to convert a produced particles data to LHEF and add to the writer."""
     assert ((type(trials) == int) or (isinstance(trials, basestring)))
     assert ((type(muf2) == int) or (type(muf2) == float)
             or (isinstance(muf2, basestring)))
     assert ((type(mur2) == int) or (type(mur2) == float)
             or (isinstance(mur2, basestring)))
     assert ((type(processID) == int)
             or (isinstance(processID, basestring)))
     assert ((type(weight) == float) or (type(weight) == int)
             or (isinstance(weight, basestring)))
     assert ((type(scale) == float) or (isinstance(scale, basestring)))
     assert ((type(alphaEM) == float) or (isinstance(alphaEM, basestring)))
     assert ((type(alphaS) == float) or (isinstance(alphaS, basestring)))
     if (self.__topWritten == False):
         self.write_top()
         self.__haveEvents = True  ##Only called once here.
     __listOfParticles = particlesIn + particlesOut
     __listOfIDs = [x.get_unique_ID() for x in __listOfParticles]
     __sortedListOfParticles = [
         x for (y, x) in sorted(zip(__listOfIDs, __listOfParticles),
                                key=lambda pair: pair[0])
     ]
     for particle in __sortedListOfParticles:
         assert particles.check_is_particle(particle)
         assert particle.__nonzero__()
     __numberParticles = len(particlesIn) + len(particlesOut)
     __line1 = "\n<event>"  #trials='" + str(trials) + "' muf2='" + str(muf2) + "' mur2='" + str(mur2) + "'>"
     __line2 = ("\n\t\t" + str(__numberParticles) + "\t" + str(processID) +
                "\t" + str(weight) + "\t" + str(scale))
     __line2 += ("\t" + str(alphaEM) + "\t" + str(alphaS))
     __inLines, __outLines = "", ""
     __endLine = "\n</event>"
     __zO = zero_or
     __pHS = "{:." + str(constants.LHEF_ME_number_decimal_places()) + "e}"
     for p in __sortedListOfParticles:  ##Iterate through both at once, but with particlesIn first!
         if not precision.check_numbers_equal(
                 p.get_four_momentum() * p.get_four_momentum(),
                 0.0):  ##Shouldn't ever need to call it.
             fFV = kinematics.fix_not_massless(p.get_four_momentum(
             ))  ##Adjust to make sure they are exactly massless for Pythia.
         else:
             fFV = p.get_four_momentum()
         __newLine = ("\n\t\t\t" + str(p.get_code()) + "\t" +
                      str(p.get_status_code()) + "\t" +
                      str(p.get_mother(0)))
         __newLine += ("\t" + str(p.get_mother(1)) + "\t" +
                       str(p.get_colour(0)) + "\t\t" + str(p.get_colour(1)))
         __newLine += ("\t\t" + __pHS.format(__zO(fFV[1])) + "\t" +
                       __pHS.format(__zO(fFV[2])) + "\t")
         __newLine += (__pHS.format(__zO(fFV[3])) + "\t" +
                       __pHS.format(__zO(fFV[0])) + "\t")
         __newLine += (__pHS.format(__zO(p.get_mass())) + "\t" +
                       str(__zO(p.get_width())) + "\t\t" +
                       str(p.get_spin()))
         __inLines += __newLine
     __toSave = __line1 + __line2 + __inLines + __outLines + __endLine
     __file = open(self.__saveName, 'a')  ##'a' means append to.
     __file.write(__toSave)
     __file.close()
     self.__numberEventsSaved += 1
Exemple #15
0
 def add_event(self, trials, muf2, mur2, processID, weight, scale, alphaEM,
               alphaS, particlesIn, particlesOut):
     """A function to convert a produced particles data to LHEF and add to the writer."""
     assert ((type(trials) == int) or (isinstance(trials, basestring)))
     assert ((type(muf2) == int) or (type(muf2) == float)
             or (isinstance(muf2, basestring)))
     assert ((type(mur2) == int) or (type(mur2) == float)
             or (isinstance(mur2, basestring)))
     assert ((type(processID) == int)
             or (isinstance(processID, basestring)))
     assert ((type(weight) == float) or (type(weight) == int)
             or (isinstance(weight, basestring)))
     assert ((type(scale) == float) or (isinstance(scale, basestring)))
     assert ((type(alphaEM) == float) or (isinstance(alphaEM, basestring)))
     assert ((type(alphaS) == float) or (isinstance(alphaS, basestring)))
     self.__numProdLogger.store(
         len(particlesOut) - 2)  ##Log number of produced partons per event.
     if (self.__topWritten == False):
         self.write_top()
         self.__haveEvents = True  ##Only called once here.
     __listOfParticles = particlesIn + particlesOut
     #Currently not sorting by order of production.
     #__listOfIDs = [x.get_unique_ID() for x in __listOfParticles]
     #__sortedListOfParticles = [x for (y,x) in sorted(zip(__listOfIDs,__listOfParticles), key=lambda pair: pair[0])]
     __sortedListOfParticles = __listOfParticles  ##Replacement line to keep the chain ordering.
     for particle in __sortedListOfParticles:
         assert particles.check_is_particle(particle)
         assert particle.__nonzero__()
     __numberParticles = len(particlesIn) + len(particlesOut)
     __line1 = "\n<event>"  # trials='" + str(trials) + "' muf2='" + str(muf2) + "' mur2='" + str(mur2) + "'>"
     __line2 = ("\n\t\t" + str(__numberParticles) + "\t" + str(processID) +
                "\t" + str(weight) + "\t" + str(scale))
     __line2 += ("\t" + str(alphaEM) + "\t" + str(alphaS))
     __inLines, __outLines = "", ""
     __endLine = "\n</event>"
     __zO = zero_or
     __pHS = "{:." + str(constants.LHEF_DS_number_decimal_places()) + "e}"
     for i, p in enumerate(
             __sortedListOfParticles
     ):  ##Iterate through both at once, but with particlesIn first!
         if not precision.check_numbers_equal(
                 p.get_four_momentum() * p.get_four_momentum(), 0.0):
             fFV = kinematics.fix_not_massless(p.get_four_momentum(
             ))  ##Adjust to make sure they are exactly massless for Pythia.
         else:
             fFV = p.get_four_momentum()
         if i <= 1:  ##Carry on as normal for first two (initial-state) particles.
             __mum1, __mum2 = p.get_mother(0), p.get_mother(1)
         else:  ##Set all mother values to 1 and 2 as required by Pythia 8.2.
             __mum1, __mum2 = 1, 2
         __newLine = ("\n\t\t\t" + str(p.get_code()) + "\t" +
                      str(p.get_status_code()) + "\t" + str(__mum1))
         __newLine += ("\t" + str(__mum2) + "\t" + str(p.get_colour(0)) +
                       "\t\t" + str(p.get_colour(1)))
         __newLine += ("\t\t" + __pHS.format(__zO(fFV[1])) + "\t" +
                       __pHS.format(__zO(fFV[2])) + "\t")
         __newLine += (__pHS.format(__zO(fFV[3])) + "\t" +
                       __pHS.format(__zO(fFV[0])) + "\t")
         __newLine += (__pHS.format(__zO(p.get_mass())) + "\t" +
                       str(__zO(p.get_width())) + "\t\t" +
                       str(p.get_spin()))
         __inLines += __newLine
     __toSave = __line1 + __line2 + __inLines + __outLines + __endLine
     __file = open(self.__saveName, 'a')  ##'a' means append to.
     __file.write(__toSave)
     __file.close()
     self.__numberEventsSaved += 1
Exemple #16
0
 def store(self, particleIn):
     """A function to store a particle in a results container."""
     assert particles.check_is_particle(particleIn)
     self.__containerList.append(particleIn)