 
 
 ------------------------------------------------------------------------------
  E x a m p l e    of     T O R O I D A L       M o n o c h r o m a t o r      
 
 
  This is the log of a session with SHADOW's utilities. It demonstrates the
 use of FOCNEW, RETRACE, SHADOWIT and RESPONSE to find the best focus and the
 transmission function of a toroidal monochromator. 
 
  The optical system was a point source with 1000 rays, photon energy 50 eV, a
 toroidal grating with 1200 lines/mm, with a geometry of 300 cm input arm,
 160 deg included angle, 300 cm exit arm. The toroid and rotation angle were
 determined automatically by SHADOW. The geometry was not based on anything
 but a whimsical choice of numbers.
 
  After the run, FOCNEW is used to locate the best focus along the exit slit
 arm. 
 
  RETRACE is then used to compute the image at the best focus by retracing
 from STAR.01. 
 
  RECOLOR is used to generate a new source file whose only difference from the
 former is the photon energy distribution.
 
  SHADOW is re-run at this point, creating a new set of results. NOTHING is
 changed in the startup files.
 
  SHADOWIT is used to insert a slit of two different sizes (1.2 and 0.8); it
 will generate two files with the 'good' rays (through the slit) and the
 'lost' ones. To use RESPONSE, one must generate a file containing the row 11
 of the ray array, that contains the wavenumber of each ray. 
 
  RESPONSE will then generate an histogram of the photon energy of the rays
 through the slit. This is the instrument response function. In a real case,
 more than one file will be specified in SHADOWIT ( see SHADOWIT.DEMO ), to
 correctly figure the beamline transmission. 
 
 
 //  Results of a previous run of SHADOW
 $ dir
 
 Directory D2:[SHADOW.SHADOW.TEST]
 
 BEGIN.DAT;1            189  		//  SOURCE file.
 EFFIC.01;1                1  		//  Efficiency of mirror/grating.
 END.00;1                  5  
 END.01;1                 11  
 MINMAX.DAT;1              2  
 MIRR.01;1              189  		//  Mirror Intercepts in mirror local
					//  ref. frame.
 OPTAX.01;1                2  
 RMIRS.01;1              189  		//  Mirror intercepts in OE ref. frame.
 STAR.01;1              189  		//  Image.
 START.00;1                5  
 START.01;1               11  
 SYSTEMFILE.DAT;1          1  

 
 
 Total of 16 files, 804 blocks.
 $ 
 $ 
 $ focnew
//  Start the program to find the best gaussian focus;  The program should be
//  run with a single wavelength beam for accurate results;  here it is only
//  for demo purposes.
 Input file ? 
 star.01 			//  Star.01 is the final image.
 We have         1000 good points out of         1000
 
//  The results of the ray bundle at the image plane are listed below.
   
 Row Par Minimum:       Maximum:       Center:        St. Dev.:		
 
  1  X    -2.9946         2.9750        0.10764E-01     1.7774    
  2  Y   -0.17821E-13    0.11664E-13   -0.40521E-14    0.48130E-14
  3  Z    -2.2685         2.2200        0.28099E-01     1.1333    
  4  X'  -0.49924E-02    0.49575E-02    0.17946E-04    0.29623E-02
  5  Y'   0.99999         1.0000         1.0000        0.37877E-05
  6  Z'  -0.17296E-02    0.17782E-02    0.17578E-04    0.78285E-03
//  The program will compute the Standard Deviation for the point specified.
//  Select the center of gravity.
 Options:  
 center at origin              [ 0 ]
 center at center of gravity   [ 1 ]
 external                      [ 2 ] 
 Then ?
 1				
//  The following is output from FOCNEW.
  -----------------------------------------------------------------------------
  Searching file : 
  stars.01                                                                    
  D2:[SHADOW.SHADOW.TEST]STARS.01;2                          19-JAN-1986 21:14
  -----------------------------------------------------------------------------
  Center at :Baricenter
  X =   0.0000000000000000E+00    Z =   0.0000000000000000E+00
  -----------------------------------------------------------------------------
  Working with 1000 "good" rays out of 1000
  .............. S A G I T T A L  ..............
  X coefficients :   0.8775897325E-05  0.5265515758E-02   3.159295994    
  Center : 0.1076388727E-01   Average versor : 0.1794613476E-04
  Sagittal   focus at       :  -599.9974283    
  Waist size at best focus (rms)	:  0.3477627393E-03
  Waist size at origin                :   1.777408263    
  .............. T A N G E N T I A L .............
  Z coefficients :   0.1547994143E-06  0.4376192525E-03   1.237715728    
  Center : 0.2765022786E-01   Average versor : 0.1621055975E-04
  Tangential focus at       :  -2828.915196    	

