Logo ROOT   6.10/00
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
tutorials/foam/index.md
Go to the documentation of this file.
1 \defgroup tutorial_FOAM FOAM tutorials
2 \ingroup Tutorials
3 \brief Examples showing how to use FOAM.
4 
5 ### What is FOAM ?
6 
7 FOAM is simplified version of multi-dimensional general
8 purpose Monte Carlo event generator (integrator) with hyper-cubical
9 "foam of cells". Certain features of full version of FOAM are omitted.
10 mFOAM is intended as an easy to use tool for MC
11 simulation/integration in few dimensions. It relies heavily on ROOT package,
12 borrowing persistency of classes from ROOT. mFOAM can be easily used from
13 the ROOT shell. For more difficult problems the full FOAM may be better.
14 
15 ### How to run application programs ?
16 
17 The application program can be run in two modes: it can be simply
18 intepreted by CINT or compiled. The first method is simpler but
19 results in slower execution. The second method employs ACLiC -
20 The Automatic Compiler of Libraries, which automaticates the
21 process of compilation and linking.
22 
23 In $(ROOTSYS)/tutorials there are 3 demonstration programs:
24 
25 #### foam_kanwa.C
26 is a simple example how to run FOAM in interactive
27 mode. To run this macro issue the following simple command from the
28 Linux shell:
29 
30 ```cpp
31  root foam_kanwa.C
32 ```
33 
34 or from CINT:
35 
36 ```cpp
37  root [0] .x foam_kanwa.C
38 ```
39 
40 Simulation will start and graphical canvas with plot
41 of the distribution function appear. In this example
42 we defined the distribution function simply as a global
43 function function Camel2.
44 
45 #### foam_demo.C
46 shows usage of FOAM in compiled mode, which is
47 the preferred method. The integrand function is defined
48 now as a Density method from class TFDISTR inheriting from
49 abstract class TFoamIntegrand. User can modify interface to
50 integrand function according to their needs but they should
51 always remember to define Density method which provides the
52 density distribution.
53 Enter CINT interpreter and type:
54 
55 ```cpp
56  root [0] gSystem->Load("libFoam.so")
57  root [1] .x foam_demo.C+
58 ```
59 
60 to load FOAM library, compile and execute macro foam_demo.C.
61 A shared object foam_demo_C.so is created in the current
62 directory. At the end of exploration phase FOAM object
63 including distribution function will be written to disk.
64 
65 #### foam_demopers.C
66 demonstrates persistency of FOAM classes.
67 To run this macro type:
68 
69 ```cpp
70  root [0] .x foam_demopers.C
71 ```
72 
73 Program reads the FOAM object from disk, checks its
74 consistency and prints geometry of cells. Next starts the
75 the generation. It can be interpreted directly by CINT
76 because compiled TFDISTR class is already available in
77 foam_demo_C.so library.
for(Int_t i=0;i< n;i++)
Definition: legend1.C:18
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition: TSystem.cxx:1825
TString as(SEXP s)
Definition: RExports.h:71
TArc * a
Definition: textangle.C:12
RooCmdArg What(const char *str)
void example()
Definition: example.C:26
R__EXTERN TSystem * gSystem
Definition: TSystem.h:539
void run(bool only_compile=false)
Definition: run.C:1
int type
Definition: TGX11.cxx:120