def calculateEventShapes(method, printOn=False, N=100): if method == 'uniformSphere': particles = particleGeneratorUniformSphere(N=N) elif method == 'uniformHemisphere': particles = particleGeneratorUniformHemisphere(N=N) elif method == 'uniformCylinder': particles = particleGeneratorUniformCylinder(N=N) elif method == 'oneBody': particles = particleGeneratorOneBody() elif method == 'twoBodyOpp': particles = particleGeneratorTwoBodyOpposite() elif method == 'twoBodyPerp': particles = particleGeneratorTwoBodyPerp() elif method == 'threeBody': particles = particleGeneratorThreeBody() elif method == 'sixBody': particles = particleGeneratorSixBody() else: print("Error: method '%s' not recognised" % method) return s = eventShapesUtilities.sphericityTensor(particles) sphericity = eventShapesUtilities.sphericity(s) aplanarity = eventShapesUtilities.aplanarity(s) C = eventShapesUtilities.C(s) D = eventShapesUtilities.D(s) circularity = eventShapesUtilities.circularity(particles) isotropy = eventShapesUtilities.isotropy(particles) if (printOn): print('The sphericity tensor is:') print(s) print('sphericity = %f\naplanarity = %f\nC = %f\nD = %f' '\ncircularity = %f\nisotropy = %f\n' % (sphericity, aplanarity, C, D, circularity, isotropy)) return np.array([sphericity, aplanarity, C, D, circularity, isotropy])
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) if not (tracks_boosted_minus1.size == 0): s1 = eventShapesUtilities.sphericityTensor(tracks_boosted_minus1) if np.isfinite(s1).all(): evtShape1[ievt] = eventShapesUtilities.sphericity(s1) if not (tracks_boosted_minus2.size == 0): s2 = eventShapesUtilities.sphericityTensor(tracks_boosted_minus2) if np.isfinite(s2).all(): evtShape2[ievt] = eventShapesUtilities.sphericity(s2) if not (tracks_boosted_minus3.size == 0): s3 = eventShapesUtilities.sphericityTensor(tracks_boosted_minus3)
jetsAK15 = makeJets(tracks, 1.5) isrJet = isrTagger(jetsAK15) # 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) genParticles = genParticles[finalParticles] # Boost everything to scalar's rest frame genParticles_boosted1 = genParticles.boost(-scalarParticle.p3/scalarParticle.energy) genParticles_boosted2 = genParticles.boost(-isrJet.p3/isrJet.energy) s0 = eventShapesUtilities.sphericityTensor(genParticles) s1 = eventShapesUtilities.sphericityTensor(genParticles_boosted1) s2 = eventShapesUtilities.sphericityTensor(genParticles_boosted2) sph0[ievt] = eventShapesUtilities.sphericity(s0) sph1[ievt] = eventShapesUtilities.sphericity(s1) sph2[ievt] = eventShapesUtilities.sphericity(s2) apl0[ievt] = eventShapesUtilities.aplanarity(s0) apl1[ievt] = eventShapesUtilities.aplanarity(s1) apl2[ievt] = eventShapesUtilities.aplanarity(s2) # Plot results fig = plt.figure(figsize=(8,8)) ax = plt.gca()
# Boost event tracks_bst = tracks.boost(-suepJet.p3/suepJet.energy) isrJet_bst = isrJet.boost(-suepJet.p3/suepJet.energy) # Find delta phi dphi_boosted = tracks_bst.phi-isrJet_bst[0].phi dphi_boosted[dphi_boosted > math.pi] -= 2*math.pi dphi_boosted[dphi_boosted < -math.pi] += 2*math.pi tracks_0p1 = tracks_bst[abs(dphi_boosted)>0.1] tracks_0p3 = tracks_bst[abs(dphi_boosted)>0.3] tracks_0p5 = tracks_bst[abs(dphi_boosted)>0.5] tracks_0p7 = tracks_bst[abs(dphi_boosted)>0.7] sphTensor_0p1 = eventShapesUtilities.sphericityTensor(tracks_0p1) sphTensor_0p3 = eventShapesUtilities.sphericityTensor(tracks_0p3) sphTensor_0p5 = eventShapesUtilities.sphericityTensor(tracks_0p5) sphTensor_0p7 = eventShapesUtilities.sphericityTensor(tracks_0p7) sph_0p1[ievt] = eventShapesUtilities.sphericity(sphTensor_0p1) sph_0p3[ievt] = eventShapesUtilities.sphericity(sphTensor_0p3) sph_0p5[ievt] = eventShapesUtilities.sphericity(sphTensor_0p5) sph_0p7[ievt] = eventShapesUtilities.sphericity(sphTensor_0p7) # Plot results fig = plt.figure(figsize=(8,8)) ax = plt.gca() #ax.plot(h_suep, 'r', label='from scalar') #ax.plot(h_isr, 'b', label='ISR')
beta_ak4_isr_v[ievt, 1] = beta_ak4_isr[0].y beta_ak4_isr_v[ievt, 2] = beta_ak4_isr[0].z tracks_bst = tracks.boost(-beta) isrJet_bst = isrJet.boost(-beta) # Calculate various subcases tracks_bst_highMult = tracks_highMult.boost(-beta) tracks_bst_leadPt = tracks_leadPt.boost(-beta) tracks_bst_leadPt_ak4_suep = tracks_leadPt.boost(-beta_ak4_suep) tracks_bst_leadPt_ak4_isr = tracks_leadPt.boost(-beta_ak4_isr) tracks_bst_noLowMult = tracks_noLowMult.boost(-beta) total_E = np.sum(tracks_bst.E) iBin = 0 for i in np.linspace(0.001, 0.002, 6): tracks_relE = tracks_bst[tracks_bst.E / total_E < i] sphTensor_relE = eventShapesUtilities.sphericityTensor(tracks_relE) sph_relE[ievt, iBin] = eventShapesUtilities.sphericity(sphTensor_relE) iBin += 1 # Find delta phi dPhi = tracks_bst.phi - isrJet_bst[0].phi dPhi[dPhi > math.pi] -= 2 * math.pi dPhi[dPhi < -math.pi] += 2 * math.pi iBin = 0 for i in np.linspace(1.5, 2.0, 6): tracks_bst_dPhi = tracks_bst[abs(dPhi) > i] sphTensor_dPhi = eventShapesUtilities.sphericityTensor(tracks_bst_dPhi) sph_dPhi[ievt, iBin] = eventShapesUtilities.sphericity(sphTensor_dPhi) iBin += 1 sphTensor_allTracks = eventShapesUtilities.sphericityTensor(tracks_bst)
dphi_boosted = genParticles_bst.phi-isrJet_bst[0].phi dphi_boosted[dphi_boosted > math.pi] -= 2*math.pi dphi_boosted[dphi_boosted < -math.pi] += 2*math.pi genParticles_bb_0p1 = genParticles[abs(dphi_noBoost)>0.1] genParticles_bb_0p3 = genParticles[abs(dphi_noBoost)>0.3] genParticles_bb_0p5 = genParticles[abs(dphi_noBoost)>0.5] genParticles_bb_0p7 = genParticles[abs(dphi_noBoost)>0.7] genParticles_ab_0p1 = genParticles_bst[abs(dphi_boosted)>0.1] genParticles_ab_0p3 = genParticles_bst[abs(dphi_boosted)>0.3] genParticles_ab_0p5 = genParticles_bst[abs(dphi_boosted)>0.5] genParticles_ab_0p7 = genParticles_bst[abs(dphi_boosted)>0.7] sphTensor_noCut = eventShapesUtilities.sphericityTensor(genParticles_bst) sphTensor_bb_0p1 = eventShapesUtilities.sphericityTensor(genParticles_bb_0p1.boost(-suepJet.p3/suepJet.energy)) sphTensor_bb_0p3 = eventShapesUtilities.sphericityTensor(genParticles_bb_0p3.boost(-suepJet.p3/suepJet.energy)) sphTensor_bb_0p5 = eventShapesUtilities.sphericityTensor(genParticles_bb_0p5.boost(-suepJet.p3/suepJet.energy)) sphTensor_bb_0p7 = eventShapesUtilities.sphericityTensor(genParticles_bb_0p7.boost(-suepJet.p3/suepJet.energy)) sphTensor_ab_0p1 = eventShapesUtilities.sphericityTensor(genParticles_ab_0p1) sphTensor_ab_0p3 = eventShapesUtilities.sphericityTensor(genParticles_ab_0p3) sphTensor_ab_0p5 = eventShapesUtilities.sphericityTensor(genParticles_ab_0p5) sphTensor_ab_0p7 = eventShapesUtilities.sphericityTensor(genParticles_ab_0p7) sphTensor_ideal = eventShapesUtilities.sphericityTensor(fromScalarParticles_bst) sph_noCut = eventShapesUtilities.sphericity(sphTensor_noCut) sph_bb_0p1 = eventShapesUtilities.sphericity(sphTensor_bb_0p1) sph_bb_0p3 = eventShapesUtilities.sphericity(sphTensor_bb_0p3) sph_bb_0p5 = eventShapesUtilities.sphericity(sphTensor_bb_0p5) sph_bb_0p7 = eventShapesUtilities.sphericity(sphTensor_bb_0p7)
isrJet_converted = uproot_methods.TLorentzVectorArray.from_cartesian( isrJet.x, isrJet.y, isrJet.z, isrJet.E) # Subtract ISR #tracks_minusISR = tracks[tracks.delta_r(isrJet) > 0.4] # Boost everything to scalar's rest frame tracks_boosted_minusISR = tracks.boost(-suepJet.p3 / suepJet.energy) isrJet_boosted = isrJet_converted.boost(-suepJet.p3 / suepJet.energy) tracks_boosted_minusISR_minus10 = suepsUtilities.removeMaxE( tracks_boosted_minusISR, N=10) tracks_boosted_minusISR_minusPhi = tracks_boosted_minusISR[ abs(tracks_boosted_minusISR.phi - isrJet_boosted.phi) > 1.0] s = eventShapesUtilities.sphericityTensor(tracks_boosted_minusISR) s1 = eventShapesUtilities.sphericityTensor(tracks_boosted_minusISR_minus10) s2 = eventShapesUtilities.sphericityTensor( tracks_boosted_minusISR_minusPhi) #s3 = eventShapesUtilities.sphericityTensor(tracks_boosted_minusISR_minus3) #s4 = eventShapesUtilities.sphericityTensor(tracks_boosted_minusISR_minus4) #s5 = eventShapesUtilities.sphericityTensor(tracks_boosted_minusISR_minus5) if variable == "sphericity": evtShape[ievt] = eventShapesUtilities.sphericity(s) evtShape1[ievt] = eventShapesUtilities.sphericity(s1) evtShape2[ievt] = eventShapesUtilities.sphericity(s2) #evtShape3[ievt] = eventShapesUtilities.sphericity(s3) #evtShape4[ievt] = eventShapesUtilities.sphericity(s4) #evtShape5[ievt] = eventShapesUtilities.sphericity(s5) elif variable == "aplanarity":