Ejemplo n.º 1
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
Ejemplo n.º 2
0
 def __init__(self):
     """A function to initiate a one-loop fine structure constant."""
     self.__oneLoopAlphaEMOfMzSquared = constants.one_loop_alphaEM_of_Mz_squared(
     )
     self.__showerCutOffEnergy = constants.cut_off_energy()
     ##Currently only set for showering on resonance with the Z-boson channel:
     self.__alphaEMMax = self.__oneLoopAlphaEMOfMzSquared
Ejemplo n.º 3
0
def get_quark_weights(S123, posQuarkCodes, cosTheta=None):
    """A function to calculate the quark weights to beused by the ME generator."""
    __cE = constants.cut_off_energy()
    assert ((type(S123) == float) and (S123 > __cE * __cE))
    assert (type(posQuarkCodes) == list)
    assert (((type(cosTheta) == float) and (-1.0 <= cosTheta) and
             (cosTheta <= 1.0)) or (cosTheta == None))
    ##Using dictionary not list so you don't have to assume an order of the quark codes.
    __hardCodedQWeights = {
        1: 16.05764282,
        2: 11.94029851,
        3: 16.05764282,
        4: 24.32321153,
        5: 31.62120432
    }
    __qWeights = {}  ##Empty dictionary initiated.
    for __qCode in posQuarkCodes:  ##Uses the quark codes given to weight for the chosen set.
        if (cosTheta == None):
            __qWeights[__qCode] = __hardCodedQWeights[
                __qCode]  ##Only take the hard coded ones required so normalisation works.
        else:
            __qWeights[__qCode] = calc_f_for_cos_theta(S123, __qCode, cosTheta)
    __total = sum(__qWeights.itervalues())
    __qWeights.update(
        (x, y / __total) for x, y in __qWeights.items())  ##Normalise them
    assert precision.check_numbers_equal(
        sum(__qWeights.itervalues()),
        1.0)  ##i.e they should now be normalised to 1.
    return __qWeights
Ejemplo n.º 4
0
 def __init__(self):
     """A function to initiate a one-loop strong coupling constant."""
     self.__oneLoopAlphaSOfMzSquared = constants.one_loop_alphaS_of_Mz_squared(
     )
     self.__showerCutOffEnergy = constants.cut_off_energy()
     self.__alphaSMax = self.calculate(self.__showerCutOffEnergy *
                                       self.__showerCutOffEnergy)
Ejemplo n.º 5
0
def get_code_and_theta(S123, posQuarkCodes):
    """A function to select a quark code and cos(theta) value consistent with the differential cross section."""
    __cE = constants.cut_off_energy()
    assert ((type(S123) == float) and (S123 > __cE * __cE))
    assert (type(posQuarkCodes) == list)
    __qCode = get_quark_code(S123, posQuarkCodes)
    __theta = get_quarks_theta(S123, __qCode)
    return __qCode, __theta
Ejemplo n.º 6
0
def get_code_and_theta(S123,posQuarkCodes):
	"""A function to select a quark code and cos(theta) value consistent with the differential cross section."""
	__cE = constants.cut_off_energy()
	assert ((type(S123) == float) and (S123 > __cE*__cE))
	assert (type(posQuarkCodes) == list)
	__qCode = get_quark_code(S123,posQuarkCodes)
	__theta = get_quarks_theta(S123,__qCode)
	return __qCode, __theta
Ejemplo n.º 7
0
def produce_quark_directions(S123, theta):
    """A function to produce a set of opposite directional quark vectors in opposite directions."""
    __cE = constants.cut_off_energy()
    assert ((type(S123) == float) and (S123 > __cE * __cE))
    assert ((type(theta) == float) and (0.0 <= theta) and (theta <= math.pi))
    __phi = kinematics.get_random_phi()
    __x = math.sin(theta) * math.cos(__phi)
    __y = math.sin(theta) * math.sin(__phi)
    __z = math.cos(theta)
    __direction = fourVectors.fourVector(0.0, __x, __y, __z)
    __oppositeDirection = __direction.copy()
    __oppositeDirection *= -1.0
    return __direction, __oppositeDirection
