VMC Examples Version 6.6
Loading...
Searching...
No Matches
Ex03MCApplication.h
Go to the documentation of this file.
1#ifndef EX03_MC_APPLICATION_H
2#define EX03_MC_APPLICATION_H
3
4//------------------------------------------------
5// The Virtual Monte Carlo examples
6// Copyright (C) 2014 - 2018 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 Ex03MCApplication.h
14/// \brief Definition of the Ex03MCApplication class
15///
16/// Geant4 ExampleN03 adapted to Virtual Monte Carlo
17///
18/// \author I. Hrivnacova; IPN, Orsay
19
20#include <TVirtualMCApplication.h>
21
22#include "Ex03CalorimeterSD.h"
24
25#include <TGeoUniformMagField.h>
26#include <TMCVerbose.h>
27
28class Ex03MCStack;
30
31class TMCRootManager;
32
33/// \ingroup E03
34/// \brief Implementation of the TVirtualMCApplication
35///
36/// \date 06/03/2003
37/// \author I. Hrivnacova; IPN, Orsay
38
40{
41 public:
42 Ex03MCApplication(const char* name, const char* title);
44 virtual ~Ex03MCApplication();
45
46 // methods
47 void InitMC(const char* setup);
48 void RunMC(Int_t nofEvents);
49 void FinishRun();
50 void ReadEvent(Int_t i);
51
53 virtual void InitOnWorker();
54 virtual void FinishRunOnWorker();
55
56 virtual void ConstructGeometry();
57 virtual void InitGeometry();
58 virtual void AddParticles();
59 virtual void AddIons();
60 virtual void GeneratePrimaries();
61 virtual void BeginEvent();
62 virtual void BeginPrimary();
63 virtual void PreTrack();
64 virtual void Stepping();
65 virtual void PostTrack();
66 virtual void FinishPrimary();
67 virtual void FinishEvent();
68
69 // set methods
70 void SetPrintModulo(Int_t value);
71 void SetVerboseLevel(Int_t verboseLevel);
72 void SetControls(Bool_t isConstrols);
73 void SetField(Double_t bz);
74
75 // get methods
79
80 // method for tests
81 void SetOldGeometry(Bool_t oldGeometry = kTRUE);
82
83 private:
84 // methods
86 void RegisterStack() const;
87
88 // data members
89 mutable TMCRootManager* fRootManager; //!< Root manager
90 Int_t fPrintModulo; ///< The event modulus number to be printed
91 Int_t fEventNo; ///< Event counter
92 TMCVerbose fVerbose; ///< VMC verbose helper
93 Ex03MCStack* fStack; ///< VMC stack
94 Ex03DetectorConstruction* fDetConstruction; ///< Dector construction
95 Ex03CalorimeterSD* fCalorimeterSD; ///< Calorimeter SD
96 Ex03PrimaryGenerator* fPrimaryGenerator; ///< Primary generator
97 TGeoUniformMagField* fMagField; ///< Magnetic field
98 Bool_t fOldGeometry; ///< Option for geometry definition
99 Bool_t fIsControls; ///< Option to activate special controls
100 Bool_t fIsMaster; ///< If is on master thread
101
102 ClassDef(Ex03MCApplication, 1) // Interface to MonteCarlo application
103};
104
105// inline functions
106
107/// Set the event modulus number to be printed
108/// \param value The new event modulus number value
109inline void Ex03MCApplication::SetPrintModulo(Int_t value)
110{
111 fPrintModulo = value;
112}
113
114/// Set verbosity
115/// \param verboseLevel The new verbose level value
116inline void Ex03MCApplication::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 Ex03MCApplication::SetField(Double_t bz)
124{
125 fMagField->SetFieldValue(0., 0., bz);
126}
127
128/// \return The detector construction
134
135/// \return The calorimeter sensitive detector
140
141/// \return The primary generator
146
147/// Switch on/off the old geometry definition (via VMC functions)
148/// \param oldGeometry If true, geometry definition via VMC functions
149inline void Ex03MCApplication::SetOldGeometry(Bool_t oldGeometry)
150{
151 fOldGeometry = oldGeometry;
152}
153
154/// Switch on/off special process controls
155/// \param isControls If true, special process controls setting is activated
156inline void Ex03MCApplication::SetControls(Bool_t isControls)
157{
158 fIsControls = isControls;
159}
160
161#endif // EX03_MC_APPLICATION_H
Definition of the Ex03DetectorConstruction class.
Definition of the Ex03CalorimeterSD class.
The calorimeter sensitive detector.
The detector construction (via TGeo )
Implementation of the TVirtualMCApplication.
Int_t fPrintModulo
The event modulus number to be printed.
void SetVerboseLevel(Int_t verboseLevel)
TGeoUniformMagField * fMagField
Magnetic field.
Bool_t fIsControls
Option to activate special controls.
virtual void BeginPrimary()
TMCVerbose fVerbose
VMC verbose helper.
void InitMC(const char *setup)
void RunMC(Int_t nofEvents)
void SetControls(Bool_t isConstrols)
Bool_t fIsMaster
If is on master thread.
virtual void FinishEvent()
virtual TVirtualMCApplication * CloneForWorker() const
virtual void InitOnWorker()
Ex03PrimaryGenerator * fPrimaryGenerator
Primary generator.
Ex03CalorimeterSD * GetCalorimeterSD() const
void SetOldGeometry(Bool_t oldGeometry=kTRUE)
Ex03DetectorConstruction * GetDetectorConstruction() const
virtual void InitGeometry()
void SetField(Double_t bz)
virtual void FinishPrimary()
Ex03MCStack * fStack
VMC stack.
Ex03CalorimeterSD * fCalorimeterSD
Calorimeter SD.
virtual void AddParticles()
virtual void FinishRunOnWorker()
Ex03DetectorConstruction * fDetConstruction
Dector construction.
Bool_t fOldGeometry
Option for geometry definition.
Int_t fEventNo
Event counter.
void SetPrintModulo(Int_t value)
virtual void GeneratePrimaries()
virtual void BeginEvent()
Ex03PrimaryGenerator * GetPrimaryGenerator() const
virtual void ConstructGeometry()
TMCRootManager * fRootManager
Root manager.
Implementation of the TVirtualMCStack interface.
Definition Ex03MCStack.h:36
The primary generator.
Ex03DetectorConstruction * GetDetectorConstruction() const
void SetField(Double_t bz)
void SetVerboseLevel(Int_t verboseLevel)
void SetPrintModulo(Int_t value)
void SetControls(Bool_t isConstrols)
void SetOldGeometry(Bool_t oldGeometry=kTRUE)
Ex03bCalorimeterSD * GetCalorimeterSD() const
Ex03PrimaryGenerator * GetPrimaryGenerator() const