VMC Examples Version 6.6
Loading...
Searching...
No Matches
VMC::Gflash::PrimaryGenerator Class Reference

The primary generator. More...

#include <PrimaryGenerator.h>

Inheritance diagram for VMC::Gflash::PrimaryGenerator:

Public Member Functions

 PrimaryGenerator (TVirtualMCStack *stack)
 
 PrimaryGenerator (const PrimaryGenerator &origin, TVirtualMCStack *stack)
 
 PrimaryGenerator ()
 
virtual ~PrimaryGenerator ()
 
virtual void GeneratePrimaries (const TVector3 &worldSize)
 
void SetNofPrimaries (Int_t nofPrimaries)
 
void SetVertexPosition (TVector3 position)
 
void SetVertexDirection (TVector3 direction)
 
TVector3 GetVertexPosition () const
 Return the Vertex position.
 
TVector3 GetVertexDirection () const
 Return the Vertex direction.
 

Private Member Functions

void GenerateOnePrimary (const TVector3 &origin)
 

Private Attributes

TVirtualMCStackfStack
 VMC stack.
 
Int_t fNofPrimaries
 Number of primary particles.
 
TVector3 fVertexPosition
 Vertex position.
 
TVector3 fVertexDirection
 Vertex direction.
 

Detailed Description

The primary generator.

Geant4 gflash example adapted to Virtual Monte Carlo.

Date
28/10/2015
Author
I. Hrivnacova; IPN, Orsay

Definition at line 40 of file PrimaryGenerator.h.

Constructor & Destructor Documentation

◆ PrimaryGenerator() [1/3]

VMC::Gflash::PrimaryGenerator::PrimaryGenerator ( TVirtualMCStack * stack)

Standard constructor

Parameters
stackThe VMC stack

Definition at line 39 of file PrimaryGenerator.cxx.

40 : TObject(),
41 fStack(stack),
44 fVertexDirection(TVector3(0, 0, 1))
45 {
46 /// Standard constructor
47 /// \param stack The VMC stack
48 }
TVector3 fVertexPosition
Vertex position.
TVector3 fVertexDirection
Vertex direction.
TVirtualMCStack * fStack
VMC stack.
Int_t fNofPrimaries
Number of primary particles.

◆ PrimaryGenerator() [2/3]

VMC::Gflash::PrimaryGenerator::PrimaryGenerator ( const PrimaryGenerator & origin,
TVirtualMCStack * stack )

Copy constructor (for clonig on worker thread in MT mode).

Parameters
originThe source object (on master).
stackThe VMC stack

Definition at line 51 of file PrimaryGenerator.cxx.

53 : TObject(origin),
54 fStack(stack),
55 fNofPrimaries(origin.fNofPrimaries),
56 fVertexPosition(origin.fVertexPosition),
57 fVertexDirection(origin.fVertexDirection)
58 {
59 /// Copy constructor (for clonig on worker thread in MT mode).
60 /// \param origin The source object (on master).
61 /// \param stack The VMC stack
62 }

◆ PrimaryGenerator() [3/3]

VMC::Gflash::PrimaryGenerator::PrimaryGenerator ( )

Default constructor

Definition at line 65 of file PrimaryGenerator.cxx.

66 : TObject(),
67 fStack(0),
71 {
72 /// Default constructor
73 }

◆ ~PrimaryGenerator()

VMC::Gflash::PrimaryGenerator::~PrimaryGenerator ( )
virtual

Destructor

Definition at line 76 of file PrimaryGenerator.cxx.

77 {
78 /// Destructor
79 }

Member Function Documentation

◆ GeneratePrimaries()

void VMC::Gflash::PrimaryGenerator::GeneratePrimaries ( const TVector3 & worldSize)
virtual

Fill the user stack (derived from TVirtualMCStack) with primary particles.

Definition at line 141 of file PrimaryGenerator.cxx.

142 {
143 /// Fill the user stack (derived from TVirtualMCStack) with primary
144 /// particles.
145
146 for (Int_t i = 0; i < fNofPrimaries; i++) GenerateOnePrimary(origin);
147 }
void GenerateOnePrimary(const TVector3 &origin)

