Title: The Virtual MonteCarlo
1The Virtual MonteCarlo
- D.Adamova2, V.Berejnoi1, R.Brun1, F.Carminati1,
A.Fassó1, E.Futo1, I.Gonzalez3, I.Hrivnacova4,
A.Morsch1 - 1CERN, Geneva 2NPI, Rez 3IFCA, Cantabria 4IPN,
Orsay - For the ALICE Collaboration
- Presented by I. Hrivnacova
- Conference forComputing in High Energy and
Nuclear Physics - La Jolla, 27 March 2003
2Outline
- Interfaces
- Available MCs
- Examples
- Distribution
- Future
3The VMC Concept
- The Virtual MonteCarlo (VMC) has been developed
in order to - Run the same user application with all supported
transport Monte Carlos - Run different transport Monte Carlo programs
without changing the user code and therefore the
geometry definition, the detector response
simulation, or input and output formats - VMC decouples the dependence of a user code from
a concrete MC
4VMC Concept
User Code
VMC
Geant3
Input
Geant4
Particles Hits
Geant3 VMC
Fluka
Geant4 VMC
Output
Fluka VMC
5Virtual Monte Carlo
6Interfaces (1)
Virtual MC
- TVirtualMC
- Interface to the Monte Carlo program
- Generalization of Geant3 functions for definition
of simulation task - Provides methods for definition of geometry and
physics setup for access to tracked particle
properties during stepping for run control - Implementations
- TGeant3, TGeant4, TFluka (coming
soon) - Are provided for the user
Methods For Building Accessing Geometry
Methods For Building Accessing Materials
Methods For Setting Physics
Methods For Accessing Tracked Particle During
Stepping
Methods For Run Control
7Interfaces (2)
Virtual MC Application
- TVirtualMCApplication
- Interface to a user application
- Defines user actions at each stage of a
simulation run - Mandatory
- Implementation has to be done by a user
ConstructGeometry InitGeometry GeneratePrimaries
BeginEvent BeginPrimary PreTrack Stepping PostTrac
k FinishPrimary FinishEvent
8Interfaces (3)
- TVirtualMCStack
- Interface to a user defined particles stack
- Mandatory
- User can use the concrete stack classes provided
in the examples or implement their own stack
class - TVirtualMCDecayer
- Interface to an external decayer
- Eg. Pythia6
- Optional
9Use of VMCGeometry Construction
void MyMCApplicationConstruct Geometry()
Double_t trackerTube3 trackerTube0 0.
trackerTube1 60. trackerTube2 50.
gMC-gtGsvolu("TRTU", "TUBE", fImedAl,
trackerTube, 3) Double_t posX -100.
Double_t posY 0. Double_t posZ 0.
gMC-gtGspos("TRTU", 1 , "EXPH", posX, posY, posZ,
0, "ONLY")
User MC Application
ConstructGeometry InitGeometry GeneratePrimaries
BeginEvent BeginPrimary PreTrack Stepping PostTrac
k FinishPrimary FinishEvent
- Geometry is defined by calls to TVirtualMC
interface
10Use of VMCPrimary Particles
void MyMCApplicationGeneratePrimaries()
// Define particle properties // PDG
encoding // position vx, vy, vz, vt //
momentum px py, pz, e // // Add particle
to MC stack gMC-gtGetStack()
-gtSetTrack(toBeDone, -1, pdg, px, py, pz, e,
vx, vy, vz, t, )
User MC Application
ConstructGeometry InitGeometry GeneratePrimaries
BeginEvent BeginPrimary PreTrack Stepping PostTrac
k FinishPrimary FinishEvent
- Primary particles are defined by calls to the
TVirtualMCStack interface
11Use of VMCHits Production
void MyMCApplication Stepping() // Get
track position Double_t x, y, z
gMC-gtTrackPosition(x, y, z) // Get energy
deposit Double_t edep gMC-gtEdep() //
Create user hit mySD-gtAddHit(x, y, z, edep)
User MC Application
ConstructGeometry InitGeometry GeneratePrimaries
BeginEvent BeginPrimary PreTrack Stepping PostTrac
k FinishPrimary FinishEvent
- The user stepping function is called by MC at
each step - User gets the properties of the tracked particle
by calls to TVirtualMC and saves them in their
own hits objects
12Available MCs
- Geant3, Geant4
- Geant3 VMC and Geant4 VMC in production
- Fluka
- Fluka VMC in development
13Available MCsGeant3 VMC
- Provided within a single package together with
Geant321 (FORTRAN) - Straightforward implementation
- VirtualMC was largely inspired by Geant3
- Geant3 Geometry Browser
- Provided within TGeant3
- http//alisoft.cern.ch/ people/morsch/Geant3GUI.ht
ml
14Available MCsGeant4 VMC (1)
- Provided within a package - geant4_vmc
- Requires Geant4 installation
- Access to Geant4
- Switching between Root UI and Geant4 UI
- Geant4 classes are not processed by CINT G4
objects are not accessible from the Root UI - Use of G3toG4
- TVirtualMC has been inspired by Geant3
- An effort has been made to minimize the
limitations of the G3toG4 tool in Geant4 4.0 - Support for reflections
- Limited support for MANY volume positions
15Available MCsGeant4 VMC (2)
- Geant4 VMC extensions
- Geant4 VMC Geometry Browser
- Analogy to Geant3 Geometry browser
- Geometry XML Convertor
- Enables to export Geant4 geometry to XML (AGDD)
and then to browse and visualize using GraXML - More on GraXML in the presentation
- GraXML Modular Geometric Modeller (J.
Hrivnac)
16Available MCsFluka VMC
- In development by the ALICE collaboration and
FLUKA team - TFluka in AliRoot
- Implemented
- Functions for building/accessing geometry
- Use of Geant4 VMC Flugg
- Functions for accessing tracked particle during
stepping - Recording particles in VMC stack
- Functions for run management
- To be done
- Functions for setting physics
- External decayer
17Examples
- 3 examples provided in geant4_vmc
- In spite of being provided within Geant4 VMC,
they are built independently and do not require
Geant4 installation in case a user wants to run
them with Geant3 only - Geant4 novice examples N01, N02 and N03 rewritten
with use of Virtual Monte Carlo - Implement MC Application and MC Stack
- All examples are executed in the same way
- cd geant4_vmc/examples/E0n
- root
- root0 .x run_g3.C or run_g4.C
18-
- // Load basic libraries
- gROOT-gtLoadMacro(basiclibs.C)
- basiclibs()
-
-
-
-
-
- // Load this example library
- gSystem-gtLoad("libexample01")
-
- // MC application
- Ex01MCApplication appl
- new Ex01MCApplication("Example01", "The
example01 MC application")
E01 run_g3.C run_g4.C
// Load Geant3 libraries gROOT-gtLoadMacro(g3libs
.C) g3libs()
// Load Geant4 libraries gROOT-gtLoadMacro(g4libs
.C) g4libs()
appl-gtInitMC("g3Config.C")
appl-gtInitMC("g4Config.C")
19E01 g3Config.C g4Config.C
void Config() new TGeant3("C Interface
to Geant3")
void Config()
// RunConfiguration for Geant4
TG4RunConfiguration runConfiguration new
TG4RunConfiguration() // Geant4 VMC
new TGeant4("TGeant4", "The Geant4 Monte Carlo",
runConfiguration)
20ExamplesAliRoot
- AliRoot Framework
- Integrates simulation, reconstruction and
analysis software for the ALICE experiment - Simulation based on Virtual Monte Carlo
- A complex example of VMC usage
- No MC specific code in user code
- PPR production with Geant3
- More on AliRoot in the presentations
- The AliRoot Framework, status and perspectives
(F.Carminati) - Simulation in ALICE (A. Morsch)
- ALICE experience with Geant4 (I. Gonzalez)
21AliRoot Geometry
Dimuon Arm
22AliRoot Hits Production
Geant3
Geant4
23VMC Future (1)
- Integration of the new Root geometrical modeller
(TGeo) in VMC in progress - Will then be able to define MC geometry directly
via TGeo - Geant3, Fluka
- Replacement of the native geometry with TGeo
inside the program itself - Geant3
- Already operational, close to completion
- Production release in coming weeks
- Fluka
- Work is ongoing
24VMC Future (2)
- Geant4
- Discussions about using the Root geometry
modeller through an abstract interface to Geant4
geometry have been started - RootToG4 converter
- Converter from Root geometry to Geant4 native
geometry - Already operational, close to completion
- Production release will follow the release of the
new Geant3 version - More on TGeo in the presentation
- A Geometrical Modeller for HEP (A. Gheata)
25Distribution
- ROOT CVS server
- mc core package (interfaces), in Root
- geant3, geant4_vmc
- 2 independent modules (parallel to root)
- cvs -d pservercvs_at_root.cern.ch/user/cvs co P
geant3 - cvs -d pservercvs_at_root.cern.ch/user/cvs co P
geant4_vmc - ROOT Web
- http//root.cern.ch/root/vmc/VirtualMC.html
- Distribution of sources
- geant321_vmc.version.tar.gz
- geant4_vmc.version.tar.gz
26Summary
- VMC allows the user to run different transport
MonteCarlos from the same user code - On the menu today Geant3, Geant4
- Coming soon Fluka
- VMC available from
- http//root.cern.ch/root/vmc/VirtualMC.html