VMC Examples Version 6.6
Loading...
Searching...
No Matches
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
24ClassImp(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//_____________________________________________________________________________
37Ex01Particle::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//_____________________________________________________________________________
47Ex01Particle::Ex01Particle() : fID(0), fParticle(0), fMother(0), fDaughters(0)
48{
49 /// Default constructor
50}
51
52//_____________________________________________________________________________
54{
55 /// Destructor
56
57 if (fDaughters) delete fDaughters;
58}
59
60// operators
61
62// public methods
63
64//_____________________________________________________________________________
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//_____________________________________________________________________________
77{
78 /// Set particle mother
79 /// \param particle The mother particle
80
81 fMother = particle;
82}
83
84//_____________________________________________________________________________
86{
87 /// \return The particle Id.
88
89 return fID;
90}
91
92//_____________________________________________________________________________
93TParticle* Ex01Particle::GetParticle() const
94{
95 /// \return The particle definition (TParticle).
96
97 return fParticle;
98}
99
100//_____________________________________________________________________________
102{
103 /// \return The particle mother.
104
105 return fMother;
106}
107
108//_____________________________________________________________________________
110{
111 /// \return The number of daughters.
112
113 if (!fDaughters) return 0;
114
115 return fDaughters->GetEntriesFast();
116}
117
118//_____________________________________________________________________________
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}
Definition of the Ex01Particle class.
Extended TParticle with pointers to mother and daughter particles.
void AddDaughter(Ex01Particle *particle)
TParticle * fParticle
The particle definition.
TObjArray * fDaughters
The particle daughters.
Int_t GetNofDaughters() const
Ex01Particle * fMother
The particle mother.
Ex01Particle * GetDaughter(Int_t i) const
void SetMother(Ex01Particle *particle)
Ex01Particle * GetMother() const
Int_t GetID() const
virtual ~Ex01Particle()
Int_t fID
The particle Id.
TParticle * GetParticle() const