]
                lepbits.append(tree.mupibit[ilep])
                lepbits.append(tree.mukbit[ilep])
                lepbits.append(tree.mupbit[ilep])
                lepbits.append(tree.muebit[ilep])
                lepbits.append(tree.mumubit[ilep])

            #print("hi")
            #print(proton)
            #print(lepton)

            # Make sure the charges are not the same
            if proton[4] == lepton[4]:
                continue

            pp = vec_mag(proton[1:4])
            lp = vec_mag(lepton[1:4])

            bc = proton[0:-1] + lepton[0:-1]
            bc_mass = invmass([bc])

            dE = bc[0] - beam[0] / 2.0
            bc[0] = beam[0] / 2.0
            mes = invmass([bc])

            pidx = proton[-1]
            lidx = lepton[-1]

            # Should the low cut be 2.2 or 2.3?
            cut1 = pp > 2.3 and pp < 2.8 and lp > 2.3 and lp < 2.8
            cut2 = dE > -0.5
        e = tree.TRKenergyCM[j]
        p3 = tree.TRKp3CM[j]
        phi = tree.TRKphiCM[j]
        costh = tree.TRKcosthCM[j]
        px, py, pz = sph2cart(p3, costh, phi)
        lund = tree.TRKLund[j]
        q = int(lund / np.abs(lund))

        mylund = particle_lunds[max_pid]

        new_energy = recalc_energy(particle_masses[max_pid], [px, py, pz])
        #print(lund,mylund,e, new_energy)
        particle = [new_energy, px, py, pz, q, mylund]
        myparticles.append(particle)
        scalarmomsum[0] += vec_mag(particle[1:4])

        if p3 > 1.7:
            n_high_p += 1
            nhighmom[0] += 1
            highmomE += new_energy
            #print(particle)

        if mylund == 211:
            pie[npi[0]] = new_energy
            pipx[npi[0]] = px
            pipy[npi[0]] = py
            pipz[npi[0]] = pz
            piq[npi[0]] = q
            pipibit[npi[0]] = pibit
            pikbit[npi[0]] = Kbit
Esempio n. 3
0
        q = int(lund / np.abs(lund))

        new_energy = recalc_energy(particle_masses[max_particle], [px, py, pz])
        particle = [new_energy, px, py, pz, q, particle_lunds[max_particle]]
        myparticles.append(particle)

        if lund == 211:
            pie[npi[0]] = e
            pipx[npi[0]] = px
            pipy[npi[0]] = py
            pipz[npi[0]] = pz
            piq[npi[0]] = q

            npi[0] += 1

        pmag = vec_mag(particle[1:4])
        if particle[-1] == 11 and pmag > 2.25 and pmag < 2.8:
            leptons.append(np.array(particle + [j]))
        elif particle[-1] == 2212 and pmag > 2.25 and pmag < 2.8:
            protons.append(np.array(particle + [j]))
    #exit()

    ############################################################################
    # Print out the photons
    ############################################################################
    nphotons = tree.ngamma
    output += "%d\n" % (nphotons)
    for j in range(nphotons):
        #e = tree.gammaenergy[j]
        #p3 = tree.gammap3[j]
        #phi = tree.gammaphi[j]
    highmomE = 0
    n_high_p = 0
    ntrks[0] = 0

    # Pions
    for j in range(npi[0]):

        ntrks[0] += 1

        e = tree.pie[j]
        px,py,pz = tree.pipx[j], tree.pipy[j], tree.pipz[j]
        q = tree.piq[j]

        particle = [e,px,py,pz,q,j,211]
        myparticles.append(particle)
        p3 = vec_mag(particle[1:4])
        costh = particle[3]/p3
        scalarmomsum[0] += p3

        if p3>2.0:
            n_high_p += 1
            nhighmom[0] += 1
            highmomE += e

    # Kaons
    for j in range(nk[0]):

        ntrks[0] += 1

        e = tree.ke[j]
        px,py,pz = tree.kpx[j], tree.kpy[j], tree.kpz[j]