Index: trunk/SophyaLib/Manual/piahelp.tex
===================================================================
--- trunk/SophyaLib/Manual/piahelp.tex	(revision 3817)
+++ trunk/SophyaLib/Manual/piahelp.tex	(revision 3839)
@@ -12,4 +12,5 @@
 \item {\bf Func Plot }  (p. \pageref{FuncZPlot}) 
 \item {\bf Graphic-Elts }  (p. \pageref{GraphicZElts}) 
+\item {\bf GraphicExport }  (p. \pageref{GraphicExport}) 
 \item {\bf Graphics }  (p. \pageref{Graphics}) 
 \item {\bf Obj. Display }  (p. \pageref{ObjZZDisplay}) 
@@ -107,5 +108,5 @@
 saveall & p. \pageref{saveall}  & savefits & p. \pageref{savefits}  & savelist & p. \pageref{savelist}  \\  
 saveobjs & p. \pageref{saveobjs}  & saveppf & p. \pageref{saveppf}  & scanfits & p. \pageref{scanfits}  \\  
-swfitstable & p. \pageref{swfitstable}  & vecfrascii & p. \pageref{vecfrascii}  & writefits & p. \pageref{writefits} \\  
+swfitstable & p. \pageref{swfitstable}  & vecfrascii & p. \pageref{vecfrascii}  & writefits & p. \pageref{writefits}  \\  
 \end{tabular} 
 \end{center} 
@@ -134,9 +135,20 @@
 \begin{tabular}{llllll} 
 addarc & p. \pageref{addarc}  & addarca & p. \pageref{addarca}  & addarrow & p. \pageref{addarrow}  \\  
-addcirc & p. \pageref{addcirc}  & addctext & p. \pageref{addctext}  & addfarc & p. \pageref{addfarc}  \\  
-addfarca & p. \pageref{addfarca}  & addfcirc & p. \pageref{addfcirc}  & addfoval & p. \pageref{addfoval}  \\  
-addfpoly & p. \pageref{addfpoly}  & addfrect & p. \pageref{addfrect}  & addline & p. \pageref{addline}  \\  
-addmarker & p. \pageref{addmarker}  & addoval & p. \pageref{addoval}  & addpoly & p. \pageref{addpoly}  \\  
-addrect & p. \pageref{addrect}  & addtext & p. \pageref{addtext}  &   &   \\  
+addaxelabels & p. \pageref{addaxelabels}  & addcirc & p. \pageref{addcirc}  & addctext & p. \pageref{addctext}  \\  
+addfarc & p. \pageref{addfarc}  & addfarca & p. \pageref{addfarca}  & addfcirc & p. \pageref{addfcirc}  \\  
+addfoval & p. \pageref{addfoval}  & addfpoly & p. \pageref{addfpoly}  & addfrect & p. \pageref{addfrect}  \\  
+addline & p. \pageref{addline}  & addmarker & p. \pageref{addmarker}  & addoval & p. \pageref{addoval}  \\  
+addpoly & p. \pageref{addpoly}  & addrect & p. \pageref{addrect}  & addtext & p. \pageref{addtext}  \\  
+addtitle & p. \pageref{addtitle}  & setaxelabels & p. \pageref{setaxelabels}  & settitle & p. \pageref{settitle}  \\  
+\end{tabular} 
+\end{center} 
+\vspace{6mm} 
+\begin{center} 
+ \rule{2cm}{0.5mm} \makebox[60mm]{{ \bf GraphicExport } help group} \rule{2cm}{0.5mm} \\ 
+\vspace{3mm} 
+\begin{tabular}{llllll} 
+imagcmap2eps & p. \pageref{imagcmap2eps}  & imagcmap2ps & p. \pageref{imagcmap2ps}  & psclosefile & p. \pageref{psclosefile}  \\  
+psgetfilename & p. \pageref{psgetfilename}  & pssetfilename & p. \pageref{pssetfilename}  & w2eps & p. \pageref{w2eps}  \\  
+w2ps & p. \pageref{w2ps}  & wdg2rgb & p. \pageref{wdg2rgb}  & win2rgb & p. \pageref{win2rgb}  \\  
 \end{tabular} 
 \end{center} 
@@ -147,11 +159,8 @@
 \begin{tabular}{llllll} 
 PIConsole & p. \pageref{PIConsole}  & PIDraw3DWdg & p. \pageref{PIDraw3DWdg}  & PIImage & p. \pageref{PIImage}  \\  
-PIScDrawWdg & p. \pageref{PIScDrawWdg}  & Windows & p. \pageref{Windows}  & addaxelabels & p. \pageref{addaxelabels}  \\  
-addtitle & p. \pageref{addtitle}  & drpanel & p. \pageref{drpanel}  & graphicatt & p. \pageref{graphicatt}  \\  
-imagcmap2eps & p. \pageref{imagcmap2eps}  & imagcmap2ps & p. \pageref{imagcmap2ps}  & newwin & p. \pageref{newwin}  \\  
-psclosefile & p. \pageref{psclosefile}  & psgetfilename & p. \pageref{psgetfilename}  & pssetfilename & p. \pageref{pssetfilename}  \\  
-setaxelabels & p. \pageref{setaxelabels}  & setaxesatt & p. \pageref{setaxesatt}  & setinsetlimits & p. \pageref{setinsetlimits}  \\  
-settitle & p. \pageref{settitle}  & stacknext & p. \pageref{stacknext}  & w2eps & p. \pageref{w2eps}  \\  
-w2ps & p. \pageref{w2ps}  & zone & p. \pageref{zone}  &   &   \\  
+PIScDrawWdg & p. \pageref{PIScDrawWdg}  & Windows & p. \pageref{Windows}  & drpanel & p. \pageref{drpanel}  \\  
+graphicatt & p. \pageref{graphicatt}  & newwin & p. \pageref{newwin}  & setaxesatt & p. \pageref{setaxesatt}  \\  
+setdefafsz & p. \pageref{setdefafsz}  & setinsetlimits & p. \pageref{setinsetlimits}  & stacknext & p. \pageref{stacknext}  \\  
+zone & p. \pageref{zone}  &   &  &  &   \\  
 \end{tabular} 
 \end{center} 
