PelROOT
The Pelletron-Linac data analysis tools for ROOT

Compiling your analysis code

There are 3 ways of compiling code using the PelROOT libraries:
  1. Compiling a histogram or trigger code
  2. Compiling a single c++ program
  3. Compiling a directory with multiple files and classes definitions

Compiling a histogram or trigger code

This is the easiest way to compile a .cxx code but can be used only for the histogram and trigger codes used during data acquisition and analysis. Other than that, use one of the methods described in the next sections. To compile an analysis code, just load the .cxx file in the ScanRoot or SPMRoot programs. The file will be automatically compiled and loaded in memory. In this case, the files need to follow some simple rules that can be found in this link.

Compiling a single c++ program

To compile a single root macro, just type in the prompt:
    compileMacro macro.cxx
where macro.cxx is the name of your macro. A shared library named macro.so will be generated automatically and can be loaded into root with the command:
    gSystem->Load("macro.so");

Compiling a directory with multiple files and classes definitions

After your analysis class have been written it is necessary to compile it in order to boost performance. In general, a few rules should be followed in order to use the general compiler tool that is part of this package.
  1. All library files should be in a single directory. That does not mean you can't have multiple libraries in different directories but the compiler tool compiles only one directory at once
  2. All c++ header files should have .h extension
  3. All c++ code files should have a .cxx extension
  4. You should have a file named LinkDef.h. This file is necessary to create a CINT dictionary file for ROOT. If there is NO LinkDef.h file, the macro will automatically create one but with limited functionality. Click here for instructions on how to create a LinkDef.h file if necessary.
To compile the code type:
    compile LIBNAME [INPUTDIR] [OUTPUTDIR]
where:

LinkDef.h

The structure of the LinkDef.h file is basically:
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#ifdef __CINT__
#pragma link C++ class NAME1+;
#pragma link C++ function NAME2+;
...
...
...
#endif
where NAME1, NAME2, NAME3 are the name of the classes, function, templates, enumerators, etc... you have defined and want to create root dictionary. Only classes, functions, etc that have a dictionary created can be used in a non-compiled macro or in the root prompt. Classes, functions, enumerators, etc that will have a dictionary generated should have prototypes defined in a .h file, otherwise the compiler will not be able to create the dictionary. Here is the list of all #pragma directives you can have in the rootCint
#pragma link C++ class ClassName[-];
#pragma link C class ClassName;
#pragma link off class ClassName;
#pragma link C++ enum ClassName;
#pragma link C enum ClassName;
#pragma link off enum ClassName;
#pragma link C++ function FuncName;
#pragma link C function FuncName;
#pragma link off function FuncName;
#pragma link C++ global VariableName;
#pragma link C global VariableName;
#pragma link off global VariableName;
#pragma link C++ typedef TypeName;
#pragma link C typedef TypeName;
#pragma link off typedef TypeName;
#pragma link off all classes;
#pragma link off all functions;
#pragma link off all variables;
#pragma link off all typedefs;

26 09 06 - 18:00 |

Last Comments

Options:

Calendar

« May 2024
S M T W T F S
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

Last Comments

admin (version 3.01): Both men and women are wo…
Appannababu (Make your questio…): Hello Patrico, Thanks, I …
Patricio Carnelli… (Make your questio…): Hi Appannababu, This scri…
Appannababu (Make your questio…): Hello, I am new t…
cheap nashville p… (Using Graphical C…): Thanks for your sharing.i…
Supra Skytop (version 3.01): This topic was really edu…
Supra Sneakers (Using Graphical C…): Hey, appreciate it for ta…
Patricio Carnelli… (Make your questio…): Hello, I’m a PhD student …
Bob (Pivot 1.30 Beta 2…): And this is what a commen…

Search site

Archives

01 Sep - 30 Sep 2006
01 Dec - 31 Dec 2006
01 Jan - 31 Jan 2007
01 Feb - 28 Feb 2007
01 Mar - 31 Mar 2007
01 Apr - 30 Apr 2007
01 Jun - 30 Jun 2007
01 Oct - 31 Oct 2007
01 May - 31 May 2008
01 Oct - 31 Oct 2008
01 May - 31 May 2013
01 Nov - 30 Nov 2013
01 Jun - 30 Jun 2014

RSS & Atom

XML: RSS Feed XML: Atom Feed