source: sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_FrontDetectorPanelGraph.ipf @ 947

Last change on this file since 947 was 947, checked in by srkline, 8 years ago

Changes to VCALC files, moving detector information into sub-folders in anticipation of the possible folder structure that I will use for the actual data reduction. But purely speculative at this point.

Fixing some typos in other procedures.

File size: 11.6 KB
Line 
1#pragma rtGlobals=1             // Use modern global access method.
2
3
4
5
6/////////////
7// different views of the detector positions - based on John's drawings and the geometry
8//
9//
10// These are the side and top views with the "rays" traced out to show
11// where the detector views overlap
12//
13// TODO: make sure that all of the values are from global constants, not hard-wired values
14//
15//
16//
17
18
19// generate the waves needed for drawing the views
20// draw a blank graph
21Function SetupSideView()
22
23        SetDataFolder root:Packages:NIST:VSANS:VCALC
24
25        Make/O/D/N=2 FT_profileX,FT_profileY,FB_profileX,FB_profileY
26        Make/O/D/N=2 MT_profileX,MT_profileY,MB_profileX,MB_profileY
27       
28        Make/O/D/N=4 FT_rayX,FT_rayY,FB_rayX,FB_rayY
29        Make/O/D/N=4 MT_rayX,MT_rayY,MB_rayX,MB_rayY
30
31        Make/O/D/N=2 B_S_profileX,B_S_profileY
32        Make/O/D/N=4 B_S_rayX,B_S_rayY
33       
34        DoWindow SideView
35        if(V_Flag==0)
36                Execute "SideView()"
37        endif
38       
39//      UpdateSideView()  // don't bother running this here - the Execute is a separate command and is out of sync.
40       
41        SetDataFolder root:
42        return(0)
43End
44
45//TODO - still need to account for the 30cm SDD offset for the T/B detectors. These are only
46//      seen in the side view.
47Function UpdateSideView()
48
49        SetDataFolder root:Packages:NIST:VSANS:VCALC
50       
51// wave declarations
52        Wave FT_profileX,FT_profileY,FB_profileX,FB_profileY
53        Wave MT_profileX,MT_profileY,MB_profileX,MB_profileY
54       
55        Wave FT_rayX,FT_rayY,FB_rayX,FB_rayY
56        Wave MT_rayX,MT_rayY,MB_rayX,MB_rayY
57
58        Wave B_S_profileX,B_S_profileY
59        Wave B_S_rayX,B_S_rayY
60
61// Dimensions of detectors
62        NVAR F_LR_w = gFront_LR_w
63        NVAR F_LR_h = gFront_LR_h
64        NVAR F_TB_w = gFront_TB_w
65        NVAR F_TB_h = gFront_TB_h
66       
67        NVAR M_LR_w = gMiddle_LR_w
68        NVAR M_LR_h = gMiddle_LR_h
69        NVAR M_TB_w = gMiddle_TB_w
70        NVAR M_TB_h = gMiddle_TB_h
71
72        NVAR B_h = gBack_h
73        NVAR B_w = gBack_w
74
75
76// get the values from the panel
77        Variable F_LR_sep,F_TB_sep, F_SDD, F_offset
78        Variable M_LR_sep,M_TB_sep, M_SDD, M_offset
79        Variable B_SDD, B_offset
80
81        NVAR TB_SDD_offset = gFront_SDDOffset           //in mm !!  distance T/B are behind L/R - not to be confused with lateral offset
82        TB_SDD_offset /= 1000           //convert to meters for the plot
83       
84        //front
85//      ControlInfo VCALCCtrl_2a
86//      F_LR_sep = V_Value
87        ControlInfo VCALCCtrl_2b
88        F_TB_sep = V_Value
89        ControlInfo VCALCCtrl_2c
90        F_offset = V_Value
91        ControlInfo VCALCCtrl_2d
92        F_SDD = V_Value
93                               
94        //middle
95//      ControlInfo VCALCCtrl_3a
96//      M_LR_sep = V_Value
97        ControlInfo VCALCCtrl_3b
98        M_TB_sep = V_Value
99        ControlInfo VCALCCtrl_3c
100        M_offset = V_Value
101        ControlInfo VCALCCtrl_3d
102        M_SDD = V_Value
103       
104        //back                 
105        ControlInfo VCALCCtrl_4a
106        B_offset = V_Value     
107        ControlInfo VCALCCtrl_4b
108        B_SDD = V_Value         
109
110//      Print "Front ", F_LR_sep,F_TB_sep, F_SDD, F_offset
111//      Print "Middle ",  M_LR_sep,M_TB_sep, M_SDD, M_offset
112//      Print "Back ",  B_SDD, B_offset                 
113                       
114
115// FRONT
116        FT_profileX = F_SDD+TB_SDD_offset               //SDD in meters, set back from L/R
117        FB_profileX = FT_profileX
118       
119        FT_profileY[0] = F_TB_sep               // separation in mm
120        FT_profileY[1] = FT_profileY[0] + F_TB_h        // add in height of T/B panel in mm
121       
122        FB_profileY = -FT_profileY
123
124        //angles (not calculating anything, just connect the dots)
125        FT_rayX[0] = 0
126        FT_rayX[1] = F_SDD+TB_SDD_offset
127        FT_rayX[2] = F_SDD+TB_SDD_offset
128        FT_rayX[3] = 0
129       
130        FT_rayY[0] = 0
131        FT_rayy[1] = FT_profileY[0]
132        FT_rayY[2] = FT_profileY[1]
133        FT_rayY[3] = 0
134       
135       
136        FB_rayX[0] = 0
137        FB_rayX[1] = F_SDD+TB_SDD_offset
138        FB_rayX[2] = F_SDD+TB_SDD_offset
139        FB_rayX[3] = 0
140       
141        FB_rayY[0] = 0
142        FB_rayy[1] = FB_profileY[0]
143        FB_rayY[2] = FB_profileY[1]
144        FB_rayY[3] = 0 
145
146
147// MIDDLE       
148        MT_profileX = M_SDD+TB_SDD_offset               //SDD in meters
149        MB_profileX = MT_profileX
150       
151        MT_profileY[0] = M_TB_sep               // separation in mm
152        MT_profileY[1] = MT_profileY[0] + M_TB_h        // add in height of T/B panel in mm
153       
154        MB_profileY = -MT_profileY
155
156        //angles (not calculating anything, just connect the dots)
157        MT_rayX[0] = 0
158        MT_rayX[1] = M_SDD+TB_SDD_offset
159        MT_rayX[2] = M_SDD+TB_SDD_offset
160        MT_rayX[3] = 0
161       
162        MT_rayY[0] = 0
163        MT_rayy[1] = MT_profileY[0]
164        MT_rayY[2] = MT_profileY[1]
165        MT_rayY[3] = 0
166       
167       
168        MB_rayX[0] = 0
169        MB_rayX[1] = M_SDD+TB_SDD_offset
170        MB_rayX[2] = M_SDD+TB_SDD_offset
171        MB_rayX[3] = 0
172       
173        MB_rayY[0] = 0
174        MB_rayy[1] = MB_profileY[0]
175        MB_rayY[2] = MB_profileY[1]
176        MB_rayY[3] = 0 
177
178// BACK
179        B_S_profileX = B_SDD            //SDDb in meters
180       
181        B_S_profileY[0] = B_h/2         // half-height
182        B_S_profileY[1] = -B_h/2                // half-height
183
184        B_S_rayX[0] = 0
185        B_S_rayX[1] = B_SDD
186        B_S_rayX[2] = B_SDD
187        B_S_rayX[3] = 0
188       
189        B_S_rayY[0] = 0
190        B_S_rayy[1] = B_S_profileY[0]
191        B_S_rayY[2] = B_S_profileY[1]
192        B_S_rayY[3] = 0
193       
194        SetDataFolder root:
195       
196        Execute "SideView()"
197       
198        return(0)
199       
200End
201
202
203Window SideView() : Graph
204
205        PauseUpdate; Silent 1           // building window...
206        String fldrSav0= GetDataFolder(1)
207        SetDataFolder root:Packages:NIST:VSANS:VCALC
208       
209        CheckDisplayed/W=VCALC#SideView FB_rayY
210        if(V_flag == 0)
211//              Display /W=(41,720,592,1119) FB_rayY vs FB_rayX as "SideView"
212                AppendToGraph/W=VCALC#SideView FB_rayY vs FB_rayX
213                AppendToGraph/W=VCALC#SideView FT_rayY vs FT_rayX
214                AppendToGraph/W=VCALC#SideView MB_rayY vs MB_rayX
215                AppendToGraph/W=VCALC#SideView MT_rayY vs MT_rayX
216                AppendToGraph/W=VCALC#SideView B_S_rayY vs B_S_rayX
217                AppendToGraph/W=VCALC#SideView B_S_profileY vs B_S_profileX
218                AppendToGraph/W=VCALC#SideView FB_profileY vs FB_profileX
219                AppendToGraph/W=VCALC#SideView FT_profileY vs FT_profileX
220                AppendToGraph/W=VCALC#SideView MB_profileY vs MB_profileX
221                AppendToGraph/W=VCALC#SideView MT_profileY vs MT_profileX
222       
223                ModifyGraph/W=VCALC#SideView lSize(B_S_profileY)=5,lSize(FB_profileY)=5,lSize(FT_profileY)=5,lSize(MB_profileY)=5
224                ModifyGraph/W=VCALC#SideView lSize(MT_profileY)=5
225                ModifyGraph/W=VCALC#SideView rgb(FB_rayY)=(0,0,0),rgb(FT_rayY)=(0,0,0),rgb(MB_rayY)=(0,0,0),rgb(MT_rayY)=(0,0,0)
226                ModifyGraph/W=VCALC#SideView rgb(B_S_rayY)=(0,0,0),rgb(B_S_profileY)=(1,52428,52428),rgb(FB_profileY)=(3,52428,1)
227                ModifyGraph/W=VCALC#SideView rgb(FT_profileY)=(3,52428,1),rgb(MB_profileY)=(1,12815,52428),rgb(MT_profileY)=(1,12815,52428)
228                ModifyGraph/W=VCALC#SideView grid=1
229                ModifyGraph/W=VCALC#SideView mirror=2
230                ModifyGraph/W=VCALC#SideView nticks(left)=8
231                Label/W=VCALC#SideView left "\\Z10Vertical position (mm)"
232                Label/W=VCALC#SideView bottom "\\Z10SDD (meters)"
233                SetAxis/W=VCALC#SideView left -800,800
234                SetAxis/W=VCALC#SideView bottom 0,25
235//              TextBox/W=VCALC#SideView/C/N=text0/A=MC/X=22.54/Y=42.04 "\\JCSIDE VIEW\rOnly the Top/Bottom panels are shown"
236                TextBox/W=VCALC#SideView/C/N=text0/A=MC/X=40.15/Y=43.62 "\\JCSIDE VIEW\r= Top/Bottom panels"
237        endif
238        SetDataFolder fldrSav0
239       
240EndMacro
241
242
243
244//////////////////
245// generate the waves needed for drawing the views
246// draw a blank graph
247//
248// TOP VIEW uses the L and R banks
249//
250Function SetupTopView()
251
252        SetDataFolder root:Packages:NIST:VSANS:VCALC
253
254        Make/O/D/N=2 FL_profileX,FL_profileY,FR_profileX,FR_profileY
255        Make/O/D/N=2 ML_profileX,ML_profileY,MR_profileX,MR_profileY
256       
257        Make/O/D/N=4 FL_rayX,FL_rayY,FR_rayX,FR_rayY
258        Make/O/D/N=4 ML_rayX,ML_rayY,MR_rayX,MR_rayY
259
260        Make/O/D/N=2 B_T_profileX,B_T_profileY
261        Make/O/D/N=4 B_T_rayX,B_T_rayY
262
263        DoWindow TopView
264        if(V_Flag==0)
265                Execute "TopView()"
266        endif
267       
268       
269        SetDataFolder root:
270        return(0)
271End
272
273Function UpdateTopView()
274
275        SetDataFolder root:Packages:NIST:VSANS:VCALC
276       
277// wave declarations
278        Wave FL_profileX,FL_profileY,FR_profileX,FR_profileY
279        Wave ML_profileX,ML_profileY,MR_profileX,MR_profileY
280       
281        Wave FL_rayX,FL_rayY,FR_rayX,FR_rayY
282        Wave ML_rayX,ML_rayY,MR_rayX,MR_rayY
283
284        Wave B_T_profileX,B_T_profileY
285        Wave B_T_rayX,B_T_rayY
286
287// Dimensions of detectors
288        NVAR F_LR_w = gFront_LR_w
289        NVAR F_LR_h = gFront_LR_h
290        NVAR F_TB_w = gFront_TB_w
291        NVAR F_TB_h = gFront_TB_h
292       
293        NVAR M_LR_w = gMiddle_LR_w
294        NVAR M_LR_h = gMiddle_LR_h
295        NVAR M_TB_w = gMiddle_TB_w
296        NVAR M_TB_h = gMiddle_TB_h
297
298        NVAR B_h = gBack_h
299        NVAR B_w = gBack_w
300
301
302// get the values from the panel
303        Variable F_LR_sep,F_TB_sep, F_SDD, F_offset
304        Variable M_LR_sep,M_TB_sep, M_SDD, M_offset
305        Variable B_SDD, B_offset
306        //front
307        ControlInfo VCALCCtrl_2a
308        F_LR_sep = V_Value
309//      ControlInfo VCALCCtrl_2b
310//      F_TB_sep = V_Value
311        ControlInfo VCALCCtrl_2c
312        F_offset = V_Value
313        ControlInfo VCALCCtrl_2d
314        F_SDD = V_Value
315                               
316        //middle
317        ControlInfo VCALCCtrl_3a
318        M_LR_sep = V_Value
319//      ControlInfo VCALCCtrl_3b
320//      M_TB_sep = V_Value
321        ControlInfo VCALCCtrl_3c
322        M_offset = V_Value
323        ControlInfo VCALCCtrl_3d
324        M_SDD = V_Value
325       
326        //back                 
327        ControlInfo VCALCCtrl_4a
328        B_offset = V_Value     
329        ControlInfo VCALCCtrl_4b
330        B_SDD = V_Value         
331
332//      Print "Front ", F_LR_sep,F_TB_sep, F_SDD, F_offset
333//      Print "Middle ",  M_LR_sep,M_TB_sep, M_SDD, M_offset
334//      Print "Back ",  B_SDD, B_offset                 
335                       
336
337// FRONT
338        FL_profileX = F_SDD             //SDD in meters
339        FR_profileX = FL_profileX
340       
341        FL_profileY[0] = F_LR_sep               // separation in mm
342        FL_profileY[1] = FL_profileY[0] + F_LR_w        // add in width of L/R panel in mm
343       
344        FR_profileY = -FL_profileY
345
346        //angles (not calculating anything, just connect the dots)
347        FL_rayX[0] = 0
348        FL_rayX[1] = F_SDD
349        FL_rayX[2] = F_SDD
350        FL_rayX[3] = 0
351       
352        FL_rayY[0] = 0
353        FL_rayy[1] = FL_profileY[0]
354        FL_rayY[2] = FL_profileY[1]
355        FL_rayY[3] = 0
356       
357       
358        FR_rayX[0] = 0
359        FR_rayX[1] = F_SDD
360        FR_rayX[2] = F_SDD
361        FR_rayX[3] = 0
362       
363        FR_rayY[0] = 0
364        FR_rayy[1] = FR_profileY[0]
365        FR_rayY[2] = FR_profileY[1]
366        FR_rayY[3] = 0 
367
368
369// MIDDLE       
370        ML_profileX = M_SDD             //SDD in meters
371        MR_profileX = ML_profileX
372       
373        ML_profileY[0] = M_LR_sep               // separation in mm
374        ML_profileY[1] = ML_profileY[0] + M_LR_w        // add in width of L/R panel in mm
375       
376        MR_profileY = -ML_profileY
377
378        //angles (not calculating anything, just connect the dots)
379        ML_rayX[0] = 0
380        ML_rayX[1] = M_SDD
381        ML_rayX[2] = M_SDD
382        ML_rayX[3] = 0
383       
384        ML_rayY[0] = 0
385        ML_rayy[1] = ML_profileY[0]
386        ML_rayY[2] = ML_profileY[1]
387        ML_rayY[3] = 0
388       
389       
390        MR_rayX[0] = 0
391        MR_rayX[1] = M_SDD
392        MR_rayX[2] = M_SDD
393        MR_rayX[3] = 0
394       
395        MR_rayY[0] = 0
396        MR_rayy[1] = MR_profileY[0]
397        MR_rayY[2] = MR_profileY[1]
398        MR_rayY[3] = 0 
399
400// BACK
401        B_T_profileX = B_SDD            //SDDb in meters
402       
403        B_T_profileY[0] = B_h/2         // half-height
404        B_T_profileY[1] = -B_h/2                // half-height
405
406        B_T_rayX[0] = 0
407        B_T_rayX[1] = B_SDD
408        B_T_rayX[2] = B_SDD
409        B_T_rayX[3] = 0
410       
411        B_T_rayY[0] = 0
412        B_T_rayY[1] = B_T_profileY[0]
413        B_T_rayY[2] = B_T_profileY[1]
414        B_T_rayY[3] = 0
415       
416        SetDataFolder root:
417       
418        Execute "TopView()"
419       
420        return(0)
421       
422End
423
424
425Window TopView() : Graph
426        PauseUpdate; Silent 1           // building window...
427        String fldrSav0= GetDataFolder(1)
428        SetDataFolder root:Packages:NIST:VSANS:VCALC
429       
430        CheckDisplayed/W=VCALC#TopView FR_rayY
431        if(V_flag == 0)
432               
433//              Display /W=(594,721,1144,1119) FR_rayY vs FR_rayX as "TopView"
434                AppendToGraph/W=VCALC#TopView FR_rayY vs FR_rayX
435                AppendToGraph/W=VCALC#TopView FL_rayY vs FL_rayX
436                AppendToGraph/W=VCALC#TopView MR_rayY vs MR_rayX
437                AppendToGraph/W=VCALC#TopView ML_rayY vs ML_rayX
438                AppendToGraph/W=VCALC#TopView B_T_rayY vs B_T_rayX
439                AppendToGraph/W=VCALC#TopView B_T_profileY vs B_T_profileX
440                AppendToGraph/W=VCALC#TopView FR_profileY vs FR_profileX
441                AppendToGraph/W=VCALC#TopView FL_profileY vs FL_profileX
442                AppendToGraph/W=VCALC#TopView MR_profileY vs MR_profileX
443                AppendToGraph/W=VCALC#TopView ML_profileY vs ML_profileX
444       
445                ModifyGraph/W=VCALC#TopView lSize(B_T_profileY)=5,lSize(FR_profileY)=5,lSize(FL_profileY)=5,lSize(MR_profileY)=5
446                ModifyGraph/W=VCALC#TopView lSize(ML_profileY)=5
447                ModifyGraph/W=VCALC#TopView rgb(FR_rayY)=(0,0,0),rgb(FL_rayY)=(0,0,0),rgb(MR_rayY)=(0,0,0),rgb(ML_rayY)=(0,0,0)
448                ModifyGraph/W=VCALC#TopView rgb(B_T_rayY)=(0,0,0),rgb(B_T_profileY)=(1,52428,52428),rgb(FR_profileY)=(39321,26208,1)
449                ModifyGraph/W=VCALC#TopView rgb(FL_profileY)=(39321,26208,1)
450                ModifyGraph/W=VCALC#TopView grid=1
451                ModifyGraph/W=VCALC#TopView mirror=2
452                ModifyGraph/W=VCALC#TopView nticks(left)=8
453                Label/W=VCALC#TopView left "\\Z10Horizontal position (mm)"
454                Label/W=VCALC#TopView bottom "\\Z10SDD (meters)"
455                SetAxis/W=VCALC#TopView left -800,800
456                SetAxis/W=VCALC#TopView bottom 0,25
457                TextBox/W=VCALC#TopView/C/N=text0/A=MC/X=41.61/Y=43.62 "\\JCTOP VIEW\r= Left/Right panels"
458        endif
459        SetDataFolder fldrSav0
460
461EndMacro
462
463
464
Note: See TracBrowser for help on using the repository browser.