@@ -165,6 +174,6 @@
 imagnav & p. \pageref{imagnav}  & nt2d & p. \pageref{nt2d}  & nt2dci & p. \pageref{nt2dci}  \\  
 nt2dcn & p. \pageref{nt2dcn}  & nt2dvec & p. \pageref{nt2dvec}  & nt3d & p. \pageref{nt3d}  \\  
-ntcont & p. \pageref{ntcont}  & surf & p. \pageref{surf}  & textdrawer & p. \pageref{textdrawer}  \\  
-vecplot & p. \pageref{vecplot}  &   &  &  &   \\  
+ntcont & p. \pageref{ntcont}  & pirgbdisp & p. \pageref{pirgbdisp}  & surf & p. \pageref{surf}  \\  
+textdrawer & p. \pageref{textdrawer}  & vecplot & p. \pageref{vecplot}  &   &   \\  
 \end{tabular} 
 \end{center} 
@@ -343,5 +352,6 @@
 \end{verbatim} 
 \subsection{CxxExecutorCmd} \label{CxxExecutorCmd} 
-\noindent 
+Commands for c++ codelt on the fly compilation and execution 
+ \\[2mm]  \noindent 
 \piacommand{c++args} \label{cZZargs} 
 \begin{verbatim} 
@@ -463,5 +473,9 @@
 \end{verbatim} 
 \subsection{Expr. Plotting} \label{ExprZZPlotting} 
-\noindent 
+Compute and plot various (c-syntax) expressions of objects 
+Objects are seen as list of structures (n-tuples)
+See ObjectExpressions help item for a list of structure
+fields for the different classes managed by piapp 
+ \\[2mm]  \noindent 
 \piahelpitem{ObjectExpressions} \label{ObjectExpressions} 
 \begin{verbatim} 
@@ -508,8 +522,6 @@
 \piacommand{fillgd2} \label{fillgd2} 
 \begin{verbatim} 
-Creates and Fills a GeneralFitData with 
-            (X=f(Object), Y=g(...), Z=h(...)) ErrZ=k(...)
- Usage: fillgd2 namegfd nameobj f_X() g_Y() h_Z() k_ErrZ() 
-                                [Cut() loop_param]
+Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), Z=h(...)) ErrZ=k(...)
+ Usage: fillgd1 namegfd nameobj f_X() g_Y() h_Z() k_ErrZ() [Cut() loop_param]
   Related commands: ntloop fillnt ObjectExpressions ...
 \end{verbatim} 
@@ -517,16 +529,13 @@
 \begin{verbatim} 
 Fills a Matrix M(Line=g_Y(Object)+0.5, Col=f_X(Object)+0.5)) =  h_V(Object) 
- Usage: fillmtx namevec nameobj f_X() g_Y() h_V() 
-                [Cut() graphic_attributes loop_param]
+ Usage: fillmtx namevec nameobj f_X() g_Y() h_V() [Cut() graphic_attributes loop_param]
   Related commands: fillvec fillnt ObjectExpressions ...
 \end{verbatim} 
 \piacommand{fillnt} \label{fillnt} 
 \begin{verbatim} 
-Creates and Fills an NTuple(x,y,z,t) with 
-            (X=f(Object),Y=g(...),Z=h(...),T=k(...))
+Creates and Fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))
  Usage: fillnt nameobj f_X() g_Y() h_Z() k_T() [Cut() nameNt loop_param]
   Related commands: ntloop plot2d projh1d projh2d projprof 
-  Related commands: fillvec fillmtx ntloop exptovec fillgd1 
-                    fillgd2 ObjectExpressions ...
+  Related commands: fillvec fillmtx ntloop exptovec fillgd1 fillgd2 ObjectExpressions ...
 \end{verbatim} 
 \piacommand{fillvec} \label{fillvec} 
@@ -554,9 +563,8 @@
 \begin{verbatim} 
 Loops over an Object NTupleInterface calling a function from a C-file 
-and optionaly fills an NTuple(x,y,z,t) with 
-     (X=f(Object),Y=g(...),Z=h(...),T=k(...))
+and optionaly fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))
  Usage: ntloop nameobj CFileName FuncName [NtupleName loop_param]
-  Related commands: fillvec fillmtx fillnt fillgd1 fillgd2 
-  Related commands: exptovec ntexpcfile fillnt ObjectExpressions ...
+  Related commands: fillvec fillmtx fillnt fillgd1 fillgd2 exptovec ObjectExpressions ...
+  Related commands: ntexpcfile fillnt
 \end{verbatim} 
 \piacommand{plot2d} \label{plot2d} 
@@ -575,6 +583,5 @@
 \begin{verbatim} 
 Plots (2D) Y=g(Object) vs. X=f(Object) with error bars eX/Y=f_ErrX/Y(Object) 
- Usage: plot2de nameobj f_X() g_Y() f_ErrX() f_ErrY() [f_Cut() 
-                graphic_attributes loop_param]
+ Usage: plot2de nameobj f_X() g_Y() f_ErrX() f_ErrY() [f_Cut() graphic_attributes loop_param]
   Related commands: plot2d plot2dw plot3d ObjectExpressions ...
 \end{verbatim} 
@@ -612,6 +619,5 @@
 \begin{verbatim} 
 Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a 2D histogram 