◆ SetNofPrimaries()

void VMC::Gflash::PrimaryGenerator::SetNofPrimaries ( Int_t nofPrimaries)
inline

Set the number of particles to be generated

Parameters
nofPrimariesThe number of particles to be generated

Definition at line 77 of file PrimaryGenerator.h.

78{
79 fNofPrimaries = nofPrimaries;
80}

◆ SetVertexPosition()

void VMC::Gflash::PrimaryGenerator::SetVertexPosition ( TVector3 position)
inline

Set the Vertex position

Parameters
positionThe Vertex position

Definition at line 84 of file PrimaryGenerator.h.

85{
86 fVertexPosition = position;
87}

◆ SetVertexDirection()

void VMC::Gflash::PrimaryGenerator::SetVertexDirection ( TVector3 direction)
inline

Set the Vertex direction

Parameters
directionThe Vertex direction

Definition at line 91 of file PrimaryGenerator.h.

92{
93 fVertexDirection = direction;
94}

◆ GetVertexPosition()

TVector3 VMC::Gflash::PrimaryGenerator::GetVertexPosition ( ) const
inline

Return the Vertex position.

Definition at line 97 of file PrimaryGenerator.h.

98{
99 return fVertexPosition;
100}

◆ GetVertexDirection()

TVector3 VMC::Gflash::PrimaryGenerator::GetVertexDirection ( ) const
inline

Return the Vertex direction.

Definition at line 103 of file PrimaryGenerator.h.

104{
105 return fVertexDirection;
106}

◆ GenerateOnePrimary()

void VMC::Gflash::PrimaryGenerator::GenerateOnePrimary ( const TVector3 & origin)
private

Add one primary particle (kElectron) to the user stack (derived from TVirtualMCStack).

Parameters
originThe track position

Definition at line 86 of file PrimaryGenerator.cxx.

87 {
88 /// Add one primary particle (kElectron) to the user stack
89 /// (derived from TVirtualMCStack).
90 /// \param origin The track position
91
92 // Track ID (filled by stack)
93 Int_t ntr;
94
95 // Option: to be tracked
96 Int_t toBeDone = 1;
97
98 // PDG
99 Int_t pdg = kElectron;
100
101 // Polarization
102 Double_t polx = 0.;
103 Double_t poly = 0.;
104 Double_t polz = 0.;
105
106 // Position
107 Double_t vx = origin.X();
108 Double_t vy = origin.Y();
109 Double_t vz = origin.Z();
110 Double_t tof = 0.;
111 fVertexPosition = origin;
112
113 // Energy (in GeV)
114 Double_t kinEnergy = 50.;
115 Double_t mass = 0.51099906 * 1e-03;
116 Double_t e = mass + kinEnergy;
117 Double_t pmag = sqrt(e * e - mass * mass);
118
119 // Particle momentum
120 Double_t px, py, pz;
121 px = pmag * fVertexDirection.X();
122 py = pmag * fVertexDirection.Y();
123 pz = pmag * fVertexDirection.Z();
124
125 // Randomize position
126 // if (fIsRandom) {
127 // vy = origin.Y()*(gRandom->Rndm() - 0.5);
128 // vz = origin.Z()*(gRandom->Rndm() - 0.5);
129 // }
130
131 // Add particle to stack
132 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
133 poly, polz, kPPrimary, ntr, 1., 0);
134 }

Member Data Documentation

◆ fStack

TVirtualMCStack* VMC::Gflash::PrimaryGenerator::fStack
private

VMC stack.

Definition at line 65 of file PrimaryGenerator.h.

◆ fNofPrimaries

Int_t VMC::Gflash::PrimaryGenerator::fNofPrimaries
private

Number of primary particles.

Definition at line 66 of file PrimaryGenerator.h.

◆ fVertexPosition

TVector3 VMC::Gflash::PrimaryGenerator::fVertexPosition
private

Vertex position.

Definition at line 67 of file PrimaryGenerator.h.

◆ fVertexDirection

TVector3 VMC::Gflash::PrimaryGenerator::fVertexDirection
private

Vertex direction.

Definition at line 68 of file PrimaryGenerator.h.


The documentation for this class was generated from the following files: