VMC Examples Version 6.6
Loading...
Searching...
No Matches
Ex03PrimaryGenerator.h
Go to the documentation of this file.
1#ifndef EX03_PRIMARY_GENERATOR_H
2#define EX03_PRIMARY_GENERATOR_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 Ex03PrimaryGenerator.h
14/// \brief Definition of the Ex03PrimaryGenerator class
15///
16/// Geant4 ExampleN03 adapted to Virtual Monte Carlo: \n
17/// Id: ExN03PrimaryGeneratorAction.hh,v 1.5 2002/01/09 17:24:11 ranjard Exp
18/// GEANT4 tag Name: geant4-05-00
19///
20/// \author I. Hrivnacova; IPN, Orsay
21
22#include <TVirtualMCApplication.h>
23
24class TVirtualMCStack;
25class TVector3;
26
27/// \ingroup E03
28/// \brief The primary generator
29///
30/// \date 06/03/2003
31/// \author I. Hrivnacova; IPN, Orsay
32
34{
35 public:
36 /// Predefined primary generators
37 enum Type
38 {
39 kDefault, ///< default (e-)
40 kUser, ///< user defined particle and ion
41 kUserDecay, ///< particle with user defined decay (K0Short)
42 kAnti, ///< light anti-nuclei (with Geant4 only)
43 kTestField, ///< mu+ with a suitable energy to test magnetic field
44 kPion ///< pi- ith a suitable energy to test biasing
45 };
46
47 public:
50 const Ex03PrimaryGenerator& origin, TVirtualMCStack* stack);
52 virtual ~Ex03PrimaryGenerator();
53
54 // methods
55 virtual void GeneratePrimaries(const TVector3& worldSize);
56
57 // set methods
58 void SetIsRandom(Bool_t isRandomGenerator);
59 void SetPrimaryType(Type primaryType);
60 void SetNofPrimaries(Int_t nofPrimaries);
61
62 // get methods
63 Bool_t GetUserDecay() const;
64
65 private:
66 // methods
67 void GeneratePrimary1(const TVector3& origin);
68 void GeneratePrimary2(const TVector3& origin);
69 void GeneratePrimary3(const TVector3& origin);
70 void GeneratePrimary4(const TVector3& origin);
71 void GeneratePrimary5(const TVector3& origin);
72 void GeneratePrimary6(const TVector3& origin);
73
74 // data members
75 TVirtualMCStack* fStack; ///< VMC stack
76 Bool_t fIsRandom; ///< Switch to random generator
77 Type fPrimaryType; ///< Primary generator selection
78 Int_t fNofPrimaries; ///< Number of primary particles
79
80 ClassDef(Ex03PrimaryGenerator, 1) // Ex03PrimaryGenerator
81};
82
83// inline functions
84
85/// Switch on/off the random generator
86/// \param isRandom If true, the position is randomized
87inline void Ex03PrimaryGenerator::SetIsRandom(Bool_t isRandom)
88{
89 fIsRandom = isRandom;
90}
91
92/// Set the primary particle type to be generated
93/// \param primaryType The primary particle type \see Ex03Primary
96{
97 fPrimaryType = primaryType;
98}
99
100/// Set the number of particles to be generated
101/// \param nofPrimaries The number of particles to be generated
102inline void Ex03PrimaryGenerator::SetNofPrimaries(Int_t nofPrimaries)
103{
104 fNofPrimaries = nofPrimaries;
105}
106
107/// Return true if particle with user decay is activated
112
113#endif // EX03_PRIMARY_GENERATOR_H
The primary generator.
void GeneratePrimary1(const TVector3 &origin)
virtual void GeneratePrimaries(const TVector3 &worldSize)
void GeneratePrimary3(const TVector3 &origin)
TVirtualMCStack * fStack
VMC stack.
void SetIsRandom(Bool_t isRandomGenerator)
void SetNofPrimaries(Int_t nofPrimaries)
void GeneratePrimary2(const TVector3 &origin)
Bool_t GetUserDecay() const
Return true if particle with user decay is activated.
void GeneratePrimary6(const TVector3 &origin)
void GeneratePrimary5(const TVector3 &origin)
Int_t fNofPrimaries
Number of primary particles.
void GeneratePrimary4(const TVector3 &origin)
Type
Predefined primary generators.
@ kTestField
mu+ with a suitable energy to test magnetic field
@ kUserDecay
particle with user defined decay (K0Short)
@ kUser
user defined particle and ion
@ kAnti
light anti-nuclei (with Geant4 only)
@ kPion
pi- ith a suitable energy to test biasing
void SetPrimaryType(Type primaryType)
Type fPrimaryType
Primary generator selection.
Bool_t fIsRandom
Switch to random generator.