| 1 | \documentclass[twoside,11pt]{article} | 
|---|
| 2 | %  Package standard : Utilisation de caracteres accentues, mode francais et graphique | 
|---|
| 3 | \usepackage{url} | 
|---|
| 4 | \usepackage[latin1]{inputenc} | 
|---|
| 5 | \usepackage[T1]{fontenc} | 
|---|
| 6 | \usepackage[english]{babel} | 
|---|
| 7 | \usepackage{graphicx} | 
|---|
| 8 | % package a mettre pour faire du pdf | 
|---|
| 9 | \usepackage{palatino} | 
|---|
| 10 |  | 
|---|
| 11 | %  Extension de symboles mathematiques | 
|---|
| 12 | \usepackage{amssymb} | 
|---|
| 13 |  | 
|---|
| 14 | %  Definition pour Docs Sophya | 
|---|
| 15 | \usepackage{defsophya} | 
|---|
| 16 |  | 
|---|
| 17 |  | 
|---|
| 18 |  | 
|---|
| 19 | \begin{document} | 
|---|
| 20 |  | 
|---|
| 21 | \begin{titlepage} | 
|---|
| 22 | %  The title page - top of the page with the title of the paper | 
|---|
| 23 | \titrehp{Sophya  \\ An overview } | 
|---|
| 24 | %  Authors list | 
|---|
| 25 | \auteurs{ | 
|---|
| 26 | R. Ansari            &  ansari@lal.in2p3.fr       \\ | 
|---|
| 27 | G. Le Meur           &  lemeur@lal.in2p3.fr       \\ | 
|---|
| 28 | C. Magneville        &  cmv@hep.saclay.cea.fr     \\ | 
|---|
| 29 | S. Henrot-Versille   &  versille@in2p3.fr | 
|---|
| 30 | } | 
|---|
| 31 | % \auteursall | 
|---|
| 32 | %  The title page - bottom of the page with the paper number | 
|---|
| 33 | \titrebp{1} | 
|---|
| 34 | \end{titlepage} | 
|---|
| 35 |  | 
|---|
| 36 | \tableofcontents | 
|---|
| 37 |  | 
|---|
| 38 | \newpage | 
|---|
| 39 |  | 
|---|
| 40 | \section{Introduction} | 
|---|
| 41 |  | 
|---|
| 42 | {\bf SOPHYA} ({\bf SO}ftware for {\bf PHY}sics {\bf A}nalysis) | 
|---|
| 43 | is a collection of C++ classes designed for numerical and | 
|---|
| 44 | physics analysis software development. Our goal is to provide | 
|---|
| 45 | easy to use, yet powerful classes which can be used by scientists. | 
|---|
| 46 | We have decided to use as much as possible available | 
|---|
| 47 | numerical analysis libraries, encapsulating them whenever | 
|---|
| 48 | possible. | 
|---|
| 49 |  | 
|---|
| 50 | The SOPHYA design and implementation has been carried out | 
|---|
| 51 | with the specific goal of providing the general framework for | 
|---|
| 52 | the Planck-HFI data processing software. However, most of the | 
|---|
| 53 | packages presented here have a more general scope than the CMB analysis | 
|---|
| 54 | and Planck surveyor mission problem. | 
|---|
| 55 | The source directory tree | 
|---|
| 56 | \footnote{ CVS server: cvsserver.lal.in2p3.fr:/projects/Eros/CVSEros} | 
|---|
| 57 | is organised into a number of modules. | 
|---|
| 58 |  | 
|---|
| 59 | \begin{itemize} | 
|---|
| 60 | \item[] {\bf Mgr/}  Scripts for code management, | 
|---|
| 61 | makefile generation and software installation | 
|---|
| 62 | \item[] {\bf SysTools/} General architecture support classes such | 
|---|
| 63 | as {\tt PPersist, NDataBlock<T>}, and few utility classes | 
|---|
| 64 | ({\tt DataCard, DVList} \ldots). | 
|---|
| 65 | \item[] {\bf TArray/} template numerical arrays, vectors and matrices | 
|---|
| 66 | ({\tt PixelMap<T> SphericalMap<T>} \ldots) | 
|---|
| 67 | \item[] {\bf NTools/} Some standard numerical analysis tools | 
|---|
| 68 | (linear, and non linear parameter fitting, FFT, \ldots) | 
|---|
| 69 | \item[] {\bf HiStats/}  Histogram-ming and data set handling classes \\ | 
|---|
| 70 | ({\tt Histo Histo2D NTuple XNTuple} \ldots) | 
|---|
| 71 | \end{itemize} | 
|---|
| 72 |  | 
|---|
| 73 | The modules listed below are more tightly related to the | 
|---|
| 74 | CMB (Cosmic Microwave Background) data analysis problem: | 
|---|
| 75 | \begin{itemize} | 
|---|
| 76 | \item[] {\bf SkyMap/} Local and full sky maps, and few geometry | 
|---|
| 77 | handling utility classes. \\ | 
|---|
| 78 | ({\tt PixelMap<T>, LocalMap<T>, SphericalMap<T>, \ldots}) | 
|---|
| 79 | \item[] {\bf SkyT/} | 
|---|
| 80 | classes for spectral emission and detector frequency response modelling \\ | 
|---|
| 81 | ({\tt SpectralResponse, RadSpectra, BlackBody} \ldots) | 
|---|
| 82 | \item[] {\bf Samba/} few classes for map and TOD analysis. | 
|---|
| 83 | \item[] {\bf PMixer/} skymixer and related programs | 
|---|
| 84 | \end{itemize} | 
|---|
| 85 |  | 
|---|
| 86 | The following modules contain the interface classes with | 
|---|
| 87 | external libraries: | 
|---|
| 88 | \begin{itemize} | 
|---|
| 89 | \item[] {\bf FitsIOServer/} Classes for handling file input-output | 
|---|
| 90 | in FITS format using the cfitsio library. | 
|---|
| 91 | \item[] {\bf LinAlg/} Interface with Lapack linear algebra package | 
|---|
| 92 | \item[] {\bf IFFTW/} Interface with FFTW package | 
|---|
| 93 | \end{itemize} | 
|---|
| 94 |  | 
|---|
| 95 | Other modules: | 
|---|
| 96 | \begin{itemize} | 
|---|
| 97 | \item[] {\bf Tests/} Simple test programs | 
|---|
| 98 | \item[] {\bf ProgPI/}  interactive analysis tool - It should be noted that | 
|---|
| 99 | this module uses the SOPHYA class library and is based on {\bf PI} | 
|---|
| 100 | which is a C++ library defining a complete GUI program | 
|---|
| 101 | architecture. An additional module (PIext) define the interactive | 
|---|
| 102 | analysis program framework and the interfaces with the objects | 
|---|
| 103 | in SOPHYA.  The {\bf PI/} \footnote{the PI package documentation | 
|---|
| 104 | is available from {\bf http://www.lal.in2p3.fr/recherche/eros/PeidaDoc/} } | 
|---|
| 105 | and {\bf PIext/} modules are not currently part | 
|---|
| 106 | of the SOPHYA CVS structure. | 
|---|
| 107 | \end{itemize} | 
|---|
| 108 |  | 
|---|
| 109 | \newpage | 
|---|
| 110 |  | 
|---|
| 111 | \section{Using Sophya} | 
|---|
| 112 | Two environment variables {\bf DPCBASEREP} and {\bf EROSCXX} are used | 
|---|
| 113 | to define the path where the Sophya libraries and executable are installed. | 
|---|
| 114 | {\bf DPCBASEREP} defines the base directory path and {\bf EROSCXX} the | 
|---|
| 115 | name of the C++ compiler. The complete path is built using {\bf DPCBASEREP}, | 
|---|
| 116 | the operating system name (as obtained by the {\tt uname} command), and | 
|---|
| 117 | the compiler name. In the example below, we show the complete path | 
|---|
| 118 | for a {\tt Linux} system, using the GNU g++ compiler: | 
|---|
| 119 |  | 
|---|
| 120 | \begin{itemize} | 
|---|
| 121 | \item \$DPCBASEREP/Include : Include (.h) files | 
|---|
| 122 | \item \$DPCBASEREP/Linux-g++/Libs : Path for the archive libraries (.a) | 
|---|
| 123 | \item \$DPCBASEREP/Linux-g++/ShLibs : Shared library path (.so) | 
|---|
| 124 | \item \$DPCBASEREP/Linux-g++/Exec : Executable file path | 
|---|
| 125 | \end{itemize} | 
|---|
| 126 |  | 
|---|
| 127 | In order to use the shared libraries, the {\bf LD\_LIBRARY\_PATH} variable | 
|---|
| 128 | should contain the Sophya shared library path | 
|---|
| 129 | ({\tt \$DPCBASEREP/Linux-g++/ShLibs } when using g++ compiler on Linux) | 
|---|
| 130 |  | 
|---|
| 131 | The file {\tt \$DPCBASEREP/Include/MakefileUser.h} defines the compilation | 
|---|
| 132 | flag and the list of Sophya libraries. It should be included in the | 
|---|
| 133 | user's makefile. The default compilation rules assumes that the object (.o) | 
|---|
| 134 | and executable files would be put in the following diretories: \\ | 
|---|
| 135 | {\tt \$HOME/`uname`-\$EROSCXX/Objs} \\ | 
|---|
| 136 | {\tt \$HOME/`uname`-\$EROSCXX/Exec}. | 
|---|
| 137 | In the case of a {\tt Linux} system and using {\tt g++} as the C++ compiler, | 
|---|
| 138 | these two directories would be translated to \\ | 
|---|
| 139 | {\tt \$HOME/Linux-g++/Objs} and {\tt \$HOME/Linux-g++/Exec}. | 
|---|
| 140 | The GNU make program should be used. | 
|---|
| 141 | \par | 
|---|
| 142 | The file {\tt \$DPCBASEREP/Include/makefile\_auto} defines the rules to compile | 
|---|
| 143 | a given source program, and link it against the Sophya libraries to produce | 
|---|
| 144 | an executable. The example below shows the steps to compile a program named | 
|---|
| 145 | {\tt trivial.cc }. | 
|---|
| 146 | \begin{verbatim} | 
|---|
| 147 | csh> cp $DPCBASEREP/Include/makefile_auto makefile | 
|---|
| 148 | csh> make trivial | 
|---|
| 149 | \end{verbatim} | 
|---|
| 150 | This command should compile the {\tt trivial.cc} file, | 
|---|
| 151 | and link it against the sophya libraries. The object and executable | 
|---|
| 152 | file names are: \\ | 
|---|
| 153 | {\tt \$HOME/`uname`-\$EROSCXX/Objs/trivial.o} \\ | 
|---|
| 154 | {\tt \$HOME/`uname`-\$EROSCXX/Exec/trivial}. | 
|---|
| 155 | \par | 
|---|
| 156 | The file {\tt \$DPCBASEREP/Include/makefile\_example} provides another | 
|---|
| 157 | example makefile. | 
|---|
| 158 |  | 
|---|
| 159 |  | 
|---|
| 160 | \newpage | 
|---|
| 161 |  | 
|---|
| 162 | \section{Building and installing Sophya} | 
|---|
| 163 | Presently, the Sophya library compilation has been tested with the following | 
|---|
| 164 | compiler/platform pairs: | 
|---|
| 165 |  | 
|---|
| 166 | \begin{center} | 
|---|
| 167 | \begin{tabular}{ll} | 
|---|
| 168 | Compaq/DEC OSF1  &     cxx  (6.0 , 6.2)  \\ | 
|---|
| 169 | Linux            &     g++  (2.91 , 2.95)  \\ | 
|---|
| 170 | Linux            &     KCC  (3.4)   \\ | 
|---|
| 171 | Solaris          &     g++  (2.95)  \\ | 
|---|
| 172 | SGI IRIX64       &     CC           \\ | 
|---|
| 173 | \end{tabular} | 
|---|
| 174 | \end{center} | 
|---|
| 175 |  | 
|---|
| 176 | Some of the modules in the Sophya package uses external libraries. The | 
|---|
| 177 | {\bf FitsIOServer} is the example of such a module, where the {\tt libcfitsio.a} | 
|---|
| 178 | is used. | 
|---|
| 179 | The build procedure expects to find the include files and the libraries in: \\ | 
|---|
| 180 | {\tt \$EXTLIBDIR/Include/FitsIO } \\ | 
|---|
| 181 | {\tt \$EXTLIBDIR/`uname`-\$EROSCXX/Libs} \\ | 
|---|
| 182 |  | 
|---|
| 183 | The object files from a given Sophya module are grouped in an archive library | 
|---|
| 184 | with the module's name ({\tt libmodulename.a}). All Sophya modules | 
|---|
| 185 | are grouped in a single shared library ({\tt libsophya.so}), while the | 
|---|
| 186 | modules with reference to external libraries are grouped in | 
|---|
| 187 | ({\tt libextsophya.so}). The {\bf PI} and {\bf PIext} modules are | 
|---|
| 188 | grouped in ({\tt libPI.so}). | 
|---|
| 189 |  | 
|---|
| 190 | The environment variables {\bf DPCDEVREP}, {\bf EXTLIBDIR} and {\bf EROSCXX} | 
|---|
| 191 | must be defined in order to install the Sophya package. | 
|---|
| 192 | In the example below, we assume that we want to install Sophya from a | 
|---|
| 193 | released (tagged) version in the source directory {\tt \$SRC} in the | 
|---|
| 194 | {\tt /usr/local/Sophya} diretory, using {\tt g++}. We assume that | 
|---|
| 195 | the external libraries directory tree has been set up in | 
|---|
| 196 | {\tt /usr/local/ExtLibs/}. \\[3mm] | 
|---|
| 197 | \centerline{ | 
|---|
| 198 | \rule{20mm}{0.5mm} | 
|---|
| 199 | {\bf \large the use of GNU make is mandatory} | 
|---|
| 200 | \rule{20mm}{0.5mm} } | 
|---|
| 201 |  | 
|---|
| 202 | \vspace*{3mm} | 
|---|
| 203 | \begin{verbatim} | 
|---|
| 204 | # We select our C++ compiler | 
|---|
| 205 | csh> setenv EROSCXX g++ | 
|---|
| 206 | # Setup the build directory | 
|---|
| 207 | csh> mkdir /usr/local/Sophya/ | 
|---|
| 208 | csh> setenv DPCDEVREP /usr/local/Sophya/ | 
|---|
| 209 | csh> setenv EXTLIBDIR /usr/local/ExtLibs/ | 
|---|
| 210 | # Use the top level makefile in Mgr/ | 
|---|
| 211 | csh> cd $SRC | 
|---|
| 212 | csh> cp Mgr/Makefile Makefile | 
|---|
| 213 | # Step 1: Create the directory tree and copy the include files (.h) | 
|---|
| 214 | csh> make depend | 
|---|
| 215 | # Step 2: Compile the modules without external library reference | 
|---|
| 216 | csh> make libs | 
|---|
| 217 | # Step 3: Compile the modules WITH  external library reference (optional) | 
|---|
| 218 | csh> make extlibs | 
|---|
| 219 | # Step 4: Build libsophya.so | 
|---|
| 220 | csh> make slb | 
|---|
| 221 | # Step 5: Build libextsophya.so (optional) | 
|---|
| 222 | csh> make slbext | 
|---|
| 223 | # Step 6: Compile the PI and PIext modules (optional) | 
|---|
| 224 | csh> make PI | 
|---|
| 225 | # Step 7: Build the corresponding shared library libPI.so (optional) | 
|---|
| 226 | csh> make slbpi | 
|---|
| 227 | \end{verbatim} | 
|---|
| 228 |  | 
|---|
| 229 | To compile all modules and build the shared libraries, it is possible | 
|---|
| 230 | to use: | 
|---|
| 231 | \begin{verbatim} | 
|---|
| 232 | # Step 2,3,6 | 
|---|
| 233 | csh> make all | 
|---|
| 234 | # Step 4,5,7 | 
|---|
| 235 | csh> make slb | 
|---|
| 236 | \end{verbatim} | 
|---|
| 237 |  | 
|---|
| 238 | At this step, all libraries sould have been made. Programs using | 
|---|
| 239 | Sophya libraries can now be built: | 
|---|
| 240 | \begin{verbatim} | 
|---|
| 241 | # To compile test programs | 
|---|
| 242 | csh> cd Tests | 
|---|
| 243 | csh> make arrt ... | 
|---|
| 244 | csh> cd .. | 
|---|
| 245 | # To compile other programs, for example from the PMixer module | 
|---|
| 246 | csh> cd PMixer | 
|---|
| 247 | csh> make | 
|---|
| 248 | csh> cd .. | 
|---|
| 249 | # To build (s)piapp (libPI.so is needed) | 
|---|
| 250 | csh> cd ProgPI | 
|---|
| 251 | csh> make | 
|---|
| 252 | csh> cd .. | 
|---|
| 253 | \end{verbatim} | 
|---|
| 254 |  | 
|---|
| 255 | \subsection{Mgr module} | 
|---|
| 256 | This module contains scripts which can be used for generating the | 
|---|
| 257 | makefiles for each module. | 
|---|
| 258 | \begin{itemize} | 
|---|
| 259 | \item {\bf Makefile} Top level Makefile for builiding the libraries. | 
|---|
| 260 | \item {\bf Makefile.h} contains the defintion of compilation flags for the | 
|---|
| 261 | different compilers and systems. This file is used for building the | 
|---|
| 262 | library and generating {\bf MakefileUser.h} (to be included in makefiles). | 
|---|
| 263 | \item {\bf Makefile.slb} contains the rules for building shared libraries | 
|---|
| 264 | for the different compilers and systems. (to be included in makefiles) | 
|---|
| 265 | \item {\bf crerep\_sophya} c-shell script for creating the directory tree | 
|---|
| 266 | under {\tt \$DPCBASEREP} and {\tt \$DPCDEVREP} | 
|---|
| 267 | \item {\bf install\_sophya} c-shell script for installing the Sophya package. | 
|---|
| 268 | Usually from {\tt \$DPCDEVREP} to {\tt \$DPCBASEREP} | 
|---|
| 269 | \item {\bf mkmflien} c-shell script for making symbolic links or copying | 
|---|
| 270 | include files to {\tt \$DPCDEVREP/Include} or {\tt \$DPCBASEREP/Include} | 
|---|
| 271 | \item {\bf mkmf} c-shell script for generating module makefiles and the | 
|---|
| 272 | top level makefile (named GNUmakefile) | 
|---|
| 273 | \item {\bf mkmflib} c-shell script for generating each library module | 
|---|
| 274 | makefile (named GNUmakefile) | 
|---|
| 275 | \item {\bf mkmfprog} c-shell script for generating makefile for a module | 
|---|
| 276 | containing the source for executable programs (named GNUmakefile). | 
|---|
| 277 | \item {\bf mkmfPI} c-shell script for generating makefile for PI and PIext | 
|---|
| 278 | modules (named GNUmakefile) | 
|---|
| 279 | \item {\bf libdirs} List of Sophya modules without reference to external | 
|---|
| 280 | libraries. | 
|---|
| 281 | \item {\bf extlibdirs} List of Sophya modules with reference to external | 
|---|
| 282 | libraries. | 
|---|
| 283 |  | 
|---|
| 284 | \end{itemize} | 
|---|
| 285 |  | 
|---|
| 286 | \newpage | 
|---|
| 287 |  | 
|---|
| 288 | \section{Learning Sophya through examples} | 
|---|
| 289 | The examples here illustrates the basic | 
|---|
| 290 | usage of Sophya classes. Sophya documentation can be found at our web site: \\ | 
|---|
| 291 | {\bf http://hfi-l2.in2p3.fr}. | 
|---|
| 292 |  | 
|---|
| 293 | \subsection{Using classes in SysTools} | 
|---|
| 294 |  | 
|---|
| 295 | {\bf SysTools} contains utility classes such as {\tt DataCards} or | 
|---|
| 296 | {\tt DVlist}, an hierarchy of exception classes for Sophya, a template | 
|---|
| 297 | class {\tcls{NDataBlock}} for handling reference counting on numerical | 
|---|
| 298 | arrays, as well as classes providing the services for implementing simple | 
|---|
| 299 | serialization. For simple programs, it is a good practice to handle | 
|---|
| 300 | the exceptions at least at high level, in the {\tt main()} function. | 
|---|
| 301 | The example below shows the exception handling and the usage | 
|---|
| 302 | of Sophya persistence. | 
|---|
| 303 | \vspace*{5mm} | 
|---|
| 304 |  | 
|---|
| 305 | \begin{figure}[hbt] | 
|---|
| 306 | \dclsa{PPersist} | 
|---|
| 307 | \dclsbb{PIOPersist}{PInPersist} | 
|---|
| 308 | \dclsb{POutPersist} | 
|---|
| 309 | \caption{partial class diagram for classes handling persistencein Sophya} | 
|---|
| 310 | \end{figure} | 
|---|
| 311 |  | 
|---|
| 312 | \input{ex1.inc} | 
|---|
| 313 |  | 
|---|
| 314 | \end{document} | 
|---|