VMC Version 2.0
Loading...
Searching...
No Matches
TVirtualMCApplication.h
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// Author: Ivana Hrivnacova, 23/03/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#ifndef ROOT_TVirtualMCApplication
21#define ROOT_TVirtualMCApplication
22//
23// Class TVirtualMCApplication
24// ---------------------------
25// Interface to a user Monte Carlo application.
26//
27
28#include "TNamed.h"
29#include "TMath.h"
30
31#include "TMCtls.h"
32
33class TVirtualMC;
34class TMCManager;
35
36class TVirtualMCApplication : public TNamed {
37
38public:
40 TVirtualMCApplication(const char *name, const char *title);
41
44
46 virtual ~TVirtualMCApplication();
47
50
51 //
52 // methods
53 //
54
56 void RequestMCManager();
57
59 void Register(TVirtualMC *mc);
60
62 TVirtualMC *GetMC() const;
63
65 virtual void ConstructGeometry() = 0;
66
68 virtual Bool_t MisalignGeometry() { return kFALSE; }
69
71 virtual void ConstructOpGeometry() {}
72
75
78 virtual void InitGeometry() = 0;
79
81 virtual void AddParticles() {}
82
84 virtual void AddIons() {}
85
87 virtual void GeneratePrimaries() = 0;
88
90 virtual void BeginEvent() = 0;
91
93 virtual void BeginPrimary() = 0;
94
96 virtual void PreTrack() = 0;
97
99 virtual void Stepping() = 0;
100
102 virtual void PostTrack() = 0;
103
105 virtual void FinishPrimary() = 0;
106
108 virtual void EndOfEvent() {}
109
111 virtual void FinishEvent() = 0;
112
114 virtual Double_t TrackingRmax() const { return DBL_MAX; }
115
117 virtual Double_t TrackingZmax() const { return DBL_MAX; }
118
120 virtual void Field(const Double_t *x, Double_t *b) const;
121
123 virtual void GeaneStepping() { ; }
124
125 // Functions for multi-threading applications
127 virtual TVirtualMCApplication *CloneForWorker() const { return 0; }
128
130 virtual void InitOnWorker() {}
132 virtual void BeginRunOnWorker() {}
134 virtual void FinishRunOnWorker() {}
136 virtual void Merge(TVirtualMCApplication * /*localMCApplication*/) {}
137
138protected:
142
146
147private:
148 // static data members
149#if !defined(__CINT__)
150 static TMCThreadLocal TVirtualMCApplication
152#else
154#endif
156 static Bool_t fLockMultiThreading;
157
158 ClassDef(TVirtualMCApplication, 1) // Interface to MonteCarlo application
159};
160
161inline void TVirtualMCApplication::Field(const Double_t * /*x*/, Double_t *b) const
162{
163 // No magnetic field
164 b[0] = 0;
165 b[1] = 0;
166 b[2] = 0;
167}
168
169#endif // ROOT_TVirtualMCApplication
Singleton manager class for handling and steering a run with multiple TVirtualMC engines sharing even...
Definition: TMCManager.h:43
Interface to a user Monte Carlo application.
TVirtualMCApplication()
Default constructor.
virtual ~TVirtualMCApplication()
Destructor.
TMCManager * fMCManager
Pointer to requested TMCManager which will only be instantiated by a call to RequestMCManager()
virtual void ConstructSensitiveDetectors()
Define sensitive detectors (optional)
virtual void InitGeometry()=0
Initialize geometry (Usually used to define sensitive volumes IDs)
virtual void Merge(TVirtualMCApplication *)
Merge the data accumulated on workers to the master if needed.
virtual void GeneratePrimaries()=0
Generate primary particles.
virtual void ConstructGeometry()=0
Construct user geometry.
void Register(TVirtualMC *mc)
Register the an engine.
TVirtualMC * GetMC() const
Return the transport engine registered to this application.
virtual void FinishPrimary()=0
Define actions at the end of the primary track.
virtual Double_t TrackingZmax() const
Define maximum z for tracking (optional)
virtual void FinishRunOnWorker()
Define actions at the end of the worker run if needed.
virtual TVirtualMCApplication * CloneForWorker() const
Clone MC application on worker.
virtual Bool_t MisalignGeometry()
Misalign user geometry (optional)
virtual void PostTrack()=0
Define actions at the end of each track.
virtual void GeaneStepping()
Define action at each step for Geane.
virtual void ConstructOpGeometry()
Define parameters for optical processes (optional)
virtual void AddParticles()
Add user defined particles (optional)
static TMCThreadLocal TVirtualMCApplication * fgInstance
Singleton instance.
void RequestMCManager()
Request a TMCManager which is required if multiple engines should be run.
virtual void Field(const Double_t *x, Double_t *b) const
Calculate user field b at point x.
static Bool_t fLockMultiThreading
Forbid multithreading mode if multi run via global static flag.
virtual void AddIons()
Add user defined ions (optional)
virtual void BeginRunOnWorker()
Define actions at the beginning of the worker run if needed.
virtual void Stepping()=0
Define action at each step.
virtual void BeginPrimary()=0
Define actions at the beginning of the primary track.
static TVirtualMCApplication * Instance()
Static access method.
virtual void BeginEvent()=0
Define actions at the beginning of the event.
TVirtualMC * fMC
The current transport engine in use.
virtual Double_t TrackingRmax() const
Define maximum radius for tracking (optional)
virtual void EndOfEvent()
Define actions at the end of the event before calling SD's end of the event.
virtual void PreTrack()=0
Define actions at the beginning of each track.
virtual void InitOnWorker()
Initialize MC application on worker.
virtual void FinishEvent()=0
Define actions at the end of the event.
Abstract Monte Carlo interface.
Definition: TVirtualMC.h:49