GET library
GETDocUsingLibrary.hh
Go to the documentation of this file.
1 //======================================================================
2 /*! \file GETDocUsingLibrary.hh
3  *
4  * Documentation page for how to use the library.
5  */
6 //======================================================================
7 
8 
9 //======================================================================
10 /*! \page get_page_linking Linking the library to C++ codes
11  *
12  * Some scripts are generated automatically at compilation time.
13  * If the shell environment is set properly, these scripts are
14  * accessible from a shell terminal.
15  *
16  * - \b get_cpp gives the compiler options used to build the library
17  * - \b get_inc gives all the include directive options required
18  * for C++ compilation with the GET library
19  * - \b get_lib gives the options required to link a program with
20  * the GET library and all other needed libraries
21  *
22  * The scripts \b get_base_inc and \b get_base_lib show only the
23  * options related to the GET library, and not the other libraries.
24  *
25  * The following is an example of a simplified makefile:
26  * \code
27 
28  # Compilation options
29  CPP := g++
30  CPPFLAGS := ${shell get_cpp}
31  INCFLAGS := ${shell get_inc}
32  LDFLAGS := ${shell get_lib}
33 
34  # Library source file
35  MY_SRC := #$(shell ls *.cpp)
36  MY_OBJ := #$(LIB_SRC:%.cpp=%.o)
37  MY_INC := #$(shell ls *.hh)
38 
39  # Program executable
40  EXE := my_program
41 
42  #===============================================================
43  # Dependencies
44 
45  all: ${EXE}
46  @echo ""
47  @echo "Programs:"
48  @echo " "${EXE}
49  @echo ""
50 
51  # Object files
52  %.o: %.cpp ${MY_INC}
53  @echo ""
54  @echo "--> Compiling object $*"
55  ${CPP} $< ${CPPFLAGS} ${INCFLAGS} -c -o $@
56  @echo ""
57 
58  # Program
59  ${EXE}: ${MY_OBJ}
60  @echo ""
61  @echo "--> Linking program $*"
62  ${CPP} $< ${CPPFLAGS} ${INCFLAGS} ${LDFLAGS} -o $*
63  @echo ""
64 
65  \endcode
66  *
67  *
68  */
69 
70 
71 //======================================================================
72 /*! \page get_page_embed_root Loading the library in a ROOT session
73  *
74  * In order to use the libraries within a ROOT session, the ROOT
75  * configuration file (\b .rootrc) must be customized in order to declare
76  * the files locations.
77  *
78  * Here is an example of the required declarations:
79  *
80  * \code
81 # ROOT Configuration file (.rootrc)
82 
83 Unix.*.Root.DynamicPath: .:$(ROOTSYS)/lib:$(JG_ROOT_LIB)
84 Unix.*.Root.MacroPath: .:$(ROOTSYS)/macros:$(JG_ROOT_MACRO):$(JG_ROOT_LIB)
85 
86 # ACLiC customization.
87 ACLiC.IncludePaths: -I$(GCPP_INC) -I$(JG_ROOT_INC)
88 
89 # Rint (interactive ROOT executable) specific alias, logon and logoff macros.
90 Rint.Logon: my_rootlogon.C
91  * \endcode
92  *
93  *
94  * It is also possible to automatically load the libraries at root session
95  * start, by calling the scripts provided with the libraries.
96  *
97  * Adding the following lines to your own ROOT logon script (see \b .rootrc
98  * file), the following libraries will be loaded, and the corresponding
99  * include directories will be declared in your ROOT session:
100  * - GCpp, GRootTools and GFFT libraries (J. Giovinazzo)
101  * - MFM and TinyXML libraries
102  * - Xerces-C XML parsing libraries
103  * - GET and GETRoot libraries (J. Giovinazzo)
104  *
105  * \code
106 {
107  //----------------------------------------------------------------------------
108  // this is to avoid a problem with the corresponding ROOT library...
109  TRotation *_t_rotation_dummy_ = NULL;
110 
111  //----------------------------------------------------------------------------
112  // Additionnal JG libraries for ROOT
113  //----------------------------------------------------------------------------
114  if (getenv("JG_ROOT_MACRO") != NULL)
115  {
116  gROOT->Macro ( (TString(getenv("JG_ROOT_MACRO"))) + "/root_base_libs.C" );
117  }
118  else
119  cerr << "env. variable JG_ROOT_MACRO not defined" << endl;
120 
121  //----------------------------------------------------------------------------
122  // GFFT libraries
123  //----------------------------------------------------------------------------
124  if (getenv("GFFT_BASE") != NULL)
125  {
126  gROOT->Macro ( (getenv("GFFT_BASE")+string("/root/GFFTRootLibs.C")).c_str() );
127  }
128 
129  //----------------------------------------------------------------------------
130  // GET Analysis libraries
131  // (it also loads the TinyXML and the MFM libraries)
132  //----------------------------------------------------------------------------
133  if (getenv("GET_BASE") != NULL)
134  {
135  gROOT->Macro ( (getenv("GET_BASE")+string("/root/GETRootLibs.C")).c_str() );
136  }
137 }
138  * \endcode
139  *
140  */
141