- Usage: projh2d nameh2d nameobj f_X() g_Y() [h_WT()=1. Cut() 
-                graphic_attributes loop_param]
+ Usage: projh2d nameh2d nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]
    Histo2D nameh2d is created if necessary 
   Related commands: projh1d projprof ObjectExpressions ...
@@ -620,11 +626,10 @@
 \begin{verbatim} 
 Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a profile histogram 
- Usage: projprof nameprof nameobj f_X() g_Y() [h_WT()=1. Cut() 
-                 graphic_attributes loop_param]
+ Usage: projprof nameprof nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]
    HProf nameprof is created if necessary 
   Related commands: projh1d projh2d ObjectExpressions ...
 \end{verbatim} 
 \subsection{External Modules} \label{ExternalZModules} 
-Dynamic load (shared object modules) management command group 
+Dynmamic shared library load (DLL) and external (add-on) module management 
  \\[2mm]  \noindent 
 \piacommand{call} \label{call} 
@@ -768,7 +773,9 @@
 \begin{verbatim} 
 savefits: alias for writefits 
+
 \end{verbatim} 
 \piacommand{savelist} \label{savelist} 
 \begin{verbatim} 
+
  Usage: savelist objname1 [objname2 ...] filename
   Related commands: saveobj openppf
@@ -984,6 +991,6 @@
 \begin{verbatim} 
 Displays a function z=f(x,y) from a C-file (Fills a matrix with function values)
- Usage: func2dff C-FileName FunctionName xmin xmax nptx ymin ymax npty [gr_att]
-Related commands: func funcff func2d 
+ Usage: func2dff C-FileName FunctionName xmin xmax nptx ymin ymax npty [graphic_attributes]
+  Related commands: func funcff func2d 
 \end{verbatim} 
 \piacommand{funcff} \label{funcff} 
@@ -994,5 +1001,6 @@
 \end{verbatim} 
 \subsection{Graphic-Elts} \label{GraphicZElts} 
-\noindent 
+Simple graphic objects (lines, circles, text...) creation and display 
+ \\[2mm]  \noindent 
 \piacommand{addarc} \label{addarc} 
 \begin{verbatim} 
@@ -1025,4 +1033,8 @@
   Related commands: addline addtext addrect addfrect 
        addmarker addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt
+\end{verbatim} 
+\piacommand{addaxelabels} \label{addaxelabels} 
+\begin{verbatim} 
+Set the X and Y axis labels for the current 2D graphic object   alias for setaxelabels 
 \end{verbatim} 
 \piacommand{addcirc} \label{addcirc} 
@@ -1177,4 +1189,72 @@
       addcirc addfcirc addarc addfrac addpoly addfpoly settitle graphicatt
 \end{verbatim} 
+\piacommand{addtitle} \label{addtitle} 
+\begin{verbatim} 
+Set the title string (top title / bottom title) 
+   alias for settitle 
+\end{verbatim} 
+\piacommand{setaxelabels} \label{setaxelabels} 
+\begin{verbatim} 
+Set the X and Y axis labels for the current 2D graphic object 
+
+  Usage: setaxelabels xLabel yLabel [ColorFntAtt]
+  Related commands: settitle addtext graphicatt
+\end{verbatim} 
+\piacommand{settitle} \label{settitle} 
+\begin{verbatim} 
+Set the title string (top title / bottom title) for the current graphic object
+  Usage: settitle TopTitle [BottomTitle] [fontAtt]
+  Related commands: addtext graphicatt
+\end{verbatim} 
+\subsection{GraphicExport} \label{GraphicExport} 
+Commands to export graphics (widget/windows in postscript or PI-RGB image files 
+ \\[2mm]  \noindent 
+\piacommand{imagcmap2eps} \label{imagcmap2eps} 
+\begin{verbatim} 
+imagcmap2eps: Current Image+ColorMap To EncapsulatedPostScript 
+Usage: imagcmap2eps EPSFileName
+\end{verbatim} 
+\piacommand{imagcmap2ps} \label{imagcmap2ps} 
+\begin{verbatim} 
+w2ps: Current Image+ColorMap To PostScript 
+Usage: imagcmap2ps 
+\end{verbatim} 
+\piacommand{psclosefile} \label{psclosefile} 
+\begin{verbatim} 
+psclosefile: close current postscript file 
+Usage: w2psclosefile 
+\end{verbatim} 
+\piacommand{psgetfilename} \label{psgetfilename} 
+\begin{verbatim} 
+psgetfilename: Prints current PostScript file name 
+Usage: psgetfilename 
+\end{verbatim} 
+\piacommand{pssetfilename} \label{pssetfilename} 
+\begin{verbatim} 
+pssetfilename: Sets current PostScript file name
+Usage: pssetfilename FileName 
+\end{verbatim} 
+\piacommand{w2eps} \label{w2eps} 
+\begin{verbatim} 
+w2eps: Current Window To EncapsulatedPostScript 
+Usage: w2eps EPSFileName
+\end{verbatim} 
+\piacommand{w2ps} \label{w2ps} 
+\begin{verbatim} 
+w2ps: Current Window To PostScript 
+Usage: w2ps 
+\end{verbatim} 
+\piacommand{wdg2rgb} \label{wdg2rgb} 
+\begin{verbatim} 
+ Export the current widget to a PI-RGB file (.rgb)
+ Usage : wdg2rgb PI-RGB_FileName  (.rgb)
+ Related commands: pirgbdisp  win2rgb 
+\end{verbatim} 
+\piacommand{win2rgb} \label{win2rgb} 
+\begin{verbatim} 
+ Export the current window to a PI-RGB file (.rgb)
+ Usage : win2rgb PI-RGB_FileName  (.rgb)
+ Related commands: pirgbdisp  wdg2rgb 
+\end{verbatim} 
 \subsection{Graphics} \label{Graphics} 
 Basic graphics and object display commands 
@@ -1195,5 +1275,5 @@
 o <Ctl>E : Command editing -> Goto the end of line 
 o <Ctl>K : Command editing -> Clear to the end of line 
-o <Ctl>C : Stop/break command execution by PIACmd/Commander
+o <Ctl>C : Stop/break command execution by PIACmd/Commander 
 o Cursor left,right : Command editing -> Move cursor 
 o Cursor Up,Down : recall command from history buffer 
@@ -1239,6 +1319,5 @@
 o <Alt>D : Shows the drawer manipulation pop-up menu 
 o <Alt>V : Copy/Paste / Text paste at the current cursor position 
-o <Alt>C : Copy/Paste / Copies the selected region content as text 
-                        in the copy/paste buffer 
+o <Alt>C : Copy/Paste / Copies the selected regions content as text in the copy/paste buffer 
 o <Alt>X : Show/Hide the Cut Window 
 o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) 
