Logo ROOT   6.16/01
Reference Guide
TVirtualMC.cxx
Go to the documentation of this file.
1// @(#)root/vmc:$Id$
2// Authors: Ivana Hrivnacova, Rene Brun , Federico Carminati 13/04/2002
3
4/*************************************************************************
5 * Copyright (C) 2006, Rene Brun and Fons Rademakers. *
6 * Copyright (C) 2002, ALICE Experiment at CERN. *
7 * All rights reserved. *
8 * *
9 * For the licensing terms see $ROOTSYS/LICENSE. *
10 * For the list of contributors see $ROOTSYS/README/CREDITS. *
11 *************************************************************************/
12
13#include "TVirtualMC.h"
14
15/** \class TVirtualMC
16 \ingroup vmc
17
18Abstract Monte Carlo interface
19
20Virtual MC provides a virtual interface to Monte Carlo.
21It enables the user to build a virtual Monte Carlo application
22independent of any actual underlying Monte Carlo implementation itself.
23
24A user will have to implement a class derived from the abstract
25Monte Carlo application class, and provide functions like
26ConstructGeometry(), BeginEvent(), FinishEvent(), ... .
27The concrete Monte Carlo (Geant3, Geant4) is selected at run time -
28when processing a ROOT macro where the concrete Monte Carlo is instantiated.
29*/
30
32
34
35////////////////////////////////////////////////////////////////////////////////
36///
37/// Standard constructor
38///
39
40TVirtualMC::TVirtualMC(const char *name, const char *title,
41 Bool_t /*isRootGeometrySupported*/)
42 : TNamed(name,title),
43 fApplication(0),
44 fStack(0),
45 fDecayer(0),
46 fRandom(0),
47 fMagField(0)
48{
49 if(fgMC) {
50 Warning("TVirtualMC","Cannot initialise twice MonteCarlo class");
51 } else {
52 fgMC=this;
53
55
56 if (!fApplication) {
57 Error("TVirtualMC", "No user MC application is defined.");
58 }
59
61 }
62}
63
64////////////////////////////////////////////////////////////////////////////////
65///
66/// Default constructor
67///
68
70 : TNamed(),
71 fApplication(0),
72 fStack(0),
73 fDecayer(0),
74 fRandom(0),
75 fMagField(0)
76{
77}
78
79////////////////////////////////////////////////////////////////////////////////
80///
81/// Destructor
82///
83
85{
86 fgMC=0;
87}
88
89//
90// methods
91//
92
93////////////////////////////////////////////////////////////////////////////////
94///
95/// Static access method
96///
97
99 return fgMC;
100}
101
102////////////////////////////////////////////////////////////////////////////////
103///
104/// Set particles stack.
105///
106
108{
109 fStack = stack;
110}
111
112////////////////////////////////////////////////////////////////////////////////
113///
114/// Set external decayer.
115///
116
118{
119 fDecayer = decayer;
120}
121
122////////////////////////////////////////////////////////////////////////////////
123///
124/// Set random number generator.
125///
126
128{
129 gRandom = random;
130 fRandom = random;
131}
132
133////////////////////////////////////////////////////////////////////////////////
134///
135/// Set magnetic field.
136///
137
139{
140 fMagField = field;
141}
bool Bool_t
Definition: RtypesCore.h:59
#define ClassImp(name)
Definition: Rtypes.h:363
#define TMCThreadLocal
Definition: TMCtls.h:80
R__EXTERN TRandom * gRandom
Definition: TRandom.h:62
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:866
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:880
This is the base class for the ROOT Random number generators.
Definition: TRandom.h:27
static TVirtualMCApplication * Instance()
Static access method.
Abstract base class for particle decays.
Interface to a user defined particles stack.
Abstract Monte Carlo interface.
Definition: TVirtualMC.h:42
TVirtualMC()
Default constructor.
Definition: TVirtualMC.cxx:69
TRandom * fRandom
Random number generator.
Definition: TVirtualMC.h:907
static TVirtualMC * GetMC()
Static access method.
Definition: TVirtualMC.cxx:98
virtual void SetRandom(TRandom *random)
Set the random number generator.
Definition: TVirtualMC.cxx:127
virtual void SetStack(TVirtualMCStack *stack)
Set the particle stack.
Definition: TVirtualMC.cxx:107
TVirtualMagField * fMagField
Magnetic field.
Definition: TVirtualMC.h:908
static TMCThreadLocal TVirtualMC * fgMC
Monte Carlo singleton instance.
Definition: TVirtualMC.h:900
TVirtualMCApplication * fApplication
User MC application.
Definition: TVirtualMC.h:893
virtual void SetExternalDecayer(TVirtualMCDecayer *decayer)
Set the external decayer.
Definition: TVirtualMC.cxx:117
virtual void SetMagField(TVirtualMagField *field)
Set the magnetic field.
Definition: TVirtualMC.cxx:138
virtual ~TVirtualMC()
Destructor.
Definition: TVirtualMC.cxx:84
TVirtualMCStack * fStack
Particles stack.
Definition: TVirtualMC.h:905
TVirtualMCDecayer * fDecayer
External decayer.
Definition: TVirtualMC.h:906
Abstract class for magnetic field.