Ejemplo n.º 8
0
def produce_quark_directions(S123,theta):
	"""A function to produce a set of opposite directional quark vectors in opposite directions."""
	__cE = constants.cut_off_energy()
	assert ((type(S123) == float) and (S123 > __cE*__cE))
	assert((type(theta) == float) and (0.0 <= theta) and (theta <= math.pi))
	__phi = kinematics.get_random_phi()
	__x = math.sin(theta)*math.cos(__phi)
	__y = math.sin(theta)*math.sin(__phi)
	__z = math.cos(theta)
	__direction = fourVectors.fourVector(0.0,__x,__y,__z)
	__oppositeDirection = __direction.copy()
	__oppositeDirection *= -1.0
	return __direction, __oppositeDirection
Ejemplo n.º 9
0
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]
Ejemplo n.º 10
0
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]
Ejemplo n.º 11
0
def get_quark_code(S123,posQuarkCodes,cosTheta = None):
	"""A function to return a weighted random quark code."""
	__cE = constants.cut_off_energy()
	assert ((type(S123) == float) and (S123 > __cE*__cE))
	assert (type(posQuarkCodes) == list)
	assert (((type(cosTheta) == float) and (-1.0 <= cosTheta) and (cosTheta <= 1.0)) or (cosTheta == None))
	__qWeights = get_quark_weights(S123,posQuarkCodes,cosTheta) ##Re-set for every cosTheta.
	__R = random.random() ##Doesn't include 1 so using < not <= for checks is fair.
	__sumSoFar = 0.0
	for __qCode in posQuarkCodes: ##Using the initialised set for which the weights are normalised to 1.
		__sumSoFar += __qWeights[__qCode]
		if (__R < __sumSoFar):
			return __qCode
	assert False ##Should have returned by now!
Ejemplo n.º 12
0
def scaled_quark_directions(S123,theta):
	"""A function to return two quark directional vectors scaled to match a given S123 value."""
	__cE = constants.cut_off_energy()
	assert ((type(S123) == float) and (S123 > __cE*__cE))
	assert((type(theta) == float) and (0.0 <= theta) and (theta <= math.pi))
	__E = math.sqrt(S123)/2.0
	__dV1, __dV2 = produce_quark_directions(S123,theta)
	__magnitude = __dV1.calculate_cartesian_magnitude()
	__scale = __E/__magnitude
	__dV1 *= __scale
	__dV2 *= __scale
	__dV1[0], __dV2[0] = __E, __E
	##Check massless:
	assert (precision.check_numbers_equal(__dV1*__dV1,0.0) and precision.check_numbers_equal(__dV2*__dV2,0.0))
	return __dV1, __dV2
Ejemplo n.º 13
0
def scaled_quark_directions(S123, theta):
    """A function to return two quark directional vectors scaled to match a given S123 value."""
    __cE = constants.cut_off_energy()
    assert ((type(S123) == float) and (S123 > __cE * __cE))
    assert ((type(theta) == float) and (0.0 <= theta) and (theta <= math.pi))
    __E = math.sqrt(S123) / 2.0
    __dV1, __dV2 = produce_quark_directions(S123, theta)
    __magnitude = __dV1.calculate_cartesian_magnitude()
    __scale = __E / __magnitude
    __dV1 *= __scale
    __dV2 *= __scale
    __dV1[0], __dV2[0] = __E, __E
    ##Check massless:
    assert (precision.check_numbers_equal(__dV1 * __dV1, 0.0)
            and precision.check_numbers_equal(__dV2 * __dV2, 0.0))
    return __dV1, __dV2
Ejemplo n.º 14
0
def get_quark_code(S123, posQuarkCodes, cosTheta=None):
    """A function to return a weighted random quark code."""
    __cE = constants.cut_off_energy()
    assert ((type(S123) == float) and (S123 > __cE * __cE))
    assert (type(posQuarkCodes) == list)
    assert (((type(cosTheta) == float) and (-1.0 <= cosTheta) and
             (cosTheta <= 1.0)) or (cosTheta == None))
    __qWeights = get_quark_weights(S123, posQuarkCodes,
                                   cosTheta)  ##Re-set for every cosTheta.
    __R = random.random(
    )  ##Doesn't include 1 so using < not <= for checks is fair.
    __sumSoFar = 0.0
    for __qCode in posQuarkCodes:  ##Using the initialised set for which the weights are normalised to 1.
        __sumSoFar += __qWeights[__qCode]
        if (__R < __sumSoFar):
            return __qCode
    assert False  ##Should have returned by now!
