VMC Version 2.0
Loading...
Searching...
No Matches
TVirtualMC.cxx
Go to the documentation of this file.
1// -----------------------------------------------------------------------
2// Copyright (C) 2019 CERN and copyright holders of VMC Project.
3// This software is distributed under the terms of the GNU General Public
4// License v3 (GPL Version 3), copied verbatim in the file "LICENSE".
5//
6// See https://github.com/vmc-project/vmc for full licensing information.
7// -----------------------------------------------------------------------
8
9// Authors: Ivana Hrivnacova, Rene Brun , Federico Carminati 13/04/2002
10
11/*************************************************************************
12 * Copyright (C) 2006, Rene Brun and Fons Rademakers. *
13 * Copyright (C) 2002, ALICE Experiment at CERN. *
14 * All rights reserved. *
15 * *
16 * For the licensing terms see $ROOTSYS/LICENSE. *
17 * For the list of contributors see $ROOTSYS/README/CREDITS. *
18 *************************************************************************/
19
20#include "TVirtualMC.h"
21#include "TError.h"
22#include "TMCVersion.h"
23#include "Riostream.h"
24
25namespace {
26//_____________________________________________________________________________
27void PrintVersion()
28{
30
31 std::cout << std::endl
32 << "=============================================================" << std::endl
33 << " Virtual Monte Carlo Library" << std::endl
34 << " Version " << VMC_RELEASE << " ( " << VMC_RELEASE_DATE << " )" << std::endl
35 << "=============================================================" << std::endl;
36}
37
38} // namespace
39
56TMCThreadLocal TVirtualMC *TVirtualMC::fgMC = nullptr;
61
62TVirtualMC::TVirtualMC(const char *name, const char *title, Bool_t /*isRootGeometrySupported*/)
63 : TNamed(name, title), fApplication(nullptr), fId(0), fStack(nullptr), fManagerStack(nullptr), fDecayer(nullptr),
64 fRandom(nullptr), fMagField(nullptr)
65{
66 PrintVersion();
67
69
70 if (fApplication) {
72 } else {
73 ::Fatal("TVirtualMC::TVirtualMC", "No user MC application is defined.");
74 }
75 fgMC = this;
76 fRandom = gRandom;
77}
78
83
85 : TNamed(), fApplication(nullptr), fId(0), fStack(nullptr), fManagerStack(nullptr), fDecayer(nullptr),
86 fRandom(nullptr), fMagField(nullptr)
87{
88}
89
94
96{
97 fgMC = nullptr;
98}
99
100//
101// methods
102//
103
108
110{
111 return fgMC;
112}
113
118
119void TVirtualMC::ProcessEvent(Int_t eventId)
120{
121 ProcessEvent(eventId, kFALSE);
122}
123
128
130{
131 fStack = stack;
132}
133
138
139void TVirtualMC::SetExternalDecayer(TVirtualMCDecayer *decayer)
140{
141 fDecayer = decayer;
142}
143
148
149void TVirtualMC::SetRandom(TRandom *random)
150{
151 gRandom = random;
152 fRandom = random;
153}
154
159
160void TVirtualMC::SetMagField(TVirtualMagField *field)
161{
162 fMagField = field;
163}
164
169
170void TVirtualMC::SetId(UInt_t id)
171{
172 fId = id;
173}
174
180{
181 fManagerStack = stack;
182}
Definition of the code version and release date.
#define VMC_RELEASE
Definition: TMCVersion.h:17
#define VMC_RELEASE_DATE
Definition: TMCVersion.h:18
Concrete implementation of particles stack used by the TMCManager.
void Register(TVirtualMC *mc)
Register the an engine.
static TVirtualMCApplication * Instance()
Static access method.
Interface to a user defined particles stack.
Abstract Monte Carlo interface.
Definition: TVirtualMC.h:49
TVirtualMC()
Default constructor.
Definition: TVirtualMC.cxx:84
TRandom * fRandom
Random number generator.
Definition: TVirtualMC.h:925
static TVirtualMC * GetMC()
Static access method.
Definition: TVirtualMC.cxx:109
TMCManagerStack * fManagerStack
Stack handled by the TMCManager.
Definition: TVirtualMC.h:923
virtual void ProcessEvent()=0
Process one event.
virtual void SetRandom(TRandom *random)
Set the random number generator.
Definition: TVirtualMC.cxx:149
void SetId(UInt_t id)
Set the VMC id.
Definition: TVirtualMC.cxx:170
Int_t fId
Unique identification of this VMC.
Definition: TVirtualMC.h:920
virtual void SetStack(TVirtualMCStack *stack)
Set the particle stack.
Definition: TVirtualMC.cxx:129
void SetManagerStack(TMCManagerStack *stack)
Set container holding additional information for transported TParticles.
Definition: TVirtualMC.cxx:179
TVirtualMagField * fMagField
Magnetic field.
Definition: TVirtualMC.h:926
static TMCThreadLocal TVirtualMC * fgMC
Static TVirtualMC pointer.
Definition: TVirtualMC.h:910
TVirtualMCApplication * fApplication
User MC application.
Definition: TVirtualMC.h:906
virtual void SetExternalDecayer(TVirtualMCDecayer *decayer)
Set the external decayer.
Definition: TVirtualMC.cxx:139
virtual void SetMagField(TVirtualMagField *field)
Set the magnetic field.
Definition: TVirtualMC.cxx:160
virtual ~TVirtualMC()
Destructor.
Definition: TVirtualMC.cxx:95
TVirtualMCStack * fStack
Particles stack.
Definition: TVirtualMC.h:922
TVirtualMCDecayer * fDecayer
External decayer.
Definition: TVirtualMC.h:924