VMC Examples Version 6.6
Loading...
Searching...
No Matches
Ex06MCApplication.h
Go to the documentation of this file.
1#ifndef EX06_MC_APPLICATION_H
2#define EX06_MC_APPLICATION_H
3
4//------------------------------------------------
5// The Virtual Monte Carlo examples
6// Copyright (C) 2007 - 2014 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 Ex06MCApplication.h
14/// \brief Definition of the Ex06MCApplication class
15///
16/// Geant4 ExampleN06 adapted to Virtual Monte Carlo \n
17///
18/// \author I. Hrivnacova; IPN, Orsay
19
20#include <TLorentzVector.h>
21#include <TMCVerbose.h>
22#include <TVirtualMCApplication.h>
23
24class TCanvas;
26
27class Ex03MCStack;
30
31/// \ingroup E06
32/// \brief Implementation of the TVirtualMCApplication
33///
34/// \date 16/05/2005
35/// \author I. Hrivnacova; IPN, Orsay
36
38{
39 public:
40 Ex06MCApplication(const char* name, const char* title);
42 virtual ~Ex06MCApplication();
43
44 // static access method
46
47 // methods
48 void InitMC(const char* setup);
49 void RunMC(Int_t nofEvents);
50
52 virtual void InitOnWorker();
53 virtual void Merge(TVirtualMCApplication* localMCApplication);
54
55 virtual void ConstructGeometry();
56 virtual void ConstructOpGeometry();
57 virtual void InitGeometry();
58 virtual void GeneratePrimaries();
59 virtual void BeginEvent();
60 virtual void BeginPrimary();
61 virtual void PreTrack();
62 virtual void Stepping();
63 virtual void PostTrack();
64 virtual void FinishPrimary();
65 virtual void FinishEvent();
66 void FinishRun();
67
68 // set methods
69 void SetVerboseLevel(Int_t verboseLevel);
70
71 // get methods
73
74 // method for tests
75 void SetOldGeometry(Bool_t oldGeometry = kTRUE);
76 void SetTestStackPopper(Bool_t option = kFALSE);
77
78 private:
79 // methods
81
82 // stack popper test
83 void GenerateFeedback(Int_t nofPhotons, TLorentzVector momentum);
84
85 // data members
86 Int_t fGammaCounter; ///< Optical photons counter
87 Int_t fFeedbackCounter; ///< Feedback photons counter
88 Int_t fRunGammaCounter; ///< Optical photons counter2
89 Int_t fRunFeedbackCounter; ///< Feedback photons counter2
90 TMCVerbose fVerbose; ///< VMC verbose helper
91 Ex03MCStack* fStack; ///< VMC stack
92 TVirtualMagField* fMagField; ///< The magnetic field
93 Ex06DetectorConstruction* fDetConstruction; ///< Dector construction
94 Ex06PrimaryGenerator* fPrimaryGenerator; ///< Primary generator
95 Bool_t fOldGeometry; ///< Option for geometry definition
96 Bool_t fTestStackPopper; ///< Option for stack popper test
97 Bool_t fIsMaster; ///< If is on master thread
98
99 ClassDef(Ex06MCApplication, 1) // Interface to MonteCarlo application
100};
101
102// inline functions
103
104/// \return The singleton instance
106{
107 return (Ex06MCApplication*)(TVirtualMCApplication::Instance());
108}
109
110/// Set verbosity
111/// \param verboseLevel The new verbose level value
112inline void Ex06MCApplication::SetVerboseLevel(Int_t verboseLevel)
113{
114 fVerbose.SetLevel(verboseLevel);
115}
116
117/// \return The primary generator
122
123/// Switch on/off the old geometry definition (via VMC functions)
124/// \param oldGeometry If true, geometry definition via VMC functions
125inline void Ex06MCApplication::SetOldGeometry(Bool_t oldGeometry)
126{
127 fOldGeometry = oldGeometry;
128}
129
130/// Switch on/off the stack popper test
131/// \param option stack popper test activation option
133{
134 fTestStackPopper = option;
135}
136
137#endif // EX06_MC_APPLICATION_H
Implementation of the TVirtualMCStack interface.
Definition Ex03MCStack.h:36
The detector construction (via TGeo )
Implementation of the TVirtualMCApplication.
Bool_t fTestStackPopper
Option for stack popper test.
static Ex06MCApplication * Instance()
void RunMC(Int_t nofEvents)
virtual void GeneratePrimaries()
Int_t fFeedbackCounter
Feedback photons counter.
TVirtualMagField * fMagField
The magnetic field.
void GenerateFeedback(Int_t nofPhotons, TLorentzVector momentum)
Int_t fRunGammaCounter
Optical photons counter2.
Int_t fRunFeedbackCounter
Feedback photons counter2.
virtual void BeginPrimary()
Bool_t fIsMaster
If is on master thread.
void InitMC(const char *setup)
Int_t fGammaCounter
Optical photons counter.
Ex06DetectorConstruction * fDetConstruction
Dector construction.
virtual void InitGeometry()
Bool_t fOldGeometry
Option for geometry definition.
virtual void BeginEvent()
void SetOldGeometry(Bool_t oldGeometry=kTRUE)
virtual void ConstructGeometry()
virtual TVirtualMCApplication * CloneForWorker() const
Ex03MCStack * fStack
VMC stack.
virtual void InitOnWorker()
void SetVerboseLevel(Int_t verboseLevel)
Ex06PrimaryGenerator * fPrimaryGenerator
Primary generator.
TMCVerbose fVerbose
VMC verbose helper.
void SetTestStackPopper(Bool_t option=kFALSE)
virtual void FinishEvent()
virtual void FinishPrimary()
virtual void Merge(TVirtualMCApplication *localMCApplication)
Ex06PrimaryGenerator * GetPrimaryGenerator() const
virtual void ConstructOpGeometry()
The primary generator.