Esempio n. 1
0
# Example of how to use the LHE Reader for an electron scattering example
from lhereader import readLHEF
from ROOT import TCanvas, TH1F, TH2F, TLorentzVector, TF1
import math

# Extract electrons:
data = []
data = readLHEF('FFop1_cuts/30deg_1.lhe')
electrons = data.getParticlesByIDs([11, -11])

# Make ROOT:
c = TCanvas()
c.Divide(2, 2)

hist_4in = TH1F("q^{2} in", "Incoming Electron q^{2} ", 100, 0, 0.00001)
hist_4out = TH1F("q^{2} out", "Outgoing Electron q^{2} ", 100, 0, 0.00001)

# Loop over Electrons:
for e in electrons:
    # Incoming Electron:
    if e.status is -1:
        squared_4mom = (-e.px * e.px - e.py * e.py - e.pz * e.pz +
                        e.energy * e.energy)
        hist_4in.Fill(squared_4mom)
    # Outgoing Electron:
    if e.status is 1:
        squared_4mom = (-e.px * e.px - e.py * e.py - e.pz * e.pz +
                        e.energy * e.energy)
        hist_4out.Fill(squared_4mom, (Factor))

c.cd()
Esempio n. 2
0
from lhereader import readLHEF
from ROOT import TCanvas, TH1F

#data=readLHEF('unweighted_events.lhe')
data = readLHEF('gammatogammaH.lhe')
parts = data.getParticlesByIDs([25])  # collect particles by hepid
c = TCanvas()
hist = TH1F("pt", "Pt of Higgs", 100, 0, 1000)
for p in parts:
    hist.Fill(p.pt)
hist.Draw()
c.SaveAs("pt_higgs.png")
Esempio n. 3
0
from lhereader import readLHEF
from ROOT import TCanvas, TH1F, TLegend
import CommonSetup1

c = TCanvas()
#c.SetLogy()
c.cd()
csetup = CommonSetup1.CommonSetup()
csetup.style()

data7 = readLHEF('../LHE/1500_01.lhe')
parts7 = data7.getParticlesByIDs([39])
print(len(parts7))
hist7 = TH1F("inv_mass", "inv_mass of Gr", 100, 0, 6000)
_7 = [hist7.Fill(p.invariantMass) for p in parts7]
hist7.SetLineColor(625)
hist7.SetLineWidth(3)
hist7.SetXTitle("M_{HH} in GeV")
hist7.SetYTitle("Events")
hist7.Draw()

c.Update()
data6 = readLHEF('M1500.lhe')
parts6 = data6.getParticlesByIDs([39])
print(len(parts6))
hist6 = TH1F("inv_mass", "inv_mass of Gr", 100, 0, 6000)
_6 = [hist6.Fill(p.invariantMass) for p in parts6]
hist6.SetLineColor(413)
#hist6.SetLineStyle(2)
hist6.SetLineWidth(3)
hist6.SetXTitle("Inv_Mass_{Gr} in GeV")
Esempio n. 4
0
from lhereader import readLHEF
from ROOT import TCanvas, TH1F, TLegend
import CommonSetup1

c = TCanvas()
#c.SetLogy()
c.cd()
csetup = CommonSetup1.CommonSetup()
csetup.style()

data7 = readLHEF('cmsgrid_final.lhe')
parts7 = data7.getParticlesByIDs([35])
print(len(parts7))
hist7 = TH1F("inv_mass", "inv_mass of Gr", 100, 0, 200)
_7 = [hist7.Fill(p.invariantMass) for p in parts7]
hist7.SetLineColor(625)
hist7.SetLineWidth(3)
hist7.SetXTitle("M_{HH} in GeV")
hist7.SetYTitle("Events")
hist7.Draw()