Ejemplo n.º 15
0
def get_quark_weights(S123,posQuarkCodes,cosTheta = None):
	"""A function to calculate the quark weights to beused by the ME generator."""
	__cE = constants.cut_off_energy()
	assert ((type(S123) == float) and (S123 > __cE*__cE))
	assert (type(posQuarkCodes) == list)
	assert (((type(cosTheta) == float) and (-1.0 <= cosTheta) and (cosTheta <= 1.0)) or (cosTheta == None))
	##Using dictionary not list so you don't have to assume an order of the quark codes.
	__hardCodedQWeights = {1:16.05764282,2:11.94029851,3:16.05764282,4:24.32321153,5:31.62120432}
	__qWeights = {} ##Empty dictionary initiated.
	for __qCode in posQuarkCodes: ##Uses the quark codes given to weight for the chosen set.
		if (cosTheta == None):
			__qWeights[__qCode] = __hardCodedQWeights[__qCode] ##Only take the hard coded ones required so normalisation works.
		else:
			__qWeights[__qCode] = calc_f_for_cos_theta(S123,__qCode,cosTheta)
	__total = sum(__qWeights.itervalues())
	__qWeights.update((x, y/__total) for x, y in __qWeights.items()) ##Normalise them
	assert precision.check_numbers_equal(sum(__qWeights.itervalues()),1.0) ##i.e they should now be normalised to 1.
	return __qWeights
Ejemplo n.º 16
0
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]
Ejemplo n.º 17
0
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]
Ejemplo n.º 18
0
	##Begin testing:##
	print "\n----------------------------------------------------------------------"
	print "----------------------------------------------------------------------\n"
	print "////////////////////////////////"
	print "Testing runningCouplings module:"
	print "////////////////////////////////"
	assertions.pause(__name__)
	
	##Setup here:##
	print "\nGenerating test values..."
	tOneLoopAlphaS = oneLoopAlphaS()
	tOneLoopAlphaEM = oneLoopAlphaEM()
	tTwoLoopAlphaS = twoLoopAlphaS()
	tFourLoopAlphaS = fourLoopAlphaS()
	tCutOffEnergy = constants.cut_off_energy()	
	tQRange = range(2,3700,1)
	tNfQRange = range(0,3700000,100)
	tNfs , tOneLoopAlphaSs, tTwoLoopAlphaSs = [], [], []
	tOneLoopAlphaEMs = []
	tFourLoopAlphaSs, tDifferenceInAlphaSs = [], []
	tOneLoopWeightedAlphaSs, tTwoLoopWeightedAlphaSs, tFourLoopWeightedAlphaSs = [], [], []
	tOneLoopWeightedAlphaEMs = []
	tBeta0s, tLns, tDenoms = [] , [], []
	tZBosonMass = particleData.knownParticles.get_mass_from_code(particleData.knownParticles.get_code_from_name('Z-boson'))
	tZBosonMassSquared = tZBosonMass * tZBosonMass
	for tN1, tX1 in enumerate(tQRange):
		tQRange[tN1] = (tQRange[tN1]/10.0)
		tOneLoopAlphaSs.append(tOneLoopAlphaS.calculate(tQRange[tN1]**2))
		tOneLoopAlphaEMs.append(tOneLoopAlphaEM.calculate(tQRange[tN1]**2))
		tTwoLoopAlphaSs.append(tTwoLoopAlphaS.calculate(tQRange[tN1]))
Ejemplo n.º 19
0
	def __init__(self):
		"""A function to initiate a one-loop strong coupling constant."""
		self.__oneLoopAlphaSOfMzSquared = constants.one_loop_alphaS_of_Mz_squared()
		self.__showerCutOffEnergy = constants.cut_off_energy()
		self.__alphaSMax = self.calculate(self.__showerCutOffEnergy*self.__showerCutOffEnergy)
Ejemplo n.º 20
0
	def __init__(self):
		"""A function to initiate a one-loop fine structure constant."""
		self.__oneLoopAlphaEMOfMzSquared = constants.one_loop_alphaEM_of_Mz_squared()
		self.__showerCutOffEnergy = constants.cut_off_energy()
		##Currently only set for showering on resonance with the Z-boson channel:
		self.__alphaEMMax = self.__oneLoopAlphaEMOfMzSquared
