VMC Examples
Version 6.8
Toggle main menu visibility
Loading...
Searching...
No Matches
examples
E01
src
Ex01Particle.cxx
Go to the documentation of this file.
1
//------------------------------------------------
2
// The Virtual Monte Carlo examples
3
// Copyright (C) 2007 - 2014 Ivana Hrivnacova
4
// All rights reserved.
5
//
6
// For the licensing terms see geant4_vmc/LICENSE.
7
// Contact: root-vmc@cern.ch
8
//-------------------------------------------------
9
10
/// \file Ex01Particle.cxx
11
/// \brief Implementation of the Ex01Particle class
12
///
13
/// Geant4 ExampleN01 adapted to Virtual Monte Carlo
14
///
15
/// \date 05/04/2002
16
/// \author I. Hrivnacova; IPN, Orsay
17
18
#include "
Ex01Particle.h
"
19
20
#include <TObjArray.h>
21
#include <TParticle.h>
22
23
/// \cond CLASSIMP
24
ClassImp(
Ex01Particle
)
25
/// \endcond
26
27
//_____________________________________________________________________________
28
Ex01Particle
::
Ex01Particle
(Int_t
id
, TParticle* particle)
29
:
fID
(
id
),
fParticle
(particle),
fMother
(0),
fDaughters
(0)
30
{
31
/// Standard constructor
32
/// \param id The particle id
33
/// \param particle The particle definition (TParticle)
34
}
35
36
//_____________________________________________________________________________
37
Ex01Particle::Ex01Particle
(Int_t
id
, TParticle* particle,
Ex01Particle
* mother)
38
:
fID
(id),
fParticle
(particle),
fMother
(mother),
fDaughters
(0)
39
{
40
/// Standard constructor
41
/// \param id The particle id
42
/// \param particle The particle definition (TParticle)
43
/// \param mother The particle mother
44
}
45
46
//_____________________________________________________________________________
47
Ex01Particle::Ex01Particle
() :
fID
(0),
fParticle
(0),
fMother
(0),
fDaughters
(0)
48
{
49
/// Default constructor
50
}
51
52
//_____________________________________________________________________________
53
Ex01Particle::~Ex01Particle
()
54
{
55
/// Destructor
56
57
if
(
fDaughters
)
delete
fDaughters
;
58
}
59
60
// operators
61
62
// public methods
63
64
//_____________________________________________________________________________
65
void
Ex01Particle::AddDaughter
(
Ex01Particle
* particle)
66
{
67
/// Add particles daughter
68
/// \param particle The daughter particle
69
70
if
(!
fDaughters
)
fDaughters
=
new
TObjArray();
71
72
fDaughters
->Add(particle);
73
}
74
75
//_____________________________________________________________________________
76
void
Ex01Particle::SetMother
(
Ex01Particle
* particle)
77
{
78
/// Set particle mother
79
/// \param particle The mother particle
80
81
fMother
= particle;
82
}
83
84
//_____________________________________________________________________________
85
Int_t
Ex01Particle::GetID
()
const
86
{
87
/// \return The particle Id.
88
89
return
fID
;
90
}
91
92
//_____________________________________________________________________________
93
TParticle*
Ex01Particle::GetParticle
()
const
94
{
95
/// \return The particle definition (TParticle).
96
97
return
fParticle
;
98
}
99
100
//_____________________________________________________________________________
101
Ex01Particle
*
Ex01Particle::GetMother
()
const
102
{
103
/// \return The particle mother.
104
105
return
fMother
;
106
}
107
108
//_____________________________________________________________________________
109
Int_t
Ex01Particle::GetNofDaughters
()
const
110
{
111
/// \return The number of daughters.
112
113
if
(!
fDaughters
)
return
0;
114
115
return
fDaughters
->GetEntriesFast();
116
}
117
118
//_____________________________________________________________________________
119
Ex01Particle
*
Ex01Particle::GetDaughter
(Int_t i)
const
120
{
121
/// \return \em i -th daughter
122
/// \param i The daughter index
123
124
// add test if i
125
126
return
(
Ex01Particle
*)
fDaughters
->At(i);
127
}
Ex01Particle.h
Definition of the Ex01Particle class.
Ex01Particle
Extended TParticle with pointers to mother and daughter particles.
Definition
Ex01Particle.h:32
Ex01Particle::AddDaughter
void AddDaughter(Ex01Particle *particle)
Definition
Ex01Particle.cxx:65
Ex01Particle::fParticle
TParticle * fParticle
The particle definition.
Definition
Ex01Particle.h:53
Ex01Particle::fDaughters
TObjArray * fDaughters
The particle daughters.
Definition
Ex01Particle.h:55
Ex01Particle::GetNofDaughters
Int_t GetNofDaughters() const
Definition
Ex01Particle.cxx:109
Ex01Particle::Ex01Particle
Ex01Particle()
Definition
Ex01Particle.cxx:47
Ex01Particle::fMother
Ex01Particle * fMother
The particle mother.
Definition
Ex01Particle.h:54
Ex01Particle::GetDaughter
Ex01Particle * GetDaughter(Int_t i) const
Definition
Ex01Particle.cxx:119
Ex01Particle::SetMother
void SetMother(Ex01Particle *particle)
Definition
Ex01Particle.cxx:76
Ex01Particle::GetMother
Ex01Particle * GetMother() const
Definition
Ex01Particle.cxx:101
Ex01Particle::GetID
Int_t GetID() const
Definition
Ex01Particle.cxx:85
Ex01Particle::~Ex01Particle
virtual ~Ex01Particle()
Definition
Ex01Particle.cxx:53
Ex01Particle::Ex01Particle
Ex01Particle(Int_t id, TParticle *particle)
Definition
Ex01Particle.cxx:28
Ex01Particle::fID
Int_t fID
The particle Id.
Definition
Ex01Particle.h:52
Ex01Particle::GetParticle
TParticle * GetParticle() const
Definition
Ex01Particle.cxx:93
Generated on
for VMC Examples by
1.17.0