/  The focus is vitual.
  Waist size at best focus (rms)	:  0.1521287000E-01	 
  Waist size at origin                :   1.112183075    
  ..............   LEAST CONFUSION  .............
  T coefficients :   0.8930696739E-05  0.5703135011E-02   4.397011722    
  Center : 0.2967147401E-01   Average versor : 0.2418358948E-04
  Circle of least confusion :  -638.5691112    
 
  Waist size at best focus (rms)	:  0.8687318607    
  Waist size at origin                :   2.096695334    
 
 All done. File out data.
//  FOCNEW may prepare a file with the waist size along the axis.
 Do you want a plottable file ? 	
 y
 Enter :
 1	for X
 2	for Z
 3	for T
 4	for all
  Then ? 
 4
 Please specify Limits [ YMIN, YMAX, STEP ] ?	
//  Limits of plots with reference relative to the image used.
 Ymin ? 	
 -2000
 Ymax ? 
 -3500
 Ystep ? 
 10
  File root [ 7 letters max ] ? 
 focus
 Enter :
 0	for another plot
 1	to restart
 2	to exit
  Then ? 
 2
 $
 $ dir *focus*	
//  Look at files generated by FOCNEW.
 
 Directory D2:[SHADOW.SHADOW.TEST]
 
 FOCUS.DAT;1               4    	! Log file
 FTFOCUS.DAT;1            10  	! plottable files
 FXFOCUS.DAT;1            10  
 FZFOCUS.DAT;1            10  
 
 Total of 4 files, 34 blocks.
 $
 $ 
 $
 $ 
 $ 
 $retrace
//  Compute image at best tangential focus.
 RETRACE> Ray input file ? 
 star.01
 RETRACE> Ray output file ? 
 star.new
 RETRACE> Do you want to retrace the phase too ? 
 0
//  Enter 0 for NO.
 RETRACE> Distance ? 
//  From input file (image).
 -2829			! 
 Read         1000 rays.
 Another run [ Y/N ] ?
 n
 $ 
 $ 
 $ 
 $ minmax
//  To check the results.
 Input file ? 
 star.new
//  This is the new file recently generated.
 Options --- Enter
 0 for excluding the losses
 1 for including losses at a particular O.E.
 2 for including all the losses.
 Then ? 
 0
 Comment ?
 Retraced image of TGM
 ************
  D2:[SHADOW.SHADOW.TEST]STAR.NEW;2 
  19-JAN-1986 21:16
 ***********
  Total rays :         1000
  Lost rays  :            0
  EXCLUDING LOSSES
  X max is            11.1287250519    
  X min is           -11.0495290756    
  Y max is           -2828.90991211    
  Y min is           -2828.90991211    
  Z max is          -0.406766685046E-05		//  Not bad.
  Z min is          -0.552533455193E-01
  X prime max is     0.495751760900E-02
  X prime min is    -0.499243568629E-02
  Y prime max is      1.00000000000    
  Y prime min is     0.999987363815    
  Z prime max is     0.695099297445E-03
  Z prime min is    -0.681439996697E-03
 $ 
 $ 
 $ 
 $  
 $ recolor
  File for input ?
  begin.dat
//  Old source (monochromatic).
  and for output ?
  begin.dat
//  New source.
  Data ready. Read         1000 points.
  Are you going to specify energies in eV [0] or wavelengths in angstroms [1]?
  0
  Available options :
  1	single line
  2	multi lines
 
  3	box distribution
  Then ?
//  Continuous distribution.
  3
  Minimum value ?
//  Bracketing the central wavelength. 
  49.5	
  Maximum value ?
  50.5
  Enter seed for random number generator :
  18191991
  All done.
  $ 
  $ 
 //  SHADOW was re-run here to generate a new set of data; nothing but the
 //  source file was changed. Have a look at the focus condition using PLOTXY.
  $ 
  $plotxy
 PLOT> Input file? 
 star.new
 PLOT> Options --- Enter
 PLOT>   0   for excluding the losses
 PLOT>   1   for including only the losses
 PLOT>   2   for including all the rays.
 PLOT> Then ? 
 0
 PLOT> Comment for plot [ 80 char ] ?
 Retraced image of TGM
 PLOT> File read OK. Full specifications:
      D2:[SHADOW.SHADOW.TEST]STARS.NEW;1                          
      Was created : 19-JAN-1986 17:08