@@ -1296,13 +1375,4 @@
 
   Related commands: newwin zone stacknext graphicatt setinsetlimits
-\end{verbatim} 
-\piacommand{addaxelabels} \label{addaxelabels} 
-\begin{verbatim} 
-Set the X and Y axis labels for the current 2D graphic object   alias for setaxelabels 
-\end{verbatim} 
-\piacommand{addtitle} \label{addtitle} 
-\begin{verbatim} 
-Set the title string (top title / bottom title) 
-   alias for settitle 
 \end{verbatim} 
 \piacommand{drpanel} \label{drpanel} 
@@ -1348,5 +1418,5 @@
                 midas_pastel midas_heat midas_rainbow3 midas_bluered
                 midas_bluewhite midas_redwhite
-                multicol16 multicol64
+                multicol16 multicol64 rgb216cm rgb512cm rgb4096cm
 >> revcmap : reverse colorMap
 >> ZoomFactors :  zoomxN   ex: zoomx1 zoomx2 zoomx3 ...
@@ -1354,8 +1424,10 @@
 >> imagecenter=ix,iy : Position the image in widget
 >> lut=ltyp,min,max : Sets LUT type and min/max
-                   (ltyp=lin/log/sqrt/square)
+                   (ltyp=lin/log/sqrt/square/rgb)
 >> autolut=alt[,ns[,min,max]] : AutoLut method selection 
                    (alt=minmax/meansig/hispeak/histail/hisrng)
 >> invx,invy,exchxy : image axes configuration
+>> cdreal,cdimag,cdphase,cdmod,cdmod2 (default=cdmod): Displayed value
+     for complex arrays (real/imaginary part, phase, module, module^2)
 --- General purpose options:
 >> stat,stats / nsta,nstat,nostat,nostats : Toggle statistic display
@@ -1367,14 +1439,4 @@
    Related commands: setaxesatt setinsetlimits 
 \end{verbatim} 
-\piacommand{imagcmap2eps} \label{imagcmap2eps} 
-\begin{verbatim} 
-imagcmap2eps: Current Image+ColorMap To EncapsulatedPostScript 
-Usage: imagcmap2eps EPSFileName
-\end{verbatim} 
-\piacommand{imagcmap2ps} \label{imagcmap2ps} 
-\begin{verbatim} 
-w2ps: Current Image+ColorMap To PostScript 
-Usage: imagcmap2ps 
-\end{verbatim} 
 \piacommand{newwin} \label{newwin} 
 \begin{verbatim} 
@@ -1383,26 +1445,4 @@
     Usage: newwin [nx ny [sizeX sizeY]] 
   Related commands: zone
-\end{verbatim} 
-\piacommand{psclosefile} \label{psclosefile} 
-\begin{verbatim} 
-psclosefile: close current postscript file 
-Usage: w2psclosefile 
-\end{verbatim} 
-\piacommand{psgetfilename} \label{psgetfilename} 
-\begin{verbatim} 
-psgetfilename: Prints current PostScript file name 
-Usage: psgetfilename 
-\end{verbatim} 
-\piacommand{pssetfilename} \label{pssetfilename} 
-\begin{verbatim} 
-pssetfilename: Sets current PostScript file name
-Usage: pssetfilename FileName 
-\end{verbatim} 
-\piacommand{setaxelabels} \label{setaxelabels} 
-\begin{verbatim} 
-Set the X and Y axis labels for the current 2D graphic object 
-
-  Usage: setaxelabels xLabel yLabel [ColorFntAtt]
-  Related commands: settitle addtext graphicatt
 \end{verbatim} 
 \piacommand{setaxesatt} \label{setaxesatt} 
@@ -1424,10 +1464,18 @@
          fixedfontsize: Use font size attribute (BaseDrawer) 
 >> Scale type: linx liny logx logy -> Lin/Log Scales for 2D plots 
->> AxeDirection: Reverse X/Y axe drawing direction
-         revax revay axelr axedu (or axerl/axeud -> revax/revay)
+>> AxeDirection: Reverse X/Y axe drawing direction 
+         revax revay axelr axedu (or axerl/axeud -> revax/revay) 
 >> xylimits=xmin,xmax,ymin,ymax  -> Forces X-Y limits in 2-D plots 
 >> defdrrect=xmin,xmax,ymin,ymax -> Defines drawing rectangle 2-D plots 
           The rectangle is defined as a fraction of the widget size
 
+\end{verbatim} 
+\piacommand{setdefafsz} \label{setdefafsz} 
+\begin{verbatim} 
+Define the Global Default value for PIDrawer AutoFontSize Fraction 
+ Usage: setdefafsz value 
+   0<value<1 : default PIDrawer font size, as a fraction of the widget size
+   Its value can be set by the PIDEFAFSZFRAC environment variable 
+   See also graphic attributes : fixedfontsize autofontsize=frac 
 \end{verbatim} 
 \piacommand{setinsetlimits} \label{setinsetlimits} 
