--- PamCut/doc/PamCutDevGuide.tex 2009/06/05 13:33:18 1.2 +++ PamCut/doc/PamCutDevGuide.tex 2009/06/15 14:44:01 1.3 @@ -534,18 +534,35 @@ implementations of actions if you need some example to setup your build. \section{How to build and use the library} +\subsection{Standard Pamela environment} If the makefiles are correctly set up, the only remaining thing is to type \verb1make all1. Remember to set the PAMELA environment with the set\_pam\_env script BEFORE invoking \verb1make1. This will generate a {\it libPamCut.so} file which will contain all the cuts. To clean the project and build from scratch -type \verb1make clean all1. To use the library in an analysis code the +type \verb1make clean all1. The software can then be installed in the usual +Pamela environment calling \verb1make install1: this will place all the +headers in the folder \verb1$PAM_INC/PamCut1 and the {\it libPamCut.so} file in +\verb1$PAM_LIB1. To eliminate the installed files call \verb1make distclean1; +note that this will NOT do the work of \verb1make clean1, eg., clean the +project, but simply remove the files copied in the Pamela directories. Remember +to type \verb1make install1 each time you modify and recompile the software, to +upgrade the installed version to the new one. + +To use the library in an analysis code the environment header must be included in the code: \verb1#include "/PamCutEnv.h"1. With this, all the classes and common definitions will be accessible. A typical usage of {\bf PamCut} inside the analysis code would look like: \begin{verbatim} - + + #include + + int main(){ + . + . + . + PamCutCollection collection; DummyCut1 dummy1; @@ -555,23 +572,48 @@ collection.Process(event, 0, event->GetEntries()-1); + . + . + . + } + \end{verbatim} In the simple example above a \verb1DummyCut11 and a \verb1DummyCut21 object (which requires some sort of parameter) are instantiated. They are added to \verb1collection1 which takes care of applying them to all the events. -When the analysis code is compiled the linker must be aware that it -needs a library called {\it libPamCut.so} and where to find it. In the {\it -makefile} which builds the analysis program the following option must be added -to the linker invocation: +\subsection{Custom environment} +If you don't have access to the Pamela software directories (eg., you don't +have write permission on them) you cannot install the software; but you can +still use PamCut directly from the source folder. + +First of all, you have to tell the compiler where to find the {\bf PamCut}'s +headers. They are in the main {\bf PamCut} directory, so you may add this +option: \newline -\verb1-L -lPamCut1. - -One could also wish to move {\it libPamCut.so} to another directory: this path -must then replace what is indicated as \verb11 above. +\verb1 -I1 +\newline +to the compiler invocation in the {\it makefile} of your main analysis program. +This tells the compiler to search for headers in the folder specified after +\verb1-I1. So, if {\it } is the folder which contains the {\bf +PamCut}'s main folder, you don't have to change anything in your main analysis +file (with respect to what described in the previous subsection), since: +\newline +\verb1 #include 1 +\newline +includes the file {\it PamCutEnv.h} which is in the folder {\it PamCut} in the +standard inclusion directories, one of which is the one specified with the +\verb1-I1 compiler directive. Obviously, one can play with directories, having +care to indicate the right paths to the compiler -Finally, when the analysis code is compiled and linked against libPamCut.so, to +The following option must be added to the linker invocation: +\newline +\verb1 -L -lPamCut1. +\newline +to tell the linker where the dynamic library is. + +Then, when the analysis code is compiled and linked against libPamCut.so, to launch it it's necessary to tell the environment where the library is, so that the program can dynamically access it at runtime. This information is encoded in the environment variable LD\_LIBRARY\_PATH, which contains the paths of the