/  Statistics of ray follow:
  
 PLOT> Found         1000 good points out of        1000
 
 								
 Row Par Minimum:       Maximum:       Center:        St. Dev.:
 
  1  X    -1.7545         1.7682       -0.63567E-02     1.0487    
  2  Y    -2329.00       -2329.00       -2329.00        *****    
  3  Z    -1.9931         1.9233        0.11330E-01    0.85217    
  4  X'  -0.49924E-02    0.49575E-02    0.17946E-04    0.29623E-02
  5  Y'   0.99999         1.0000         1.0000        0.00000E+00
  6  Z'  -0.17296E-02    0.17782E-02    0.17578E-04    0.78285E-03
 11   Photon Energy  (eV)      49.501         50.499

//  Notice photon range in row 11.
 
 PLOT> Rows to use for plot .
 PLOT> For X ? 				
 3
 PLOT>     Y ? 
 6
  
//  Plot out Z phase space by choosing Z' and Z.
 PLOT> Scaling options. Enter 
  
        0   for automatic scaling
        1   for cartesian scaling
        2   for external limits
 PLOT> Then ? 
 0					 //  Automatic: different units.
 PLOT> Scatter [ 0 ] or connected plot [ 1 ] option.
 PLOT> Then ? 
 0					 //  Necessary for Monte Carlo.
 PLOT> Hairline at [ 0,0 ] ? 
 1
 PLOT> Overlay a mirror/slit ? 
 0
 PLOT> Ready for histograms. Enter:
      -1         to skip 
       0     for same limits as plot
       1                     3*stdev
       2                     external
 PLOT> ? 
 1
 PLOT> Terminal type: [ 0 ] VT240, [ 1 ] MIME, [ 2 ] TEK, [ 3 ] HIREZ
  0
 PLOT> Do you want to save the TD command file ?
  0					//  Plot follows.
  $
  $
  $ 
