forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TVirtualMC.cxx
129 lines (110 loc) · 3.44 KB
/
TVirtualMC.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
// @(#)root/vmc:$Id$
// Authors: Ivana Hrivnacova, Rene Brun , Federico Carminati 13/04/2002
/*************************************************************************
* Copyright (C) 2006, Rene Brun and Fons Rademakers. *
* Copyright (C) 2002, ALICE Experiment at CERN. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#include "TVirtualMC.h"
//______________________________________________________________________________
// Virtual MC provides a virtual interface to Monte Carlo.
// It enables the user to build a virtual Monte Carlo application
// independent of any actual underlying Monte Carlo implementation itself.
//
// A user will have to implement a class derived from the abstract
// Monte Carlo application class, and provide functions like
// ConstructGeometry(), BeginEvent(), FinishEvent(), ... .
// The concrete Monte Carlo (Geant3, Geant4) is selected at run time -
// when processing a ROOT macro where the concrete Monte Carlo is instantiated.
//______________________________________________________________________________
ClassImp(TVirtualMC)
TMCThreadLocal TVirtualMC* TVirtualMC::fgMC=0;
//_____________________________________________________________________________
TVirtualMC::TVirtualMC(const char *name, const char *title,
Bool_t /*isRootGeometrySupported*/)
: TNamed(name,title),
fStack(0),
fDecayer(0),
fRandom(0),
fMagField(0)
{
//
// Standard constructor
//
if(fgMC) {
Warning("TVirtualMC","Cannot initialise twice MonteCarlo class");
} else {
fgMC=this;
fApplication = TVirtualMCApplication::Instance();
if (!fApplication) {
Error("TVirtualMC", "No user MC application is defined.");
}
fRandom = gRandom;
}
}
//_____________________________________________________________________________
TVirtualMC::TVirtualMC()
: TNamed(),
fApplication(0),
fStack(0),
fDecayer(0),
fRandom(0),
fMagField(0)
{
//
// Default constructor
//
}
//_____________________________________________________________________________
TVirtualMC::~TVirtualMC()
{
//
// Destructor
//
fgMC=0;
}
//
// methods
//
//_____________________________________________________________________________
TVirtualMC *TVirtualMC::GetMC()
{
//static: return virtual MC object
return fgMC;
}
//_____________________________________________________________________________
void TVirtualMC::SetStack(TVirtualMCStack* stack)
{
//
// Set particles stack.
//
fStack = stack;
}
//_____________________________________________________________________________
void TVirtualMC::SetExternalDecayer(TVirtualMCDecayer* decayer)
{
//
// Set external decayer.
//
fDecayer = decayer;
}
//_____________________________________________________________________________
void TVirtualMC::SetRandom(TRandom* random)
{
//
// Set random number generator.
//
gRandom = random;
fRandom = random;
}
//_____________________________________________________________________________
void TVirtualMC::SetMagField(TVirtualMagField* field)
{
//
// Set magnetic field.
//
fMagField = field;
}