ROOT  6.06/09
Reference Guide
TVirtualMCApplication.h
Go to the documentation of this file.
1 // @(#)root/vmc:$Id$
2 // Author: Ivana Hrivnacova, 23/03/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 #ifndef ROOT_TVirtualMCApplication
14 #define ROOT_TVirtualMCApplication
15 //
16 // Class TVirtualMCApplication
17 // ---------------------------
18 // Interface to a user Monte Carlo application.
19 //
20 
21 #ifndef ROOT_TNamed
22 #include "TNamed.h"
23 #endif
24 #ifndef ROOT_TMath
25 #include "TMath.h"
26 #endif
27 
28 #include "TMCtls.h"
29 
30 class TVirtualMCApplication : public TNamed {
31 
32 public:
33  // Standard constructor
34  TVirtualMCApplication(const char *name, const char *title);
35 
36  // Default constructor
38 
39  // Destructor
40  virtual ~TVirtualMCApplication();
41 
42  // Static access method
44 
45  //
46  // methods
47  //
48 
49  // Construct user geometry
50  virtual void ConstructGeometry() = 0;
51 
52  // Misalign user geometry (optional)
53  virtual Bool_t MisalignGeometry() {return kFALSE;}
54 
55  // Define parameters for optical processes (optional)
56  virtual void ConstructOpGeometry() {}
57 
58  // Initialize geometry
59  // (Usually used to define sensitive volumes IDs)
60  virtual void InitGeometry() = 0;
61 
62  // Add user defined particles (optional)
63  virtual void AddParticles() {}
64 
65  // Add user defined ions (optional)
66  virtual void AddIons() {}
67 
68  // Generate primary particles
69  virtual void GeneratePrimaries() = 0;
70 
71  // Define actions at the beginning of the event
72  virtual void BeginEvent() = 0;
73 
74  // Define actions at the beginning of the primary track
75  virtual void BeginPrimary() = 0;
76 
77  // Define actions at the beginning of each track
78  virtual void PreTrack() = 0;
79 
80  // Define action at each step
81  virtual void Stepping() = 0;
82 
83  // Define actions at the end of each track
84  virtual void PostTrack() = 0;
85 
86  // Define actions at the end of the primary track
87  virtual void FinishPrimary() = 0;
88 
89  // Define actions at the end of the event
90  virtual void FinishEvent() = 0;
91 
92  // Define maximum radius for tracking (optional)
93  virtual Double_t TrackingRmax() const { return DBL_MAX; }
94 
95  // Define maximum z for tracking (optional)
96  virtual Double_t TrackingZmax() const { return DBL_MAX; }
97 
98  // Calculate user field \a b at point \a x
99  virtual void Field(const Double_t* x, Double_t* b) const;
100 
101  // Define action at each step for Geane
102  virtual void GeaneStepping() {;}
103 
104  // New functions for multi-threading applications
105  virtual TVirtualMCApplication* CloneForWorker() const { return 0;}
106  virtual void InitForWorker() const {}
107  virtual void BeginWorkerRun() const {}
108  virtual void FinishWorkerRun() const {}
109  virtual void Merge(TVirtualMCApplication* /*localMCApplication*/) {}
110 
111 private:
112  // static data members
113 #if !defined(__CINT__)
114  static TMCThreadLocal TVirtualMCApplication* fgInstance; // singleton instance
115 #else
116  static TVirtualMCApplication* fgInstance; // singleton instance
117 #endif
118 
119  ClassDef(TVirtualMCApplication,1) //Interface to MonteCarlo application
120 };
121 
122 inline void TVirtualMCApplication::Field(const Double_t* /*x*/, Double_t* b) const {
123  // No magnetic field
124  b[0] = 0; b[1] = 0; b[2] = 0;
125 }
126 
127 #endif //ROOT_TVirtualMCApplication
128 
virtual Double_t TrackingRmax() const
virtual void BeginEvent()=0
virtual void ConstructOpGeometry()
virtual void ConstructGeometry()=0
virtual void PreTrack()=0
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
static TMCThreadLocal TVirtualMCApplication * fgInstance
virtual void BeginWorkerRun() const
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual void FinishWorkerRun() const
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
virtual ~TVirtualMCApplication()
Destructor.
virtual void InitForWorker() const
virtual void PostTrack()=0
virtual void Merge(TVirtualMCApplication *)
virtual void Stepping()=0
virtual void FinishPrimary()=0
virtual Double_t TrackingZmax() const
virtual void Field(const Double_t *x, Double_t *b) const
#define TMCThreadLocal
Definition: TMCtls.h:59
double Double_t
Definition: RtypesCore.h:55
virtual void InitGeometry()=0
virtual void GeneratePrimaries()=0
virtual TVirtualMCApplication * CloneForWorker() const
#define name(a, b)
Definition: linkTestLib0.cpp:5
virtual Bool_t MisalignGeometry()
virtual void FinishEvent()=0
static TVirtualMCApplication * Instance()
Static access method.
virtual void BeginPrimary()=0
TVirtualMCApplication()
Default constructor.