Exemple #1
0
    tracks_z = events['Tracks.fCoordinates.fZ'][ievt]
    tracks_E = np.sqrt(tracks_x**2 + tracks_y**2 + tracks_z**2 + 0.13957**2)
    tracks = uproot_methods.TLorentzVectorArray.from_cartesian(
        ak.to_awkward0(tracks_x), ak.to_awkward0(tracks_y),
        ak.to_awkward0(tracks_z), ak.to_awkward0(tracks_E))

    tracks_fromPV0 = events['Tracks_fromPV0'][ievt]
    tracks_matchedToPFCandidate = events['Tracks_matchedToPFCandidate'][ievt]
    tracks = tracks[(tracks.pt > 1.) & (abs(tracks.eta) < 2.5) &
                    (ak.to_awkward0(tracks_fromPV0) >= 2) &
                    (ak.to_awkward0(tracks_matchedToPFCandidate) > 0)]

    # Cluster AK15 jets
    jetsAK15 = suepsUtilities.makeJets(tracks, 1.5)
    if len(jetsAK15) > 0:
        isrJet = suepsUtilities.isrTagger(jetsAK15)
        # Boost everything to scalar's rest frame
        tracks_boosted = tracks.boost(-isrJet.p3 / isrJet.energy)
    else:
        tracks_boosted = tracks

    tracks_boosted_minus1 = suepsUtilities.removeMaxE(tracks_boosted, N=5)
    tracks_boosted_minus2 = suepsUtilities.removeMaxE(tracks_boosted, N=10)
    tracks_boosted_minus3 = suepsUtilities.removeMaxE(tracks_boosted, N=20)
    tracks_boosted_minus4 = suepsUtilities.removeMaxE(tracks_boosted, N=40)
    tracks_boosted_minus5 = suepsUtilities.removeMaxE(tracks_boosted, N=80)

    if not (tracks_boosted.size == 0):
        s = eventShapesUtilities.sphericityTensor(tracks_boosted)
        if np.isfinite(s).all():
            evtShape[ievt] = eventShapesUtilities.sphericity(s)
Exemple #2
0
IsrParticles = GenParticles[GenParticles_ParentId != 999998]

hist1 = bh.Histogram(bh.axis.Regular(100, 0, 1))
hist2 = bh.Histogram(bh.axis.Regular(100, 0, 1))

for ievt in range(GenParticles_Status.size):
    # Gen particles
    fromScalarParticles = FromScalarParticles[ievt]
    isrParticles = IsrParticles[ievt]

    # Tracks in the event
    tracks = Tracks[ievt]

    # Cluster AK15 jets and find ISR jet
    jetsAK15 = suepsUtilities.makeJets(tracks, 1.5)
    suepJet = suepsUtilities.isrTagger(jetsAK15)
    isrJet = suepsUtilities.isrTagger(jetsAK15, multiplicity='low')

    # Boost event
    fromScalarParticles_bst = fromScalarParticles.boost(-suepJet.p3 /
                                                        suepJet.energy)
    isrParticles_bst = isrParticles.boost(-suepJet.p3 / suepJet.energy)
    isrJet_bst = isrJet.boost(-suepJet.p3 / suepJet.energy)

    # Cluster gen AK2 jets
    genJetsAK2_fromScalar = suepsUtilities.makeJets(fromScalarParticles,
                                                    0.2,
                                                    mode='new')
    genJetsAK2_ISR = suepsUtilities.makeJets(isrParticles, 0.2, mode='new')
    genJetsAK2_fromScalar_bst = suepsUtilities.makeJets(
        fromScalarParticles_bst, 0.2, mode='new')
