Examples of the SIGMA processor (1)

Examples of the SIGMA processor (1)

zone 2 2 2 APPLICATION SIGMA X=ARRAY(200,0#2*PI) sinus=sin(x) sinx=sin(x)/x 2 EXIT gra 200 x sinus set dmod 2 gra 200 x sinx l set dmod 0 1 SIGMA x=array(300,0#8) sigma g=cosh(x)+sin(1/(.1+x*x)) gra 300 x g sigma x=array(300,0#3) 3 GRAPH 300 x $SIGMA(cosh(x)+sin(1/(.1+X*X))) sigma x=array(300,0#1) 4 GRAPH 300 x $RSIGMA(cosh(x)+sin(1/(.1+X*X)))
This example (and the next one) shows how to use the array manipulation package SIGMA. There are four ways to give directives to SIGMA. The complete information on SIGMA is given in the chapter SIGMA of the PAW manual.

  1. Precede the statement by the prefix SIGMA .
  2. The PAW command: APPLication SIGMA . All commands typed in after this command will be directly processed by SIGMA. The command EXIT will return control to PAW.
  3. The PAW system function $SIGMA. The expression to be evaluated must be enclosed in parentheses. The function will return the numerical value of the expression (if the result is a scalar) or the name of a temporary vector (if the result is a vector).
  4. The PAW system function $RSIGMA. This function has be to used in COMIS calls expecting a REAL argument, e.g.
                                                                                                                       
          CALL file.f($RSIGMA(sqrt(x(1)))                                                                                   
    
    Otherwise the value may be passed as an INTEGER if the SIGMA result turns out to be a whole number.

Note also:

The system function $FORMAT(number,format)+ to format a number according to a Fortran-like FORMAT string, e.g. $FORMAT([x],F9.3). Supports F,E,G,I, and Z (hexadecimal). The complete list of the system functions available is given on next page.


The function is literally replaced, at run-time, by its current value. The following functions are available:
                                                                                                                   
    $DATE  .......................  Current date in format DD/MM/YY                                                     
    $TIME  .......................  Current time in format HH.MM.SS                                                     
    $CPTIME  .....................  CP time elapsed since last call (in sec)                                            
    $RTIME  ......................  Real time elapsed since last call (in sec)                                          
    $VDIM(VNAME,IDIM)  ...........  Physical length of vector VNAME                                                     
                                    on dimension IDIM (1..3)                                                            
    $VLEN(VNAME,IDIM)  ...........  As above, but for the logical length                                                
                                    (i.e. stripping trailing zeroes)                                                    
    $NUMVEC  .....................  Current number of vectors                                                           
    $VEXIST(VNAME)  ..............  Index of vector VNAME                                                               
                                    (1..$NUMVEC or 0 if VNAME does not exist)                                           
    $SUBSTRING(STRING,IX,NCH)  ...  STRING(IX:IX+NCH-1)                                                                 
    $UPPER(STRING)  ..............  STRING changed to upper case                                                        
    $LOWER(STRING)  ..............  STRING changed to lower case                                                        
    $LEN(STRING)  ................  Length of STRING                                                                    
    $INDEX(STR1,STR2)  ...........  Position of first occurence of STR2 in STR1                                         
    $WORDS(STRING,SEP)  ..........  Number of words separated by SEP                                                    
    $WORD(STRING,K,N,SEP)  .......  Extract N words starting at word K                                                  
    $QUOTE(STRING)  ..............  Add quotes around STRING                                                            
    $UNQUOTE(STRING)  ............  Remove quotes around STRING                                                         
    $EVAL(Expression)  ...........  Result of the Expression computed by KUIP                                           
    $SIGMA(Expression)  ..........  Result of the Expression computed by SIGMA                                          
    $RSIGMA(Expression) ..........  As above but a decimal point is added to                                            
                                    integer results                                                                     
    $FORMAT(number,format)  ......  Format a number according to Fortran. e.g.                                          
                                    $FORMAT(1.5,F5.2) ==> ' 1.50'                                                       
                                    $FORMAT(123,I5.5) ==> '00123'                                                       
    $ARGS  .......................  Command line at program invocation                                                  
    $KEYNUM  .....................  Address of latest clicked key in style GP                                           
    $KEYVAL  .....................  Value of latest clicked key in style GP                                             
    $LAST  .......................  Latest command line executed                                                        
    $ANUM  .......................  Number of aliases                                                                   
    $ANAM(I)  ....................  Name of I-th alias                                                                  
    $AVAL(I)  ....................  Value of I-th alias                                                                 
    $STYLE  ......................  Current style as defined by SET/STYLE                                               
    $OS  .........................  Operating system name, e.g. UNIX or VMS                                             
    $MACHINE  ....................  Hardware or Unix brand, e.g. VAX or HPUX                                            
    $PID  ........................  Process ID                                                                          
    $IQUEST(I)  ..................  Value of IQUEST(I) status vector                                                    
    $ENV(var)  ...................  Value of environment variable                                                       
    $FEXIST(file)  ...............  1 if file exists or 0 otherwise                                                     
    $SHELL(cmd,N)  ...............  N'th line of shell command output (Unix only)                                       
    $SHELL(cmd,sep)  .............  Shell output with newlines replaced by sep                                          
    $SHELL(cmd)  .................  Same as $SHELL(cmd,' ')                                                             
    $CALL('fun(args)')  ..........  Call a Fortran REAL FUNCTION                                                        

                                                                                                                   
    $ICALL('ifun(args)')  ........  Call an INTEGER FUNCTION                                                            
    $LCALL('lfun(args)')  ........  Call a LOGICAL FUNCTION and return 0 or 1                                           
    $DCALL('dfun(args)')  ........  Call a DOUBLE PRECISION FUNCTION                                                    
    $HCDIR()  ....................  Current Hbook working directory                                                     
    $HEXIST(id)  .................  1 if histogram ID exists or 0 otherwise                                             
    $HINFO(id,'ENTRIES')  ........  Number of entries                                                                   
    $HINFO(id,'MEAN')  ...........  Mean value                                                                          
    $HINFO(id,'RMS')  ............  Standard deviation                                                                  
    $HINFO(id,'EVENTS')  .........  Number of equivalent events                                                         
    $HINFO(id,'OVERFLOW')  .......  Content of overflow channel                                                         
    $HINFO(id,'UNDERFLOW')  ......  Content of underflow channel                                                        
    $HINFO(id,'MIN')  ............  Minimum bin content                                                                 
    $HINFO(id,'MAX')  ............  Maximum bin content                                                                 
    $HINFO(id,'SUM')  ............  Total histogram content                                                             
    $HINFO(id,'NSLIX')  ..........  Number of X slices                                                                  
    $HINFO(id,'NSLIY')  ..........  Number of Y slices                                                                  
    $HINFO(id,'NBANX')  ..........  Number of X bandes                                                                  
    $HINFO(id,'NBANY')  ..........  Number of Y bandes                                                                  
    $HINFO(id,'NPROX')  ..........  Projection X (0 or 1)                                                               
    $HINFO(id,'NPROY')  ..........  Projection Y (0 or 1)                                                               
    $HINFO(id,'XBINS')  ..........  Number of bins in X direction                                                       
    $HINFO(id,'XMIN')  ...........  Lower histogram limit in X direction                                                
    $HINFO(id,'XMAX')  ...........  Upper histogram limit in X direction                                                
    $HINFO(id,'YBINS')  ..........  Number of bins in Y direction                                                       
    $HINFO(id,'YMIN')  ...........  Lower histogram limit in Y direction                                                
    $HINFO(id,'YMAX')  ...........  Upper histogram limit in Y direction                                                
    $HTITLE(id)  .................  Histogram title                                                                     
    $GRAFINFO('XZONES')  .........  Number of zones in X direction                                                      
    $GRAFINFO('YZONES')  .........  Number of zones in Y direction                                                      
    $GRAFINFO('NT')  .............  Current Normalization Transformation number                                         
    $GRAFINFO('WNXMIN')  .........  Lower X limit of window in current NT                                               
    $GRAFINFO('WNXMAX')  .........  Upper X limit of window in current NT                                               
    $GRAFINFO('WNYMIN')  .........  Lower Y limit of window in current NT                                               
    $GRAFINFO('WNYMAX')  .........  Upper Y limit of window in current NT                                               
    $GRAFINFO('VPXMIN')  .........  Lower X limit of viewport in current NT                                             
    $GRAFINFO('VPXMAX')  .........  Upper X limit of viewport in current NT                                             
    $GRAFINFO('VPYMIN')  .........  Lower Y limit of viewport in current NT                                             
    $GRAFINFO('VPYMAX')  .........  Upper Y limit of viewport in current NT                                             
    $GRAFINFO('TXALIH')  .........  Horizontal text alignment                                                           
    $GRAFINFO('TXALIV')  .........  Vertical text alignment                                                             
    $GRAFINFO('TXFONT')  .........  Text font                                                                           
    $GRAFINFO('TXPREC')  .........  Text precision                                                                      
    $GRAFINFO('?attr')  ..........  HPLOT/HIGZ attribute (HELP SET for valid names)                                     
    $RGBINFO(icol,'R')  ..........  Weight of Red in color table                                                        
    $RGBINFO(icol,'G')  ..........  Weight of Green in color table                                                      
    $RGBINFO(icol,'B')  ..........  Weight of Blue in color table                                                       
    $CUT(n)  .....................  Cut expression $n                                                                   
    $CUTEXPAND(string)  ..........  Replace $n in the (quoted) string by $CUT(n)                                        


Last update: 96/05/24 17.24
Olivier.Couet@Cern.Ch