VMC Examples Version 6.6
Loading...
Searching...
No Matches
MCApplication.h
Go to the documentation of this file.
1#ifndef MC_APPLICATION_H
2#define MC_APPLICATION_H
3
4//------------------------------------------------
5// The Virtual Monte Carlo examples
6// Copyright (C) 2007 - 2015 Ivana Hrivnacova
7// All rights reserved.
8//
9// For the licensing terms see geant4_vmc/LICENSE.
10// Contact: root-vmc@cern.ch
11//-------------------------------------------------
12
13/// \file TR/include/MCApplication.h
14/// \brief Definition of the MCApplication class
15///
16/// Geant4 TestEm10 adapted to Virtual Monte Carlo.
17///
18/// \author I. Hrivnacova; IPN, Orsay
19
20#include <TVirtualMCApplication.h>
21
22#include <TGeoUniformMagField.h>
23#include <TMCVerbose.h>
24
25class Ex03MCStack;
26
27class TMCRootManager;
28
29namespace VMC
30{
31namespace TR
32{
33
34class DetectorConstruction;
35class SensitiveDetector;
36class PrimaryGenerator;
37
38/// \ingroup TR
39/// \brief Implementation of the TVirtualMCApplication
40///
41/// \date 18/12/2015
42/// \author I. Hrivnacova; IPN, Orsay
43
45{
46 public:
47 MCApplication(const char* name, const char* title);
49 virtual ~MCApplication();
50
51 // methods
52 void InitMC(const char* setup);
53 void RunMC(Int_t nofEvents);
54 void FinishRun();
55
57 virtual void InitOnWorker();
58 virtual void FinishRunOnWorker();
59
60 virtual void ConstructGeometry();
61 virtual void InitGeometry();
62 virtual void GeneratePrimaries();
63 virtual void BeginEvent();
64 virtual void BeginPrimary();
65 virtual void PreTrack();
66 virtual void Stepping();
67 virtual void PostTrack();
68 virtual void FinishPrimary();
69 virtual void FinishEvent();
70
71 // set methods
72 void SetPrintModulo(Int_t value);
73 void SetVerboseLevel(Int_t verboseLevel);
74 void SetControls(Bool_t isConstrols);
75 void SetField(Double_t bz);
76
77 // get methods
81
82 // method for tests
83 void SetOldGeometry(Bool_t oldGeometry = kTRUE);
84
85 private:
86 // methods
87 MCApplication(const MCApplication& origin);
88 void RegisterStack() const;
89 void BookHisto() const;
90
91 // data members
92 mutable TMCRootManager* fRootManager; //!< Root manager
93 Int_t fPrintModulo; ///< The event modulus number to be printed
94 Int_t fEventNo; ///< Event counter
95 TMCVerbose fVerbose; ///< VMC verbose helper
96 Ex03MCStack* fStack; ///< VMC stack
97 DetectorConstruction* fDetConstruction; ///< Dector construction
99 PrimaryGenerator* fPrimaryGenerator; ///< Primary generator
100 TGeoUniformMagField* fMagField; ///< Magnetic field
101 Bool_t fOldGeometry; ///< Option for geometry definition
102 Bool_t fIsControls; ///< Option to activate special controls
103 Bool_t fIsMaster; ///< If is on master thread
104
105 ClassDef(MCApplication, 1) // Interface to MonteCarlo application
106};
107
108// inline functions
109
110/// Set the event modulus number to be printed
111/// \param value The new event modulus number value
112inline void MCApplication::SetPrintModulo(Int_t value) { fPrintModulo = value; }
113
114/// Set verbosity
115/// \param verboseLevel The new verbose level value
116inline void MCApplication::SetVerboseLevel(Int_t verboseLevel)
117{
118 fVerbose.SetLevel(verboseLevel);
119}
120
121// Set magnetic field
122// \param bz The new field value in z
123inline void MCApplication::SetField(Double_t bz)
124{
125 fMagField->SetFieldValue(0., 0., bz);
126}
127
128/// \return The detector construction
133
134/// \return The calorimeter sensitive detector
139
140/// \return The primary generator
145
146/// Switch on/off the old geometry definition (via VMC functions)
147/// \param oldGeometry If true, geometry definition via VMC functions
148inline void MCApplication::SetOldGeometry(Bool_t oldGeometry)
149{
150 fOldGeometry = oldGeometry;
151}
152
153/// Switch on/off special process controls
154/// \param isControls If true, special process controls setting is activated
155inline void MCApplication::SetControls(Bool_t isControls)
156{
157 fIsControls = isControls;
158}
159
160} // namespace TR
161} // namespace VMC
162
163#endif // MC_APPLICATION_H
Implementation of the TVirtualMCStack interface.
Definition Ex03MCStack.h:36
The detector construction (via TGeo )
Implementation of the TVirtualMCApplication.
virtual void InitGeometry()
PrimaryGenerator * GetPrimaryGenerator() const
virtual void FinishPrimary()
void SetControls(Bool_t isConstrols)
virtual void GeneratePrimaries()
void SetOldGeometry(Bool_t oldGeometry=kTRUE)
Ex03MCStack * fStack
VMC stack.
virtual void ConstructGeometry()
void SetPrintModulo(Int_t value)
Bool_t fOldGeometry
Option for geometry definition.
Int_t fPrintModulo
The event modulus number to be printed.
SensitiveDetector * GetSensitiveDetector() const
Bool_t fIsControls
Option to activate special controls.
Bool_t fIsMaster
If is on master thread.
SensitiveDetector * fSensitiveDetector
Absorber SD.
PrimaryGenerator * fPrimaryGenerator
Primary generator.
TMCVerbose fVerbose
VMC verbose helper.
virtual TVirtualMCApplication * CloneForWorker() const
virtual void FinishRunOnWorker()
void SetField(Double_t bz)
virtual void BeginPrimary()
void RunMC(Int_t nofEvents)
void SetVerboseLevel(Int_t verboseLevel)
TGeoUniformMagField * fMagField
Magnetic field.
TMCRootManager * fRootManager
Root manager.
Int_t fEventNo
Event counter.
virtual void InitOnWorker()
DetectorConstruction * GetDetectorConstruction() const
void InitMC(const char *setup)
DetectorConstruction * fDetConstruction
Dector construction.
The primary generator.
The absorber sensitive detector.