def costheta_CS(pt1, eta1, phi1, pt2, eta2, phi2, l1id):
    mu1 = TLorentzVector()
    mu2 = TLorentzVector()
    Q = TLorentzVector()

    if (l1id < 0):
        mu1.SetPtEtaPhiM(pt1, eta1, phi1, 0)
        mu2.SetPtEtaPhiM(pt2, eta2, phi2, 0)
    else:
        mu1.SetPtEtaPhiM(pt2, eta2, phi2, 0)
        mu2.SetPtEtaPhiM(pt1, eta1, phi1, 0)

    Q = mu1 + mu2

    mu1plus = ((2.0)**(-0.5)) * (mu1.E() + mu1.Pz())
    mu1minus = ((2.0)**(-0.5)) * (mu1.E() - mu1.Pz())

    mu2plus = ((2.0)**(-0.5)) * (mu2.E() + mu2.Pz())
    mu2minus = ((2.0)**(-0.5)) * (mu2.E() - mu2.Pz())

    costheta = ((2.0 / Q.Mag()) /
                ((Q.Mag()**2.0 + Q.Pt()**2.0)**(0.5))) * (mu1plus * mu2minus -
                                                          mu1minus * mu2plus)

    return costheta
def M_miss_pm(Energy,parts,p_nu_z,PTmiss_vect):
	p_nu_x,p_nu_y=PTmiss_vect
	p_nu_T = sqrt(p_nu_x**2+p_nu_y**2)
	E_nu = sqrt(p_nu_T**2 + p_nu_z**2)
	neutr=TLorentzVector(p_nu_x,p_nu_y,p_nu_z,E_nu)
	p=TLorentzVector(0,0,0,Energy)	# px,py,pz,E
	for part in parts:
		p=p-part.P4()
	p=p-neutr
	return p.Mag()
        elif tokenValue == 8:
            # piPlus meson
            pip[npip].SetPxPyPzE(float(token[2]), float(token[3]),
                                 float(token[4]), float(token[5]))
            npip += 1
        elif tokenValue == 9:
            # piMinus meson
            pim.SetPxPyPzE(float(token[2]), float(token[3]), float(token[4]),
                           float(token[5]))

        # Now process the event
        if nEvents > 1 and tokenValue == 4:  # we have the full event

            # Calculate invariant mass of neutron
            neutron = beam + target - (pip[0] + pip[1] + pim)
            neutronMass += [neutron.Mag()]

            # Calculate invariant mass [n pi+ pi+ pi-]
            massn3pi = (neutron + pip[0] + pip[1] + pim).Mag()
            hn3pi.Fill(massn3pi)

            # Calculate invariant mass [ pi+ pi+ pi- ]
            mass3pi = (pip[0] + pip[1] + pim).Mag()
            h3pi.Fill(mass3pi)

            # Calculate invariant mass [ pi+1 pi- ]
            masspip1pim = (pip[0] + pim).Mag()
            hpip1pim.Fill(masspip1pim)

            # Calculate invariant mass [ pi+2 pi- ]
            masspip2pim = (pip[1] + pim).Mag()
Exemple #4
0
                            float(word[5]))
        elif value == 8:
            # piPlus meson
            PiPlus[nPiPlus].SetPxPyPzE(float(word[2]), float(word[3]),
                                       float(word[4]), float(word[5]))
            nPiPlus += 1
        elif value == 9:
            # piMinus meson
            PiMinus.SetPxPyPzE(float(word[2]), float(word[3]), float(word[4]),
                               float(word[5]))

        if value == 8 and nPiPlus == 2:
            Neutron = Beam + Target - (PiPlus[0] + PiPlus[1] + PiMinus
                                       )  #missing neutron vector
            n, pip1, pip2, pim = Neutron.Mag(), PiPlus[0].Mag(), PiPlus[1].Mag(
            ), PiMinus.Mag()
            im1, im2, im3, im4, im5, im6, im7, im8 = n + pip1 + pip2 + pim, pip1 + pip2 + pim, pip1 + pim, pip2 + pim, pip1 + pip2, n + pip1, n + pip2, n + pim
            IMspectra.Fill(im1, im2, im3, im4, im5, im6, im7,
                           im8)  #filling Ntuple

rootFile.Write()  #saving the Ntuple in a root file

IMCanvas = TCanvas("cc", "Invariant mass spectra", 10, 10, 1000,
                   700)  #creating a 2x4 canvas
IMCanvas.Divide(2, 4)

IMCanvas.cd(1)  #Navigation and filling of Canvas
IMspectra.Draw("npip1pip2pim")
IMCanvas.cd(2)
IMspectra.Draw("pip1pip2pim")
IMCanvas.cd(3)
Exemple #5
0
from __future__ import division, print_function
from ROOT import TLorentzVector

# Create the energy-momentum vector for a photon with energy 5 GeV
photon = TLorentzVector(0, 0, 5.0, 5.0)

# Create the 4-vector for a proton at rest
proton = TLorentzVector(0, 0, 0, 0.938)

# Create vectors for two pi+ pions and one pi- pion
pip1, pip2, pim = TLorentzVector(), TLorentzVector(), TLorentzVector()

# Set the vector components for the pions
pip1.SetPxPyPzE(-0.226178, -0.198456, 1.946048, 1.974144)
pip2.SetPxPyPzE(0.554803, -0.301158, 1.301439, 1.453219)
pim.SetPxPyPzE(-0.07765, 0.072333, 1.372624, 1.38382)

# Print the magnitudes of each 4-vector
print("The magnitude of the photon 4-vector is", photon.Mag())
print("The magnitude of the proton 4-vector is", proton.Mag())
print("The magnitude of the pip1 4-vector is", pip1.Mag())
print("The magnitude of the pip2 4-vector is", pip2.Mag())
print("The magnitude of the pim 4-vector is", pim.Mag())

# Create a new 4-vector by adding/subtracting the others
diff = photon + proton - (pip1 + pip2 + pim)

diffMass = diff.Mag()
print("The invariant mass of the missing particle is", diffMass)