c.Update()
"""data6=readLHEF('M1500.lhe')
parts6=data6.getParticlesByIDs([39])
print(len(parts6))
hist6=TH1F("inv_mass", "inv_mass of Gr",100,0,6000)
_6=[hist6.Fill(p.invariantMass) for p in parts6]
hist6.SetLineColor(413)
#hist6.SetLineStyle(2)
hist6.SetLineWidth(3)
hist6.SetXTitle("Inv_Mass_{Gr} in GeV");
Esempio n. 5
0
from lhereader import readLHEF
from ROOT import TCanvas, TH1F, TLegend
import CommonSetup1

c = TCanvas()
c.SetLogy()
c.cd()
csetup = CommonSetup1.CommonSetup()
csetup.style()

data1 = readLHEF('cmsgrid_final_MG261.lhe')
parts1 = data1.getParticlesByIDs([5, -5])
print(len(parts1))
hist1 = TH1F("pT", "p_{T} of b [GeV]", 10, 0, 500)
#_1=[hist1.Fill(p.pt) for p in parts1]
hist1.SetLineColor(633)
for p in parts1:
    #if(p.mother == [4,4]):
    hist1.Fill(p.pt)
hist1.SetLineWidth(4)
hist1.SetXTitle("p_{T} GeV")
hist1.SetYTitle("Events")
hist1.Draw()

c.Update()
data2 = readLHEF('cmsgrid_final_MG260.lhe')
parts2 = data2.getParticlesByIDs([5, -5])
print(len(parts2))
hist2 = TH1F("pT", "p_{T} of b [GeV]", 10, 0, 500)
#_2=[hist.Fill(p.pt) for p in parts2]
hist2.SetLineColor(600)
Esempio n. 6
0
from lhereader import readLHEF
from ROOT import TCanvas, TH1F, TFile
fileName = [
    'gammatogammaH.lhe', 'gammatogammaHminus.lhe', 'ZtogammaH.lhe',
    'ZtogammaHminus.lhe'
]
for i in range(0, 4):
    data = readLHEF('../JHUGenerator/' + fileName[i])
    output = fileName[i].replace("lhe", 'root')
    file = TFile(output, 'recreate')
    parts_higgs = data.getParticlesByIDs([25])  # collect particles by hepid
    parts_pho = data.getParticlesByIDs([22])  # collect particles by hepid

    higgs_pt = TH1F("h_pt", "Pt of Higgs", 100, 0, 1000)
    higgs_eta = TH1F("h_eta", "Eta of Higgs", 100, -5, 5)
    photon_pt = TH1F("ph_pt", "Pt of photon", 100, 0, 1000)
    photon_eta = TH1F("ph_eta", "Eta of photon", 100, -5, 5)
    i = 0
    for p in parts_higgs:
        higgs_pt.Fill(p.pt)
        higgs_eta.Fill(p.eta)
        i = i + 1
        if i % 10000 == 0:
            print "pt:", p.pt
    for p in parts_pho:
        photon_pt.Fill(p.pt)
        photon_eta.Fill(p.eta)
    file.Write()
    print(output + 'has been created.')
Esempio n. 7
0
from lhereader import readLHEF
from ROOT import TFile, TCanvas, TH1F, TLegend, TLatex, TLorentzVector

c = TCanvas()

data1 = readLHEF('../LHE/spin0/m300.lhe')
events1 = data1.events
data2 = readLHEF('../LHE/spin0/m600.lhe')
events2 = data2.events
data3 = readLHEF('../LHE/spin0/m900.lhe')
events3 = data3.events

hpt_h_300 = TH1F("pt_h_300", "M_{X}=300", 100, 0, 500)
hpt_h_600 = TH1F("pt_h_600", "M_{X}=600", 100, 0, 500)
hpt_h_1000 = TH1F("pt_h_1000", "M_{X}=900", 100, 0, 500)

for e in events1:
    higgs = e.getParticlesByIDs([25])
    for h in higgs:
        hpt_h_300.Fill(h.pt)

for e in events2:
    higgs = e.getParticlesByIDs([25])
    for h in higgs:
        hpt_h_600.Fill(h.pt)

for e in events3:
    higgs = e.getParticlesByIDs([25])
    for h in higgs:
        hpt_h_1000.Fill(h.pt)