Skip to content

Commit

Permalink
ptspec: fix pT region for model and cocktail
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed May 19, 2014
1 parent 6d754d1 commit f5c8cf5
Showing 1 changed file with 32 additions and 24 deletions.
56 changes: 32 additions & 24 deletions pyana/examples/gp_ptspec.py
Expand Up @@ -31,7 +31,7 @@ def getSubplotTitle(mn, mr):

def gp_ptspec():
"""example for a 2D-panel plot (TODO)"""
fenergies = ['19', '27', '39', '62']#, '200']
fenergies = ['19', '27', '39', '62', '200']
nen = len(fenergies)
#mee_keys = ['pi0', 'LMR', 'omega', 'phi', 'IMR', 'jpsi']
mee_keys = ['LMR', ]
Expand All @@ -55,7 +55,7 @@ def gp_ptspec():
lmr_label = 'LMR: %g < M_{ee} < %g GeV/c^{2}' % (
mee_range_split[0], mee_range_split[1]
)
if energy == '200': continue
#if energy == '200': continue
if mee_name not in mee_keys: continue
mee_dict[mee_name] = mee_range
data[filebase] = np.loadtxt(open(file_url, 'rb'))
Expand All @@ -64,12 +64,15 @@ def gp_ptspec():
data[filebase] = data[filebase][:-1] # skip mT<0.4 point
if energy == '200': data[filebase][:,(1,3,4)] /= 0.5
# calculate average pT first
pTs = data[filebase][:,0]
probs = unp.uarray(data[filebase][:,1], data[filebase][:,3]) # dN/pT
mask = (data[filebase][:,0] > 0.4) & (data[filebase][:,0] < 2.)
avpt_data = data[filebase][mask]
pTs = avpt_data[:,0]
wghts = avpt_data[:,1]
probs = unp.uarray(avpt_data[:,1], avpt_data[:,3]) # dN/pT
probs /= umath.fsum(probs) # probabilities
avpt = umath.fsum(pTs*probs)
logging.info(('%s: {} %g' % (
filebase, np.average(pTs[:-1], weights = data[filebase][:-1,1])
filebase, np.average(pTs, weights = wghts)
)).format(avpt)) # TODO: syst. uncertainties
# save datapoint for average pT and append to yvalsPt for yaxis range
dp = [ float(getEnergy4Key(energy)), avpt.nominal_value, 0., avpt.std_dev, 0. ]
Expand Down Expand Up @@ -146,28 +149,30 @@ def gp_ptspec():
# arrow_bar = 0.002, layout = '3x2'
#)
#make plot for LMR spectra only
lmr_key = getSubplotTitle('LMR', '0.4-0.76') # 0.4 not for 200 GeV! skipping above!
lmr_key = getSubplotTitle('LMR', '0.4-0.76')
if energy == '200':
lmr_key = getSubplotTitle('LMR', '0.3-0.76')
pseudo_point = np.array([[-1,0,0,0,0]])
model_titles = ['cocktail + model', 'cocktail', 'in-medium', 'QGP']
model_props = [
'with lines lc %s lw 5 lt %d' % (default_colors[-2], i+1)
for i in xrange(len(model_titles))
]
make_plot(
data = dpt_dict[lmr_key][0] + [ pseudo_point ] * len(model_titles),
properties = dpt_dict[lmr_key][1] + model_props,
titles = dpt_dict[lmr_key][2] + model_titles,
name = os.path.join(outDir, 'ptspecLMR'),
ylabel = '1/N@_{mb}^{evt} d^{2}N@_{ee}^{acc.}/dp_{T}dM_{ee} (c^3/GeV^2)',
xlabel = 'dielectron transverse momentum, p_{T} (GeV/c)',
ylog = True, xr = [0, 2.0], yr = [1e-8, 100],
lmargin = 0.15, bmargin = 0.08, rmargin = 0.98, tmargin = 0.84,
key = ['maxrows 4', 'samplen 0.7', 'width -2', 'at graph 1.,1.2'],
arrow_bar = 0.005, size = '10in,13in',
labels = {
'stat. errors only': [0.7,0.95,False], lmr_label: [0.05,0.03,False]
}
)
#make_plot(
# data = dpt_dict[lmr_key][0] + [ pseudo_point ] * len(model_titles),
# properties = dpt_dict[lmr_key][1] + model_props,
# titles = dpt_dict[lmr_key][2] + model_titles,
# name = os.path.join(outDir, 'ptspecLMR'),
# ylabel = '1/N@_{mb}^{evt} d^{2}N@_{ee}^{acc.}/dp_{T}dM_{ee} (c^3/GeV^2)',
# xlabel = 'dielectron transverse momentum, p_{T} (GeV/c)',
# ylog = True, xr = [0, 2.0], yr = [1e-8, 100],
# lmargin = 0.15, bmargin = 0.08, rmargin = 0.98, tmargin = 0.84,
# key = ['maxrows 4', 'samplen 0.7', 'width -2', 'at graph 1.,1.2'],
# arrow_bar = 0.005, size = '10in,13in',
# labels = {
# 'stat. errors only': [0.7,0.95,False], lmr_label: [0.05,0.03,False]
# }
#)
# make mean pt plot
yMinPt, yMaxPt = 0.95*min(yvalsPt), 1.05*max(yvalsPt)
#make_plot(
Expand Down Expand Up @@ -202,16 +207,19 @@ def gp_ptspec():
# make mean pt plot for LMR only
make_plot(
data = [
np.array(data_avpt['LMR_c']),
#np.array(data_avpt['LMR_c']),
np.array(data_avpt['LMR_m']),
np.array(data_avpt['LMR'])
],
properties = [
#'with lines lt 2 lw 4 lc %s' % default_colors[0],
'with lines lt 1 lw 4 lc %s' % default_colors[0],
'with lines lt 2 lw 4 lc %s' % default_colors[0],
'lt 1 lw 4 ps 1.5 lc %s pt 18' % default_colors[0]
],
titles = [ 'cocktail', '+medium', getMeeLabel('data') ],
titles = [
#'cocktail',
'model', getMeeLabel('data')
],
name = os.path.join(outDir, 'meanPtLMR'),
xlabel = '{/Symbol \326}s_{NN} (GeV)',
ylabel = 'LMR {/Symbol \341}p_{T}{/Symbol \361} in STAR Acceptance (GeV/c)',
Expand Down

0 comments on commit f5c8cf5

Please sign in to comment.