@@ -1439,24 +1487,8 @@
   Related commands: graphicatt /inset
 \end{verbatim} 
-\piacommand{settitle} \label{settitle} 
-\begin{verbatim} 
-Set the title string (top title / bottom title) for the current graphic object
-  Usage: settitle TopTitle [BottomTitle] [fontAtt]
-  Related commands: addtext graphicatt
-\end{verbatim} 
 \piacommand{stacknext} \label{stacknext} 
 \begin{verbatim} 
 Displays the next widget on stack window 
   Usage: stacknext
-\end{verbatim} 
-\piacommand{w2eps} \label{w2eps} 
-\begin{verbatim} 
-w2eps: Current Window To EncapsulatedPostScript 
-Usage: w2eps EPSFileName
-\end{verbatim} 
-\piacommand{w2ps} \label{w2ps} 
-\begin{verbatim} 
-w2ps: Current Window To PostScript 
-Usage: w2ps 
 \end{verbatim} 
 \piacommand{zone} \label{zone} 
@@ -1467,5 +1499,6 @@
 \end{verbatim} 
 \subsection{Obj. Display} \label{ObjZZDisplay} 
-\noindent 
+Most useful commands to view and display objects  
+ \\[2mm]  \noindent 
 \piacommand{bargraph} \label{bargraph} 
 \begin{verbatim} 
@@ -1568,4 +1601,11 @@
     labon : put labels for contours 
 \end{verbatim} 
+\piacommand{pirgbdisp} \label{pirgbdisp} 
+\begin{verbatim} 
+Read and display RGB-image object (PIPixRGBArray) from file 
+ Usage : pirgbdisp PI-RGB_FileName [gr_opt] 
+ gr_opt (def=rgb216cm):zoom, rgb4096cm rgb32768cm lut=rgb[,min,max]
+ Related commands: win2rgb wdg2rgb 
+\end{verbatim} 
 \piacommand{surf} \label{surf} 
 \begin{verbatim} 
@@ -1900,6 +1940,5 @@
 \begin{verbatim} 
 Project a map(double) into a local map(double)
- Usage: map2local map(double) localmap(double) nx,ny angleX,angleY phi0,theta0 
-                  [x0,y0] [angle]
+ Usage: map2local map(double) localmap(double) nx,ny angleX,angleY phi0,theta0 [x0,y0] [angle]
    nx,ny: number of pixels in x(col),y(row) direction
           X-axis==phi, Y-axis==theta
@@ -1988,5 +2027,4 @@
 \subsection{SophyaCmd} \label{SophyaCmd} 
 \noindent 
-
 \piacommand{errorellipse} \label{errorellipse} 
 \begin{verbatim} 
@@ -2008,7 +2046,7 @@
  Usage: setprjmoldefval OutOfMapValue 
 \end{verbatim} 
-
 \subsection{pawCmd} \label{pawCmd} 
-\noindent 
+CERN PAW like expression plotting commands  
+ \\[2mm]  \noindent 
 \piacommand{h/2d/geth} \label{hZ2dZgeth} 
 \begin{verbatim} 
Index: trunk/SophyaLib/Manual/sophya.tex
===================================================================
--- trunk/SophyaLib/Manual/sophya.tex	(revision 3817)
+++ trunk/SophyaLib/Manual/sophya.tex	(revision 3839)
@@ -48,5 +48,5 @@
 \vspace{1cm}
 \begin{center}
-{\bf \Large Sophya Version: 2.2 (V\_Jan2010) }
+{\bf \Large Sophya Version: 2.2 (V\_Sep2010) }
 \end{center}
 \titrebp{1}
@@ -103,6 +103,5 @@
 \subsection{Acknowlegments}
 Many people have contributed to the development SOPHYA and/or the PI library 
-and (s)piapp interactive analysis tool.
-we are grateful to the following people:
+and (s)piapp interactive analysis tool, in particular:
 
 \begin{tabular}{lcl}
@@ -159,5 +158,6 @@
 \item[] {\bf SkyT/} 
 classes for spectral emission and detector frequency response modelling \\
-({\tt SpectralResponse, RadSpectra, BlackBody} \ldots)
+({\tt SpectralResponse, RadSpectra, BlackBody} \ldots). This module needs extensive 
+checking and corrections.
 \item[] {\bf Samba/} Spherical harmonic analysis, noise generators \ldots 
 \end{itemize}
@@ -234,5 +234,5 @@
 \item[] {\bf LUC} {\bf L}ittle {\bf U}niverse {\bf C}alculator is a module containing classes to 
 perform basic computation related to the universe geometry (FRW metric).
-\item[] {\bf PMixer/} skymixer and related programs
+\item[] {\bf PMixer/} skymixer and related programs. This module is {\bf obsolete}.
 \end{itemize}
 
@@ -590,5 +590,5 @@
 PPF format version (currently V3), the file endiannes {\tt (BIG-ENDIAN , LITTLE-ENDIAN)}
 and the file creation date and time. It should be noted that the present SOPHYA version 
-(V=2.1) does not allow updating an existing PPF file.
+(V=2.2) does not allow updating an existing PPF file.
 \item[\rond] A collection of tagged data items and data structuring tags. 
 the PPF tags are one byte (8 bits) long and may be followed by a length information
@@ -847,6 +847,6 @@
 \end{itemize}
  
- \subsection{Random numbers}
- \index{RandomGenerator}
+ \subsection{Pseudo-random number generators}
+ \index{Random numbers}
 \begin{figure}[hbt]
 \dclsbb{ AnyDataObj }{ RandomGeneratorInterface } 
@@ -855,43 +855,92 @@
 \dclsbb{ RandomGeneratorInterface }{ FMTRandGen }
 \end{figure}
