def twobodyparticledecay(self,particle,products): # takes a list of two particles and decays them. ''' Get Produced hadron masses ''' Decaytables = Decaydictionary.Decays() particle4vector = particle.Getvector4D() product1code = products[0] product2code = products[1] mass1 = Decaytables.Getmass(product1code) mass2 = Decaytables.Getmass(product2code) ''' Get boost class which contains useful boosting functions ''' #print "boost in two body called" boost = Boosts.boost4D(particle4vector) ''' CMF mass of the string (mass of decaying object) ''' cmsvector = boost.GetCMF() Mass = cmsvector[0] mom3 = Mass/2 mom3 *= self.Sqrtlambda1(Mass,mass1,mass2) ''' Do the random angle generation ''' randomphi = random.random() randomtheta = random.uniform(-1,1) phi = 2.*numpy.pi*randomphi sinphi = numpy.sin(phi) cosphi = numpy.cos(phi) theta = numpy.pi*randomtheta sintheta = numpy.sin(theta) costheta = numpy.cos(theta) ''' start setting the 4 vectors of the products ''' mom = Fourvector.vector4D(0.,sintheta*cosphi,sintheta*sinphi,costheta) mom *= mom3 E1 = numpy.sqrt(mass1*mass1+mom3*mom3) E2 = numpy.sqrt(mass2*mass2+mom3*mom3) finalvec1 = Fourvector.vector4D() finalvec1[0] = E1 finalvec1 += mom finalvec2 = Fourvector.vector4D() finalvec2[0] = E2 finalvec2 -= mom ''' Boost back into the lab frame ''' print "Is the crash here" finalvec1 = boost/finalvec1 #hadron finalvec2 = boost/finalvec2 #photon ''' Create the particles and return them in a list ''' finalproduct1 = Particle.particle4D(product1code,finalvec1) finalproduct2 = Particle.particle4D(product2code,finalvec2) return [finalproduct1, finalproduct2]
def masslessmomenta(lop): noparts = len(lop) newlist = [] for i in range(noparts): if lop[i].Checkgluon() == False: # not a gluon is a quark ''' do momenta boosting things here ''' mass = lop[i].Getinvariantmass() #print mass, "mass in invariant mass" vec = copy.deepcopy(lop[i].Getvector()) #print vec, "vec before" p_2 = 0 for j in range(1,4): # just go over the momentum values, try my scaling formula p_2 += (vec[j]*vec[j]) al = numpy.sqrt((mass*mass + p_2) / p_2) newvector = Fourvector.vector4D(vec[0], al*vec[1],al*vec[2],al*vec[3]) ID = lop[i].GetID() #print ID, "id of theparticle " newparticle = Particle.particle4D(ID,newvector) newlist.append(newparticle) #print newparticle.Getinvariantmass(), "check inv mass" if lop[i].Checkgluon() == True: newlist.append(lop[i]) return newlist
def Convertfromhepmc(): reader = hepmc.IO_GenEvent("INPUT", "r") # ryan.hepmc is the file for PYTHIA stuff evtnum = 0 # should be zero noheavyevents = 0 evt = hepmc.GenEvent() reader.fill_next_event(evt) totaleventlist = [] while evt.particles_size(): # evtnum < 50000 ''' Loop for each event. I.e. each list of particles ''' subeventlist = [] evtnum+=1 #print "Event %d: " % evtnum, evt #print "Particles: ", evt.particles() #print "Num particles: ", evt.particles_size() #print "Num vertices: ", evt.vertices_size() #for p in evt.particles(): # m = p.momentum() # "X,Y,Z,E" # print m fsps = evt.fsParticles() #print "FS particles: ", fsps #print "Num FS particles: ", len(fsps) if evtnum % 100 == 0: print "Event %d" % evtnum for p in fsps: ''' Build the list of final state particles in PyLund, and fill their properties ''' #print p m = p.momentum() # E,x,y,z colour = p.flow(1) anticolour = p.flow(2) #print "1", colour, "2", anticolour ''' Build properties into PyLund particle class and append the particle to the sublist ''' partfv = Fourvector.vector4D(m.e(),m.px(),m.py(),m.pz()) ID = p.pdg_id() newpart = Particle.particle4D(ID,partfv)# #print newpart.Getinvariantmass(), "particle invariant mass" newpart.Setcolour(colour) newpart.Setanticolour(anticolour) subeventlist.append(newpart) ''' Perform some checks on the list -- current edition removes photons and vetoes heavy events ''' if Vetoheavies(subeventlist) == True: # If event contains a heavy quark. go to next iteration before append. noheavyevents += 1 #print "\n\n" evt.clear() evt = reader.get_next_event() continue subeventlist = Removephotons(subeventlist) # remove the photons from the event. #print "Num fs particles", len(subeventlist) # WE REMOVE THE PHOTONS. NO FS PARTICLES DOES NOT INCLUDE THE PHOTONS. ''' The call the colour ordering function ''' #print subeventlist subeventlist = Colourorderlist(subeventlist) #print subeventlist, "event list after colour ordering" #print checkcolours(subeventlist) #sys.exit() subeventlist = masslessmomenta(subeventlist) # attempting the massels mom subeventlist = Fixlowenergy(subeventlist) #print subeventlist, "event list after fixing low nergy gluons" #print energies(subeventlist) #print checkquark(subeventlist) #sys.exit() subeventlist = Gluonsplitting.Splitgluons(subeventlist) #print subeventlist, "event list after splitting the gluons" #print len(subeventlist), "number of particles fed into string former" subeventlist = Stringformer.Formstrings(subeventlist) # Convert the lists to strings! #print subeventlist, "sublist after forming all the strings." #sys.exit() totaleventlist.append(subeventlist) #print "\n\n" evt.clear() evt = reader.get_next_event() #print noheavyevents return totaleventlist # returns a list of lists that contain strings ready for feeding into PyLund!
def Failsafe2(self,string): # IN SITU. NEEDS NEW TABLES TO BE CODED. stringvec4D = string.Gettotalvector4D() boost = Boosts.boost4D(stringvec4D) cmsvector = boost.GetCMF() Mass = cmsvector[0] # string mass ''' Get the hadron masses ''' Decaytables = Decaydictionary.Decays() hadronpair = Decaytables.Failsafe2complete(string) hadron1code = hadronpair[0] hadron2code = hadronpair[1] mass1 = Decaytables.Getmass(hadron1code) if mass1 == 0: print "mass 1 == 0" print hadron1code, "hadron1code" print hadron2code, "hadron2code" sys.exit() mass2 = Decaytables.Getmass(hadron2code) mom3 = Mass/2 mom3 *= self.Sqrtlambda1(Mass,mass1,mass2) randomphi = random.random() randomtheta = random.uniform(-1,1) phi = 2.*numpy.pi*randomphi sinphi = numpy.sin(phi) cosphi = numpy.cos(phi) theta = numpy.pi*randomtheta sintheta = numpy.sin(theta) costheta = numpy.cos(theta) mom = Fourvector.vector4D(0.,sintheta*cosphi,sintheta*sinphi,costheta) mom *= mom3 E1 = numpy.sqrt(mass1*mass1+mom3*mom3) E2 = numpy.sqrt(mass2*mass2+mom3*mom3) finalvec1 = Fourvector.vector4D() finalvec1[0] = E1 finalvec1 += mom finalvec2 = Fourvector.vector4D() finalvec2[0] = E2 finalvec2 -= mom finalvec1 = boost/finalvec1 finalvec2 = boost/finalvec2 finalvec1row = finalvec1.Getvector() finalvec2row = finalvec2.Getvector() for i in range(4): if math.isnan(finalvec1row[i]) == True: finalvec1 = Fourvector.vector4D(mass1,0,0,0) if math.isnan(finalvec2row[i]) == True: finalvec2 = Fourvector.vector4D(mass2,0,0,0) # if we have nan values, then produce them at reast. see how this works print Mass, "stringmass" print "reached the problem with double kaon produictiion" sys.exit() finalhadron1 = Particle.particle4D(hadron1code,finalvec1) finalhadron2 = Particle.particle4D(hadron2code,finalvec2) return [finalhadron1, finalhadron2]
def threebodyparticledecay(self,decayingparticle,producthadrons): # product hadrons = list of particles (from chosendecay in hadrondecay module) decayingvector = decayingparticle.Getvector4D() hadron1code = producthadrons[0] hadron2code = producthadrons[1] hadron3code = producthadrons[2] Decaytables = Decaydictionary.Decays() m1 = Decaytables.Getmass(hadron1code) m2 = Decaytables.Getmass(hadron2code) m3 = Decaytables.Getmass(hadron3code) boost = Boosts.boost4D(decayingvector) cmsvector = boost.GetCMF() Mass = cmsvector[0] ''' PLACE HOLDER HERE TO TRY AND GET A RESULT. NOT TOO CONCERNED ABOUT MOMENTA YET ''' finalvec1 = Fourvector.vector4D(m1,0,0,0) finalvec2 = Fourvector.vector4D(m2,0,0,0) finalvec3 = Fourvector.vector4D(m3,0,0,0) product1 = Particle.particle4D(hadron1code,finalvec1) product2 = Particle.particle4D(hadron2code,finalvec2) product3 = Particle.particle4D(hadron3code,finalvec3) return [product1,product2,product3] while True: print "ARE WE STUCK IN THE TIME WARP LOOP. 3 - BODY DECAY" ''' Constrain m12 ''' m12_min = m1 + m2 m12_max = Mass - m3 D_m12 = m12_max - m12_min rng = random.random() m12 = m12_min + rng * D_m12 # select a number randomly (uniform) between m12min and m12max. ''' Use m12 to constrain m23 ''' E2 = (m12*m12 - m1*m1 + m2*m2) / (2*m12) # the energy of particle 2 in the rest frame of m12 E3 = (Mass*Mass - m12*m12 - m3*m3) / (2*m12) # same but for 3 m23_min = (E2 + E3)*(E2 + E3) - (numpy.sqrt(E2*E2 - m2*m2) + numpy.sqrt(E3*E3 - m3*m3))**2 # these two are m23 squared m23_max = (E2 + E3)*(E2 + E3) - (numpy.sqrt(E2*E2 - m2*m2) - numpy.sqrt(E3*E3 - m3*m3))**2 D_m23 = numpy.sqrt(m23_max) - numpy.sqrt(m23_min) rng2 = random.random() m23 = numpy.sqrt(m23_min) + rng2 * D_m23 ''' Calculate m13 from m12, m23 ''' m13_2 = Mass*Mass + m1*m1 + m2+m2 + m3*m3 - m12*m12* - m23*m23 m13 = numpy.sqrt(m13_2) ''' Hardcode the momenta functions ''' # Can use lambda as well to get the expressions p1 = (Mass/2) * self.Sqrtlambda1(Mass,m23,m1) #print p1, "p1" p2 = (Mass/2) * self.Sqrtlambda1(Mass,m13,m2) #print p2, "p2" p3 = (Mass/2) * self.Sqrtlambda1(Mass,m12,m3) #print p3, "p3" ''' Generate the angles phi is isotropic ''' randomphi = random.random() phi = 2.*numpy.pi*randomphi sinphi = numpy.sin(phi) cosphi = numpy.cos(phi) ''' Generate the thetas in the plane of decay ''' # First momentum theta is random. randomtheta1 = random.uniform(-1,1) theta1 = numpy.pi*randomtheta1 sintheta1 = numpy.sin(theta1) costheta1 = numpy.cos(theta1) # Second is also random, and helps determine the second. However have to generate sensible / possible angles for i in range(100): randomtheta2 = random.uniform(-1,1) theta2 = numpy.pi*randomtheta2 sintheta2 = numpy.sin(theta2) costheta2 = numpy.cos(theta2) # Third constrained by the first two in order to balance momentum. sintheta3 = (-p1*sintheta1 - p2*sintheta2) / p3 costheta3 = (-p1*costheta1 - p2*costheta2) / p3 if abs(sintheta3) <= 1 and abs(costheta3) <= 1: ''' Build the 4 vectors ''' vecE1 = numpy.sqrt(m1*m1 + p1*p1) #print vecE1, "vecE1" vecE2 = numpy.sqrt(m2*m2 + p2*p2) #print vecE2, "vecE2" vecE3 = numpy.sqrt(m3*m3 + p3*p3) #print vecE3, "vecE3" finalvec1 = Fourvector.vector4D(vecE1,p1*sintheta1*cosphi,p1*sintheta1*sinphi,costheta1) finalvec1 = boost/finalvec1 finalvec2 = Fourvector.vector4D(vecE2,p2*sintheta2*cosphi,p2*sintheta2*sinphi,costheta2) finalvec2 = boost/finalvec2 finalvec3 = Fourvector.vector4D(vecE3,p3*sintheta3*cosphi,p3*sintheta3*sinphi,costheta3) finalvec3 = boost/finalvec3 ''' Construct the particles ''' product1 = Particle.particle4D(hadron1code,finalvec1) product2 = Particle.particle4D(hadron2code,finalvec2) product3 = Particle.particle4D(hadron3code,finalvec3) return [product1,product2,product3]
def Failsafe1(self,string): ''' Get Produced hadron & photon masses ''' Decaytables = Decaydictionary.Decays() Failsafe1hadron = Decaytables.GetFailsafe1hadron(string) if Failsafe1hadron == 0: Failsafe1hadron = 22 # set to a photon #print "Failsafe1 being fed an unphysical string - setting the hadron to photon to avoid crash but investigate the problem" #print string.Getstringmass(), "stringmass" #print string.Getstringcontent(), "stringcontent" #print Failsafe1hadron hadronmass = Decaytables.Getmass(Failsafe1hadron) # mass1 #print hadronmass, "hadronmass" photonmass = 0 # mass 2 ''' Get boost class which contains useful boosting functions ''' string4vector = string.Gettotalvector4D() boost = Boosts.boost4D(string4vector) ''' CMF mass of the string (mass of decaying object) ''' cmsvector = boost.GetCMF() Mass = cmsvector[0] mom3 = Mass/2 mom3 *= self.Sqrtlambda1(Mass,hadronmass,photonmass) ''' Do the random angle generation ''' randomphi = random.random() randomtheta = random.uniform(-1,1) phi = 2.*numpy.pi*randomphi sinphi = numpy.sin(phi) cosphi = numpy.cos(phi) theta = numpy.pi*randomtheta sintheta = numpy.sin(theta) costheta = numpy.cos(theta) ''' start setting the 4 vectors of the products ''' mom = Fourvector.vector4D(0.,sintheta*cosphi,sintheta*sinphi,costheta) mom *= mom3 E1 = numpy.sqrt(hadronmass*hadronmass+mom3*mom3) E2 = numpy.sqrt(photonmass*photonmass+mom3*mom3) finalvec1 = Fourvector.vector4D() finalvec1[0] = E1 finalvec1 += mom finalvec2 = Fourvector.vector4D() finalvec2[0] = E2 finalvec2 -= mom ''' Boost back into the lab frame ''' finalvec1 = boost/finalvec1 #hadron finalvec2 = boost/finalvec2 #photon ''' Create the particles and return them in a list ''' Failsafe1hadron = self.Checkforkaons(Failsafe1hadron) finalhadron = Particle.particle4D(Failsafe1hadron,finalvec1) finalphoton = Particle.particle4D(22,finalvec2) if abs(finalhadron.Getcode()) == 311: print "FOUND IT" sys.exit() return [finalhadron, finalphoton]
def Twobodydiquarks(self,string,diquark1, diquark2): stringvec4D = string.Gettotalvector4D() boost = Boosts.boost4D(stringvec4D) cmsvector = boost.GetCMF() Mass = cmsvector[0] # string mass ''' Get the hadron masses ''' Decaytables = Decaydictionary.Decays() #hadronpair = Decaytables.Failsafe2complete(string) #need to get the diquarks for string ends. hadron1code = diquark1 #print hadron1code, "hadron1code from diquark twobody" hadron2code = diquark2 #print hadron2code, "hadron2code from diquark twobody" mass1 = Decaytables.Getmass(hadron1code) mass2 = Decaytables.Getmass(hadron2code) mom3 = Mass/2 mom3 *= self.Sqrtlambda1(Mass,mass1,mass2) randomphi = random.random() randomtheta = random.uniform(-1,1) phi = 2.*numpy.pi*randomphi sinphi = numpy.sin(phi) cosphi = numpy.cos(phi) theta = numpy.pi*randomtheta sintheta = numpy.sin(theta) costheta = numpy.cos(theta) mom = Fourvector.vector4D(0.,sintheta*cosphi,sintheta*sinphi,costheta) mom *= mom3 E1 = numpy.sqrt(mass1*mass1+mom3*mom3) E2 = numpy.sqrt(mass2*mass2+mom3*mom3) finalvec1 = Fourvector.vector4D() finalvec1[0] = E1 finalvec1 += mom finalvec2 = Fourvector.vector4D() finalvec2[0] = E2 finalvec2 -= mom finalvec1 = boost/finalvec1 finalvec2 = boost/finalvec2 ''' reset the final vecs to represent massless diquarks. Just need the flavour assignment ''' finalvec1 = copy.deepcopy(string.Getqvector4D()) finalvec2 = copy.deepcopy(string.Getqbarvector4D()) finalhadron1 = Particle.particle4D(hadron1code,finalvec1) finalhadron2 = Particle.particle4D(hadron2code,finalvec2) if hadron1code > 0: newstring = MRS.mrs4D(finalhadron1,finalhadron2) if hadron1code < 0: newstring = MRS.mrs4D(finalhadron2,finalhadron1) # try to keep the negative / positive ids in the relative placements (kind of important) #print newstring.Getstringcontent(), "CHECKING THE TWO BODY MODULE" return newstring
def Decaystring(self,decayingstring,decayingquarknumber,hadronproducedID): #class that takes an (unboosted) mrs as an arguement and decays it, producing a particle and a new iteration of string. ''' NOTE - DECAYING SIDE ONLY CARES IF THE NUMBER IS POSITIVE OR NEGATIVE - I.E. PDG CODE OF QUARK / ANTIQUARK REPSECTIVELY ''' #print "decaystring class reached" Decaytables = Decaydictionary.Decays() twobodyclass = Twobodydecay.twobodydecay4D() hadroncodetest = PDG_ID.PDG_Type(hadronproducedID) if hadroncodetest.isBaryon() is True: if self.__qPDG.isQuark() or self.__qbarPDG.isQuark() is True: baryonproducts = self.Baryonproduction(hadronproducedID,decayingquarknumber) if baryonproducts[1] == 0: stringcontent = [baryonproducts[0],self.__qbarID] #print stringcontent, "IS THERE SOMETHING WRONG HERE" if baryonproducts[1] == 1: stringcontent = [self.__qID, baryonproducts[0]] #print stringcontent, "HOW ABOUT HERE, IS THERE ERROR" ''' If the produced particle is a diquark i.e. producing diquarks at the ends of the string. just need to redistribute momentum via a two body decay ''' if hadroncodetest.isDiquark() is True: # i.e. we're producing two diquarks, one at each end of the string recievingdiquark = self.Finddiquarkstringcontent(decayingquarknumber,hadronproducedID) #print recievingdiquark, "RECIEVINGDIQUARK" newstring = twobodyclass.Twobodydiquarks(decayingstring,hadronproducedID,recievingdiquark) # produce a new string, hadronproduced ID here is a DIQUARK. adc = Availabledecays.availabledecays4D(newstring)# AVAILABLE DECAY CLASS newproducts = adc.Finddecay() ''' Assign the new values to the parameters in the code. now producing a baryon from a diquark end ''' decayingquarknumber = newproducts[0] #print decayingquarknumber, "DECAYINGQUARK NUMBER IN THE BARYONPROD" hadronproducedID = newproducts[1] #print hadronproducedID, "HADRONPRODUCED ID IN THE BAREEREREREOWIJIW3ERJIOWEJ" #print PDG_ID.PDG_Type.mass(PDG_ID.PDG_Type(hadronproducedID)), "HADRON MASS IN THE BARREEEEEE" #print "SUCESSFULLY DETERMINED A MASS" stringcontent = self.Getbaryonstringcontent(hadronproducedID,decayingquarknumber,recievingdiquark) # takes the (baryon, diquark) IDs. that have just been found decayingstring = copy.deepcopy(newstring) #print stringcontent, "stringcontent from the module" ''' If the produced particle is a meson, leaves behind a quark remnant at the end of the string ''' if hadroncodetest.isMeson() is True: stringcontent = self.Findstringcontent(decayingquarknumber,hadronproducedID) # finds [quark, antiquark] of the string #print stringcontent, "DO WE GOT A PROBLEM HERE" ''' Get out the string information (ie the quark information) ''' boostedstring = self.Booststringforward(decayingstring) quark1 = boostedstring.Getq() antiquark1 = boostedstring.Getqbar() quark1vector4D = quark1.Getvector4D() antiquark1vector4D = antiquark1.Getvector4D() ''' define particle produced values ''' # Initialise the particle for manipulation later. (hadron is object k) hadronmomentum = Fourvector.vector4D(1.,1.,1.,1.) # placeholder (used for class creation), is reset later hadron = Particle.particle4D(hadronproducedID,hadronmomentum) hadronmass = hadron.Getmass() '''Create p+, p-''' #print antiquark1vector4D.Getvector(), "#PRINT VECOTRS" #print quark1vector4D.Getvector() if quark1vector4D[3] < 0: p_plus = quark1vector4D[0] - quark1vector4D[3] p_minus = antiquark1vector4D[0] + antiquark1vector4D[3] if quark1vector4D[3] > 0: p_plus = quark1vector4D[0] + quark1vector4D[3] p_minus = antiquark1vector4D[0] - antiquark1vector4D[3] ''' Find the quark content of the string ''' #print stringcontent[0], "stringcontent 0 " #print stringcontent[1], "stringcontent 1 " ''' Try 100 hundred times to get a successful kperp and z value for the current string decay ''' n = 0 while True: n = n+1 ##print "Are we stuck" #print "stringmass", boostedstring.Getstringmass() #print "hadronmass", hadronmass #print antiquark1vector4D.Getvector(), "#PRINT VECOTRS" #print quark1vector4D.Getvector() ''' Get k perp value ''' kperp = self.Getkperphitmiss(boostedstring) # 0.305 #print kperp, "kperp" ''' Get z value ''' z_plus = self.Getzhitmiss(boostedstring,kperp,hadronmass) # 0.24 z_minus = 1 - z_plus #print z_plus, "z_plus" ''' Create the k+- values ''' k_plus = z_plus*p_plus k_minus = (hadronmass*hadronmass + kperp*kperp) / (z_plus*p_plus) ##print k_plus, "k_plus" ##print k_minus, "k_minus" ''' Create the angles for future resolving ''' ''' phi is isotropic, and taken as angle to the quark. pi is added to phi to get the hadron angle ''' q_phi = 2*numpy.pi*random.random() k_phi = q_phi + numpy.pi qnew_cosphi = numpy.cos(q_phi) qnew_sinphi = numpy.sin(q_phi) k_cosphi = numpy.cos(k_phi) k_sinphi = numpy.sin(k_phi) ''' Create the final vectors ''' qnew_plus = z_minus * p_plus #print z_minus #print p_plus, "P PLUS" qnew_minus = (kperp*kperp) / (z_minus * p_plus) ''' Arrange arrays of [p+, p_, pcostheta, psintheta] ''' qnew = [qnew_plus, qnew_minus, kperp*qnew_cosphi, kperp*qnew_sinphi] #print qnew, "QNEW" knew = [k_plus, k_minus, kperp*k_cosphi, kperp*k_sinphi] #print knew, "KNEW" antiqnew = [0,p_minus - k_minus - qnew_minus, 0, 0] #print antiqnew, "ANTIQNEW" ''' From the arrays constructed above, create the vectors E,p ''' ''' Start with the particle ''' k_E = (k_plus + k_minus) /2 k_px = knew[2] k_py = knew[3] k_pz = (k_plus - k_minus) /2 kmom = Fourvector.vector4D(k_E,k_px,k_py,k_pz) ''' And now for the quark in the string ''' q_E = (qnew[0]+qnew[1])/2 q_px = qnew[2] q_py = qnew[3] q_pz = (qnew[0]-qnew[1])/2 qmom = Fourvector.vector4D(q_E,q_px,q_py,q_pz) ''' And now for the antiquark in the string ''' antiq_E = (antiqnew[0] + antiqnew[1]) /2 antiq_px = antiqnew[2] antiq_py = antiqnew[3] antiq_pz = (antiqnew[0] - antiqnew[1]) /2 antiqmom = Fourvector.vector4D(antiq_E,antiq_px,antiq_py,antiq_pz) ''' Testing the dynamics of the system - momentum should be conserved ''' totalmom = antiqmom+qmom+kmom ##print p_plus*p_minus, "total cmf momentum of the system originally, i.e. 2E" ##print totalmom*totalmom, "Invariant mass squared of the final system" ''' Now need to boost the system back into the lab frame ''' ''' Adjust the quarks and create a new string, and boost to lab frame ''' #print stringcontent, "STRINGCONTENT" quark2 = Particle.particle4D(float(stringcontent[0]),quark1.Getvector4D()) #print hadronproducedID, "HADRON ID" ##print stringcontent[1], "ANTI QUARK NUMBER" antiquark2 = Particle.particle4D(float(stringcontent[1]),antiquark1.Getvector4D()) quark2.Setmom(qmom) antiquark2.Setmom(antiqmom) quark1.Setmom(qmom) antiquark1.Setmom(antiqmom) newstring = MRS.mrs4D(quark2,antiquark2) newstring_labframe = self.Booststringback(newstring) # Final string, in the lab frame #print newstring_labframe.Getstringcontent(), "LABFRAME CONTENT" #testthequark = newstring_labframe.Getq() #print testthequark.Getinvariantmass(), "invariant mass of the quark in the string" ''' Now need to boost then adjust the produced hadron ''' kmomrotated = self.__rotateboost.Rotatebackwards(kmom) # rotate out or rotated frame kmomboosted = self.__lorentzboost/kmomrotated # boost into the lab frame (original frame) hadron.Setmom(kmomboosted) ##print Decaytables.Findminandmaxpairmass(newstring_labframe)[1], "testing the condition for failure here" ##print newstring_labframe.Getstringmass(), "stringmass in the new labframe" ##print Decaytables.Stringdecaysmallesthadron(newstring_labframe), "result of the decaytables testing shit, searching for error" ##print newstring_labframe.Getstringcontent(), "stringcontent" #if n > 3: #sys.exit() ''' Check validity of the decay (cons of energy) ''' if qnew_minus + k_minus >= quark1vector4D[0] + antiquark1vector4D[0]: #print qnew_minus #print k_minus #print quark1vector4D[0] #print antiquark1vector4D[0] #print "CONDITION 1 FAILED" continue if quark2.Checkquark() is True and antiquark2.Checkquark() is True: meson = Decaytables.GetFailsafe1hadron(newstring_labframe) #print meson, "STRINGDECAY ERROR MESSAGE. THIS IS WHAT TRYING TO GET MASS OF" #mass = Decaytables.Getmass(meson) if meson == 0: continue mass = Decaytables.Getmass(meson) if newstring_labframe.Getstringmass() <= mass: #print "CONDITION 2 FAILED" continue break if Decaytables.GetFailsafe1hadron(newstring_labframe) == 0: # if no possible stringcollapse avaiable, try and produce something with less mom frac #print "CONDITION 3 FAILED" continue # previous findminandmaxpairmass(string)[0] else: break kaoncheck = self.Checkforkaons(hadronproducedID) hadron.SetID(kaoncheck) #print "STRING SUCCESSFULLY DECAYED" return [newstring_labframe, hadron] # returns the new string and a hadron, both boosted into the lab frame
mom1 = Fourvector.vector4D(numpy.sqrt(41),3.,4.,4.) mom2 = Fourvector.vector4D(numpy.sqrt(45),2.,4.,5.) mom3 = Fourvector.vector4D(numpy.sqrt(101),9,4.,2.) mom4 = Fourvector.vector4D(6,2,4.,4.) mom5 = Fourvector.vector4D(6,-2.,-4.,-4.) ''' momenta for 91.2 GeV ''' mom10 = Fourvector.vector4D(91.2/2,35.,20.,numpy.sqrt(454.36)) mom11 = Fourvector.vector4D(91.2/2,-35.,-20.,-numpy.sqrt(454.36)) ''' Create some quarks ''' dquark = Particle.particle4D(1,mom10) uquark = Particle.particle4D(2,mom10) squark = Particle.particle4D(3,mom10) cquark = Particle.particle4D(4,mom10) bquark = Particle.particle4D(5,mom10) tquark = Particle.particle4D(6,mom10) ''' Create some antiquarks ''' antidquark = Particle.particle4D(-1,mom11) antiuquark = Particle.particle4D(-2,mom11) antisquark = Particle.particle4D(-3,mom11) anticquark = Particle.particle4D(-4,mom11) antibquark = Particle.particle4D(-5,mom11) antitquark = Particle.particle4D(-6,mom11)
def Getmh(left,dec_g,right,z,splitflavour): # return False if conditions not met. Otherwise return normal vector output. Decaytables = Decaydictionary.Decays() gvec4Dx = dec_g.Getvector4D() gvec4D = copy.deepcopy(gvec4Dx) sgl_flavour = copy.deepcopy(splitflavour) if right.Checkgluon() == True: # particle on the right is a gluon. only have to consider the left hand side particle. #print "right particle is gluon, check that part" # Need the information of the quark / antiquark on the left. leftvector4D = left.Getvector4D() #print leftvector4D, "left vector" if left.Checkdiquark() == False: # left is a quark. Have to assign according to that idea if left.GetID() > 0: # if the left is the quark. need antiflavour if splitflavour > 10: # i.e. were producing a diquark sgl_flavour = copy.deepcopy(splitflavour) # we want the positive again. # UNLESS THE FLAVOUR CREATED IS A DIQUARK if splitflavour < 10: # i.e. we not producing a diquark sgl_flavour *= -1 # we want the negative quark on the left of the gluon split if left.GetID() < 0: # we have an anti quark on the left somehow??. Perhaps we've already had some diquark produciton :/ if splitflavour > 10: sgl_flavour = copy.deepcopy(splitflavour) * -1 if splitflavour < 10: sgl_flavour = copy.deepcopy(splitflavour) if left.Checkdiquark() == True: if left.GetID() < 0: # negative diquark sgl_flavour = copy.deepcopy(splitflavour) * -1 if left.GetID() > 0: # positive diquark #print "we haev a positive diquark" #print left.GetID(), "left ID" sys.exit() sgl_flavour = copy.deepcopy(splitflavour) sgl_vec4D = copy.deepcopy(gvec4D) #print sgl_vec4D.Getvector()[0], "Energy of the gluon" sgl_vec4D *= z #print "scaled vector", sgl_vec4D # get the scaled momentum. sgl = Particle.particle4D(sgl_flavour, sgl_vec4D) # Create a temp string to test for FS1 hadron. I.e. if there is a small hadron that can be made. #print left.GetID(), "left ID" #print left.Getvector(), "left vector" #print sgl_flavour, "sgl flavour" #print sgl.Getvector(), "sgl vector" string = MRS.mrs4D(left,sgl) #print string.Getstringmass(), "string mass of the left,sgl pair" fs1hadron = Decaytables.GetFailsafe1hadron(string) #print fs1hadron, "fs1hadron in the right split code" if fs1hadron == 0: return False # condition failed. cant produce a hadron. fs1mass = PDG_ID.PDG_Type.mass(PDG_ID.PDG_Type(fs1hadron)) #print fs1mass totalmom = sgl_vec4D + leftvector4D if totalmom*totalmom < (fs1mass*fs1mass): # Condition that the resultant qqbar pair is heavy enough to at least form a hadron. return False # Condition failed. Need to reloop again for different z. # Provided above conditions are satisfied, return the particles in correct sides based on nature of the left quark. # create the other particle sgr_flavour = copy.deepcopy(sgl_flavour) * -1 sgr_vec4D = copy.deepcopy(gvec4D) sgr_vec4D *= (1-z) ''' Create a new proxy particle to form a string with the right hand side to check cons stuff ''' copyright = copy.deepcopy(right) newrightflavour = 1 if abs(sgr_flavour) > 10: # we have a diquark if sgr_flavour > 0: # positive diquark newrightflavour = 1 if sgr_flavour < 0: newrightflavour = -1 if abs(sgr_flavour) < 10: # we ahve a regular quarks if sgr_flavour > 0: # positive quark newrightflavour = -1 if sgr_flavour < 0: newrightflavour = 1 copyright.SetID(newrightflavour) #print copyright.Getvector(), "vector of the right hand side particle" #print sgr_vec4D, "vector of the right hand side gluon after split. They must be collinear or smthing" sgr = Particle.particle4D(sgr_flavour,sgr_vec4D) string2 = MRS.mrs4D(sgr,copyright) #print string2.Getstringmass(), "stringmass of the second pseudo string" fs1hadron2 = Decaytables.GetFailsafe1hadron(string2) if fs1hadron2 == 0: return False # new conditional if abs(splitflavour) > 10: # we have a diquark produced rightvec4D = right.Getvector4D() sgr4D = sgr.Getvector4D() inv = rightvec4D + sgr4D invmass = numpy.sqrt(inv * inv) if invmass < 2.5: # invariant mass is less than two for the decaying gluon and the right hand side particle. then veto diquark production return False # Flavours already flipped from the above condition. Should always be correct relative to the left and eachother. return [sgl,sgr] if right.Checkgluon() == False: # so the right side is a quark. need to account for both sides having sufficient mass to form hadrons. #print "right particle is a quark, see that algorithm" if left.Checkdiquark() == False: #print "left is not diquark" #print splitflavour, "splitflavour in this party" if left.GetID() > 0: # if the left is the quark. need antiflavour if splitflavour > 10: # i.e. were producing a diquark sgl_flavour = copy.deepcopy(splitflavour) # we want the positive again. # UNLESS THE FLAVOUR CREATED IS A DIQUARK if splitflavour < 10: # i.e. we not producing a diquark sgl_flavour *= -1 # we want the negative quark on the left of the gluon split if left.GetID() < 0: # we have an anti quark on the left somehow??. Perhaps we've already had some diquark produciton :/ #print "left ID is less than zero" if splitflavour > 10: "we've reached the left neg, g diquark part" sgl_flavour = copy.deepcopy(splitflavour) * -1 #print left.GetID() #print sgl_flavour, "flavour of sgl" if splitflavour < 10: sgl_flavour = copy.deepcopy(splitflavour) if left.Checkdiquark() == True: if left.GetID() < 0: # negative diquark sgl_flavour = copy.deepcopy(splitflavour) * -1 if left.GetID() > 0: # positive diquark sgl_flavour = copy.deepcopy(splitflavour) sgl_vec4D = copy.deepcopy(gvec4D) print sgl_vec4D, "sgl vec4D" print sgl_vec4D * sgl_vec4D sgl_vec4D *= z sgr_vec4D = copy.deepcopy(gvec4D) print sgr_vec4D, "sgrvec4D" sgr_vec4D *= (1-z) sgr_flavour = copy.deepcopy(sgl_flavour) * -1 # sgr is the anti of the sgl #print right.GetID(), "right ID" #print left.GetID(), "left ID" #print sgr_flavour, "sgrflavour" #print sgl_flavour, "sglflavour" sgl = Particle.particle4D(sgl_flavour,sgl_vec4D) sgr = Particle.particle4D(sgr_flavour,sgr_vec4D) string1 = MRS.mrs4D(left,sgl) #print string1.Getstringcontent(), "stringcontent of string 1 in gluon splitting rigt hand is quark" string2 = MRS.mrs4D(sgr,right) #print string2.Getstringcontent(), "stringcontent of string 2 in gs right hand is quark" #print string1.Getstringmass(), string2.Getstringmass(), "string masses of 1,2 respectuively" fs1hadron1 = Decaytables.GetFailsafe1hadron(string1) #print fs1hadron1 if fs1hadron1 == 0: return False fs1hadron2 = Decaytables.GetFailsafe1hadron(string2) #print fs1hadron2 if fs1hadron2 == 0: return False return [sgl,sgr]