Exemple #3
0
def signalRun(mMed, hist1, hist2):
    # Get the file and import using uproot
    base = '/Users/chrispap/'
    datasets = [
        base +
        'PrivateSamples.SUEP_2018_mMed-%d_mDark-2_temp-2_decay-darkPhoHad_13TeV-pythia8_n-100_0_RA2AnalysisTree.root'
        % (mMed),
    ]

    rootfile = datasets[0]
    fin = uproot.open(rootfile)

    # Attach the branches to numpy arrays
    tree = fin['TreeMaker2/PreSelection']

    def get_branch(branchname):
        return tree[branchname].array()

    GenParticles_pt = get_branch('GenParticles.fCoordinates.fPt')
    GenParticles_eta = get_branch('GenParticles.fCoordinates.fEta')
    GenParticles_phi = get_branch('GenParticles.fCoordinates.fPhi')
    GenParticles_E = get_branch('GenParticles.fCoordinates.fE')
    GenParticles_ParentId = get_branch(b'GenParticles_ParentId')
    GenParticles_PdgId = get_branch(b'GenParticles_PdgId')
    GenParticles_Status = get_branch(b'GenParticles_Status')
    HT = get_branch(b'HT')

    Tracks_x = get_branch('Tracks.fCoordinates.fX')
    Tracks_y = get_branch('Tracks.fCoordinates.fY')
    Tracks_z = get_branch('Tracks.fCoordinates.fZ')
    Tracks_fromPV0 = get_branch('Tracks_fromPV0')
    Tracks_matchedToPFCandidate = get_branch('Tracks_matchedToPFCandidate')

    GenParticles_pt = GenParticles_pt[HT > 1200]
    GenParticles_eta = GenParticles_eta[HT > 1200]
    GenParticles_phi = GenParticles_phi[HT > 1200]
    GenParticles_E = GenParticles_E[HT > 1200]
    GenParticles_ParentId = GenParticles_ParentId[HT > 1200]
    GenParticles_PdgId = GenParticles_PdgId[HT > 1200]
    GenParticles_Status = GenParticles_Status[HT > 1200]
    Tracks_x = Tracks_x[HT > 1200]
    Tracks_y = Tracks_y[HT > 1200]
    Tracks_z = Tracks_z[HT > 1200]
    Tracks_fromPV0 = Tracks_fromPV0[HT > 1200]
    Tracks_matchedToPFCandidate = Tracks_matchedToPFCandidate[HT > 1200]

    Tracks_E = np.sqrt(Tracks_x**2 + Tracks_y**2 + Tracks_z**2 + 0.13957**2)
    Tracks = uproot_methods.TLorentzVectorArray.from_cartesian(
        Tracks_x, Tracks_y, Tracks_z, Tracks_E)
    # Select good tracks
    Tracks = Tracks[(Tracks.pt > 1.) & (abs(Tracks.eta) < 2.5) &
                    (Tracks_fromPV0 >= 2) & (Tracks_matchedToPFCandidate > 0)]

    GenParticles = uproot_methods.TLorentzVectorArray.from_ptetaphie(
        GenParticles_pt, GenParticles_eta, GenParticles_phi, GenParticles_E)
    # Keep only final particles
    GenParticles_ParentId = GenParticles_ParentId[
        (GenParticles_Status == 1) & (GenParticles.pt > 1) &
        (abs(GenParticles.eta) < 2.5)]
    GenParticles = GenParticles[(GenParticles_Status == 1)
                                & (GenParticles.pt > 1) &
                                (abs(GenParticles.eta) < 2.5)]
    FromScalarParticles = GenParticles[GenParticles_ParentId == 999998]
    IsrParticles = GenParticles[GenParticles_ParentId != 999998]

    for ievt in range(GenParticles_Status.size):
        # Gen particles
        fromScalarParticles = FromScalarParticles[ievt]
        isrParticles = IsrParticles[ievt]

        # Tracks in the event
        tracks = Tracks[ievt]

        # Cluster AK15 jets and find ISR jet
        jetsAK15 = suepsUtilities.makeJets(tracks, 1.5)
        suepJet = suepsUtilities.isrTagger(jetsAK15)
        isrJet = suepsUtilities.isrTagger(jetsAK15, multiplicity='low')

        # Boost event
        fromScalarParticles_bst = fromScalarParticles.boost(-suepJet.p3 /
                                                            suepJet.energy)
        isrParticles_bst = isrParticles.boost(-suepJet.p3 / suepJet.energy)
        isrJet_bst = isrJet.boost(-suepJet.p3 / suepJet.energy)

        dphi_fromScalar_bst = fromScalarParticles_bst.phi - isrJet_bst[0].phi
        dphi_ISR_bst = isrParticles_bst.phi - isrJet_bst[0].phi
        dphi_fromScalar_bst[dphi_fromScalar_bst > math.pi] -= 2 * math.pi
        dphi_fromScalar_bst[dphi_fromScalar_bst < -math.pi] += 2 * math.pi
        dphi_ISR_bst[dphi_ISR_bst > math.pi] -= 2 * math.pi
        dphi_ISR_bst[dphi_ISR_bst < -math.pi] += 2 * math.pi

        hist1.fill(abs(dphi_fromScalar_bst))
        hist2.fill(abs(dphi_ISR_bst))
    genParticles_pt = GenParticles_pt[ievt]
    genParticles_phi = GenParticles_phi[ievt]
    genParticles_eta = GenParticles_eta[ievt]
    genParticles_E = GenParticles_E[ievt]
    genParticles = uproot_methods.TLorentzVectorArray.from_ptetaphie(
        genParticles_pt, genParticles_eta, genParticles_phi, genParticles_E)
    genParticles_ParentId = GenParticles_ParentId[ievt]
    genParticles_PdgId = GenParticles_PdgId[ievt]
    genParticles_Status = GenParticles_Status[ievt]

    # Tracks in the event
    tracks = Tracks[ievt]

    # Cluster AK15 jets and find ISR jet
    jetsAK15 = suepsUtilities.makeJets(tracks, 1.5)
    isrJet = suepsUtilities.isrTagger(jetsAK15, multiplicity='low')
    suepsJet = suepsUtilities.isrTagger(jetsAK15, multiplicity='high')
    isrJetPt[ievt] = isrJet.pt
    jetRatio[ievt] = isrJet.pt / suepsJet.pt

    # The last copy of the scalar mediator
    #scalarParticle = genParticles[(genParticles_PdgId == 25) & (genParticles_Status == 62)]

    # Define mask arrays to select the desired particles
    #finalParticles = (genParticles_Status == 1) & (genParticles.pt > 1) & (abs(genParticles.eta) < 3)
    #finalParticles_minusISR = finalParticles &
    #(suepsUtilities.deltar(genParticles.eta, genParticles.phi, isrJet.eta, isrJet.phi) > 1.5)
    #genParticles = genParticles[finalParticles]

    # Boost everything to scalar's rest frame
    #genParticles_boosted1 = genParticles.boost(-scalarParticle.p3/scalarParticle.energy)