Changeset 3438 in Sophya for trunk/SophyaLib/Manual/piapp.tex


Ignore:
Timestamp:
Dec 12, 2007, 10:34:59 PM (18 years ago)
Author:
ansari
Message:

Ajout aknowledgments ds docs et + chapitre 5 ds piapp.tex (expression plotting) - Reza 12/12/2007

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/Manual/piapp.tex

    r3437 r3438  
    110110loaded at run time. 
    111111\end{itemize}
     112
     113\subsection{Acknowlegments}
     114Many people have contributed to the development SOPHYA and/or the PI library
     115and (s)piapp interactive analysis tool.
     116we are grateful to the following people:
     117
     118\begin{tabular}{lcl}
     119Reza Ansari & \hspace{5mm} & (LAL-Univ.Paris Sud, Orsay) \\
     120Eric Aubourg & & (DAPNIA-CEA/APC, Saclay) \\
     121Sophie Henrot-Versille & & (LAL-IN2P3/CNRS, Orsay) \\
     122Alex Kim & & (LBL, Berkeley) \\
     123Guy Le Meur & & (LAL-IN2P3/CNRS, Orsay) \\
     124Eric Lesquoy & & (DAPNIA-CEA, Saclay) \\
     125Christophe Magneville & & (DAPNIA-CEA, Saclay) \\
     126Bruno Mansoux & & (LAL-IN2P3/CNRS, Orsay) \\
     127Olivier Perdereau & & (LAL-IN2P3/CNRS, Orsay) \\
     128Nicolas Regnault & & (LPNHE-IN2P3/CNRS, Paris) \\
     129Benoit Revenu & & (APC/Univ.Paris 7, Paris) \\
     130Francois Touze & & (LAL-IN2P3/CNRS, Orsay) \\
     131\end{tabular}
     132
     133We thank also the persons who have helped us by useful suggestions, among others : \\
     134S. Bargot, S. Du, S. Plasczczynski, C. Renault and D. Yvon.
     135
    112136%%%
    113137\begin{figure}[ht!]
     
    9911015%%%%%%%%%%%%%%% Section 5 :   analyse a la paw
    9921016\newpage
    993 \section{Tables and interactive analysis}
     1017\section{Tables and Expression Plotting}
    9941018\label{tableplot}
     1019A powerful data analysis technic available in piapp is
     10202D, 3D plot, and histogramming applied to arbitrary analytical
     1021expression of table columns.
     1022This analysis technic has been introduced by the popular
     1023CERN \href{http://paw.web.cern.ch/paw/}{\bf PAW}
     1024({\bf P}hysics {\bf A}nalysis {\bf Workstation})
     1025\footnote{PAW home page : http://paw.web.cern.ch/paw/ } program
     1026and the underlying HBOOK fortran library.
     1027Compared to PAW, piapp extends in many respects this capability,
     1028piapp offers in particular the possibility to manipulate many
     1029objects as if they where a DataTable, or NTuple.
     1030There are also additional 2D and 3D representations e.g.
     1031{\tt plot2de} \myppageref{plot2de}, 
     1032{\tt plot2dw} \myppageref{plot2dw}, 
     1033{\tt plot2dc} \myppageref{plot2dc} and
     1034{\tt plot3dw} \myppageref{plot3dw}.
     1035
     1036\subsection{How does it work ?}
     1037
     1038The Expression.Plotting commands in piapp operate on objects through the
     1039{\bf NTupleInterface} class methods. Some classes like NTuple or BaseDataTable
     1040inherit from NTupleInterface, while for the other classes, the corresponding
     1041NObjMgrAdapter class exposes an object conforming to NTupleInterface through the
     1042method : \\
     1043\hspace*{5mm} {\tt  NTupleInterface* NObjMgrAdapter::GetNTupleInterface()} \\
     1044A C file (PIATmp\_xxx/expf\_pia\_dl.c) is created by piapp containing the
     1045specified expressions, which should conform to the C-language syntax.
     1046In addition to the functions in {\tt math.h} (sin, cos, log \ldots),
     1047the following functions are defined by piapp and can be used:
     1048\begin{itemize}
     1049\item Flat random number generators: {\tt drand01() , drandpm1() }
     1050\item Gaussian random number generator: {\tt GauRand() }
     1051\item Angle conversion: {\tt deg2rad(double d), rad2deg(double r) }
     1052\item $(\theta,\varphi)$ to Molleweide X,Y projection: \\
     1053\hspace*{5mm}{\tt double tetphi2mollX(double theta, double phi)} \\
     1054\hspace*{5mm}{\tt double tetphi2mollY(double theta)}
     1055\item Longitude(0..360) deg., Latitude(-90..90) deg. conversion to Molleweide X,Y: \\
     1056\hspace*{5mm}{\tt double longlat2mollX(double longit, double lat) } \\
     1057\hspace*{5mm}{\tt double longlat2mollY(double lat) }
     1058\end{itemize}
     1059
     1060The processing steps for an Expression.Plotting in piapp :
     1061\begin{enumerate}
     1062\item Creation of the C-file.
     1063\item On the fly compilation of the generated file.
     1064\item The resulting shared-object is loaded and linked with the application
     1065\item Loop over the NTupleInterface object rows. The created function is called
     1066with the data from each row
     1067\item The return values are used to fill an histogram, or a matrix/vector or
     1068another NTuple or to produce a 2D or 3D graphic display.
     1069\end{enumerate}
     1070
     1071Although rather complex, the efficiency gain during processing data easily compensates
     1072for the overhead of the compilation step.
     1073 
     1074\subsection{Column/variable names}
     1075
     1076When working with real 2-D tables (NTuple, DataTable \ldots), the column names
     1077are the name of the variables which can be used in the C-expressions.
     1078There is an additional variable, called {\tt \_nl}, automatically
     1079provided by piapp, corresponding the table row number, starting from 0.
     1080
     1081For the other objects in piapp, the variable names are listed below:
     1082\begin{itemize}
     1083\item[\rond] For 2D table objects {\bf (NTuple,DataTable,\ldots)}:  ColumnNames,\_nl
     1084\item[\rond] For FITS files opened through {\tt fitsadapt} command: FITSColumnNames,\_nl
     1085\item[\rond] For {\bf Histo1D/HProf} objects : i,x,val,err,nb,\_nl
     1086\item[\rond] For {\bf Histo2D} objects : i,j,x,y,val,err,\_nl
     1087\item[\rond] For {\bf HistoErr} objects : i,x,val,err2,nb,\_nl
     1088\item[\rond] For {\bf Histo2DErr} objects : i,j,x,y,val,err2,nb,\_nl
     1089\item[\rond] For {\bf \tcls{TVector}, \tcls{TMatrix} , \tcls{Image} } objects : \\
     1090 \hspace*{10mm}  n,r,c,val,real,imag,mod,phas,\_nl
     1091\item[\rond] For {\bf \tcls{TArray}} objects : n,x,y,z,t,u,val,real,imag,mod,phas,\_nl
     1092\item[\rond] For {\bf GeneralFitData} objects : x0,ex0 x1,ex1 ...  xn,exn  y,ey ,ok,\_nl
     1093\item[\rond] For {\bf \tcls{SphereHEALPix} , \tcls{SphereThetaPhi} , \tcls{SphereECP}
     1094\tcls{LocalMap} } objects : \hspace{10mm} i,k,val,real,imag,mod,phas,teta,phi,\_nl
     1095\end{itemize} 
    9951096
    9961097%%%%%%%%%%%%%%% Section 6 :  command interpreter
     
    10291130managed by {\bf NamedObjMgr} (See below).
    10301131
     1132\subsubsection{Interpreter/Commander variables}
    10311133\begin{itemize}
    10321134\item[\rond] {\bf Definition and initialisation of variables } 
     
    10871189
    10881190\par
    1089 
    1090 \item[\rond] {\bf Special variables }
     1191\end{itemize}
     1192
     1193\subsubsection{Special variables}
    10911194\begin{itemize}
    10921195\item {\tt \$retval} ou {\tt \$retstr}  :  the string specified in the last {\bf return} statement
     
    10981201\end{itemize}
    10991202
    1100 \item[\rond] {\bf Objects/Application level variables} \\
     1203\subsubsection{Environment variables}
     1204Environment variables can simply be accessed by {\tt \$varenvname}.
     1205However,  the environment variables have the lowest priority during substitution.
     1206Interpreter's variables have the highest priority, followed
     1207by the application level variables.
     1208
     1209\subsubsection{Objects/Application level variables}
    11011210For some classes managed by NamedObjMgr,
    11021211PIACmd provide acces to some of the attributes of the object by
     
    11071216{\tt \${vname} }  is replaced by its value, even if an interpreter variable with the
    11081217same name has been defined.
     1218\begin{itemize}
     1219\item[\rond] Accessing object attributes
    11091220\begin{verbatim}
    11101221# -------- Example with a Vector
     
    11151226#           used to get list of valid attributes
    11161227piapp[3] echo ${va.?}
    1117 TMatrix.Att: rank size/nelts nrow/nrows ncol/ncols sum
     1228TMatrix.Att: rank size/nelts nrow/nrows ncol/ncols sum sumsq norm min ...
    11181229#  Compound names, in the form  name.att must be inclosed in
    11191230#    braces {name.att}
     
    11291240\end{verbatim}
    11301241
    1131 \item[\rond] {\bf Environment variables} can simply be accessed by {\tt \$varenvname}.
    1132 However,  the environment variables have the lowest priority during substitution.
    1133 Interpreter's variables have the highest priority, followed
    1134 by the application level variables.
    1135 
     1242\item[\rond] Accessing object.Info() \\
     1243For objects having an DVList Info() object (TArray/TVector/TMatrix , NTuple, DataTable, SwPPFDataTable, it is possible to access DVList members by the corresponding names : \\
     1244\hspace*{10mm} {\tt \$\{objName.info.varName\} }
     1245\item[\rond] Getting DataTable rows \\
     1246For NTuple and BaseDataTable objects (DataTable, SwPPFDataTable, SwFitsDataTable), it is
     1247possible to get a string representation of a given row, by specifying
     1248\$\{tableName.row\} followed by the row number (starting from 0) : \\
     1249\hspace*{10mm} {\tt \$\{tableName.row.num\} }
    11361250\end{itemize}
     1251
    11371252 
    11381253
     
    12641379\end{itemize}
    12651380
     1381Executing commands in a separate thread is useful for CPU or data intensive
     1382commands. Most {\bf Expr.Plotting}
     1383(plot2d, plot2dw, plot2de, plot3d, ntloop, fillvec, fillmtx \ldots)
     1384and some of the {\bf pawCmd} (n/plot n/proj) are thread safe. However, due to the
     1385current mutex lock management for these Expr.Plotting/pawCmd commands, only one
     1386such command can run concurrently with other piapp threads.
     1387Some of the commands in the {\bf CxxExecutorCmd} (
     1388c++exec, c++execfrf, c++create, c++createfrf, c++compile, c++link) are also thread safe.
     1389The same remark concerning lock management applies to these commands, while
     1390CxxExecutorCmd commands can run in parallel with Expr.Plotting commands.
     1391
     1392
    12661393%%%%%%%%%%%%%%% Section 7 :  c++ execution
    12671394\newpage
Note: See TracChangeset for help on using the changeset viewer.