source: trunk/documents/UserDoc/DocBookUsersGuides/ForApplicationDeveloper/xml/Fundamentals/global.xml@ 1353

Last change on this file since 1353 was 1211, checked in by garnier, 16 years ago

CVS update

File size: 29.5 KB
Line 
1<!-- ******************************************************** -->
2<!-- -->
3<!-- [History] -->
4<!-- Changed by: Katsuya Amako, 21-Sep-1998 -->
5<!-- Changed by: Katsuya Amako, 9-Jul-1998 -->
6<!-- Proof read by: Joe Chuma, 2-Jul-1999 -->
7<!-- Changed by: Katsuya Amako, 15-Jul-2000 -->
8<!-- Changed by: Dennis Wright, 29-Nov-2001 -->
9<!-- Converted to DocBook: Katsuya Amako, Aug-2006 -->
10<!-- -->
11<!-- ******************************************************** -->
12
13
14<!-- ******************* Section (Level#1) ****************** -->
15<sect1 id="sect.GlobClass">
16<title>
17Global Usage Classes
18</title>
19
20<para>
21The "global" category in Geant4 collects all classes, types,
22structures and constants which are considered of general use within
23the Geant4 toolkit. This category also defines the interface with
24third-party software libraries (CLHEP, STL, etc.) and
25system-related types, by defining, where appropriate,
26<literal>typedef</literal>s according to the Geant4 code conventions.
27</para>
28
29<!-- ******************* Section (Level#2) ****************** -->
30<sect2 id="sect.GlobClass.SignClass">
31<title>
32Signature of Geant4 classes
33</title>
34
35<para>
36In order to keep an homogeneous naming style, and according to
37the Geant4 coding style conventions, each class part of the Geant4
38kernel has its name beginning with the prefix <emphasis>G4</emphasis>, e.g.,
39<emphasis>G4VHit, G4GeometryManager, G4ProcessVector</emphasis>, etc. Instead of
40the raw C types, <emphasis>G4</emphasis> types are used within the Geant4 code.
41For the basic numeric types (<literal>int, float, double</literal>, etc.),
42different compilers and different platforms provide different value
43ranges. In order to assure portability, the use of <emphasis>G4int,
44G4float, G4double, G4bool</emphasis>, globally defined, is preferable.
45<emphasis>G4</emphasis> types implement the right generic type
46for a given architecture.
47</para>
48
49<!-- ******************* Section (Level#3) ****************** -->
50<sect3 id="sect.GlobClass.SignClass.BasicType">
51<title>
52Basic types
53</title>
54
55<para>
56The basic types in Geant4 are considered to be the
57following:
58
59<itemizedlist spacing="compact">
60 <listitem><para>
61 <emphasis>G4int</emphasis>,
62 </para></listitem>
63 <listitem><para>
64 <emphasis>G4long</emphasis>,
65 </para></listitem>
66 <listitem><para>
67 <emphasis>G4float</emphasis>,
68 </para></listitem>
69 <listitem><para>
70 <emphasis>G4double</emphasis>,
71 </para></listitem>
72 <listitem><para>
73 <emphasis>G4bool</emphasis>,
74 </para></listitem>
75 <listitem><para>
76 <emphasis>G4complex</emphasis>,
77 </para></listitem>
78 <listitem><para>
79 <emphasis>G4String</emphasis>.
80 </para></listitem>
81</itemizedlist>
82
83which currently consist of simple <literal>typedef</literal>s to
84respective types defined in the <emphasis role="bold">CLHEP</emphasis>,
85<emphasis role="bold">STL</emphasis> or system
86libraries. Most definitions of these basic types come with the
87inclusion of a single header file, <literal>globals.hh</literal>. This file
88also provides inclusion of required system headers, as well as some
89global utility functions needed and used within the Geant4
90kernel.
91</para>
92
93</sect3>
94
95<!-- ******************* Section (Level#3) ****************** -->
96<sect3 id="sect.GlobClass.SignClass.Typedefs">
97<title>
98Typedefs to CLHEP classes and their usage
99</title>
100
101<para>
102The following classes are <literal>typedef</literal>s to the corresponding
103classes of the <emphasis role="bold">CLHEP</emphasis>
104(<emphasis role="bold">Computing Library for High Energy Physics</emphasis>)
105distribution. For more detailed documentation please refer to the
106<ulink url="http://cern.ch/clhep/manual/RefGuide/">
107<emphasis role="bold">CLHEP reference guide</emphasis>
108</ulink>
109and the
110<ulink url="http://cern.ch/clhep/manual/UserGuide/">
111<emphasis role="bold">CLHEP user manual</emphasis>
112</ulink>
113.
114
115<itemizedlist spacing="compact">
116 <listitem><para>
117 <emphasis>G4ThreeVector, G4RotationMatrix, G4LorentzVector</emphasis> and
118 <emphasis>G4LorentzRotation</emphasis>
119 <para>
120 Vector classes: defining 3-component (x,y,z) vector entities,
121 rotation of such objects as 3x3 matrices,
122 4-component (x,y,z,t) vector entities and their rotation as 4x4 matrices.
123 </para>
124 </para></listitem>
125 <listitem><para>
126 <emphasis>G4Plane3D, G4Transform3D, G4Normal3D, G4Point3D</emphasis>, and
127 <emphasis>G4Vector3D</emphasis>
128 <para>
129 Geometrical classes: defining geometrical entities and
130 transformations in 3D space.
131 </para>
132 </para></listitem>
133</itemizedlist>
134</para>
135
136</sect3>
137</sect2>
138
139
140<!-- ******************* Section (Level#2) ****************** -->
141<sect2 id="sect.GlobClass.HEPRandom">
142<title>
143The <emphasis>HEPRandom</emphasis> module in CLHEP
144</title>
145
146<para>
147The <emphasis>HEPRandom</emphasis> module, originally part of the Geant4
148kernel, and now distributed as a module of <emphasis
149role="bold">CLHEP</emphasis>,
150has been designed and developed starting from the <emphasis>Random</emphasis>
151class of MC++, the original <emphasis role="bold">CLHEP</emphasis>'s
152<emphasis>HepRandom</emphasis> module and the
153<emphasis role="bold">Rogue Wave</emphasis> approach in the
154<emphasis role="bold">Math.h++</emphasis> package. For
155detailed documentation on the <emphasis>HEPRandom</emphasis> classes see the
156
157<ulink url="http://cern.ch/clhep/manual/RefGuide/">
158<emphasis role="bold">CLHEP reference guide</emphasis>
159</ulink>
160and the
161<ulink url="http://cern.ch/clhep/manual/UserGuide/">
162<emphasis role="bold">CLHEP user manual</emphasis>
163</ulink>
164.
165</para>
166
167<para>
168Information written in this manual is extracted from the
169original
170<ulink url="http://cern.ch/clhep/manual/UserGuide/Random/Random.html">
171manifesto
172</ulink>
173 distributed with the <emphasis>HEPRandom</emphasis>
174package.</para>
175
176<para>
177The <emphasis>HEPRandom</emphasis> module consists of classes implementing
178different random ``engines'' and different random
179``distributions''. A distribution associated to an engine
180constitutes a random ``generator''. A distribution class can
181collect different algorithms and different calling sequences for
182each method to define distribution parameters or range-intervals.
183An engine implements the basic algorithm for pseudo-random numbers
184generation.
185</para>
186
187<para>
188There are 3 different ways of shooting random values:
189
190<orderedlist spacing="compact">
191 <listitem><para>
192 Using the static generator defined in the <emphasis>HepRandom</emphasis>
193 class: random values are shot using static methods <literal>shoot()</literal>
194 defined for each distribution class. The static generator will use,
195 as default engine, a <emphasis>HepJamesRandom</emphasis> object, and the user can
196 set its properties or change it with a new instantiated engine
197 object by using the static methods defined in the <emphasis>HepRandom</emphasis>
198 class.
199 </para></listitem>
200 <listitem><para>
201 Skipping the static generator and specifying an engine object:
202 random values are shot using static methods
203 <literal>shoot(*HepRandomEngine)</literal> defined for each distribution
204 class. The user must instantiate an engine object and give it as
205 argument to the shoot method. The generator mechanism will then be
206 by-passed by using the basic <literal>flat()</literal> method of the
207 specified engine. The user must take care of the engine objects
208 he/she instantiates.
209 </para></listitem>
210 <listitem><para>
211 Skipping the static generator and instantiating a distribution
212 object: random values are shot using <literal>fire()</literal> methods (NOT
213 static) defined for each distribution class. The user must
214 instantiate a distribution object giving as argument to the
215 constructor an engine by pointer or by reference. By doing so, the
216 engine will be associated to the distribution object and the
217 generator mechanism will be by-passed by using the basic
218 <literal>flat()</literal> method of that engine.
219 </para></listitem>
220</orderedlist>
221</para>
222
223<para>
224In this guide, we'll only focus on the static generator (point
2251.), since the static interface of <emphasis>HEPRandom</emphasis> is the only one
226used within the Geant4 toolkit.
227</para>
228
229<!-- ******************* Section (Level#3) ****************** -->
230<sect3 id="sect.GlobClass.HEPRandom.Engines">
231<title>
232<emphasis>HEPRandom</emphasis> engines
233</title>
234
235<para>
236The class <emphasis>HepRandomEngine</emphasis> is the abstract class defining
237the interface for each random engine. It implements the
238<literal>getSeed()</literal> and <literal>getSeeds()</literal> methods which return the
239`initial seed' value and the initial array of seeds (if any)
240respectively. Many concrete random engines can be defined and added
241to the structure, simply making them inheriting from
242<emphasis>HepRandomEngine</emphasis>. Several different engines are currently
243implemented in <emphasis>HepRandom</emphasis>, we describe here five of them:
244
245<itemizedlist spacing="compact">
246 <listitem><para>
247 <emphasis>HepJamesRandom</emphasis>
248 <para>
249 It implements the algorithm described in ``F.James, Comp. Phys.
250 Comm. 60 (1990) 329'' for pseudo-random number generation. This is
251 the default random engine for the static generator; it will be
252 invoked by each distribution class unless the user sets a different one.
253 </para>
254 </para></listitem>
255 <listitem><para>
256 <emphasis>DRand48Engine</emphasis>
257 <para>
258 Random engine using the <literal>drand48()</literal> and
259 <literal>srand48()</literal> system functions from C standard library to
260 implement the <literal>flat()</literal> basic distribution and for setting
261 seeds respectively. <emphasis>DRand48Engine</emphasis> uses the
262 <literal>seed48()</literal>
263 function from C standard library to retrieve the current internal
264 status of the generator, which is represented by 3 short values.
265 <emphasis>DRand48Engine</emphasis> is the only engine defined in
266 <emphasis>HEPRandom</emphasis>
267 which intrinsically works in 32 bits precision. Copies of an object
268 of this kind are not allowed.
269 </para>
270 </para></listitem>
271 <listitem><para>
272 <emphasis>RandEngine</emphasis>
273 <para>
274 Simple random engine using the <literal>rand()</literal> and
275 <literal>srand()</literal> system functions from the C standard library to
276 implement the <literal>flat()</literal> basic distribution and for setting
277 seeds respectively. Please note that it's well known that the
278 spectral properties of <literal>rand()</literal> leave a great deal to be
279 desired, therefore the usage of this engine is not recommended if a
280 good randomness quality or a long period is required in your code.
281 Copies of an object of this kind are not allowed.
282 </para>
283 </para></listitem>
284 <listitem><para>
285 <emphasis>RanluxEngine</emphasis>
286 <para>
287 The algorithm for <emphasis>RanluxEngine</emphasis> has been taken from the
288 original implementation in FORTRAN77 by Fred James, part of the
289 <emphasis role="bold">MATHLIB HEP</emphasis> library. The initialisation is
290 carried out using
291 a Multiplicative Congruential generator using formula constants of
292 L'Ecuyer as described in ``F.James, Comp. Phys. Comm. 60 (1990)
293 329-344''. The engine provides five different luxury levels for
294 quality of random generation. When instantiating a
295 <emphasis>RanluxEngine</emphasis>, the user can specify the luxury level to the
296 constructor (if not, the default value 3 is taken). For example:
297
298 <informalexample>
299 <programlisting>
300 RanluxEngine theRanluxEngine(seed,4);
301 // instantiates an engine with `seed' and the best luxury-level
302 ... or
303 RanluxEngine theRanluxEngine;
304 // instantiates an engine with default seed value and luxury-level
305 ...
306 </programlisting>
307 </informalexample>
308
309 The class provides a <literal>getLuxury()</literal> method to get the
310 engine luxury level.
311 </para>
312 <para>
313 The <literal>SetSeed()</literal> and <literal>SetSeeds()</literal>
314 methods to set the initial seeds for the engine, can be invoked specifying
315 the luxury level. For example:
316
317 <informalexample>
318 <programlisting>
319 // static interface
320 HepRandom::setTheSeed(seed,4); // sets the seed to `seed' and luxury to 4
321 HepRandom::setTheSeed(seed); // sets the seed to `seed' keeping
322 // the current luxury level
323 </programlisting>
324 </informalexample>
325 </para>
326 </para></listitem>
327 <listitem><para>
328 <emphasis>RanecuEngine</emphasis>
329 <para>
330 The algorithm for <emphasis>RanecuEngine</emphasis> is taken from the one
331 originally written in FORTRAN77 as part of the
332 <emphasis role="bold">MATHLIB HEP</emphasis>
333 library. The initialisation is carried out using a Multiplicative
334 Congruential generator using formula constants of L'Ecuyer as
335 described in ``F.James, Comp. Phys. Comm. 60 (1990) 329-344''.
336 Handling of seeds for this engine is slightly different than the
337 other engines in <emphasis>HEPRandom</emphasis>. Seeds are taken from a seed
338 table given an index, the <literal>getSeed()</literal> method returns the
339 current index of seed table. The <literal>setSeeds()</literal> method will
340 set seeds in the local <literal>SeedTable</literal> at a given position index
341 (if the index number specified exceeds the table's size,
342 <literal>[index%size]</literal> is taken). For example:
343
344 <informalexample>
345 <programlisting>
346 // static interface
347 const G4long* table_entry;
348 table_entry = HepRandom::getTheSeeds();
349 // it returns a pointer `table_entry' to the local SeedTable
350 // at the current `index' position. The couple of seeds
351 // accessed represents the current `status' of the engine itself !
352 ...
353 G4int index=n;
354 G4long seeds[2];
355 HepRandom::setTheSeeds(seeds,index);
356 // sets the new `index' for seeds and modify the values inside
357 // the local SeedTable at the `index' position. If the index
358 // is not specified, the current index in the table is considered.
359 ...
360 </programlisting>
361 </informalexample>
362 </para>
363
364 <para>
365 The <literal>setSeed()</literal> method resets the current `status' of the
366 engine to the original seeds stored in the static table of seeds in
367 <emphasis>HepRandom</emphasis>, at the specified index.
368 </para>
369 </para></listitem>
370</itemizedlist>
371</para>
372
373<para>
374Except for the <emphasis>RanecuEngine</emphasis>, for which the internal
375status is represented by just a couple of longs, all the other
376engines have a much more complex representation of their internal
377status, which currently can be obtained only through the methods
378<literal>saveStatus()</literal>, <literal>restoreStatus()</literal> and
379<literal>showStatus()</literal>, which can also be statically called from
380<emphasis>HepRandom</emphasis>. The status of the generator is needed for example
381to be able to reproduce a run or an event in a run at a given stage
382of the simulation.
383</para>
384
385<para>
386<emphasis>RanecuEngine</emphasis> is probably the most suitable engine for
387this kind of operation, since its internal status can be
388fetched/reset by simply using
389<literal>getSeeds()</literal>/<literal>setSeeds()</literal>
390(<literal>getTheSeeds()</literal>/<literal>setTheSeeds()</literal> for the static
391interface in <emphasis>HepRandom</emphasis>).
392</para>
393
394</sect3>
395
396
397<!-- ******************* Section (Level#3) ****************** -->
398<sect3 id="sect.GlobClass.HEPRandom.StaticInt">
399<title>
400The static interface in the <emphasis>HepRandom</emphasis> class
401</title>
402
403<para>
404<emphasis>HepRandom</emphasis> a singleton class and using a
405<emphasis>HepJamesRandom</emphasis> engine as default algorithm for pseudo-random
406number generation. <emphasis>HepRandom</emphasis> defines a static private data
407member, <literal>theGenerator</literal>, and a set of static methods to
408manipulate it. By means of <literal>theGenerator</literal>, the user can
409change the underlying engine algorithm, get and set the seeds, and
410use any kind of defined random distribution. The static methods
411<literal>setTheSeed()</literal> and <literal>getTheSeed()</literal> will set and get
412respectively the `initial' seed to the main engine used by the
413static generator. For example:
414
415<informalexample>
416<programlisting>
417 HepRandom::setTheSeed(seed); // to change the current seed to 'seed'
418 int startSeed = HepRandom::getTheSeed(); // to get the current initial seed
419 HepRandom::saveEngineStatus(); // to save the current engine status on file
420 HepRandom::restoreEngineStatus(); // to restore the current engine to a previous
421 // saved configuration
422 HepRandom::showEngineStatus(); // to display the current engine status to stdout
423 ...
424 int index=n;
425 long seeds[2];
426 HepRandom::getTheTableSeeds(seeds,index);
427 // fills `seeds' with the values stored in the global
428 // seedTable at position `index'
429</programlisting>
430</informalexample>
431</para>
432
433<para>
434Only one random engine can be active at a time, the user can
435decide at any time to change it, define a new one (if not done
436already) and set it. For example:
437
438<informalexample>
439<programlisting>
440 RanecuEngine theNewEngine;
441 HepRandom::setTheEngine(&amp;theNewEngine);
442 ...
443</programlisting>
444</informalexample>
445
446or simply setting it to an old instantiated engine (the old
447engine status is kept and the new random sequence will start
448exactly from the last one previously interrupted). For example:
449
450<informalexample>
451<programlisting>
452 HepRandom::setTheEngine(&amp;myOldEngine);
453</programlisting>
454</informalexample>
455</para>
456
457<para>
458Other static methods defined in this class are:
459
460<itemizedlist spacing="compact">
461 <listitem><para>
462 <literal>void setTheSeeds(const G4long* seeds, G4int)</literal>
463 </para></listitem>
464 <listitem><para>
465 <literal>const G4long* getTheSeeds()</literal>
466 <para>
467 To set/get an array of seeds for the generator, in the case of a
468 <emphasis>RanecuEngine</emphasis> this corresponds also to set/get the current
469 status of the engine.
470 </para>
471 </para></listitem>
472 <listitem><para>
473 <literal>HepRandomEngine* getTheEngine()</literal>
474 <para>
475 To get a pointer to the current engine used by the static
476 generator.
477 </para>
478 </para></listitem>
479</itemizedlist>
480</para>
481
482</sect3>
483
484<!-- ******************* Section (Level#3) ****************** -->
485<sect3 id="sect.GlobClass.HEPRandom.Distri">
486<title>
487<emphasis>HEPRandom</emphasis> distributions
488</title>
489
490<para>
491A distribution-class can collect different algorithms and
492different calling sequences for each method to define distribution
493parameters or range-intervals; it also collects methods to fill
494arrays, of specified size, of random values, according to the
495distribution. This class collects either static and not static
496methods. A set of distribution classes are defined in
497<emphasis>HEPRandom</emphasis>. Here is the description of some of them:
498
499<itemizedlist spacing="compact">
500 <listitem><para>
501 <emphasis>RandFlat</emphasis>
502 <para>
503 Class to shoot flat random values (integers or double) within a
504 specified interval. The class provides also methods to shoot just
505 random bits.
506 </para>
507 </para></listitem>
508 <listitem><para>
509 <emphasis>RandExponential</emphasis>
510 <para>
511 Class to shoot exponential distributed random values, given a
512 mean (default mean = 1)
513 </para>
514 </para></listitem>
515 <listitem><para>
516 <emphasis>RandGauss</emphasis>
517 <para>
518 Class to shoot Gaussian distributed random values, given a mean
519 (default = 0) or specifying also a deviation (default = 1).
520 Gaussian random numbers are generated two at the time, so every
521 other time a number is shot, the number returned is the one
522 generated the time before.
523 </para>
524 </para></listitem>
525 <listitem><para>
526 <emphasis>RandBreitWigner</emphasis>
527 <para>
528 Class to shoot numbers according to the Breit-Wigner
529 distribution algorithms (plain or mean^2).
530 </para>
531 </para></listitem>
532 <listitem><para>
533 <emphasis>RandPoisson</emphasis>
534 <para>
535 Class to shoot numbers according to the Poisson distribution,
536 given a mean (default = 1) (Algorithm taken from ``W.H.Press et
537 al., Numerical Recipes in C, Second Edition'').
538 </para>
539 </para></listitem>
540</itemizedlist>
541</para>
542
543</sect3>
544</sect2>
545
546
547<!-- ******************* Section (Level#2) ****************** -->
548<sect2 id="sect.HEPNumerics">
549<title>
550The <emphasis>HEPNumerics</emphasis> module
551</title>
552
553<para>
554A set of classes implementing numerical algorithms has been
555developed in Geant4. Most of the algorithms and methods have been
556implemented mainly based on recommendations given in the books:
557
558<itemizedlist spacing="compact">
559 <listitem><para>
560 B.H. Flowers, ``An introduction to Numerical Methods In C++'',
561 Claredon Press, Oxford 1995.
562 </para></listitem>
563 <listitem><para>
564 M. Abramowitz, I. Stegun, ``Handbook of mathematical
565 functions'', DOVER Publications INC, New York 1965 ; chapters 9,
566 10, and 22.
567 </para></listitem>
568</itemizedlist>
569</para>
570
571<para>
572This set of classes includes:
573
574<itemizedlist spacing="compact">
575 <listitem><para>
576 <emphasis>G4ChebyshevApproximation</emphasis>
577 <para>
578 Class creating the Chebyshev approximation for a function
579 pointed by fFunction data member. The Chebyshev polynomial
580 approximation provides an efficient evaluation of the minimax
581 polynomial, which (among all polynomials of the same degree) has
582 the smallest maximum deviation from the true function.
583 </para>
584 </para></listitem>
585 <listitem><para>
586 <emphasis>G4DataInterpolation</emphasis>
587 <para>
588 Class providing methods for data interpolations and
589 extrapolations: Polynomial, Cubic Spline, ...
590 </para>
591 </para></listitem>
592 <listitem><para>
593 <emphasis>G4GaussChebyshevQ</emphasis>
594 </para></listitem>
595 <listitem><para>
596 <emphasis>G4GaussHermiteQ</emphasis>
597 </para></listitem>
598 <listitem><para>
599 <emphasis>G4GaussJacobiQ</emphasis>
600 </para></listitem>
601 <listitem><para>
602 <emphasis>G4GaussLaguerreQ</emphasis>
603 <para>
604 Classes implementing the Gauss-Chebyshev, Gauss-Hermite,
605 Gauss-Jacobi, Gauss-Laguerre and Gauss-Legendre quadrature methods.
606 Roots of orthogonal polynomials and corresponding weights are
607 calculated based on iteration method (by bisection Newton
608 algorithm).
609 </para>
610 </para></listitem>
611 <listitem><para>
612 <emphasis>G4Integrator</emphasis>
613 <para>
614 Template class collecting integrator methods for generic
615 functions (Legendre, Simpson, Adaptive Gauss, Laguerre, Hermite,
616 Jacobi).
617 </para>
618 </para></listitem>
619 <listitem><para>
620 <emphasis>G4SimpleIntegration</emphasis>
621 <para>
622 Class implementing simple numerical methods (Trapezoidal,
623 MidPoint, Gauss, Simpson, Adaptive Gauss, for integration of
624 functions with signature: double f(double).
625 </para>
626 </para></listitem>
627</itemizedlist>
628</para>
629
630</sect2>
631
632<!-- ******************* Section (Level#2) ****************** -->
633<sect2 id="sect.GeneManage">
634<title>
635General management classes
636</title>
637
638<para>
639The `global' category defines also a set of `utility' classes
640generally used within the kernel of Geant4. These classes
641include:
642
643<itemizedlist spacing="compact">
644 <listitem><para>
645 <emphasis>G4Allocator</emphasis>
646 <para>
647 A class for fast allocation of objects to the heap through
648 paging mechanism. It's meant to be used by associating it to the
649 object to be allocated and defining for it <literal>new</literal> and
650 <literal>delete</literal> operators via <literal>MallocSingle()</literal> and
651 <literal>FreeSingle()</literal> methods of <emphasis>G4Allocator</emphasis>.
652 </para>
653 <para>
654 <emphasis role="bold">Note</emphasis>:
655 <literal>G4Allocator</literal> assumes that objects being allocated
656 have all the same size for the type they represent. For this reason,
657 classes which are handled by <literal>G4Allocator</literal> should
658 <emphasis>avoid</emphasis> to be used as base-classes for others.
659 Similarly, base-classes of sub-classes handled through
660 <literal>G4Allocator</literal> should not define their (eventually
661 empty) virtual destructors inlined; such measure is necessary in order
662 also to prevent bad aliasing optimisations by compilers which may
663 potentially lead to crashes in the attempt to free allocated chunks
664 of memory when using the base-class pointer or not.
665 </para>
666 <para>
667 The list of allocators implicitely defined and used in Geant4 is reported here:
668 <informalexample>
669 <programlisting>
670 - events (G4Event): anEventAllocator
671 - tracks (G4Track): aTrackAllocator
672 - stacked tracks (G4StackedTrack): aStackedTrackAllocator
673 - primary particles (G4PrimaryParticle): aPrimaryParticleAllocator
674 - primary vertices (G4PrimaryVertex): aPrimaryVertexAllocator
675 - decay products (G4DecayProducts): aDecayProductsAllocator
676 - digits collections of an event (G4DCofThisEvent): anDCoTHAllocator
677 - digits collections (G4DigiCollection): aDCAllocator
678 - hits collections of an event (G4HCofThisEvent): anHCoTHAllocator
679 - hits collections (G4HitsCollection): anHCAllocator
680 - touchable histories (G4TouchableHistory): aTouchableHistoryAllocator
681 - trajectories (G4Trajectory): aTrajectoryAllocator
682 - trajectory points (G4TrajectoryPoint): aTrajectoryPointAllocator
683 - trajectory containers (G4TrajectoryContainer): aTrajectoryContainerAllocator
684 - navigation levels (G4NavigationLevel): aNavigationLevelAllocator
685 - navigation level nodes (G4NavigationLevelRep): aNavigLevelRepAllocator
686 - reference-counted handles (G4ReferenceCountedHandle&lt;X&gt;): aRCHAllocator
687 - counted objects (G4CountedObject&lt;X&gt;): aCountedObjectAllocator
688 - HEPEvt primary particles (G4HEPEvtParticle): aHEPEvtParticleAllocator
689 - electron occupancy objects(G4ElectronOccupancy): aElectronOccupancyAllocator
690 - "rich" trajectories (G4RichTrajectory): aRichTrajectoryAllocator
691 - "rich" trajectory points (G4RichTrajectoryPoint): aRichTrajectoryPointAllocator
692 - "smooth" trajectories (G4SmoothTrajectory): aSmoothTrajectoryAllocator
693 - "smooth" trajectory points (G4SmoothTrajectoryPoint): aSmoothTrajectoryPointAllocator
694 - "ray" trajectories (G4RayTrajectory): G4RayTrajectoryAllocator
695 - "ray" trajectory points (G4RayTrajectoryPoint): G4RayTrajectoryPointAllocator
696 </programlisting>
697 </informalexample>
698 For each of these allocators, accessible from the global namespace, it is
699 possible to monitor the allocation in their memory pools or force them to
700 release the allocated memory (for example at the end of a run):
701 <informalexample>
702 <programlisting>
703 // Return the size of the total memory allocated for tracks
704 //
705 aTrackAllocator.GetAllocatedSize();
706
707 // Return allocated storage for tracks to the free store
708 //
709 aTrackAllocator.ResetStorage();
710 </programlisting>
711 </informalexample>
712 </para>
713 </para></listitem>
714 <listitem><para>
715 <emphasis>G4ReferenceCountedHandle</emphasis>
716 <para>
717 Template class acting as a smart pointer and wrapping the type
718 to be counted. It performs the reference counting during the
719 life-time of the counted object.
720 </para>
721 </para></listitem>
722 <listitem><para>
723 <emphasis>G4FastVector</emphasis>
724 <para>
725 Template class defining a vector of pointers, not performing
726 boundary checking.
727 </para>
728 </para></listitem>
729 <listitem><para>
730 <emphasis>G4PhysicsVector</emphasis>
731 <para>
732 Defines a physics vector which has values of energy-loss,
733 cross-section, and other physics values of a particle in matter in
734 a given range of the energy, momentum, etc. This class serves as
735 the base class for a vector having various energy scale, for
736 example like 'log' (<emphasis>G4PhysicsLogVector</emphasis>) 'linear'
737 (<emphasis>G4PhysicsLinearVector</emphasis>), 'free'
738 (<emphasis>G4PhysicsFreeVector</emphasis>), etc.
739 </para>
740 </para></listitem>
741 <listitem><para>
742 <emphasis>G4LPhysicsFreeVector</emphasis>
743 <para>
744 Implements a free vector for low energy physics cross-section
745 data. A subdivision method is used to find the energy|momentum
746 bin.
747 </para>
748 </para></listitem>
749 <listitem><para>
750 <emphasis>G4PhysicsOrderedFreeVector</emphasis>
751 <para>
752 A physics ordered free vector inherits from
753 <emphasis>G4PhysicsVector</emphasis>. It provides, in addition, a method
754 for the user to insert energy/value pairs in sequence. Methods to retrieve
755 the max and min energies and values from the vector are also
756 provided.
757 </para>
758 </para></listitem>
759 <listitem><para>
760 <emphasis>G4Timer</emphasis>
761 <para>
762 Utility class providing methods to measure elapsed user/system
763 process time.
764 Uses <literal>&lt;sys/times.h&gt;</literal> and <literal>&lt;unistd.h&gt;</literal> -
765 POSIX.1.
766 </para>
767 </para></listitem>
768 <listitem><para>
769 <emphasis>G4UserLimits</emphasis>
770 <para>
771 Class collecting methods for get and set any kind of step
772 limitation allowed in Geant4.
773 </para>
774 </para></listitem>
775 <listitem><para>
776 <emphasis>G4UnitsTable</emphasis>
777 <para>
778 Placeholder for the system of units in Geant4.
779 </para>
780 </para></listitem>
781</itemizedlist>
782</para>
783
784
785</sect2>
786</sect1>
Note: See TracBrowser for help on using the repository browser.