Examples showing how to use FOAM.
FOAM is simplified version of multi-dimensional general purpose Monte Carlo event generator (integrator) with hyper-cubical "foam of cells". Certain features of full version of FOAM are omitted. mFOAM is intended as an easy to use tool for MC simulation/integration in few dimensions. It relies heavily on ROOT package, borrowing persistency of classes from ROOT. mFOAM can be easily used from the ROOT shell. For more difficult problems the full FOAM may be better.
The application program can be run in two modes: it can be simply interpreted by CLING or compiled. The first method is simpler but results in slower execution. The second method employs ACLiC - The Automatic Compiler of Libraries, which automatizes the process of compilation and linking.
In /home/sftnight/build/workspace/root-makedoc-master/rootspi/rdoc/src/master.build/tutorials there are 3 demonstration programs:
is a simple example how to run FOAM in interactive mode. To run this macro issue the following simple command from the Linux shell:
or from CLING:
Simulation will start and graphical canvas with plot of the distribution function appear. In this example we defined the distribution function simply as a global function function Camel2.
shows usage of FOAM in compiled mode, which is the preferred method. The integrand function is defined now as a Density method from class TFDISTR inheriting from abstract class TFoamIntegrand. User can modify interface to integrand function according to their needs but they should always remember to define Density method which provides the density distribution. Enter CLING interpreter and type:
to load FOAM library, compile and execute macro foam_demo.C. A shared object foam_demo_C.so is created in the current directory. At the end of exploration phase FOAM object including distribution function will be written to disk.
demonstrates persistency of FOAM classes. To run this macro type:
Program reads the FOAM object from disk, checks its consistency and prints geometry of cells. Next starts the the generation. It can be interpreted directly by CLING because compiled TFDISTR class is already available in foam_demo_C.so
library.
Files | |
file | foam_demo.C |
Demonstrate the TFoam class. | |
file | foam_demopers.C |
This simple macro demonstrates persistency of FOAM object. | |
file | foam_kanwa.C |
This program can be execute from the command line as folows: | |