cs0306005/vmc.tex
1: %% ****** Start of file slactemplate.tex ****** %
2: %%
3: %%
4: %%   This file is part of the APS files in the REVTeX 4 distribution.
5: %%   Version 4.0 of REVTeX, August 2001
6: %%
7: %%
8: %%   Copyright (c) 2001 The American Physical Society.
9: %%
10: %%   See the REVTeX 4 README file for restrictions and more information.
11: %%
12: %
13: % This is a template for producing manuscripts for use with REVTEX 4.0
14: % Copy this file to another name and then work on that file.
15: % That way, you always have this original template file to use.
16: %
17: \documentclass[twocolumn,twoside,slac]{revtex4}
18: \usepackage{graphicx}
19: \usepackage{fancyhdr}
20: \pagestyle{fancy}
21: \fancyhead{} % clear all fields
22: \fancyhead[C]{\it {Computing in High Energy and Nuclear Physics, 
23:                    La Jolla, March 24-28, 2003}} 
24: \fancyhead[RO,LE]{\thepage}
25: \fancyfoot{} % clear all fields
26: \fancyfoot[LE,LO]{\bf THJT006}
27: \renewcommand{\headrulewidth}{0pt}
28: \renewcommand{\footrulewidth}{0pt}
29: \renewcommand{\sfdefault}{phv}
30: 
31: \setlength{\textheight}{235mm}
32: \setlength{\textwidth}{170mm}
33: \setlength{\topmargin}{-20mm}
34: 
35: \def\tablename{Example} 
36: 
37: 
38: % You should use BibTeX and apsrev.bst for references
39: 
40: \bibliographystyle{apsrev}
41: 
42: \begin{document}
43: 
44: %Title of paper
45: \title{The Virtual Monte Carlo}
46: 
47: 
48: % Repeat the \author .. \affiliation  etc. as needed
49: %
50: % \affiliation command applies to all authors since the last
51: % \affiliation command. The \affiliation command should follow the
52: % other information
53: 
54: \author{I. H\v{r}ivn\'{a}\v{c}ov\'{a}}
55: \affiliation{IPN, Orsay, France}
56: %
57: \author{D. Adamov\'{a}}
58: \affiliation{NPI, ASCR, Rez, Czech Republic}
59: %
60: \author{V. Berejnoi, R. Brun, F.Carminati, A. Fass\`{o}, E. Fut\'{o}, A. Gheata, A. Morsch}
61: \affiliation{CERN, Geneva, Switzerland}
62: %
63: \author{I. Gonz\'{a}lez Caballero}
64: \affiliation{IFCA, Santander, Spain}
65: %
66: \author{\it{For the ALICE Collaboration}}
67: 
68: \begin{abstract}
69: The concept of Virtual Monte Carlo (VMC) has been developed by the ALICE 
70: Software Project to allow different Monte Carlo simulation programs to run 
71: without changing the user code, such as the geometry definition, the detector 
72: response simulation or input and output formats. Recently, the VMC classes 
73: have been integrated into the ROOT framework, and the other relevant packages 
74: have been separated from the AliRoot framework and can be used individually by 
75: any other HEP project. The general concept of the VMC and its set
76: of base classes provided in ROOT will be presented. Existing implementations for 
77: Geant3, Geant4 and FLUKA and simple examples of usage will be described.
78: 
79: \end{abstract}
80: 
81: %\maketitle must follow title, authors, abstract
82: \maketitle
83: 
84: \thispagestyle{fancy}
85: 
86: % body of paper here - Use proper section commands
87: % References should be done using the \cite, \ref, and \label commands
88: % Put \label in argument of \section for cross-referencing
89: %\section{\label{}}
90: 
91: \section{Introduction}
92: The concept of Virtual Monte Carlo (VMC) has been gradually developed by the ALICE
93: Software project \cite{alice-off}. From the beginning, the ALICE collaboration
94: has adopted a strategy for the development of the simulation framework 
95: that would allow a smooth transition from the currently used transport code, 
96: Geant3 \cite{g3}, to new ones Geant4 \cite{g4} and Fluka \cite{fluka}.
97: Instead of maintaining the Geant3 based code written in FORTRAN and developing 
98: in parallel a new framework, based on a new simulation program,
99: the user code was gradually migrated from FORTRAN to C++ and a general
100: C++ interface to a transport Monte Carlo (MC) was developed.
101: 
102: The VMC development went through the following phases:
103: 
104: 1. The C++ class, TGeant3, providing access to Geant3 data structures (common blocks)
105: and functions was introduced. This provided a starting point for a full migration
106: of the user code from FORTRAN to C++.
107: 
108: 2. The abstract C++ class, AliMC, was defined as a generalization of TGeant3.
109: This gave the initial step for the development of the Geant4 interface and 
110: the explicit Geant3 dependencies in the user code were also taken away. 
111: However, the implementations of the AliMC interface for both Geant3 and Geant4 
112: were dependent on the ALICE software.
113: 
114: 3. The interfaces to the user Monte Carlo application were
115: introduced. The dependence of the implementations of the AliMC interface 
116: on the ALICE software could then be removed and the VMC was also made available 
117: to non-ALICE users.
118: 
119: \section{Architecture}
120: 
121: \subsection{The VMC concept}
122: With the VMC concept the user Monte Carlo application can be defined
123: independently of a specific transport code (see Fig.~\ref{VMC-concept-now}).
124: It can then be run with all supported Monte Carlos, without changing the user code, 
125: ie., the geometry definition, the detector response simulation and input 
126: or output formats. The selection of a concrete Monte Carlo (Geant3, Geant4 or Fluka)
127: is made dynamically at run time.
128: 
129: \begin{figure}[t]
130: %\centering
131: \includegraphics[width=8cm]{concept1.eps}
132: \caption{The Virtual Monte Carlo concept.} \label{VMC-concept-now}
133: \end{figure}
134: 
135: The VMC is based on the ROOT system \cite{root}, which is used mainly
136: for scripting and dynamical loading of libraries. Once the VMC application
137: has been defined, simulations can be run interactively from the Root UI or
138: using Root macros.
139: 
140: \subsection{Design}
141: In order to completely decouple the user code from the concrete
142: Monte Carlo, the interfaces to both the Monte Carlo itself and to the user 
143: application code have been introduced as shown in Fig.~\ref{design}.
144: In the following subsections, all interfaces will be discussed in detail.
145: 
146: \begin{figure}[t]
147: %\centering
148: \includegraphics[width=8cm]{design.eps}
149: \caption{The Virtual Monte Carlo design.} \label{design}
150: \end{figure}
151: 
152: 
153: \subsubsection{Virtual MC}
154: The Virtual MC interface (class TVirtualMC) was 
155: the first interface written and it is the most robust one.
156: It has been defined as a generalization of Geant3 functions for the definition
157: of simulation tasks and it provides:
158: \begin{itemize}
159: \item Methods for building and accessing geometry
160: \item Methods for building and accessing materials
161: \item Methods for setting physics
162: \item Methods for accessing transported particle properties during stepping
163: \item Methods for run control
164: \end{itemize}
165: The implementations of the Virtual MC for concrete transport programs
166: are part of the VMC distribution and are provided for the user.
167: At the present time, the Geant3 VMC and the Geant4 VMC are in distribution, 
168: the Fluka VMC will be available soon. 
169: 
170: \subsubsection{Virtual MC Application}
171: The Virtual MC Application interface (class TVirtualMCApplication) 
172: is the interface to a user application code. It defines user actions 
173: at each stage of a simulation run:
174: \begin{tabbing}
175: Armadillo: \=        \kill
176: \> Construct geometry\\
177: \> Init geometry\\
178: \> Generate primaries\\
179: \> Begin event\\
180: \> Begin primary\\
181: \> Pre Track\\
182: \> Stepping\\
183: \> Post Track\\
184: \> Finish primary\\
185: \> Finish event
186: \end{tabbing}
187: The implementation of the Virtual MC Application completely defines 
188: the user application and has to be provided by the user. 
189:  
190: \subsubsection{Virtual MC Stack}
191: The Virtual MC Stack interface (class TVirtualMCStack)
192: defines the interface to a user defined particles stack.
193: Users can choose one of the concrete stack classes provided
194: in the VMC examples or can implement their own stack class.
195: 
196: \subsubsection{Virtual MC Decayer}
197: The last interface in the VMC, the Virtual MC Decayer (class 
198: TVirtualMCDecayer), defines the interface to the external decayer.
199: The implementation of this interface by a user is optional.
200: 
201: \section{Use of VMC}
202: The user VMC application code is written by implementing the MC Application
203: class. In the case of very simple applications the user can write everything 
204: in the one class. In more complex cases it can be convenient to define the user application
205: class as a composition of more action classes, as is shown in the VMC examples
206: described in section 5.1. 
207: 
208: In this section, three examples of a user code based on the VMC will be given.
209: 
210: \subsection{Geometry construction}
211: 
212: In Example~\ref{table-geom-construction}, an example of a geometry definition is
213: given. The geometry is defined by calls to the Virtual MC interface. 
214: In the first block, a volume named ``TRTU'' of the shape tube of an inner 
215: radius of 0~cm and outer radius of 60~cm, is created and associated with a material
216: defined by the tracking medium identifier ``idAl''. In the second block,
217: this volume is placed at the position (-100~cm, 0~cm, 0~cm) in the mother volume
218: named ``EXPH''.
219: 
220: \begin{table*}[t]
221: \begin{center}
222: \caption{Example of a user code for geometry construction using the VMC}
223: \begin{tabular}{|l|}
224: \hline 
225: \\
226: void MyMCApplication::ConstructGeometry()                       \\
227: \{                                                              \\
228: \hskip 5mm \it{// Create tracker tube volume}                   \\
229: \hskip 5mm  Double\_t trackerTube[3];                           \\
230: \hskip 5mm  trackerTube[0] =  0.;                               \\ 
231: \hskip 5mm  trackerTube[1] = 60.;                               \\ 
232: \hskip 5mm  trackerTube[2] = 50.;                               \\ 
233: \hskip 5mm  gMC$->$Gsvolu("TRTU", "TUBE", idAl, trackerTube, 3);\\
234: \\
235: \hskip 5mm \it{// Place tracker tube volume}                    \\
236: \hskip 5mm  Double\_t posX = -100.;                             \\
237: \hskip 5mm  Double\_t posY =    0.;                             \\
238: \hskip 5mm  Double\_t posZ =    0.;                             \\
239: \hskip 5mm  gMC$->$Gspos("TRTU", 1, "EXPH", posX, posY, posZ, 0, "ONLY"); \\
240: \}                                                              \\
241: \\  
242: \hline
243: \end{tabular}
244: \label{table-geom-construction}
245: \end{center}
246: \end{table*}
247: 
248: The functions for geometry building are compatible with Geant3 (both by name 
249: and in the list of parameters). The VMC also uses the Geant3 system of default 
250: physical units. In future, using the Root geometrical modeller directly will 
251: be possible as an alternative to this Geant3 style. (For more details, 
252: see section 6.)
253: 
254: \subsection{Primary particles}
255: In Example~\ref{table-primary-particles}, an example of how to define primary 
256: particles is given. This is done by calls to the Virtual MC Stack interface. 
257: The particle type (proton, electron, ...) is defined using
258: the PDG encoding and particle static properties (mass, charge, ...)
259: are taken from the particle database in ROOT (represented by the TDatabasePDG 
260: class).
261: 
262: \begin{table*}[t]
263: \begin{center}
264: \caption{Example of a user code for primary particles definition using the VMC}
265: \begin{tabular}{|l|}
266: \hline 
267: \\
268: void MyMCApplication::GeneratePrimaries()              \\
269: \{                                                     \\
270: \hskip 5mm \it{// Define particle properties: }        \\
271: \hskip 5mm \it{// PDG encoding: pdg           }        \\ 
272: \hskip 5mm \it{// position: vx, vy, vz, t     }        \\ 
273: \hskip 5mm \it{// momentum: px, py, pz, e     }        \\ 
274: \hskip 5mm \it{// ...                         }        \\
275: \\
276: \hskip 5mm \it{   // Add particle to MC stack }        \\
277: \hskip 5mm gMC$->$GetStack()                           \\
278: \hskip 18mm      $->$SetTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz,t, ...);\\
279:  \}                                                    \\
280: \\  
281: \hline
282: \end{tabular}
283: \label{table-primary-particles}
284: \end{center}
285: \end{table*}
286: 
287: \subsection{Detector response}
288: In Example~\ref{table-detector-response}, an example of a user stepping function
289: is shown. This function is called by MC at each step. In this example
290: the properties of the particle transported are obtained via calls to
291: the Virtual MC interface and then saved in the user own hits objects.
292: For large detectors it is recommended to delegate this function to 
293: stepping functions defined in subdetector classes.
294: 
295: \begin{table}[t]
296: \begin{center}
297: \caption{Example of a user code for a detector response simulation using the VMC}
298: \begin{tabular}{|l|}
299: \hline 
300: \\
301: void MyMCApplication::Stepping()                       \\
302: \{                                                     \\
303: \hskip 5mm \it{// Get current volume ID}               \\
304: \hskip 5mm  Int\_t copyNo;                             \\
305: \hskip 5mm  Int\_t id = gMC$->$CurrentVolID(copyNo);   \\
306: \\
307: \hskip 5mm \it{// Check if step is performed in the sensitive volume } \\
308: \hskip 5mm if (id != fSensitiveVolumeID) return false; \\
309: \\
310: \hskip 5mm \it{// Get track position}                  \\
311: \hskip 5mm  Double\_t x, y, z;                         \\ 
312: \hskip 5mm  gMC$->$TrackPosition(x, y, z);             \\ 
313: \\
314: \hskip 5mm \it{// Get energy deposit}                  \\ 
315: \hskip 5mm  Double\_t edep = gMC$->$Edep();            \\
316: \\
317: \hskip 5mm \it{   // Create user hit}                  \\
318: \hskip 5mm  mySD$->$AddHit(x, y, z, edep);             \\
319:  \}                                                    \\
320: \\  
321: \hline
322: \end{tabular}
323: \label{table-detector-response}
324: \end{center}
325: \end{table}
326: 
327: \section{Available MCs}
328: 
329: In this section we will outline the present status and give a short description 
330: of the implementations of the Virtual MC for the three transport MCs: 
331: Geant3, Geant4 and Fluka.
332: 
333: \subsection{Geant3 VMC}
334: The Geant3 program \cite{g3} was written to describe the passage of elementary 
335: particles through matter. Originally designed for high energy physics 
336: experiments, it has also found applications outside this domain in the areas 
337: of medical and biological sciencies, radioprotection and astronautics. 
338: The first version was released in 1974 and the system was 
339: developed with some continuity over 20 years till the last release 3.21 in 1994. 
340: It has become a popular and widely used tool in the HEP community.
341: 
342: The Geant3 VMC, which implements the Virtual MC interface to the Geant3 program,
343: is provided within a single package ``geant3'' together with Geant321 itself.
344: This ``geant3'' package is available from the ROOT Web site \cite{root}.
345: 
346: As the Virtual MC was largely inspired by Geant3, its implementation
347: for Geant3 was straightforward and has no limitations.
348: 
349: Besides the implementation of the Virtual MC, the Geant3 VMC also includes
350: the Geant3 Geometry Browser \cite{g3gui}, a GUI which provides a variety
351: of functions, namely:
352: \begin{itemize}
353: \item visualization of the geometry volumes tree
354: \item drawing of volumes and interactive setting of drawing options
355: \item browsing material and tracking medias parameters
356: \item browsing applied cuts and activated physics processes
357: \item plotting of dE/dx and cross-sections for a selected physical process
358: \end{itemize}
359: The implementation is based on the Root GUI classes.  
360: 
361: \subsection{Geant4 VMC}
362: 
363: The Geant4 project \cite{g4} was started in 1994, the first production version was 
364: released in 1998 and the system is continuously under developement by the Geant4 
365: Collaboration. Its areas of application include particle and nuclear physics 
366: experiments, medical, accelerator and space physics studies.
367: 
368: The Geant4 VMC, which implements the Virtual MC interface for the Geant4 program,
369: is provided within the ``geant4\_vmc'' package and requires a prior Geant4 
370: installation. This ``geant4\_vmc'' package is available from the ROOT Web 
371: site \cite{root}.
372: 
373: The implementation of the interface to MC for Geant4 was presented 
374: at the CHEP 2001 conference \cite{chep2001}. The design, the implementation 
375: and also the problems arising from the G3toG4 approach and their foreseen 
376: solutions were discussed. Despite improvements and design changes, 
377: the structure and the components of the package presented there 
378: can be found in the current Geant4 VMC package. The major change applied
379: since then was that the dependencies on the ALICE classes in AliGeant4 
380: have been replaced by the dependencies on the interfaces to a user 
381: application. This meant that all classes from AliGeant4 could be moved to 
382: the experiment independent part, TGeant4, that has been then renamed
383: Geant4 VMC.   
384: 
385: The main improvement from that time was in minimizing the limitations 
386: of the G3toG4 tool in the Geant4 4.0 release. New classes to support 
387: the reflection symmetry and also a limited support for the ``MANY'' 
388: volumes positions have been introduced. The G3toG4 tool does not resolve positions with ``MANY'' 
389: automatically, however a user can specify the overlapping volumes using the 
390: G4gsbool() function and then the overlaps for these volumes and their daughters
391: are automatically resolved using Boolean solids. The volume 
392: with a ``MANY'' position can only have this position. The corresponding
393: function Gsbool() has been added to the Virtual MC interface.
394: 
395: The VMC interface provides a common denominator for all implemented MCs
396: and cannot cover all commands available in a Geant4 user session
397: through the Geant4 UI. Switching between the Root UI and the Geant4 UI 
398: gives the VMC user the possibility of working with the native Geant4 UI 
399: when needed or desired. It is also possible to process a foreign command or a 
400: foreign macro in both UIs, for example the Root commands and macros 
401: can be processed in the Geant4 UI and vice versa. 
402: 
403: In a similar way as the Geant3 VMC, the Geant4 VMC also includes the Geant4 
404: Geometry Browser. It was implemented in an analogous way. It provides 
405: the same functionality for browsing geometry. It does not include the panels
406: that allow to browse the activated physical processes
407: and their characteristics.
408: 
409: In addition, the Geant4 VMC also includes an XML convertor. With this convertor
410: the Geant4 geometry can be exported to XML in the AGDD format \cite{agdd} and then 
411: browsed and visualized using the GraXML tool \cite{graxml}. The XML 
412: convertor classes are independent of the Geant4 VMC, they can be compiled 
413: in a separate library and also used with a native Geant4 application.
414: 
415: \subsection{Fluka VMC}
416: The history of FLUKA \cite{fluka} goes back to 1962-1967. Over the years it went 
417: through three different generations, which can be roughly identified
418: as the FLUKA of the '70s, the FLUKA of the '80s and today's FLUKA as a fully 
419: integrated particle physics Monte Carlo simulation package. It has many applications 
420: in high energy experimental physics, engineering, shielding, detector and telescope 
421: design, cosmic ray studies, dosimetry, medical physics and radio-biology. 
422:        
423: The Fluka VMC is now under development within the ALICE collaboration and 
424: the FLUKA team. The development version of the VMC implementation is 
425: in the TFluka package of AliRoot. 
426: 
427: Most of the functionality required by the VMC is
428: already fully operational:
429: \begin{itemize}
430: \item Functions for building and accessing geometry (through Flugg) 
431: \item Functions for accessing transported particle properties during stepping
432: \item Recording particles in the VMC stack
433: \item Functions for run management
434: \end {itemize}
435: Under development are:
436: \begin{itemize}
437: \item Functions for selecting activated physics processes
438: \item Interface to the external decayer
439: \end {itemize}
440: 
441: The geometry part of the Fluka VMC is implemented with the use of
442: the Geant4 VMC and the Flugg tool \cite{flugg}. Flugg  was developed 
443: a few years ago so that the Geant4 geometry could be used directly in the 
444: Fluka particle transport. In the near future this part will be replaced 
445: by the Root geometrical modeller. (For more details, see section 6.)
446: 
447: \section{Examples}
448: 
449: \subsection{Examples provided with the VMC}
450: To demonstrate the use of the VMC, Geant4 novice examples N01, N02 and 
451: N03 were rewritten in the VMC framework.
452: The Geant4 novice examples were chosen in order to show
453: the similarities and differences between the two frameworks.
454: Having in parallel, both the Geant4 VMC and the Geant4 native application, 
455: allows to verify the consistence of the results and to compare
456: performancies. 
457: 
458: The VMC examples demonstrate the implementation of the user 
459: MC application and MC stack classes. While in the first example all 
460: functions of the MC application are implemented directly in the Ex01MCApplication
461: class, in the other examples the MC application class is defined as 
462: being a composition of more action classes (e.g  the detector construction class)
463: and it delegates most of its functions to its components.
464: 
465: \begin{table*}[t]
466: \begin{center}
467: \caption{Root macros, run\_g3.C and run\_g4.C, that show how to run the VMC example E01. 
468: MC specific parts are given in the parallel columns.}
469: \begin{tabular}{|l|l|}
470: \hline 
471: \multicolumn{2}{|l|}{ \hskip 20mm \{                              }   \\
472: \multicolumn{2}{|l|}{ \hskip 25mm \it{// Load basic libraries}    }   \\
473: \multicolumn{2}{|l|}{ \hskip 25mm gROOT$->$LoadMacro("basiclibs.C");} \\ 
474: \multicolumn{2}{|l|}{ \hskip 25mm basiclibs();                    }   \\ 
475: \multicolumn{2}{|l|}{ \hskip 25mm                                 }   \\
476: 
477: \hskip 5mm // Load Geant3 libraries       & 
478: \hskip 5mm // Load Geant4 libraries                                   \\ 
479: \hskip 5mm gROOT$->$LoadMacro("g3libs.C"); & 
480: \hskip 5mm gROOT$->$LoadMacro("g4libs.C");                            \\                       
481: \hskip 5mm g3libs();                      & 
482: \hskip 5mm g4libs();                                                  \\
483: \multicolumn{2}{|l|}{ \hskip 25mm                                }    \\
484: \multicolumn{2}{|l|}{ \hskip 25mm \it{// Load this example library}}  \\                     
485: \multicolumn{2}{|l|}{ \hskip 25mm gSystem$->$Load("libexample01"); }  \\
486: \multicolumn{2}{|l|}{ \hskip 25mm                                }    \\
487: 
488: \multicolumn{2}{|l|}{ \hskip 25mm  \it{// MC application}        }    \\
489: \multicolumn{2}{|l|}{ \hskip 25mm  Ex01MCApplication* appl       }    \\            
490: \multicolumn{2}{|l|}{ \hskip 30mm = new Ex01MCApplication("Example01", "The example01 MC application"); } \\
491: 
492: \multicolumn{2}{|l|}{ \hskip 25mm                                }   \\
493: \hskip 5mm  appl$->$InitMC("g3Config.C"); &  
494: \hskip 5mm  appl$->$InitMC("g4Config.C");                            \\
495: 
496: \multicolumn{2}{|l|}{ \hskip 25mm                                }   \\
497: \multicolumn{2}{|l|}{ \hskip 25mm appl$->$RunMC(1);              }   \\
498: \multicolumn{2}{|l|}{ \hskip 20mm \}                             }   \\
499: \multicolumn{2}{|l|}{ \hskip 25mm                                }   \\
500: \hline 
501: \end{tabular}
502: \label{table-run-macros}
503: \end{center}
504: \end{table*}
505: 
506: All examples are executed by processing the provided Root macros.
507: The macros for running the example E01 with Geant3 and Geant4 (run\_g3.C and run\_g4.C)
508: are shown in Example~\ref{table-run-macros}. In both macros, all necessary
509: libraries are first dynamically loaded, then the user MC application is created 
510: and initialized with a MC specific configuration macro (g3Config.C or g4Config.C) 
511: shown in Example~\ref{table-config-macro}. After initialization, a simulation run with 
512: the chosen concrete MC is executed for the specified number of events.
513: 
514: \begin{table*}[t]
515: \begin{center}
516: \caption{Root configuration macros: g3Config.C and g4Config.C}
517: \begin{tabular}{|l|}
518: \hline 
519: \textbf{g3Config.C:} \\                  
520: \\
521: void Config()                                          \\
522: \{                                                     \\
523: \hskip 5mm \it{// Geant3 VMC}                          \\
524: \hskip 5mm new TGeant3("C++ Interface to Geant3");     \\
525: \}                                                     \\
526: \\  
527: \hline
528: \textbf{g4Config.C:} \\
529: \\                  
530: void Config()                                               \\
531: \{                                                          \\
532: \hskip 5mm \it{// Run Configuration for Geant4}             \\
533: %\hskip 5mm TG4RunConfiguration* runConfiguration            \\
534: %\hskip 2cm = new TG4RunConfiguration();                     \\
535: \hskip 5mm TG4RunConfiguration* runConfiguration = new TG4RunConfiguration();  \\
536: \\
537: \hskip 5mm \it{// Geant4 VMC}                               \\
538: \hskip 5mm new TGeant4("TGeant4", "The Geant4 Monte Carlo", runConfiguration);\\
539: %\hskip 5mm new TGeant4("TGeant4", "The Geant4 Monte Carlo", \\
540: %\hskip 2cm             runConfiguration");                  \\
541: \}                                                          \\
542: \\  
543: \hline
544: \end{tabular}
545: \label{table-config-macro}
546: \end{center}
547: \end{table*}
548: 
549: \subsection{AliRoot}
550: AliRoot is the ALICE off-line framework for simulation,
551: reconstruction and analysis. The simulation in AliRoot is fully based 
552: on the VMC. Hence the AliRoot framework can be given as a complex example 
553: of a VMC application. 
554: 
555: The AliRoot framework will not be discussed in more detail in this paper,
556: but the reader is directed to the other CHEP03 conference papers
557: related to this subject: ``The AliRoot Framework, status and perspectives''
558: \cite{aliroot-chep03}, ``Simulation in ALICE'' \cite{simulation-chep03}, 
559: ``ALICE experience with Geant4'' \cite{g4alice-chep03}.
560: 
561: In the following, a few figures demonstrating the use of AliRoot with two MCs, 
562: Geant3 and Geant4, will be given. In Fig.~\ref{aliroot-its-geometry} and  
563: Fig.~\ref{aliroot-muon-geometry} the geometries for two ALICE detector 
564: subsystems (the ITS and the Dimuon arm) are shown - the first drawn with Geant3, 
565: the second drawn with Geant4 and GraXML. In Fig.~\ref{aliroot-hits}, 
566: the x and z distributions of hits in the TPC subsystem are shown for two 
567: transport MCs: Geant3 and Geant4, giving qualitatively similar results.  
568: 
569: \begin{figure}[t]
570: %\centering
571: \includegraphics[width=8cm]{its.eps}
572: \caption{Geometry for ITS detector drawn with Geant3.} 
573: \label{aliroot-its-geometry}
574: \end{figure}
575: 
576: \begin{figure}[t]
577: %\centering
578: \includegraphics[width=8cm]{muon.eps}
579: \caption{Geometry for the Dimuon Arm spectrometer drawn with Geant4 and GraXML.} 
580: \label{aliroot-muon-geometry}
581: \end{figure}
582: 
583: \begin{figure}[t]
584: %\centering
585: \includegraphics[width=8cm]{hits.eps}
586: \caption{The x,z-distributions of hits in the TPC detector.} 
587: \label{aliroot-hits}
588: \end{figure}
589: 
590: \section{Future}
591: Over the past two years the ALICE Offline project, in close collaboration with
592: the ROOT team, has developed a new multi-purpose geometrical modeller for HEP.
593: It is called TGeo and has been included in ROOT \cite{tgeo-chep03}. 
594: This new geometrical modeller is currently being integrated into the VMC.
595: 
596: The VMC user will then have also the possibility
597: to define geometry directly using the new geometrical modeller. The current interface
598: will be kept for backward compatibility. Apart from making a geometry construction 
599: via the VMC more user-friendly, this integration will also improve 
600: the performance of the MC simulation. The new modeller has been optimised 
601: for performance and runs faster than Geant3 for most geometries tested. 
602: 
603: For Geant3 and Fluka, the integration of TGeo is being made by replacing
604: the native geometry with the TGeo one. The new version of
605: Geant3 with the new Root geometry package is close to completion and
606: the work on the integration of TGeo into Fluka is already well 
607: advanced.
608: 
609: For Geant4, the object-oriented methodology can be exploited and TGeo can 
610: be integrated with Geant4 through an abstract interface to the Geant4 geometry.
611: At present, the Geant4 geometry navigator class is not based on an abstract
612: interface, its generalization will be required to allow an alternative
613: implementation using TGeo. Discussions with the Geant4 team have started 
614: and the design and prototype implementation for the abstract navigator
615: and transportation are now part of the Geant4 developments planned for the 6.0
616: release \cite{g4plans}.
617: 
618: In the meantime, a convertor from Root geometry to Geant4 native
619: geometry, RootToG4, has been developed. It is already operational and close
620: to completion. It will allow the migration from the current VMC geometry definitions
621: to TGeo, before the solution via the abstract navigator is available.
622: 
623: The new concept of the VMC including the Root geometrical modeller
624: is shown in Fig.~\ref{VMC-concept-future}. 
625: 
626: \begin{figure}[t]
627: %\centering
628: \includegraphics[width=8cm]{concept2.eps}
629: \caption{The Virtual Monte Carlo and TGeo integration.} 
630: \label{VMC-concept-future}
631: \end{figure}
632: 
633: 
634: \section{Distribution}
635: The VMC is distributed with the ROOT system \cite{root}.
636: It consists of the following packages:
637: \begin{itemize}
638: \item mc: the core package (interfaces)
639: \item geant3: Geant321 + Geant3 VMC
640: \item geant4\_vmc: Geant4 VMC
641: \item examples
642: \end{itemize}
643: The ``mc'' package is directly included in ROOT, ``geant3'' and ``geant4\_vmc''
644: are available from the ROOT CVS server \cite{rootcvs} as independent modules 
645: and the package with the examples is provided within ``geant4\_vmc''.
646: 
647: The tarballs with sources are also available from the VMC
648: Web page \cite{vmc}. 
649: 
650: \section{Conclusions}
651: The Virtual Monte Carlo provides a simulation framework which is independent 
652: of any concrete MC and is based on the ROOT system. Geant3 and Geant4 have 
653: already been integrated and the same work with Fluka is in progress.
654: 
655: The main advantage with VMC is that the user 
656: can run the same simulation program with three different transport MCs.
657: The obvious consequence is that the different models can be compared and
658: better understood.
659: VMC also facilitates the use of less user-friendly tools such as Geant3 and Fluka
660: and - being inspired from Geant3 - it is also suitable for users starting 
661: with existing Geant3 applications.
662:   
663: The integration of the Root geometrical modeller will give the user
664: a new means for geometry definition, browsing, 
665: visualization and also verification directly within the scope of the VMC. 
666: 
667: 
668: % If you have acknowledgments, this puts in the proper section head.
669: \begin{acknowledgments}
670: The authors wish to thank the Geant4 and Fluka teams for the constructive
671: collaboration and their help provided during this work.
672: \end{acknowledgments}
673: 
674: % Create the reference section using BibTeX:
675: %\bibliography{basename of .bib file}
676: \begin{thebibliography}{99}   % Use for  1-9  references
677: 
678: %\bibitem{accelconf-ref}
679: %http://www.cern.ch/accelconf
680: 
681: \bibitem{alice-off}
682: http://AliSoft.cern.ch/offline
683: 
684: \bibitem{g3}
685: Application Software Group, CN Div., ``GEANT Detector Description and
686: Simulation Tool (Version 3.21)'', CERN Program Library W5013. \\
687: http://wwwinfo.cern.ch/asd/geant
688: 
689: \bibitem{g3gui}
690: http://alisoft/cern.ch/people/morsch/ Geant3GUI.html
691: 
692: \bibitem{g4}
693: S. Agostinelli et al., ``Geant4 - A Simulation Toolkit'', CERN-IT-20020003,
694: KEK Preprint 2002-85, SLAC-PUB-9350, submitted to Nuclear Instruments and
695: Methods NIM A. \\
696: http://wwwinfo.cern.ch/asd/geant4/geant4.html  
697: 
698: \bibitem{g4plans}
699: http://wwwasd.web.cern.ch/wwwasd/geant4/ source/planned\_features.html
700: 
701: \bibitem{fluka}
702: http://pcfluka.mi.infn.it
703: 
704: \bibitem{flugg}
705: http://www.fluka.org/projects/flugg
706: 
707: \bibitem{root}
708: http://root.cern.ch
709: 
710: \bibitem{rootcvs}
711: http://root.cern.ch/root/CVS.html
712: 
713: \bibitem{chep2001}
714: I. Hrivnacova for the Alice Collaboration: ``GEANT4 in the AliRoot Framework'', 
715: Proceedings of CHEP 2001, Science Press Beijing New York, p.534.
716: 
717: \bibitem{agdd}
718: http://atlas.web.cern.ch/Atlas/GROUPS/ DATABASE/detector\_description/index.html
719: 
720: \bibitem{graxml}
721: J. Hrivnac: ``GraXML - Modular Geometric Modeller'', Presented at CHEP 2003, 
722: La Jolla, PSN THJT009. \\
723: http://hrivnac.home.cern.ch/hrivnac/Activities/ Packages/GraXML
724: 
725: \bibitem{aliroot-chep03}
726: R. Brun, P. Buncic, F. Carminati, A. Morsch, F. Rademakers, K. Safarik for the
727: Alice Collaboration: `` The AliRoot Framework, status and perspectives'', 
728: Presented at CHEP 2003, La Jolla, PSN THJT003.
729: 
730: \bibitem{simulation-chep03}
731: A. Morsch for the Alice Collaboration: ``Simulation in ALICE.'',
732: Presented at CHEP 2003, La Jolla, PSN TUMT004.
733: 
734: \bibitem{g4alice-chep03}
735: F. Carminati, I. Gonzalez, I. Hrivnacova, A. Morsch for the Alice Collaboration:
736: ``ALICE experience with Geant4.'', Presented at CHEP 2003, La Jolla, PSN MOMT011.
737: 
738: \bibitem{tgeo-chep03}
739: R. Brun, A. Gheata, M. Gheata for the Alice Collaboration:
740: ``A geometrical modeller for HEP'', Presented at CHEP 2003, La Jolla, PSN THMT001.
741: 
742: \bibitem{vmc}
743: http://root.cern.ch/root/vmc/VirtualMC.html
744: 
745: %\bibitem{templates-ref}
746: %http://www.cern.ch/accelconf/templates.html
747: 
748: \end{thebibliography}
749: 
750: \end{document}
751: %
752: % ****** End of file template.aps ******
753: