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

The primary generator. More...

#include <PrimaryGenerator.h>

Inheritance diagram for VMC::TR::PrimaryGenerator:

Public Member Functions

 PrimaryGenerator (TVirtualMCStack *stack)
 
 PrimaryGenerator (const PrimaryGenerator &origin, TVirtualMCStack *stack)
 
 PrimaryGenerator ()
 
virtual ~PrimaryGenerator ()
 
virtual void GeneratePrimaries ()
 
void SetNofPrimaries (Int_t nofPrimaries)
 

Private Member Functions

void GenerateOnePrimary ()
 

Private Attributes

TVirtualMCStackfStack
 VMC stack.
 
Int_t fNofPrimaries
 Number of primary particles.
 

Detailed Description

The primary generator.

Date
18/12/2015
Author
I. Hrivnacova; IPN, Orsay

Definition at line 35 of file PrimaryGenerator.h.

Constructor & Destructor Documentation

◆ PrimaryGenerator() [1/3]

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

Standard constructor

Parameters
stackThe VMC stack

Definition at line 36 of file PrimaryGenerator.cxx.

37 : TObject(), fStack(stack), fNofPrimaries(1)
38
39 {
40 /// Standard constructor
41 /// \param stack The VMC stack
42 }
TVirtualMCStack * fStack
VMC stack.
Int_t fNofPrimaries
Number of primary particles.

◆ PrimaryGenerator() [2/3]

VMC::TR::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 45 of file PrimaryGenerator.cxx.

47 : TObject(origin), fStack(stack), fNofPrimaries(origin.fNofPrimaries)
48 {
49 /// Copy constructor (for clonig on worker thread in MT mode).
50 /// \param origin The source object (on master).
51 /// \param stack The VMC stack
52 }

◆ PrimaryGenerator() [3/3]

VMC::TR::PrimaryGenerator::PrimaryGenerator ( )

Default constructor

Definition at line 55 of file PrimaryGenerator.cxx.

55 : TObject(), fStack(0), fNofPrimaries(0)
56 {
57 /// Default constructor
58 }

◆ ~PrimaryGenerator()

VMC::TR::PrimaryGenerator::~PrimaryGenerator ( )
virtual

Destructor

Definition at line 61 of file PrimaryGenerator.cxx.

62 {
63 /// Destructor
64 }

Member Function Documentation

◆ GeneratePrimaries()

void VMC::TR::PrimaryGenerator::GeneratePrimaries ( )
virtual

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

Definition at line 114 of file PrimaryGenerator.cxx.

115 {
116 /// Fill the user stack (derived from TVirtualMCStack) with primary
117 /// particles.
118
119 for (Int_t i = 0; i < fNofPrimaries; i++) {
121 }
122 }

◆ SetNofPrimaries()

void VMC::TR::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 63 of file PrimaryGenerator.h.

64{
65 fNofPrimaries = nofPrimaries;
66}

◆ GenerateOnePrimary()

void VMC::TR::PrimaryGenerator::GenerateOnePrimary ( )
private

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

Definition at line 71 of file PrimaryGenerator.cxx.

72 {
73 /// Add one primary particle (kElectron) to the user stack
74 /// (derived from TVirtualMCStack).
75
76 // Track ID (filled by stack)
77 Int_t ntr;
78
79 // Option: to be tracked
80 Int_t toBeDone = 1;
81
82 // PDG
83 Int_t pdg = kElectron;
84 // Int_t pdg = kRootino;
85
86 // Polarization
87 Double_t polx = 0.;
88 Double_t poly = 0.;
89 Double_t polz = 0.;
90
91 // Position
92 Double_t vx = 0.;
93 Double_t vy = 0.;
94 Double_t vz = 0.;
95 Double_t tof = 0.;
96
97 // Energy (in GeV)
98 Double_t kinEnergy = 2.;
99 Double_t mass = 0.51099906 * 1e-03;
100 Double_t e = mass + kinEnergy;
101
102 // Particle momentum
103 Double_t px, py, pz;
104 px = 0.;
105 py = 0.;
106 pz = sqrt(e * e - mass * mass);
107
108 // Add particle to stack
109 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
110 poly, polz, kPPrimary, ntr, 1., 0);
111 }

Member Data Documentation

◆ fStack

TVirtualMCStack* VMC::TR::PrimaryGenerator::fStack
private

VMC stack.

Definition at line 53 of file PrimaryGenerator.h.

◆ fNofPrimaries

Int_t VMC::TR::PrimaryGenerator::fNofPrimaries
private

Number of primary particles.

Definition at line 54 of file PrimaryGenerator.h.


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