VMC Examples Version 6.6
Loading...
Searching...
No Matches
Ex03bMCApplication.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 Ex03bMCApplication.h
14/// \brief Definition of the Ex03bMCApplication class
15///
16/// Geant4 ExampleN03 adapted to Virtual Monte Carlo
17///
18/// \author I. Hrivnacova; IPN, Orsay
19
20#include <TVirtualMCApplication.h>
21
23#include "Ex03bCalorimeterSD.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/// A variant of the Ex03MCApplication class:
37/// the MC application using a sensitive detcetor
38/// derived from the new TVirtualMCSensitiveDetector interface.
39///
40/// \author I. Hrivnacova; IPN, Orsay
41
43{
44 public:
45 Ex03bMCApplication(const char* name, const char* title);
47 virtual ~Ex03bMCApplication();
48
49 // methods
50 void InitMC(const char* setup);
51 void RunMC(Int_t nofEvents);
52 void FinishRun();
53 void ReadEvent(Int_t i);
54
56 virtual void InitOnWorker();
57 virtual void FinishRunOnWorker();
58
59 virtual void ConstructGeometry();
60 virtual void ConstructSensitiveDetectors();
61 virtual void InitGeometry();
62 virtual void AddParticles();
63 virtual void AddIons();
64 virtual void GeneratePrimaries();
65 virtual void BeginEvent();
66 virtual void BeginPrimary();
67 virtual void PreTrack();
68 virtual void Stepping();
69 virtual void PostTrack();
70 virtual void FinishPrimary();
71 virtual void EndOfEvent();
72 virtual void FinishEvent();
73
74 // set methods
75 void SetPrintModulo(Int_t value);
76 void SetVerboseLevel(Int_t verboseLevel);
77 void SetControls(Bool_t isConstrols);
78 void SetField(Double_t bz);
79
80 // get methods
84
85 // method for tests
86 void SetOldGeometry(Bool_t oldGeometry = kTRUE);
87
88 private:
89 // methods
91 void RegisterStack() const;
92
93 // data members
94 mutable TMCRootManager* fRootManager; //!< Root manager
95 Int_t fPrintModulo; ///< The event modulus number to be printed
96 Int_t fEventNo; ///< Event counter
97 TMCVerbose fVerbose; ///< VMC verbose helper
98 Ex03MCStack* fStack; ///< VMC stack
99 Ex03DetectorConstruction* fDetConstruction; ///< Dector construction
100 Ex03bCalorimeterSD* fCalorimeterSD; ///< Calorimeter SD
102 TGeoUniformMagField* fMagField; ///< Magnetic field
103 Bool_t fOldGeometry; ///< Option for geometry definition
104 Bool_t fIsControls; ///< Option to activate special controls
105 Bool_t fIsMaster; ///< If is on master thread
106
107 ClassDef(Ex03bMCApplication, 1) // Interface to MonteCarlo application
108};
109
110// Define typedef so that we can use the E03 macros for all examples variants
112
113// inline functions
114
115/// Set the event modulus number to be printed
116/// \param value The new event modulus number value
118{
119 fPrintModulo = value;
120}
121
122/// Set verbosity
123/// \param verboseLevel The new verbose level value
124inline void Ex03bMCApplication::SetVerboseLevel(Int_t verboseLevel)
125{
126 fVerbose.SetLevel(verboseLevel);
127}
128
129// Set magnetic field
130// \param bz The new field value in z
131inline void Ex03bMCApplication::SetField(Double_t bz)
132{
133 fMagField->SetFieldValue(0., 0., bz);
134}
135
136/// \return The detector construction
142
143/// \return The calorimeter sensitive detector
148
149/// \return The primary generator
154
155/// Switch on/off the old geometry definition (via VMC functions)
156/// \param oldGeometry If true, geometry definition via VMC functions
157inline void Ex03bMCApplication::SetOldGeometry(Bool_t oldGeometry)
158{
159 fOldGeometry = oldGeometry;
160}
161
162/// Switch on/off special process controls
163/// \param isControls If true, special process controls setting is activated
164inline void Ex03bMCApplication::SetControls(Bool_t isControls)
165{
166 fIsControls = isControls;
167}
168
169#endif // EX03_MC_APPLICATION_H
Definition of the Ex03DetectorConstruction class.
Definition of the Ex03bCalorimeterSD class.
Ex03bMCApplication Ex03MCApplication
The detector construction (via TGeo )
Implementation of the TVirtualMCStack interface.
Definition Ex03MCStack.h:36
The primary generator.
The calorimeter sensitive detector.
Implementation of the TVirtualMCApplication.
Ex03DetectorConstruction * GetDetectorConstruction() const
virtual void GeneratePrimaries()
void SetField(Double_t bz)
virtual TVirtualMCApplication * CloneForWorker() const
Ex03PrimaryGenerator * fPrimaryGenerator
Primary generator.
void InitMC(const char *setup)
Bool_t fIsControls
Option to activate special controls.
void SetVerboseLevel(Int_t verboseLevel)
Ex03bCalorimeterSD * fCalorimeterSD
Calorimeter SD.
void SetPrintModulo(Int_t value)
TGeoUniformMagField * fMagField
Magnetic field.
Int_t fPrintModulo
The event modulus number to be printed.
Int_t fEventNo
Event counter.
void RunMC(Int_t nofEvents)
void SetControls(Bool_t isConstrols)
virtual void FinishRunOnWorker()
Bool_t fIsMaster
If is on master thread.
virtual void ConstructGeometry()
TMCRootManager * fRootManager
Root manager.
void SetOldGeometry(Bool_t oldGeometry=kTRUE)
virtual void ConstructSensitiveDetectors()
Ex03DetectorConstruction * fDetConstruction
Dector construction.
Bool_t fOldGeometry
Option for geometry definition.
Ex03bCalorimeterSD * GetCalorimeterSD() const
Ex03PrimaryGenerator * GetPrimaryGenerator() const
TMCVerbose fVerbose
VMC verbose helper.
Ex03MCStack * fStack
VMC stack.