//  Tests now the effect of slits; see SHADOWIT.DEMO for details.
  $
  $ SHADOWIT
  Interactive [ Y ] or batch session ? 
  Y 
  Parameters input. This version is interactive.
  How many files to read in ? 
  1 
  File-name : 
  STAR.NEW 
  How many of the following files: 
     1    STAR.NEW           
  do you want to use as defining apertures? 
  1 
  Please define which ones [ enter index number ] ? 
  File #            1
   Then ? 
  1 
  Column to use for intercept testing ? 
  " X "-column: 
  1 
  " Y "-column: 
  3 
  Rectangular             1
  Elliptical              2
  Elliptical with hole    3 
  Aperture type [1-3] ? 
  1 
  Xmin = 
  -2 
  Xmax = 
  2 
  Ymin = 
  -0.6 				//  Bit too large.
  Ymax = 
  0.6 
  Use how many rays ? 
  1000 
  Read from STAR.NEW           
  Array is ready.
  Accounting situation:
 
  Total rays :         1000
  Good ones  :    474.0000    
  Lost ones  :    526.0000    
  Transm.	   :   0.4740000    
  Options. Enter :
  2	file out  (e.g., for TOPDRAWER)
  3	redefine the limits
  4	restart with other files
  5	rewrite the RAYs files
  6	exit.
 <?>
 <?> 
  2 
  The HIT rays will be in a file of type *.HIT
  the others in a file type *.NHT
  Files available:
            1  STAR.NEW           
  Index of file to prepare ? 
  1 
  Which columns to write to file ? 
  First ::
  3 			//  Z intercepts.
  Second:: 
  11 			//  Wavenumber; this is the output needed by RESPONSE.
  Filename (max 9 letters, no specifier) ?
  SLIT06 
  Options. Enter :
  2	file out  (e.g., for TOPDRAWER)
  3	redefine the limits
  4	restart with other files
  5	rewrite the RAYs files
  6	exit.
  <?> 
  3 
  Enter the new limits, please. Namelist is INPUT
  $INPUT
  FILEIN  = 'STARS.NEW           ', 9*' ',
  XMAX    =   2.000000    , 9*0.0000000E+00,
  YMAX    =  0.6000000    , 9*0.0000000E+00,
  XMIN    =  -2.000000    , 9*0.0000000E+00,
  YMIN    = -0.6000000    , 9*0.0000000E+00,
  KIND    =           1, 9*0,
  NFILE   =           1,
  NPOINT  =        1000,
  IFILE   =           1, 9*0,
  KOL     =           1,           3, 18*0,
  NCHECK  =           1,
  TRANS   =  0.4740000    
  $END
   $INPUT 
    YMIN(1)=-0.4 
    YMAX(1)=0.4 
   $END 
  Accounting situation:
  Total rays :         1000
  Good ones  :    316.0000    
 
  Lost ones  :    684.0000    
  Transm.	   :   0.3160000    
  Options. Enter :
  2	file out  (e.g., for TOPDRAWER)
  3	redefine the limits
  4	restart with other files
  5	rewrite the RAYs files
  6	exit.
  <?> 
  2 
  The HIT rays will be in a file of type *.HIT
  the others in a file type *.NHT
  Files available:
            1  STAR.NEW           
  Index of file to prepare ? 
  1 
  Which columns to write to file ? 
  First :: 
  3 
  Second:: 
  11 
  Filename (max 9 letters, no specifier) ?
  SLIT04 
  Options. Enter :
  2	file out  (e.g., for TOPDRAWER)
  3	redefine the limits
  4	restart with other files
  5	rewrite the RAYs files
  6	exit.
  <?> 
  6 
  $
  $  
  $  
  $ DIR .HIT 
  
  Directory D2:[SHADOW.SHADOW.TEST]
  
  SLIT04.HIT;1             20  		! Smaller slit
  SLIT06.HIT;1             30  		! Wider slit
  
  Total of 2 files, 50 blocks
 
  $ RESPONSE 
  File for analysis ?
  SLIT06.HIT 
  Column to analyze [ 1 or 2 ] ? 
  2 
  Options: 				//  Units for output.
  eV         0
  Angs       1
  cm-1       2
  Then ? 
  0 					//  Selects eV.
  Automatic scaling [ Y/N ] ? 
  Y 
 
  Number of bins (odd, max 100) ? 
  21 
 // 21 is reasonable, remember statistics.
  Normalization kind. Enter :
  0	for no normalization
  1	maximum set at 1
  2	area normalized to 1 
  Then ? 
  0 
  Read          474
            0 points were outside limits.	// Of course. Automatic scaling.
  Another run (1/0) ?
  1 
  File for analysis ?
  SLIT04.HIT 
  Column to analyze [ 1 or 2 ] ? 
  2 
  Options: 
  eV         0
  Angs       1
  cm-1       2
  Then ? 
  0 
  Automatic scaling [ Y/N ] ? 
  Y 
  Number of bins (odd, max 100) ? 
  21 
  Normalization kind. Enter :
  
  0	for no normalization
  1	maximum set at 1
  2	area normalized to 1 
  Then ? 
  0 
  Read          316
            0 points were outside limits.
  Another run (1/0) ?
  0 
  All done. Bye !
 
  $ 
//  The program will have generated two files, HISTO1.DAT;1 and ;2, each
//  containing the results of each run.
//   Plot them out
  $ 
  $ MCR TDFILE 
  TOP DRAWER (10/10/80) NOW EXECUTING
   MODE NOECHO 
             2  MODE NOECHO
  @HISTO1.DAT;-1 
  READING FROM INDIRECT COMMAND FILE: HISTO1.DAT;-1
             3     49.50139       12.00000
  END OF INDIRECT COMMAND FILE
  HISTO 
            24  HISTO
  @HISTO1.DAT 
 
  READING FROM INDIRECT COMMAND FILE: HISTO1.DAT
            25     49.50139       10.00000      
   PRINTING SUPPRESSED AFTER     0 POINTS.  (PLOT CONTINUES.)
  END OF INDIRECT COMMAND FILE
  HISTO DOTDASH 
            46  HISTO DOTDASH                   
  END 
            47  END                             
  FORTRAN STOP
  $ UGTEK 
  
  
    UG element file: 
  SAVE.DAT 
    Plot which pictures (default=all)? 
   
    Enter picture scale factor (default=1.0): 
   
  $  
  $ LOGO 
    SHADOW       logged out at 19-JAN-1986 17:25:32.38