Ejemplo n.º 21
0
def solve_sudakovs(PperpSquaredMax,
                   S123,
                   difCrossSecIds,
                   code1,
                   code2,
                   logCrosSecs=None):
    """A function to generate a PperpSquared and y for an emission or splitting, using the Sudakov form factor."""
    ##Codes 1,2 still needed to get the charges for EM radiation.
    ##Using veto algorithm in "PYTHIA 6.0 Physics and Manual".
    ##And p198 of "Monte Carlo simulations of hard QCD radiation" for bivariant algorithm.
    ##And p16 of "Initial-state showering based on colour dipoles connected to incoming parton lines" for real y limits.
    ##And p5 of "Fooling around with the Sudakov veto algorithm" for multiple emission form.
    assert assertions.all_are_numbers([PperpSquaredMax, S123])
    assert (type(difCrossSecIds) == list)
    __kQs = particleData.knownParticles.get_known_quarks()
    __gC = particleData.knownParticles.get_code_from_name('gluon')
    __expectedCodes = __kQs + [-x for x in __kQs] + [__gC]
    assert ((code1 in __expectedCodes) and (code2 in __expectedCodes))
    __cutOff = constants.cut_off_energy() * constants.cut_off_energy()
    if (PperpSquaredMax < __cutOff):
        return None, None, None
    __notChosen1, __y, __PperpSquaredi = True, 0, assertions.force_float_number(
        PperpSquaredMax)
    __PperpSquarediMinus1 = __PperpSquaredi
    while __notChosen1:  ##i += 1
        __notChosen2 = True
        while __notChosen2:
            __R1 = random.random()
            __PperpSquaredi = calc_inv_G(
                (math.log(__R1) + calc_G(__PperpSquarediMinus1, S123)), S123)
            if (__PperpSquaredi >
                    S123 / 4.0):  ##The maximum physically possible!
                __notChosen2 = True
                __PperpSquarediMinus1 = __PperpSquaredi
                continue  #Re-run the while loop
            if (
                    __PperpSquaredi <= __PperpSquarediMinus1
            ):  ##Don't update __PperpSquaredi if fails as would start allowing higher values!
                __notChosen2 = False  ##Move on
        if (__PperpSquaredi < __cutOff):
            return None, None, None
        __R2 = random.random()
        __ymin, __ymax = -0.5 * math.log(
            S123 / __PperpSquaredi), 0.5 * math.log(S123 / __PperpSquaredi)
        __yi = calc_inv_G2(__R2 * (calc_G2(__ymax) - calc_G2(__ymin)) +
                           calc_G2(__ymin))
        if not check_rapidity_allowed(
                S123, __PperpSquaredi,
                __yi):  ##Veto incorrect y-range. On the boundary is allowed.
            __PperpSquarediMinus1 = __PperpSquaredi
            continue  ##Don't accept, notChosen1 == True, while will run again.
        __R3 = random.random()
        __numberCSIds = len(difCrossSecIds)
        __ratio = sum_cSs(difCrossSecIds, S123, __PperpSquaredi, __yi, code1,
                          code2) / __numberCSIds * calc_g(
                              __PperpSquaredi, __yi)
        if (__ratio <= __R3):
            __PperpSquarediMinus1 = __PperpSquaredi
            continue  ##Don't accept, notChosen1 == True, while will run again.
        else:
            __notChosen1 = False  ##Accept.
    ##Prepare weights for choosing Id of process occuring:
    __idWeights = {}  ##Empty dictionary initiated.
    for __difCrossSecId in difCrossSecIds:  ##Uses the Ids given so will weight for the chosen set.
        __idWeights[__difCrossSecId] = sum_cSs([__difCrossSecId], S123,
                                               __PperpSquaredi, __yi, code1,
                                               code2)
    __total = sum(__idWeights.itervalues())
    __idWeights.update(
        (x, y / __total) for x, y in __idWeights.items())  ##Normalise them
    assert precision.check_numbers_equal(
        sum(__idWeights.itervalues()),
        1.0)  ##i.e they should now be normalised to 1.
    ##Choose which process:
    __R4 = random.random(
    )  ##Doesn't include 1 -> using < not <= for checks is fair.
    __sumSoFar = 0.0
    __chosenId = None
    __chosen = False
    if (logCrosSecs == 1):
        crossSecsGluSplit.store(qg_to_qQQBar_cS(S123, __PperpSquaredi, __yi))
        crossSecsGluProd.store(qg_to_qgg_cS(S123, __PperpSquaredi, __yi))
    for __difCrossSecId in difCrossSecIds:
        if (not __chosen):
            __sumSoFar += __idWeights[__difCrossSecId]
            if (__R4 < __sumSoFar):
                __chosenId = __difCrossSecId
                __chosen = True
    assert (not (__chosenId == None))  ##Should have chosen by now!
    return __PperpSquaredi, __yi, __chosenId
