@@ -31,7 +31,7 @@ def getSubplotTitle(mn, mr):
3131
3232def gp_ptspec ():
3333 """example for a 2D-panel plot (TODO)"""
34- fenergies = ['19' , '27' , '39' , '62' ] # , '200']
34+ fenergies = ['19' , '27' , '39' , '62' , '200' ]
3535 nen = len (fenergies )
3636 #mee_keys = ['pi0', 'LMR', 'omega', 'phi', 'IMR', 'jpsi']
3737 mee_keys = ['LMR' , ]
@@ -55,7 +55,7 @@ def gp_ptspec():
5555 lmr_label = 'LMR: %g < M_{ee} < %g GeV/c^{2}' % (
5656 mee_range_split [0 ], mee_range_split [1 ]
5757 )
58- if energy == '200' : continue
58+ # if energy == '200': continue
5959 if mee_name not in mee_keys : continue
6060 mee_dict [mee_name ] = mee_range
6161 data [filebase ] = np .loadtxt (open (file_url , 'rb' ))
@@ -64,12 +64,15 @@ def gp_ptspec():
6464 data [filebase ] = data [filebase ][:- 1 ] # skip mT<0.4 point
6565 if energy == '200' : data [filebase ][:,(1 ,3 ,4 )] /= 0.5
6666 # calculate average pT first
67- pTs = data [filebase ][:,0 ]
68- probs = unp .uarray (data [filebase ][:,1 ], data [filebase ][:,3 ]) # dN/pT
67+ mask = (data [filebase ][:,0 ] > 0.4 ) & (data [filebase ][:,0 ] < 2. )
68+ avpt_data = data [filebase ][mask ]
69+ pTs = avpt_data [:,0 ]
70+ wghts = avpt_data [:,1 ]
71+ probs = unp .uarray (avpt_data [:,1 ], avpt_data [:,3 ]) # dN/pT
6972 probs /= umath .fsum (probs ) # probabilities
7073 avpt = umath .fsum (pTs * probs )
7174 logging .info (('%s: {} %g' % (
72- filebase , np .average (pTs [: - 1 ] , weights = data [ filebase ][: - 1 , 1 ] )
75+ filebase , np .average (pTs , weights = wghts )
7376 )).format (avpt )) # TODO: syst. uncertainties
7477 # save datapoint for average pT and append to yvalsPt for yaxis range
7578 dp = [ float (getEnergy4Key (energy )), avpt .nominal_value , 0. , avpt .std_dev , 0. ]
@@ -146,28 +149,30 @@ def gp_ptspec():
146149 # arrow_bar = 0.002, layout = '3x2'
147150 #)
148151 #make plot for LMR spectra only
149- lmr_key = getSubplotTitle ('LMR' , '0.4-0.76' ) # 0.4 not for 200 GeV! skipping above!
152+ lmr_key = getSubplotTitle ('LMR' , '0.4-0.76' )
153+ if energy == '200' :
154+ lmr_key = getSubplotTitle ('LMR' , '0.3-0.76' )
150155 pseudo_point = np .array ([[- 1 ,0 ,0 ,0 ,0 ]])
151156 model_titles = ['cocktail + model' , 'cocktail' , 'in-medium' , 'QGP' ]
152157 model_props = [
153158 'with lines lc %s lw 5 lt %d' % (default_colors [- 2 ], i + 1 )
154159 for i in xrange (len (model_titles ))
155160 ]
156- make_plot (
157- data = dpt_dict [lmr_key ][0 ] + [ pseudo_point ] * len (model_titles ),
158- properties = dpt_dict [lmr_key ][1 ] + model_props ,
159- titles = dpt_dict [lmr_key ][2 ] + model_titles ,
160- name = os .path .join (outDir , 'ptspecLMR' ),
161- ylabel = '1/N@_{mb}^{evt} d^{2}N@_{ee}^{acc.}/dp_{T}dM_{ee} (c^3/GeV^2)' ,
162- xlabel = 'dielectron transverse momentum, p_{T} (GeV/c)' ,
163- ylog = True , xr = [0 , 2.0 ], yr = [1e-8 , 100 ],
164- lmargin = 0.15 , bmargin = 0.08 , rmargin = 0.98 , tmargin = 0.84 ,
165- key = ['maxrows 4' , 'samplen 0.7' , 'width -2' , 'at graph 1.,1.2' ],
166- arrow_bar = 0.005 , size = '10in,13in' ,
167- labels = {
168- 'stat. errors only' : [0.7 ,0.95 ,False ], lmr_label : [0.05 ,0.03 ,False ]
169- }
170- )
161+ # make_plot(
162+ # data = dpt_dict[lmr_key][0] + [ pseudo_point ] * len(model_titles),
163+ # properties = dpt_dict[lmr_key][1] + model_props,
164+ # titles = dpt_dict[lmr_key][2] + model_titles,
165+ # name = os.path.join(outDir, 'ptspecLMR'),
166+ # ylabel = '1/N@_{mb}^{evt} d^{2}N@_{ee}^{acc.}/dp_{T}dM_{ee} (c^3/GeV^2)',
167+ # xlabel = 'dielectron transverse momentum, p_{T} (GeV/c)',
168+ # ylog = True, xr = [0, 2.0], yr = [1e-8, 100],
169+ # lmargin = 0.15, bmargin = 0.08, rmargin = 0.98, tmargin = 0.84,
170+ # key = ['maxrows 4', 'samplen 0.7', 'width -2', 'at graph 1.,1.2'],
171+ # arrow_bar = 0.005, size = '10in,13in',
172+ # labels = {
173+ # 'stat. errors only': [0.7,0.95,False], lmr_label: [0.05,0.03,False]
174+ # }
175+ # )
171176 # make mean pt plot
172177 yMinPt , yMaxPt = 0.95 * min (yvalsPt ), 1.05 * max (yvalsPt )
173178 #make_plot(
@@ -202,16 +207,19 @@ def gp_ptspec():
202207 # make mean pt plot for LMR only
203208 make_plot (
204209 data = [
205- np .array (data_avpt ['LMR_c' ]),
210+ # np.array(data_avpt['LMR_c']),
206211 np .array (data_avpt ['LMR_m' ]),
207212 np .array (data_avpt ['LMR' ])
208213 ],
209214 properties = [
215+ #'with lines lt 2 lw 4 lc %s' % default_colors[0],
210216 'with lines lt 1 lw 4 lc %s' % default_colors [0 ],
211- 'with lines lt 2 lw 4 lc %s' % default_colors [0 ],
212217 'lt 1 lw 4 ps 1.5 lc %s pt 18' % default_colors [0 ]
213218 ],
214- titles = [ 'cocktail' , '+medium' , getMeeLabel ('data' ) ],
219+ titles = [
220+ #'cocktail',
221+ 'model' , getMeeLabel ('data' )
222+ ],
215223 name = os .path .join (outDir , 'meanPtLMR' ),
216224 xlabel = '{/Symbol \326 }s_{NN} (GeV)' ,
217225 ylabel = 'LMR {/Symbol \341 }p_{T}{/Symbol \361 } in STAR Acceptance (GeV/c)' ,
0 commit comments