VMC Examples Version 6.8
Loading...
Searching...
No Matches
Ex03dMCApplication.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 Ex03dMCApplication.h
14/// \brief Definition of the Ex03dMCApplication class
15///
16/// Geant4 ExampleN03 adapted to Virtual Monte Carlo
17///
18/// \author Radoslaw Karabowicz; GSI
19
20#include <TVirtualMCApplication.h>
21
23#include "Ex03dCalorimeterSD.h"
24#include "TMCRootManager.h"
25
26#include <TGeoUniformMagField.h>
27#include <TMCVerbose.h>
28
29class Ex03dMCStack;
31
32/// \ingroup E03
33/// \brief Implementation of the TVirtualMCApplication
34///
35/// A variant of the Ex03MCApplication class
36/// updated for RNTuple output.
37///
38
39/// \date 07/07/2026
40/// \author Radoslaw Karabowicz, GSI
41
43{
44 public:
45 Ex03dMCApplication(const char* name, const char* title);
47 virtual ~Ex03dMCApplication();
48
49 // methods
50 void InitMC(const char* setup,
51 TMCRootManager::StorageMode storageMode = TMCRootManager::kRNTuple);
52 void RunMC(Int_t nofEvents);
53 void FinishRun();
54 void ReadEvent(Int_t i, TMCRootManager::StorageMode storageMode = TMCRootManager::kRNTuple,
55 Int_t threadId = -1);
56
58 virtual void InitOnWorker();
59 virtual void FinishRunOnWorker();
60
61 virtual void ConstructGeometry();
62 virtual void InitGeometry();
63 virtual void AddParticles();
64 virtual void AddIons();
65 virtual void GeneratePrimaries();
66 virtual void BeginEvent();
67 virtual void BeginPrimary();
68 virtual void PreTrack();
69 virtual void Stepping();
70 virtual void PostTrack();
71 virtual void FinishPrimary();
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 RegisterData();
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 Ex03dMCStack* fStack; ///< VMC stack
99 Ex03DetectorConstruction* fDetConstruction; ///< Dector construction
100 Ex03dCalorimeterSD* 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(Ex03dMCApplication, 1) // Interface to MonteCarlo application
108};
109
110// inline functions
111
112/// Set the event modulus number to be printed
113/// \param value The new event modulus number value
115{
116 fPrintModulo = value;
117}
118
119/// Set verbosity
120/// \param verboseLevel The new verbose level value
121inline void Ex03dMCApplication::SetVerboseLevel(Int_t verboseLevel)
122{
123 fVerbose.SetLevel(verboseLevel);
124}
125
126// Set magnetic field
127// \param bz The new field value in z
128inline void Ex03dMCApplication::SetField(Double_t bz)
129{
130 fMagField->SetFieldValue(0., 0., bz);
131}
132
133/// \return The detector construction
139
140/// \return The calorimeter sensitive detector
145
146/// \return The primary generator
151
152/// Switch on/off the old geometry definition (via VMC functions)
153/// \param oldGeometry If true, geometry definition via VMC functions
154inline void Ex03dMCApplication::SetOldGeometry(Bool_t oldGeometry)
155{
156 fOldGeometry = oldGeometry;
157}
158
159/// Switch on/off special process controls
160/// \param isControls If true, special process controls setting is activated
161inline void Ex03dMCApplication::SetControls(Bool_t isControls)
162{
163 fIsControls = isControls;
164}
165
166#endif // EX03_MC_APPLICATION_H
Definition of the Ex03DetectorConstruction class.
Definition of the Ex03dCalorimeterSD class.
The detector construction (via TGeo ).
The primary generator.
The calorimeter sensitive detector.
TMCRootManager * fRootManager
Root manager.
virtual void GeneratePrimaries()
Ex03DetectorConstruction * fDetConstruction
Dector construction.
void RunMC(Int_t nofEvents)
Ex03DetectorConstruction * GetDetectorConstruction() const
virtual TVirtualMCApplication * CloneForWorker() const
TGeoUniformMagField * fMagField
Magnetic field.
Int_t fEventNo
Event counter.
virtual void ConstructGeometry()
Ex03dMCApplication(const char *name, const char *title)
Ex03dCalorimeterSD * fCalorimeterSD
Calorimeter SD.
Bool_t fIsControls
Option to activate special controls.
Ex03dCalorimeterSD * GetCalorimeterSD() const
Ex03PrimaryGenerator * fPrimaryGenerator
Primary generator.
void ReadEvent(Int_t i, TMCRootManager::StorageMode storageMode=TMCRootManager::kRNTuple, Int_t threadId=-1)
void SetOldGeometry(Bool_t oldGeometry=kTRUE)
void SetControls(Bool_t isConstrols)
void SetField(Double_t bz)
Bool_t fOldGeometry
Option for geometry definition.
Ex03dMCStack * fStack
VMC stack.
Ex03PrimaryGenerator * GetPrimaryGenerator() const
void InitMC(const char *setup, TMCRootManager::StorageMode storageMode=TMCRootManager::kRNTuple)
void SetVerboseLevel(Int_t verboseLevel)
TMCVerbose fVerbose
VMC verbose helper.
virtual void FinishRunOnWorker()
Bool_t fIsMaster
If is on master thread.
Int_t fPrintModulo
The event modulus number to be printed.
void SetPrintModulo(Int_t value)
Implementation of the TVirtualMCStack interface.