Ejemplo n.º 22
0
 def __init__(self):
     """A function to initiate a four-loop strong coupling constant."""
     self.__fourLoopLambda = constants.four_loop_lambda()
     self.__showerCutOffEnergy = constants.cut_off_energy()
     self.__alphaSMax = self.calculate(self.__showerCutOffEnergy *
                                       self.__showerCutOffEnergy)
Ejemplo n.º 23
0
	def __init__(self):
		"""A function to initiate a two-loop strong coupling constant."""
		self.__twoLoopAlphaSOfMz = constants.two_loop_alphaS_of_Mz()
		self.__showerCutOffEnergy = constants.cut_off_energy()
		self.__alphaSMax = self.calculate(self.__showerCutOffEnergy*self.__showerCutOffEnergy)
Ejemplo n.º 24
0
    ##Begin testing:##
    print "\n----------------------------------------------------------------------"
    print "----------------------------------------------------------------------\n"
    print "////////////////////////////////"
    print "Testing runningCouplings module:"
    print "////////////////////////////////"
    assertions.pause(__name__)

    ##Setup here:##
    print "\nGenerating test values..."
    tOneLoopAlphaS = oneLoopAlphaS()
    tOneLoopAlphaEM = oneLoopAlphaEM()
    tTwoLoopAlphaS = twoLoopAlphaS()
    tFourLoopAlphaS = fourLoopAlphaS()
    tCutOffEnergy = constants.cut_off_energy()
    tQRange = range(2, 3700, 1)
    tNfQRange = range(0, 3700000, 100)
    tNfs, tOneLoopAlphaSs, tTwoLoopAlphaSs = [], [], []
    tOneLoopAlphaEMs = []
    tFourLoopAlphaSs, tDifferenceInAlphaSs = [], []
    tOneLoopWeightedAlphaSs, tTwoLoopWeightedAlphaSs, tFourLoopWeightedAlphaSs = [], [], []
    tOneLoopWeightedAlphaEMs = []
    tBeta0s, tLns, tDenoms = [], [], []
    tZBosonMass = particleData.knownParticles.get_mass_from_code(
        particleData.knownParticles.get_code_from_name('Z-boson'))
    tZBosonMassSquared = tZBosonMass * tZBosonMass
    for tN1, tX1 in enumerate(tQRange):
        tQRange[tN1] = (tQRange[tN1] / 10.0)
        tOneLoopAlphaSs.append(tOneLoopAlphaS.calculate(tQRange[tN1]**2))
        tOneLoopAlphaEMs.append(tOneLoopAlphaEM.calculate(tQRange[tN1]**2))
Ejemplo n.º 25
0
	def __init__(self):
		"""A function to initiate a four-loop strong coupling constant."""
		self.__fourLoopLambda = constants.four_loop_lambda()
		self.__showerCutOffEnergy = constants.cut_off_energy()
		self.__alphaSMax = self.calculate(self.__showerCutOffEnergy*self.__showerCutOffEnergy)