-%%   CHECK 
-{\bf \large SECTION A METTRE A JOUR } \\
- The C-functions defined in the file BaseTools/srandgen.h can be used
- for generating sequence of random numbers with different PDF (probability 
- distribution functions : flat, gaussian, poisson \ldots.
- However, we advise to use the {\bf RandomGenerator} class which provides
-can be used in multi-threaded programs. In this case, a different instance of
-the  RandomGenerator class should be created in each thread running in parallel.
-In addition, this class has a PPF handler which saves the complete state of the class and 
-the underlying generatoir to the PPF stream. This can be used to generate very long sequence
-of random numbers, distributed over several runs.
-\begin{verbatim}
-sa_size_t N = 1000;
-Vector vf(2*N), vg(2*N);
-{
-// Instanciate the random generator
-RandomGenerator rg;
-// Generate some sequence of random numbers
-for(sa_size_t i=0; i<N; i++) {
-  vf(i) = rg.Flat01();
-  vg(i) = rg.Gaussian(); 
-  }
-// Save the generator to file rg.ppf
+The {\bf RandomGeneratorInterface } is a pure virtual class which 
+defines the interface for random number generator classes and implements the 
+generation algorithm for few probability distribution functions:
+flat, Gaussian, Poisson, Exponential, 2D gaussian \ldots. The pure virtual method
+{\tt Next() } should be implemented by inheriting  classes.
+ \index{RandomGeneratorInterface}
+
+Several implementations using different pseud-random generators are provided by SOPHYA:
+\begin{enumerate}
+\item {\bf DR48RandGen} uses the well known {\tt drand48() }  pseudo-random
+sequence generator. It implements also the possibility of initializing the generator state, as well saving and 
+restoring the generator state through the SOPHYA PPF mechanism. The  {\tt drand48() }  and thus 
+{\bf DR48RandGen} objects are not NOT thread safe. Different instances of {\bf DR48RandGen}  share 
+the same underlying 48 bit state.
+\item {\bf ThSDR48RandGen} is a thread safe version of DR48RandGen. Using the constructor flag, in can 
+be instanciated to reproduce the non thread-safe behaviour of DR48RandGen. 
+Several instances of this class can be used in different threads without the risk of 
+corrupting the internal state of the drand48() generator. However, in multi-thread applications,
+ there is no guarantee to obtain the same sequence of numbers in each thread.  
+\index{ ThSDR48RandGen} 
+\item {\bf FMTRandGen } ids an implementation of RandomGeneratorInterface using 
+the SIMD-oriented Fast Mersenne Twister (SFMT). It uses the code developed by 
+Mutsuo Saito and Makoto Matsumoto from Hiroshima University. For more information on this 
+method, refer to \\
+\href{http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html} 
+{ttp://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html} \\
+The instances of FMTRandGen are thread safe, each instance having its own internal state 
+and produces an independent sequence of random numbers. 
+\index{FMTRandGen }
+\end{enumerate}
+
+A number of c-like functions are defined in the file BaseTools/srandgen.h and can be used 
+to generate random sequences: \\
+{\tt drand01() , drandpm1() ,  GaussianRand() , PoissonRand \ldots} \\
+These functions use a global instance  of RandomGeneratorInterface class which can be 
+defined and accessed through the static methods:\\
+\hspace*{5mm} { \tt RandomGeneratorInterface* RandomGeneratorInterface::GetGlobalRandGenP() } \\
+\hspace*{5mm} { \tt void SetGlobalRandGenP(RandomGeneratorInterface* rgp) } \\
+
+In multi-threaded programs, an instance of ThSDR48RandGen or FMTRandGen 
+should be created in each thread running in parallel and needing to generate random sequences. 
+All the three classes discussed here implement the automatic initialization method defined 
+{\tt (AutoInit() ) } defined in the interface class and implement a number of other initialization
+methods {\tt (SetSeed() )}.  SOPHYA provides also PPF handlers for these classes 
+which can be used to save the complete  state of the object and the underlying generator to PPF files. 
+The generator object state can be restored subsequently from the PPF file. This feature can be used 
+to generate very long sequence of random numbers, distributed over several runs.
+The example below illustrates the use of the generator classes and state save/restore 
+through PPF files:
+\begin{enumerate} 
+\item We create and use a {\bf ThSDR48RandGen} object in a first program. Its sate is saved 
+to the PPF file rg.ppf at some point in the program. 
+\begin{verbatim}
+// ------ program A 
+// A.1- Create a thread safe generator based on drand48() 
+ThSDR48RandGen rg;
+// A.2- Auto initilize its state (using the system time) 
+rg.AutoInit();
+// A.3- compute and print a smal sequence of random numbers 
+int N = 10;
+for(int i=0; i<N; i++) 
+  cout << " I=" << i << "  rand_flat01= " << rg.Flat01() 
+       << " rand.gaussian= " << rg.Gaussian() << endl;
+// A.4- Save the generator state for subsequent use
 POutPersist po("rg.ppf");
-po << rg;  
-}
-// ....
-{
-// Create and read the generator from file rg.ppf
-RandomGenerator rg;
-PInPersist pi("rg.ppf");
-pi >> rg;  
-// Continue the generation sequence
-for(sa_size_t i=N; i<2*N; i++) {
-  vf(i) = rg.Flat01();
-  vg(i) = rg.Gaussian(); 
-  }
-}
-\end{verbatim}
+po << rg;
+// A.5- compute and print a second sequence of random numbers 
+for(int i=0; i<N; i++) 
+  cout << "++ I=" << i+N << "  rand_flat01= " << rg.Flat01() 
+       << " rand.gaussian= " << rg.Gaussian() << endl;
+\end{verbatim}
+
+\item The pseudo-random generator object state is restored in a second program from the previously created 
+PPF file, before being used :
+ \begin{verbatim}  
+// ------ program B
+// B.1- Create and initialize the generator from the previously saved state
+ThSDR48RandGen rgr;
+PInPersist pin("rg.ppf");
+pin >> rgr;
+int N = 10;
+// B.2- Compute and print a sequence of random number, 
+//      should be compared to the sequance A.5
+for(int i=0; i<N; i++) 
+  cout << "-- I=" << i << "  rand_flat01= " << rgr.Flat01() 
+       << " rand.gaussian= " << rgr.Gaussian() << endl;
+\end{verbatim}
+\end{enumerate}
 
 %%%%%%%%%%%%
@@ -1161,5 +1210,6 @@
 \end{verbatim}
 
-\subsection{Input, Output}
+
+\subsection{Persistence, IO}
 Arrays can easily be saved to, or restored from files in different formats.
 SOPHYA library can handle array I/O to ASCII formatted files, to PPF streams, 
@@ -1370,6 +1420,17 @@
 \noindent {\bf Shared data access :} It is possible to access a complex array 
 elements (real and imaginary parts) through the template functions defined 
-in {\tt arrctcast.h} and discussed above. The example below shows how to use 
-these functions.
+in {\tt arrctcast.h} and discussed above. Four specific template functions are 
+defined for shared data access to complex arrays: 
+\begin{itemize}
+\item {\bf SDRealPart } return a float/double TArray, when applied to an
+array with complex elements, corresponding the the {\bf real} part of the complex values.
+\item {\bf SDImagPart } return a float/double TArray, when applied to an
+array with complex elements, corresponding the the {\bf imaginary} part of the complex values.
+\item {\bf ArrCastC2R } return a float/double TArray, when applied to an
+array with complex elements. The data is shared between the two arrays, the real array 
+containing real and imaginary parts as successive elements. 
+\item {\bf ArrCastR2C } return a complex valued TArray, when applied to a float/double array. 
+\end{itemize} 
+The example below shows how to use these functions:
 
 \begin{verbatim}
@@ -1497,4 +1558,54 @@
 \end{verbatim}
 
+
+\subsection{Special Square Matrices (SSQM) }
+SOPHYA V2.2 introduces new classes for handling special square matrices (diagonal, symmetric, triangular \ldots).
+The figure below shows the corresponding class hierarchy:
+\begin{figure}[hbt]
+\dclsccc{AnyDataObj}{\tcls{SpecialSquareMatrix}}{ \tcls{ DiagonalMatrix } }
+\dclsc{ \tcls{ LowerTriangularMatrix } } 
+\dclsc{ \tcls{ SymmetricMatrix } } 
+\end{figure}
+
+\index{ \tcls{DiagonalMatrix} }
+\index{ \tcls{SymmetricMatrix} }
+\index{ \tcls{TriangularMatrix} }
+
+Theses classes provides methods similar to TArray/TMatrix objects for manipulating these special kind of matrices.
+However, no sub-matrix extraction method is provided. The  following features are currently implemented:
+\begin{itemize}
+\item These classes implements reference sharing and behave in a way similar to TArray objects. The copy 
+constructor shares the data, while the equal operator (=) performs an element by element copy. 
+\item The {\bf FIO\_SpecialSquareMatrix$<$T$>$ } manages the persistence (I/O) in PPF format for these classes. 
+\item Constructor from and conversion to general {\bf TMatrix$<$T$>$ } objects. 
+ Non relevant elements are ignored when constructing from a general matrix and the special square matrix can be 
+converted to the general matrix through the {\tt ConvertToStdMatrix () }.
+\item Definition of element access operator {\tt mx(r,c) } as well as global assignment operator {\tt mx = a; mxb=mxa; }.
+operator {\tt mx[k] } can be used to access the non zero element k. 
+\item Addition, subtraction of a constant, multiplication or division by a constant, as well as  
+\item Element by element addition, subtraction, multiplication and division methods between same type of SSQM 
+matrices. As in the cases of general matrices, the four binary operators ( + , - , \&\& ,   /) are overloaded to perform 
+these operations. 
+\item Matrix multiplication operation between same type SSQM objects or between a general matrix and an SSQM
+object is defined through the methods: \\
+{\\ Multiply() , MultiplyXG(), MultiplyGX(),  X=D,S,T } \\
+The binary multiplication operator ( * ) is then overloaded to perform matrix multiplication.   
+\end{itemize}
+The sample code below illustrates the use of these special matrices:
+\begin{verbatim} 
+// Create and initialize a diagonal matrix
+DiagonalMatrix<double> diag(3);
+diag(0,0)=1.;  diag(1,1)=2.;  diag(2,2)=3.;
+// use of multiplication by a constant operator
+diag *= 10.;
+// check the diagonal matrix
+cout << diag << diag.ConvertToStdMatrix() << endl;
+// define and initialize a general matrix
+TMatrix<double> mx(3,3);
+mx=RegularSequence();
+cout << mx;
+// check the result of a matrix mutiplication
+cout << mx*diag;
+\end{verbatim} 
 
 \newpage 
@@ -2473,9 +2584,11 @@
 transforms on double precision data might be available.
 
+\section{Multi-thread and parallel programming with Sophya} 
+ 
 \newpage
 \section{Building and installing Sophya}
 \subsection{Supported platforms}
-Presently, the Sophya library has been tested with the following
-compiler/platform pairs:
+Presently, the SOPHYA and PI libraries and tools has been compiled and tested with 
+the following compiler/platform pairs:
 
 \begin{center}
@@ -2484,15 +2597,19 @@
 OS & compiler \\
 \hline
-Linux (32 bits)          &     g++  (3.x \, 4.0)  \\
-Linux  (SCL, 32)          &     icc - Intel compiler (9.0)   \\
-Linux  (SCL, 64)          &     g++  3.3 \, 3.4  \\
-MacOSX/Darwin (PowerPC) 10.3 \, 10.4  &         g++ (3.3  \, 4.0)\\
-MacOSX/Darwin (Intel) 10.4  &         g++ (4.0)\\
-HP/Compaq/DEC Tru64 ( OSF1)  &     cxx  (6.1  6.3)  \\
-SGI IRIX64       &     CC   (7.3)   \\
-IBM AIX (5.3)      &     xlC   (8.0)   \\
+Linux  (SL5, 64)          &     g++  4.1  \\
+Linux  (SL5, 64)          &     icc - Intel compiler (10.1)   \\
+Linux Ubuntu             &    g++ 4.4 \\
+MacOSX/Darwin 10.3 (PowerPC) \, 10.4  (Intel) &   Apple g++ 3.3  \, 4.0 \\
+MacOSX/Darwin 10.5 (Intel)  &  Apple   g++ 4.0 \\
+MacOSX/Darwin 10.6 (Intel)   Snow Leopard &  Apple  g++ 4.2 \\
+IBM AIX 5.3      &     xlC   8.0   \\
+HP/Compaq/DEC Tru64 ( OSF1)  &     cxx  6.1 \, 6.3  \\
 \hline
 \end{tabular}
 \end{center}
+
+The SOPHYA and PI library and associated tools (spiapp, runcxx \ldots) were ported and tested 
+on the Silicon Graphics (SGI)  IRIX system and the corresponding native c++ compiler ( IRIX64, CC  7.3 ),
+up to SOPHYA V2.1 (V\_Nov2007). 
 
 \subsection{Library and makefile structure}
@@ -2544,5 +2661,5 @@
 configure [-sbase SOPHYABASE] [-scxx SOPHYACXX] [-incln] 
   [-minc mymake.inc]  [-compopt 'cc/cxxOptions'] 
-  [-arch64] [-sasz64] [-nofpic] [-nothsafe] [-boundcheck] [-sodebug]
+  [-arch64] [-arch32] [-sasz64] [-ldble128] [-nofpic] [-nothsafe] [-boundcheck] [-sodebug]
   [-extp dir1 -extp dir2 ...] [-extip dir1 -extip dir2 ... ] [-extlp dir1 -extlp dir2 ... ]
   [-noextlib] [-noext fits] [-noext fftw] [-noext lapack] [-noext astro]
@@ -2560,5 +2677,17 @@
 \$SOPHYABASE/include/sophyamake.inc. If {\tt -minc} is not specified, one of
 the files in BuildMgr/ directory is selected, based on the system name and the 
-compiler {\tt  Linux\_g++\_make.inc , OSF1\_cxx\_make.inc , AIX\_xlC\_make.inc \ldots}
+compiler {\tt  Linux\_g++\_make.inc , OSF1\_cxx\_make.inc , AIX\_xlC\_make.inc \ldots} 
+\item[] -compopt : additional compiler options \\[2mm]
+\item[] -arch64 : select/force 64 bits compilation mode. This is the default on 64 bits Linux systems and AIX.
+\item[] -arch32  : select/force 32 bits compilation mode. useful on 64 bits Linux systems or AIX
+\item[] -sasz64 : select 8 byte (64 bits) size for array indices, useful if you need to allocate an manipulate 
+large arrays, with more than $2^32$ elements along a single array dimension.
+\item[] -ldble128 : set the flags activating {\tt long double} (128 bits) arrays. \\[2mm]
+\item[] -nofpic : disable -fPIC (Position Independent Code) generation flag 
+\item[] -nothsafe : disable thread-safety procedures in SOPHYA : reference sharing \ldots. 
+ ( activate the conditional compilation flag {\tt SO\_NOTHSAFE } )
+\item[] -boundcheck : compile SOPHYA and bound checking activated when accessing array elements
+( activate conditional compilation flag {\tt SO\_BOUNDCHECKING } )
+\item[] -sodebug : activate conditional compilation flag {\tt SOPHYA\_DEBUG }  \\[2mm]
 \item[] -extp : Adds the specied path to the search path of the external libraries 
 include files and archive library.
@@ -2569,5 +2698,5 @@
 \item[] -noextlib : Disable compiling of modules referencing external libraries.
 \item[] -noext : Disable compiling of the specified module (with reference to external
-library : {\tt -noext fits , -noext fftw \ldots }
+library : {\tt -noext fits , -noext fftw  -noext lapack -noext astro } \\[2mm]
 \item[] -usefftw2: Use FFTW V2 instead of the default FFTW V3 - A preprocessor
 flag will be defined in sspvflags.h 
@@ -2588,6 +2717,6 @@
 The configure script performs the following actions :
 \begin{enumerate}
-\item Creating directory tree under {\tt \$SOPHYABASE }
-\item Cpoying include files (or creating symbolic) in {\tt \$SOPHYABASE/include/ }
+\item Creates directory tree under {\tt \$SOPHYABASE }
+\item Copy include files to {\tt \$SOPHYABASE/include/ }  (or creates symbolic link) 
 \item Search for external libraries include files and create the necessary links 
 in {\tt \$SOPHYABASE/include}
@@ -2724,6 +2853,8 @@
 \index{Exception classes} \index{PThrowable} \index{PError} \index{PException}
 SOPHYA library defines a set of exceptions which are used 
-for signalling error conditions. The figure below shows a partial 
-class diagram for exception classes in SOPHYA.
+for signalling error conditions. From version V2.2 , all SOPHYA exceptions inherit from 
+the standard C++ exception class ( {\bf std::std::exception}). The method {\tt const char* what()} is 
+thus implemented and returns the corresponding error message.
+The figure below shows a partial class diagram for exception classes in SOPHYA.
 \begin{figure}[hbt]
 \dclsbb{PThrowable}{PError}
