Logo ROOT   6.10/00
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Namespaces
zdemo.py File Reference

Namespaces

 zdemo
 

Detailed Description

This macro is an example of graphs in log scales with annotations.

The presented results are predictions of invariant cross-section of Direct Photons produced at RHIC energies, based on the universality of scaling function H(z).

These Figures were published in JINR preprint E2-98-64, Dubna, 1998 and submitted to CPC.

pict1_zdemo.py.png
1 
2 import ROOT
3 from array import array
4 
5 NMAX = 20
6 Z = array( 'f', [0.]*NMAX )
7 HZ = array( 'f', [0.]*NMAX )
8 PT = array( 'f', [0.]*NMAX )
9 INVSIG = array( 'f', [0.]*NMAX )
10 
11 NLOOP = 0
12 saves = {}
13 
14 #_______________________________________________________________________________
15 def hz_calc( ENERG, DENS, TGRAD, PTMIN, PTMAX, DELP ):
16  from math import sin, cos, sqrt
17  global NLOOP
18  global Z, HZ, PT, INVSIG
19 
20  CSEFT= 1.
21  GM1 = 0.00001
22  GM2 = 0.00001
23  A1 = 1.
24  A2 = 1.
25  ALX = 2.
26  BETA = 1.
27  KF1 = 8.E-7
28  KF2 = 5.215
29 
30  MN = 0.9383
31  DEGRAD=0.01745329
32 
33  # print 'ENR= %f DENS= %f PTMIN= %f PTMAX= %f DELP= %f ' % (ENERG,DENS,PTMIN,PTMAX,DELP)
34 
35  DNDETA= DENS
36  MB1 = MN*A1
37  MB2 = MN*A2
38  EB1 = ENERG/2.*A1
39  EB2 = ENERG/2.*A2
40  M1 = GM1
41  M2 = GM2
42  THET = TGRAD*DEGRAD
43  NLOOP = int((PTMAX-PTMIN)/DELP)
44 
45  for I in range(NLOOP):
46  PT[I]=PTMIN+I*DELP
47  PTOT = PT[I]/sin(THET)
48 
49  ETOT = sqrt(M1*M1 + PTOT*PTOT)
50  PB1 = sqrt(EB1*EB1 - MB1*MB1)
51  PB2 = sqrt(EB2*EB2 - MB2*MB2)
52  P2P3 = EB2*ETOT+PB2*PTOT*cos(THET)
53  P1P2 = EB2*EB1+PB2*PB1
54  P1P3 = EB1*ETOT-PB1*PTOT*cos(THET)
55 
56  X1 = P2P3/P1P2
57  X2 = P1P3/P1P2
58  Y1 = X1+sqrt(X1*X2*(1.-X1)/(1.-X2))
59  Y2 = X2+sqrt(X1*X2*(1.-X2)/(1.-X1))
60 
61  S = (MB1*MB1)+2.*P1P2+(MB2*MB2)
62  SMIN = 4.*((MB1*MB1)*(X1*X1) +2.*X1*X2*P1P2+(MB2*MB2)*(X2*X2))
63  SX1 = 4.*( 2*(MB1*MB1)*X1+2*X2*P1P2)
64  SX2 = 4.*( 2*(MB2*MB2)*X2+2*X1*P1P2)
65  SX1X2= 4.*(2*P1P2)
66  DELM = pow((1.-Y1)*(1.-Y2),ALX)
67 
68  Z[I] = sqrt(SMIN)/DELM/pow(DNDETA,BETA)
69 
70  Y1X1 = 1. +X2*(1-2.*X1)/(2.*(Y1-X1)*(1.-X2))
71  Y1X2 = X1*(1-X1)/(2.*(Y1-X1)*(1.-X2)*(1.-X2))
72  Y2X1 = X2*(1-X2)/(2.*(Y2-X2)*(1.-X1)*(1.-X1))
73  Y2X2 = 1. +X1*(1-2.*X2)/(2.*(Y2-X2)*(1.-X1))
74  Y2X1X2= Y2X1*( (1.-2.*X2)/(X2*(1-X2)) -( Y2X2-1.)/(Y2-X2))
75  Y1X1X2= Y1X2*( (1.-2.*X1)/(X1*(1-X1)) -( Y1X1-1.)/(Y1-X1))
76 
77  KX1=-DELM*(Y1X1*ALX/(1.-Y1) + Y2X1*ALX/(1.-Y2))
78  KX2=-DELM*(Y2X2*ALX/(1.-Y2) + Y1X2*ALX/(1.-Y1))
79  ZX1=Z[I]*(SX1/(2.*SMIN)-KX1/DELM)
80  ZX2=Z[I]*(SX2/(2.*SMIN)-KX2/DELM)
81 
82  H1=ZX1*ZX2
83 
84  HZ[I]=KF1/pow(Z[I],KF2)
85  INVSIG[I]=(HZ[I]*H1*16.)/S
86 
87 
88 #_______________________________________________________________________________
89 def zdemo():
90  from array import array
91  global NLOOP
92  global Z, HZ, PT, INVSIG
93  global saves
94  global hz_calc
95 
96  # Create a new canvas.
97  c1 = ROOT.TCanvas( 'zdemo', 'Monte Carlo Study of Z scaling', 10, 40, 800, 600 )
98  c1.Range( 0, 0, 25, 18 )
99  c1.SetFillColor( 40 )
100  saves[ 'c1' ] = c1 # prevent deteletion at end of zdemo
101 
102  pl = ROOT.TPaveLabel( 1, 16.3, 24, 17.5,
103  'Z-scaling of Direct Photon Productions in pp Collisions at RHIC Energies', 'br' )
104  pl.SetFillColor(18)
105  pl.SetTextFont(32)
106  pl.SetTextColor(49)
107  pl.Draw()
108  saves[ 'pl' ] = pl
109 
110  t = ROOT.TLatex()
111  t.SetTextFont(32)
112  t.SetTextColor(1)
113  t.SetTextSize(0.03)
114  t.SetTextAlign(12)
115  t.DrawLatex( 3.1, 15.5, 'M.Tokarev, E.Potrebenikova ')
116  t.DrawLatex( 14., 15.5, 'JINR preprint E2-98-64, Dubna, 1998 ')
117  saves[ 't' ] = t
118 
119  pad1 = ROOT.TPad( 'pad1', 'This is pad1', 0.02, 0.02, 0.48, 0.83, 33 )
120  pad2 = ROOT.TPad( 'pad2', 'This is pad2', 0.52, 0.02, 0.98, 0.83, 33 )
121 
122  pad1.Draw()
123  pad2.Draw()
124 
125  saves[ 'pad1' ] = pad1; saves[ 'pad2' ] = pad2
126 
127  #
128  # Cross-section of direct photon production in pp collisions at 500 GeV vs Pt
129  #
130  energ = 63
131  dens = 1.766
132  tgrad = 90.
133  ptmin = 4.
134  ptmax = 24.
135  delp = 2.
136  hz_calc( energ, dens, tgrad, ptmin, ptmax, delp )
137  pad1.cd()
138  pad1.Range( -0.255174, -19.25, 2.29657, -6.75 )
139  pad1.SetLogx()
140  pad1.SetLogy()
141 
142  # create a 2-d histogram to define the range
143  pad1.DrawFrame( 1, 1e-18, 110, 1e-8 )
144  pad1.GetFrame().SetFillColor( 19 )
145  t = ROOT.TLatex()
146  t.SetNDC()
147  t.SetTextFont( 62 )
148  t.SetTextColor( 36 )
149  t.SetTextSize( 0.08 )
150  t.SetTextAlign( 12 )
151  t.DrawLatex( 0.6, 0.85, 'p - p' )
152 
153  t.SetTextSize( 0.05 )
154  t.DrawLatex( 0.6, 0.79, 'Direct #gamma' )
155  t.DrawLatex( 0.6, 0.75, '#theta = 90^{o}' )
156 
157  t.DrawLatex( 0.20, 0.45, 'Ed^{3}#sigma/dq^{3}' )
158  t.DrawLatex( 0.18, 0.40, '(barn/Gev^{2})' )
159 
160  t.SetTextSize( 0.045 )
161  t.SetTextColor( ROOT.kBlue )
162  t.DrawLatex( 0.22, 0.260, '#sqrt{s} = 63(GeV)' )
163  t.SetTextColor( ROOT.kRed )
164  t.DrawLatex( 0.22, 0.205,'#sqrt{s} = 200(GeV)' )
165  t.SetTextColor( 6 )
166  t.DrawLatex( 0.22, 0.15, '#sqrt{s} = 500(GeV)' )
167 
168  t.SetTextSize( 0.05 )
169  t.SetTextColor( 1 )
170  t.DrawLatex( 0.6, 0.06, 'q_{T} (Gev/c)' )
171  saves[ 't2' ] = t # note the label that is used!
172 
173  gr1 = ROOT.TGraph( NLOOP, PT, INVSIG )
174 
175  gr1.SetLineColor( 38 )
176  gr1.SetMarkerColor( ROOT.kBlue )
177  gr1.SetMarkerStyle( 21 )
178  gr1.SetMarkerSize( 1.1 )
179  gr1.Draw( 'LP' )
180  saves[ 'gr1' ] = gr1
181 
182  #
183  # Cross-section of direct photon production in pp collisions at 200 GeV vs Pt
184  #
185 
186  energ = 200
187  dens = 2.25
188  tgrad = 90.
189  ptmin = 4.
190  ptmax = 64.
191  delp = 6.
192  hz_calc( energ, dens, tgrad, ptmin, ptmax, delp )
193 
194  gr2 = ROOT.TGraph( NLOOP, PT, INVSIG )
195  gr2.SetLineColor( 38 )
196  gr2.SetMarkerColor( ROOT.kRed )
197  gr2.SetMarkerStyle( 29 )
198  gr2.SetMarkerSize( 1.5 )
199  gr2.Draw( 'LP' )
200  saves[ 'gr2' ] = gr2
201 
202  #
203  # Cross-section of direct photon production in pp collisions at 500 GeV vs Pt
204  #
205  energ = 500
206  dens = 2.73
207  tgrad = 90.
208  ptmin = 4.
209  ptmax = 104.
210  delp = 10.
211  hz_calc( energ, dens, tgrad, ptmin, ptmax, delp )
212 
213  gr3 = ROOT.TGraph( NLOOP, PT, INVSIG )
214 
215  gr3.SetLineColor( 38 )
216  gr3.SetMarkerColor( 6 )
217  gr3.SetMarkerStyle( 8 )
218  gr3.SetMarkerSize( 1.1 )
219  gr3.Draw( 'LP' )
220  saves[ 'gr3' ] = gr3
221 
222  dum = array( 'f', [0.] )
223  graph = ROOT.TGraph( 1, dum, dum )
224  graph.SetMarkerColor( ROOT.kBlue )
225  graph.SetMarkerStyle( 21 )
226  graph.SetMarkerSize( 1.1 )
227  graph.SetPoint( 0, 1.7, 1.e-16 )
228  graph.Draw( 'LP' )
229  saves[ 'graph' ] = graph
230 
231  graph = ROOT.TGraph( 1, dum, dum )
232  graph.SetMarkerColor( ROOT.kRed )
233  graph.SetMarkerStyle( 29 )
234  graph.SetMarkerSize( 1.5 )
235  graph.SetPoint( 0, 1.7, 2.e-17 )
236  graph.Draw( 'LP' )
237  saves[ 'graph2' ] = graph # note the label that is used!
238 
239  graph = ROOT.TGraph( 1, dum, dum )
240  graph.SetMarkerColor( 6 )
241  graph.SetMarkerStyle( 8 )
242  graph.SetMarkerSize( 1.1 )
243  graph.SetPoint( 0, 1.7, 4.e-18)
244  graph.Draw( 'LP' )
245  saves[ 'graph3' ] = graph # note the label that is used!
246 
247  pad2.cd()
248  pad2.Range( -0.43642, -23.75, 3.92778, -6.25 )
249  pad2.SetLogx()
250  pad2.SetLogy()
251 
252  pad2.DrawFrame( 1, 1e-22, 3100, 1e-8 )
253  pad2.GetFrame().SetFillColor( 19 )
254 
255  gr = ROOT.TGraph( NLOOP, Z, HZ )
256  gr.SetTitle( 'HZ vs Z' )
257  gr.SetFillColor( 19 )
258  gr.SetLineColor( 9 )
259  gr.SetMarkerColor( 50 )
260  gr.SetMarkerStyle( 29 )
261  gr.SetMarkerSize( 1.5 )
262  gr.Draw( 'LP' )
263  saves[ 'gr' ] = gr
264 
265  t = ROOT.TLatex()
266  t.SetNDC()
267  t.SetTextFont( 62 )
268  t.SetTextColor( 36 )
269  t.SetTextSize( 0.08 )
270  t.SetTextAlign( 12 )
271  t.DrawLatex( 0.6, 0.85, 'p - p' )
272 
273  t.SetTextSize( 0.05 )
274  t.DrawLatex( 0.6, 0.79, 'Direct #gamma' )
275  t.DrawLatex( 0.6, 0.75, '#theta = 90^{o}' )
276 
277  t.DrawLatex( 0.70, 0.55, 'H(z)' )
278  t.DrawLatex( 0.68, 0.50, '(barn)' )
279 
280  t.SetTextSize( 0.045 )
281  t.SetTextColor( 46 )
282  t.DrawLatex( 0.20, 0.30, '#sqrt{s}, GeV' )
283  t.DrawLatex( 0.22, 0.26, '63' )
284  t.DrawLatex( 0.22, 0.22, '200' )
285  t.DrawLatex( 0.22, 0.18, '500' )
286 
287  t.SetTextSize( 0.05 )
288  t.SetTextColor( 1 )
289  t.DrawLatex( 0.88, 0.06, 'z' )
290  saves[ 't3' ] = t # note the label that is used!
291 
292  c1.Modified()
293  c1.Update()
294 
295 
296 if __name__ == '__main__': # run if loaded as script
297  zdemo()
Authors
Michael Tokarev, Elena Potrebenikova (JINR Dubna)

Definition in file zdemo.py.