Ejemplo n.º 26
0
def solve_sudakovs(PperpSquaredMax,S123,difCrossSecIds,code1,code2,logCrosSecs = None):
	"""A function to generate a PperpSquared and y for an emission or splitting, using the Sudakov form factor."""
	##Codes 1,2 still needed to get the charges for EM radiation.
	##Using veto algorithm in "PYTHIA 6.0 Physics and Manual".
	##And p198 of "Monte Carlo simulations of hard QCD radiation" for bivariant algorithm.
	##And p16 of "Initial-state showering based on colour dipoles connected to incoming parton lines" for real y limits.
	##And p5 of "Fooling around with the Sudakov veto algorithm" for multiple emission form.
	assert assertions.all_are_numbers([PperpSquaredMax,S123])
	assert (type(difCrossSecIds) == list)
	__kQs = particleData.knownParticles.get_known_quarks()
	__gC = particleData.knownParticles.get_code_from_name('gluon')
	__expectedCodes = __kQs + [-x for x in __kQs] + [__gC]
	assert ((code1 in __expectedCodes) and (code2 in __expectedCodes))
	__cutOff = constants.cut_off_energy()*constants.cut_off_energy()
	if (PperpSquaredMax < __cutOff):
		return None, None, None
	__notChosen1, __y, __PperpSquaredi = True, 0, assertions.force_float_number(PperpSquaredMax)
	__PperpSquarediMinus1 = __PperpSquaredi
	while __notChosen1: ##i += 1
		__notChosen2 = True
		while __notChosen2:
			__R1 = random.random()
			__PperpSquaredi = calc_inv_G((math.log(__R1) + calc_G(__PperpSquarediMinus1,S123)),S123)
			if (__PperpSquaredi > S123/4.0): ##The maximum physically possible!
				__notChosen2 = True
				__PperpSquarediMinus1 = __PperpSquaredi
				continue #Re-run the while loop
			if (__PperpSquaredi <= __PperpSquarediMinus1): ##Don't update __PperpSquaredi if fails as would start allowing higher values!
				__notChosen2 = False ##Move on
		if (__PperpSquaredi < __cutOff):
			return None, None, None
		__R2 = random.random()
		__ymin, __ymax = -0.5*math.log(S123/__PperpSquaredi), 0.5*math.log(S123/__PperpSquaredi)
		__yi = calc_inv_G2(__R2*(calc_G2(__ymax) - calc_G2(__ymin)) + calc_G2(__ymin))
		if not check_rapidity_allowed(S123,__PperpSquaredi,__yi): ##Veto incorrect y-range. On the boundary is allowed.
			__PperpSquarediMinus1 = __PperpSquaredi
			continue ##Don't accept, notChosen1 == True, while will run again.
		__R3 = random.random()
		__numberCSIds = len(difCrossSecIds)
		__ratio = sum_cSs(difCrossSecIds,S123,__PperpSquaredi,__yi,code1,code2) / __numberCSIds*calc_g(__PperpSquaredi,__yi)
		if (__ratio <= __R3):
			__PperpSquarediMinus1 = __PperpSquaredi
			continue ##Don't accept, notChosen1 == True, while will run again.
		else:
			__notChosen1 = False ##Accept.
	##Prepare weights for choosing Id of process occuring:
	__idWeights = {} ##Empty dictionary initiated.
	for __difCrossSecId in difCrossSecIds: ##Uses the Ids given so will weight for the chosen set.
		__idWeights[__difCrossSecId] = sum_cSs([__difCrossSecId],S123,__PperpSquaredi,__yi,code1,code2)
	__total = sum(__idWeights.itervalues())
	__idWeights.update((x, y/__total) for x, y in __idWeights.items()) ##Normalise them
	assert precision.check_numbers_equal(sum(__idWeights.itervalues()),1.0) ##i.e they should now be normalised to 1.
	##Choose which process:
	__R4 = random.random() ##Doesn't include 1 -> using < not <= for checks is fair.
	__sumSoFar = 0.0
	__chosenId = None
	__chosen = False
	if (logCrosSecs == 1):
		crossSecsGluSplit.store(qg_to_qQQBar_cS(S123,__PperpSquaredi,__yi))
		crossSecsGluProd.store(qg_to_qgg_cS(S123,__PperpSquaredi,__yi))
	for __difCrossSecId in difCrossSecIds:
		if (not __chosen):
			__sumSoFar += __idWeights[__difCrossSecId]
			if (__R4 < __sumSoFar):
				__chosenId = __difCrossSecId
				__chosen = True
	assert (not (__chosenId == None)) ##Should have chosen by now!
	return __PperpSquaredi, __yi, __chosenId
Ejemplo n.º 27
0
 def __init__(self):
     """A function to initiate a two-loop strong coupling constant."""
     self.__twoLoopAlphaSOfMz = constants.two_loop_alphaS_of_Mz()
     self.__showerCutOffEnergy = constants.cut_off_energy()
     self.__alphaSMax = self.calculate(self.__showerCutOffEnergy *
                                       self.__showerCutOffEnergy)