source: Idarraga/sims_plots/plotsliverpool.py

Last change on this file was 242, checked in by idarraga, 13 years ago
File size: 12.0 KB
Line 
1import os
2import sys
3from ROOT import *
4from array import *
5from readfileSIMS import *
6from readfileLPNHE import *
7from readfileSpreading import *
8
9__PLOT_X = 0
10__PLOT_Y = 1
11__PLOT_TITLE = 2
12__PLOT_INDX = 3
13
14if len(sys.argv) < 2:
15    print("use : %s inputFilename"%sys.argv[0])
16    sys.exit()
17
18# retreive all the filenames
19filenames=[]
20filenameslpnhe=[]
21filenamesspread=[]
22simsActive=False
23lpnheActive=False
24spreadingActive=False
25
26for filesItr in range(1, len(sys.argv)):
27
28    if sys.argv[filesItr] != "-sims" and sys.argv[filesItr] != "-lpnhe" and sys.argv[filesItr] != "-spread":
29        if simsActive : filenames.append(sys.argv[filesItr])
30        if lpnheActive : filenameslpnhe.append(sys.argv[filesItr])
31        if spreadingActive : filenamesspread.append(sys.argv[filesItr])
32   
33    if sys.argv[filesItr] == "-sims":
34        simsActive = True
35        lpnheActive = False
36        spreadingActive = False
37       
38    if sys.argv[filesItr] == "-lpnhe":
39        simsActive = False
40        lpnheActive = True
41        spreadingActive = False
42       
43    if sys.argv[filesItr] == "-spread":
44        simsActive = False
45        lpnheActive = False
46        spreadingActive = True
47
48# read and append data
49x = []
50y = []
51histoTitle = []
52indx = 0
53for filename in filenames:
54    allinfo = readfileSIMS(filename, indx)
55    # next read
56    indx = indx + allinfo[__PLOT_INDX] + int(1)
57    x = x + allinfo[__PLOT_X]
58    y = y + allinfo[__PLOT_Y]
59    # append plots from several files
60    histoTitle = histoTitle + allinfo[__PLOT_TITLE]
61
62# LPNHE files
63for filename in filenameslpnhe:
64   
65    allinfo = readfileLPNHE(filename, 1, indx)
66    # next read
67    indx = indx + allinfo[__PLOT_INDX] #+ int(1)
68    x = x + allinfo[__PLOT_X]
69    y = y + allinfo[__PLOT_Y]
70    # append plots from several files
71    histoTitle = histoTitle + allinfo[__PLOT_TITLE]
72
73# Spreading files
74for filename in filenamesspread:
75    allinfo = readfileSpreading(filename, 1, indx)
76    # next read
77    indx = indx + allinfo[__PLOT_INDX] #+ int(1)
78    x = x + allinfo[__PLOT_X]
79    y = y + allinfo[__PLOT_Y]
80    # append plots from several files
81    histoTitle = histoTitle + allinfo[__PLOT_TITLE]
82
83##############################################################
84# README
85# x,y,histoTitle are lists of lists
86# have to deal with indexes.  Ex: x[0][itr]
87
88##############################################################
89# Draw !!!
90gROOT.ProcessLine(".x ~/styles/AtlasStyle.C")
91c1 = TCanvas()
92c1.SetLogy()
93leg = TLegend(0.5, 0.5, 0.9, 0.9)
94leg.SetBorderSize(1)
95leg.SetFillColor(kWhite)
96leg.SetTextSize(0.05)
97##############################################################
98g = { }
99legendMap = { }
100colors = { }
101minY = 1E14
102maxY = 1E20
103
104specPlot = -1
105
106# python -i plotsliverpool.py -sims nplus_ninn/C1LA2HSN.DP_ nplus_ninn/C1LA8NIN.DP_ nplus_ninn/C1LA9NIN.DP_ nplus_ninn/A1LA7NIN.DP_ -spread spreading_data/spreading_nplus_ninn_02-42.txt spreading_data/nplus_ninn_w08.txt -lpnhe nplus_ninn_LPNHE/B487n1.TXT nplus_ninn_LPNHE/B487n2.TXT
107indxsPlot = [ 1,12,4,7,10 ]
108mainTitle = "N+ implant n-in-n"
109legendMap[1] = "SIMS w02-42 PPS09"
110legendMap[4] = "SIMS w01 PPS10"
111legendMap[7] = "SIMS w03 PPS10"
112legendMap[10] = "SIMS w08 PPS10"
113legendMap[12] = "SIMS w487 PPS09"
114legendMap[13] = "SIMS w487 PPS09"
115specPlot = 0
116colors = { 1 : kRed , 4 : kBlack, 7 : kGreen, 10 : kBlue , 12 : kMagenta , 13 : kBlue }
117##############################################################
118
119# python -i plotsliverpool.py -sims nplus_ninn/C1LA2HSN.DP_ nplus_ninn/C1LA8NIN.DP_ nplus_ninn/C1LA9NIN.DP_ nplus_ninn/A1LA7NIN.DP_ -spread spreading_data/spreading_nplus_ninn_02-42.txt
120#indxsPlot = [ 12, 1, 10 ]
121#mainTitle = "N+ implant n-in-n"
122#legendMap[1] = "SIMS w02-42 PPS09"
123#legendMap[4] = "SIMS w01 PPS10"
124#legendMap[7] = "SIMS w03 PPS10"
125#legendMap[10] = "SIMS w08 PPS10"
126#legendMap[12] = "SPR w02-42 PPS09"
127#specPlot = 12
128#colors = { 1 : kRed , 4 : kBlack, 7 : kGreen, 10 : kBlue , 12 : kRed}
129
130# python -i plotsliverpool.py -sims high_pspray_ninn/D1LAL2HS.DP_ high_pspray_ninn/B1L7NINH.DP_ high_pspray_ninn/D1L8NINH.DP_ high_pspray_ninn/D1L9NINH.DP_ -spread spreading_data/spreading_hps_ninn_02-42.txt  spreading_data/high_pspray_ninn_w08.txt
131#indxsPlot = [ 1, 6, 11, 16, 20, 21 ]
132#mainTitle = "High p-spray n-in-n"
133#legendMap[1] = "SIMS w02-42 PPS09"
134#legendMap[6] = "SIMS w01 PPS10"
135#legendMap[11] = "SIMS w03 PPS10"
136#legendMap[16] = "SIMS w08 PPS10"
137#legendMap[20] = "SPR w02-42 PPS09"
138#legendMap[21] = "SPR w08 PPS10"
139#specPlot = 20
140#colors = { 1 : kRed , 6 : kBlack, 11 : kGreen, 16 : kBlue , 20 : kRed , 21 : kBlue }
141
142    # python -i plotsliverpool.py -sims high_pspray_ninn/D1LAL2HS.DP_ high_pspray_ninn/B1L7NINH.DP_ -spread spreading_data/spreading_hps_ninn_02-42.txt
143#indxsPlot = [ 1, 16, 20 ]
144#mainTitle = "High p-spray n-in-n"
145#legendMap[1] = "SIMS w02-42 PPS09"
146#legendMap[6] = "SIMS w01 PPS10"
147#legendMap[11] = "SIMS w03 PPS10"
148#legendMap[16] = "SIMS w08 PPS10"
149#legendMap[20] = "SPR w02-42 PPS09"
150#specPlot = 20
151#colors = { 1 : kRed , 6 : kBlack, 11 : kGreen, 16 : kBlue , 20 : kRed }
152
153# python -i plotsliverpool.py -sims lowpspray_ninn/D1LAL2LS.DP_ lowpspray_ninn/B1L7NINL.DP_ -spread spreading_data/spreading_lps_ninn_02-42.txt
154#indxsPlot = [ 1, 6, 10 ]
155#mainTitle = "Low p-spray n-in-n"
156#legendMap[1] = "SIMS w02-42 PPS09"
157#legendMap[6] = "SIMS w08 PPS10"
158#legendMap[10] = "SPR w02-42 PPS09"
159#specPlot = 10
160#colors = { 1 : kRed , 6 : kBlue, 10 : kRed }
161
162# python -i plotsliverpool.py -sims pplus_backside_ninn/C1LAL2BS.DP_ pplus_backside_ninn/D1L8NINB.DP_ pplus_backside_ninn/D1L9NINB.DP_ pplus_backside_ninn/D1L7NINB.DP_ -spread spreading_data/spreading_pplus_backside_ninn.txt spreading_data/pplus_backside_ninn_w08.txt
163#indxsPlot = [ 11, 6, 1, 16, 20, 21 ]
164#mainTitle = "P+ implant backside n-in-n"
165#legendMap[1] = "SIMS w02-42 PPS09"
166#legendMap[6] = "SIMS w01 PPS10"
167#legendMap[11] = "SIMS w03 PPS10"
168#legendMap[16] = "SIMS w08 PPS10"
169#legendMap[20] = "SPR w02-42 PPS09"
170#legendMap[21] = "SPR w08 PPS10"
171#specPlot = 20
172#colors = { 1 : kRed , 6 : kBlack, 11 : kGreen, 16 : kBlue , 20 : kRed , 21 : kBlue }
173
174# python -i plotsliverpool.py -sims pplus_backside_ninn/C1LAL2BS.DP_ pplus_backside_ninn/D1L8NINB.DP_ pplus_backside_ninn/D1L9NINB.DP_ pplus_backside_ninn/D1L7NINB.DP_ -spread spreading_data/spreading_pplus_backside_ninn.txt
175#indxsPlot = [ 16, 1, 20 ]
176#mainTitle = "P+ implant backside n-in-n"
177#legendMap[1] = "SIMS w02-42 PPS09"
178#legendMap[6] = "SIMS w01 PPS10"
179#legendMap[11] = "SIMS w03 PPS10"
180#legendMap[16] = "SIMS w08 PPS10"
181#legendMap[20] = "SPR w02-42 PPS09"
182#specPlot = 20
183#colors = { 1 : kRed , 6 : kBlack, 11 : kGreen, 16 : kBlue , 20 : kRed}
184
185# python -i plotsliverpool.py -sims nplus_ninp/C1LA3HSN.DP_ nplus_ninp/A2LA6NIP.DP_ -spread spreading_data/spreading_nplus_ninp_wafer4.txt
186#indxsPlot = [ 1, 4, 6 ]
187#mainTitle = "N+ implant n-in-p"
188#legendMap[1] = "SIMS w04 PPS09"
189#legendMap[4] = "SIMS w0X PPS10, no O2"
190#legendMap[6] = "SPR w04 PPS09"
191#specPlot = 6
192#colors = { 1 : kRed , 4 : kBlue, 6 : kRed }
193
194#python -i plotsliverpool.py -sims lowpspray_ninp/D1LAL3LS_quan.DP_ lowpspray_ninp/B1L6NIPL.DP_ -spread spreading_data/spreading_lowpspray_ninp_wafer4.txt
195#indxsPlot = [ 1, 6, 10 ]
196#mainTitle = "low p-spray n-in-p"
197#legendMap[1] = "SIMS w04 PPS09"
198#legendMap[6] = "SIMS w0X PPS10, no O2"
199#legendMap[10] = "SPR w04 PPS09"
200#specPlot = 10
201#colors = { 1 : kRed , 6 : kBlue , 10 : kRed }
202
203# python -i plotsliverpool.py -sims high_pspray_ninp/D3LAL3HS.DP_ high_pspray_ninp/B2L6NIPH.DP_ -spread spreading_data/spreading_hps_ninp_wafer4.txt spreading_data/high_pspray_ninp_w0x.txt
204#indxsPlot = [ 1, 6, 10, 11 ]
205#mainTitle = "high p-spray n-in-p"
206#legendMap[1] = "SIMS w04 PPS09"
207#legendMap[6] = "SIMS w0X PPS10"
208#legendMap[10] = "SPR w04 PPS09"
209#legendMap[11] = "SPR w0x PPS10"
210#specPlot = 10
211#colors = { 1 : kRed , 6 : kBlue , 10 : kRed , 11 : kBlue }
212
213#indxsPlot = [ 1, 6, 10 ]
214#mainTitle = "P+ implant backside n-in-p"
215#legendMap[1] = "SIMS w04 PPS09"
216#legendMap[6] = "SIMS w0X PPS10"
217#legendMap[10] = "SPR w04 PPS09"
218#specPlot = 10
219#colors = { 1 : kRed , 6 : kBlue , 10 : kRed }
220
221# python -i plotsliverpool.py -sims high_pspray_ninp_lpnhe/B1435HPS.DP_ -lpnhe lpnhe_data/B435nomod1.TXT
222#indxsPlot = [ 1, 5 ]
223#mainTitle = "high p-spray"
224#legendMap[1] = "SIMS n-in-p wafer 11 1^{st}run - medon"
225#legendMap[5] = "SIMS n-in-p wafer 11 1^{st}run - FBK"
226#colors = { 1 : kRed , 5 : kBlue }
227
228# python -i plotsliverpool.py -sims low_pspray_ninp_lpnhe/B1435LPS.DP_ -lpnhe lpnhe_data/B435spray1.TXT
229#indxsPlot = [ 1, 5 ]
230#mainTitle = "low p-spray"
231#legendMap[1] = "SIMS n-in-p wafer 11 1^{st}run - medon"
232#legendMap[5] = "SIMS n-in-p wafer 11 1^{st}run - FBK"
233#colors = { 1 : kRed , 5 : kBlue }
234
235print("Building plots and applying cuts if necessary ...")
236
237for i in indxsPlot:
238   
239    # erase selected values
240    #del(x[i][0])
241    #del(y[i][0])
242
243    x1T = array('f', x[i])
244    y1T = array('f', y[i])
245   
246    # shift in some values in lowpspray_ninn
247    x1C = []
248    y1C = []
249    copyF=False
250    cutValue = 0.
251   
252    if i == 6:
253        print("%d --> %d"%(i, len(x1T)))
254        for itr in range(0, len(x1T)):
255            #if x1T[itr] < 159 and x1T[itr] > 155:
256            #if x1T[itr] < 379.0 and x1T[itr] > 375.0:
257            if x1T[itr] < 189.0 and x1T[itr] > 184.0:
258                cutValue = x1T[itr]
259                print("cut value = %f"%cutValue)
260                copyF=True
261            if copyF == True:
262                x1C.append( x1T[itr] - cutValue )
263                y1C.append( y1T[itr] )
264    if i == 1:
265        print("%d --> %d"%(i, len(x1T)))
266        for itr in range(0, len(x1T)):
267            #if x1T[itr] < 117 and x1T[itr] > 114:
268            #if x1T[itr] < 388 and x1T[itr] > 385:
269            if x1T[itr] < 181.0 and x1T[itr] > 177.0:
270                cutValue = x1T[itr]
271                print("cut value = %f"%cutValue)
272                copyF=True
273            if copyF == True:
274                x1C.append( x1T[itr] - cutValue )
275                y1C.append( y1T[itr] )
276    if i == 10:
277        print("%d --> %d"%(i, len(x1T)))
278        for itr in range(0, len(x1T)):
279            x1C.append( x1T[itr] )
280            y1C.append( y1T[itr] )
281           
282    if i == 11:
283        print("%d --> %d"%(i, len(x1T)))
284        for itr in range(0, len(x1T)):
285            x1C.append( x1T[itr] )
286            y1C.append( y1T[itr] )
287           
288    x1 = array('f', x1C)
289    y1 = array('f', y1C)
290    #################################################
291   
292    x1 = array('f', x[i])
293    y1 = array('f', y[i])
294
295    g[i] = TGraph( len(x1), x1, y1 )
296    g[i].GetYaxis().SetRangeUser(minY, maxY)
297    g[i].SetMarkerStyle(6)
298    g[i].SetMarkerSize(2)
299   
300    g[i].GetXaxis().SetTitle("depth [nm]")
301    g[i].GetYaxis().SetTitle("concentration [Atom/cm^{3}]")
302    g[i].GetYaxis().SetTitleOffset(1.15);   
303
304
305# first build legend
306print("Done.  Building legend in the required order")
307for i in indxsPlot:
308    leg.AddEntry(g[i], legendMap[i], "L")
309
310# Now find the right order to plot to make the proper axis size
311maxIndx=-1
312maxXval=0.
313for i in indxsPlot:
314    vecX=g[i].GetX()
315    maxX = vecX[g[i].GetN()-1]
316    if maxX > maxXval:
317        maxXval = maxX
318        maxIndx = i
319print("Plot with the biggest range index [%d]"%maxIndx)
320
321# Reordering
322print("Requested order kept in the Legend : "%indxsPlot)
323for it in range(0, len(indxsPlot)):
324    if indxsPlot[it] == maxIndx:
325        saveFirst = indxsPlot[0]
326        indxsPlot[0] = maxIndx
327        indxsPlot[it] = saveFirst
328print("Reordering for axis purposes only : "%indxsPlot)
329
330# now finally really plot
331plotS = "APL"
332if specPlot > 0: plotS = "AL"
333
334print indxsPlot
335
336for i in indxsPlot:
337   
338    print("plotting %s --> index [%d]"%(legendMap[i], i))
339    g[i].SetMarkerStyle(6)
340    g[i].SetMarkerSize(2)
341    g[i].Draw(plotS)
342    g[i].SetMarkerColor(colors[i])
343    g[i].SetLineColor(colors[i])
344    if i >= specPlot: 
345        g[i].SetLineStyle(1)
346        g[i].SetLineWidth(2)
347
348    plotS = "PL"
349
350leg.Draw()
351
352t1 = TLatex()
353t1.SetTextSize(0.07)
354t1.DrawText(100, maxY*1.1, mainTitle)
355t1.SetTextSize(0.04)
356t1.DrawText(100, minY*1.5, "PPS LAL/LPNHE")
357
358# lines on top of the plot
359#t1 = TLine(158.26, 1E15, 158.26, 1E18)
360#t1.SetLineColor(1)
361#t2 = TLine(115.4466, 1E15, 115.4466, 1E18)
362#t2.SetLineColor(2)
363#t1.Draw()
364#t2.Draw()
365#[0] cut value = 158.261307
366#[1] cut value = 115.446602
367
368c1.Update()
Note: See TracBrowser for help on using the repository browser.