In [1]:
import ROOT
from ROOT import gROOT, TCanvas, TF1, TFile, TTree, gRandom, TH1F, TLegend, SetOwnership
import rootnotes
import rootprint
gROOT.Reset()
#Change the style of the plot from the default with grey background to a cleaner white background
ROOT.gROOT.SetStyle('Plain')
#This will make TLegend background color plain as well
ROOT.gStyle.SetFillColor(0)
In [2]:
%%rootprint
f = TFile("Pt.ESD.1.root")
myList = f.Get("chistpt");
#myList.Print()
In [3]:
fHistEtaPhiCC = []
fHistEtaPhiTC = []
clist = []
for i in range(100):
fHistEtaPhiCC.append(myList.FindObject("fHistEtaPhiCC%d"%i))
fHistEtaPhiCC[i].SetMarkerStyle(20)
fHistEtaPhiTC.append(myList.FindObject("fHistEtaPhiTC%d"%i))
fHistEtaPhiTC[i].SetMarkerStyle(24)
if fHistEtaPhiCC[i].GetEntries() > 0 and fHistEtaPhiTC[i].GetEntries() > 0:
clist.append(rootnotes.default_canvas("Clusters in Event %d"%i, (400, 400)))
ROOT.gStyle.SetOptStat(0)
clist[-1].cd(1)
fHistEtaPhiCC[i].Draw()
fHistEtaPhiTC[i].Draw("same")
xl1=0.7; yl1=0.85; xl2=xl1+0.3; yl2=yl1+0.125;
leg = TLegend(xl1,yl1,xl2,yl2)
leg.AddEntry(fHistEtaPhiCC[i],"CaloClusters","p")
leg.AddEntry(fHistEtaPhiTC[i],"TOFClusters","p")
leg.Draw()
SetOwnership( leg, 0 ) # 0 = release (not keep), 1 = keep
for i in range(len(clist)):
clist[i]
In [4]:
clist[0]
Out[4]:
In [5]:
clist[1]
Out[5]:
In [6]:
clist[2]
Out[6]:
In [7]:
clist[3]
Out[7]:
In [8]:
clist[4]
Out[8]:
In [9]:
clist[5]
Out[9]:
In [10]:
clist[6]
Out[10]:
In [11]:
clist[7]
Out[11]:
In [2]:
import numpy as np
def eta_to_theta(eta):
theta = 2.*np.arctan(np.exp(-eta))
theta *= 180./np.pi
return theta
theta = eta_to_theta(0.7)
In [25]:
mp = 938.
pp = 300.
Ep = np.sqrt(pp**2+mp**2)
gmp = Ep/mp
up = pp/(mp*gmp)
Kp = (gmp-1)*mp
print "Mass: \t\t%.1f MeV/c^2"%mp
print "Momentum: \t%.1f MeV/c"%pp
print "Energy: \t%.1f MeV"%Ep
print "Gamma: \t\t%.2f"%gmp
print "KE: \t\t%.2f MeV"%Kp
print "Beta: \t\t%.2f"%up
In [17]:
me = 0.511
pe = 100.
Ee = np.sqrt(pe**2+me**2)
gme = Ee/me
ue = pe/(me*gme)
Ke = (gme-1)*me
pe1 = 1000.
Ee1 = np.sqrt(pe1**2+me**2)
gme1 = Ee1/me
ue1 = pe1/(me*gme1)
Ke1 = (gme1-1)*me
print "Mass: \t\t%.1f MeV/c^2"%me
print "Momentum: \t%.1f MeV/c"%pe
print "Energy: \t%.1f MeV"%Ee
print "Gamma: \t\t%.2f"%gme
print "KE: \t\t%.2f MeV"%Ke
print "Beta: \t\t%.8f"%ue
print ""
print "Mass: \t\t%.1f MeV/c^2"%me
print "Momentum: \t%.1f MeV/c"%pe1
print "Energy: \t%.1f MeV"%Ee1
print "Gamma: \t\t%.2f"%gme1
print "KE: \t\t%.2f MeV"%Ke1
print "Beta: \t\t%.8f"%ue1
In [8]:
mk = 497.
pk = 100.
Ek = np.sqrt(pk**2+mk**2)
gmk = Ek/mk
uk = pk/(mk*gmk)
Kk = (gmk-1)*mk
print "Mass: \t\t%.1f MeV/c^2"%mk
print "Momentum: \t%.1f MeV/c"%pk
print "Energy: \t%.1f MeV"%Ek
print "Gamma: \t\t%.2f"%gmk
print "KE: \t\t%.2f MeV"%Kk
print "Beta: \t\t%.8f"%uk
In [23]:
mpi = 139.
ppi = 100.
Epi = np.sqrt(ppi**2+mpi**2)
gmpi = Epi/mpi
upi = ppi/(mpi*gmpi)
Kpi = (gmpi-1)*mpi
print "Mass: \t\t%.1f MeV/c^2"%mpi
print "Momentum: \t%.1f MeV/c"%ppi
print "Energy: \t%.1f MeV"%Epi
print "Gamma: \t\t%.2f"%gmpi
print "KE: \t\t%.2f MeV"%Kpi
print "Beta: \t\t%.8f"%upi
In [10]:
mu = 106.
pu = 100.
Eu = np.sqrt(pu**2+mu**2)
gmu = Eu/mu
uu = pu/(mu*gmu)
Ku = (gmu-1)*mu
print "Mass: \t\t%.1f MeV/c^2"%mu
print "Momentum: \t%.1f MeV/c"%pu
print "Energy: \t%.1f MeV"%Eu
print "Gamma: \t\t%.2f"%gmu
print "KE: \t\t%.2f MeV"%Ku
print "Beta: \t\t%.8f"%uu
In [28]:
#100 MeV/c proton has u = 0.1c
#distance traveled
mindist = 3.60 #meters to TOF
mindist = 4.30 #meters to EMCAL
maxdist = mindist/np.sin(eta_to_theta(0.7)*np.pi/180.)
print mindist,maxdist
print
print "Proton (p=%.1f MeV/c) minTOF: %.2f"%(pp,mindist/(up*3.e8)*1e9),"ns"
print "Proton (p=%.1f MeV/c) maxTOF: %.2f"%(pp,maxdist/(up*3.e8)*1e9),"ns"
print
print "Gamma minTOF: %.2f"%((mindist/3.e8)*1e9),"ns"
print "Gamma maxTOF: %.2f"%((maxdist/3.e8)*1e9),"ns"
print
print "Electron (p=%.1f MeV/c) minTOF: %.5f"%(pe1,mindist/(ue1*3.e8)*1e9),"ns"
print "Electron (p=%.1f MeV/c) maxTOF: %.5f"%(pe1,maxdist/(ue1*3.e8)*1e9),"ns"
print
print "Electron (p=%.1f MeV/c) minTOF: %.5f"%(pe,mindist/(ue*3.e8)*1e9),"ns"
print "Electron (p=%.1f MeV/c) maxTOF: %.5f"%(pe,maxdist/(ue*3.e8)*1e9),"ns"
print
print "Kaon (p=%.1f MeV/c) minTOF: %.2f"%(pk,mindist/(uk*3.e8)*1e9),"ns"
print "Kaon (p=%.1f MeV/c) maxTOF: %.2f"%(pk,maxdist/(uk*3.e8)*1e9),"ns"
print
print "Pion (p=%.1f MeV/c) minTOF: %.2f"%(ppi,mindist/(upi*3.e8)*1e9),"ns"
print "Pion (p=%.1f MeV/c) maxTOF: %.2f"%(ppi,maxdist/(upi*3.e8)*1e9),"ns"
print
print "Muon (p=%.1f MeV/c) minTOF: %.2f"%(pu,mindist/(uu*3.e8)*1e9),"ns"
print "Muon (p=%.1f MeV/c) maxTOF: %.2f"%(pu,maxdist/(uu*3.e8)*1e9),"ns"
In [ ]: