VMC Examples Version 6.6
Loading...
Searching...
No Matches
Ex02Particle Class Reference

Extended TParticle with pointers to mother and daughter particles. More...

#include <Ex02Particle.h>

Inheritance diagram for Ex02Particle:

Public Member Functions

 Ex02Particle (Int_t id, TParticle *particle)
 
 Ex02Particle (Int_t id, TParticle *particle, Ex02Particle *mother)
 
 Ex02Particle ()
 
virtual ~Ex02Particle ()
 
void SetMother (Ex02Particle *particle)
 
void AddDaughter (Ex02Particle *particle)
 
virtual void Print (Option_t *option="") const
 
void PrintDaughters () const
 
Int_t GetID () const
 
TParticle * GetParticle () const
 
Ex02ParticleGetMother () const
 
Int_t GetNofDaughters () const
 
Ex02ParticleGetDaughter (Int_t i) const
 

Private Attributes

Int_t fID
 The particle Id.
 
TParticle * fParticle
 The particle definition.
 
TRef fMother
 The particle mother.
 
TRefArray fDaughters
 The particle daughters.
 

Detailed Description

Extended TParticle with pointers to mother and daughter particles.

Date
05/04/2002
Author
I. Hrivnacova; IPN, Orsay

Definition at line 33 of file Ex02Particle.h.

Constructor & Destructor Documentation

◆ Ex02Particle() [1/3]

Ex02Particle::Ex02Particle ( Int_t id,
TParticle * particle )

Standard constructor

Parameters
idThe particle id
particleThe particle definition (TParticle)

Definition at line 32 of file Ex02Particle.cxx.

33 : fID(id), fParticle(particle), fMother(), fDaughters()
34{
35 /// Standard constructor
36 /// \param id The particle id
37 /// \param particle The particle definition (TParticle)
38}
Int_t fID
The particle Id.
TRefArray fDaughters
The particle daughters.
TParticle * fParticle
The particle definition.
TRef fMother
The particle mother.

◆ Ex02Particle() [2/3]

Ex02Particle::Ex02Particle ( Int_t id,
TParticle * particle,
Ex02Particle * mother )

Standard constructor

Parameters
idThe particle id
particleThe particle definition (TParticle)
motherThe particle mother

Definition at line 41 of file Ex02Particle.cxx.

42 : fID(id), fParticle(particle), fMother(mother), fDaughters()
43{
44 /// Standard constructor
45 /// \param id The particle id
46 /// \param particle The particle definition (TParticle)
47 /// \param mother The particle mother
48}

◆ Ex02Particle() [3/3]

Ex02Particle::Ex02Particle ( )

Default constructor

Definition at line 51 of file Ex02Particle.cxx.

51 : fID(0), fParticle(0), fMother(), fDaughters()
52{
53 /// Default constructor
54}

◆ ~Ex02Particle()

Ex02Particle::~Ex02Particle ( )
virtual

Destructor

Definition at line 57 of file Ex02Particle.cxx.

58{
59 /// Destructor
60
61 delete fParticle;
62}

Member Function Documentation

◆ SetMother()

void Ex02Particle::SetMother ( Ex02Particle * particle)

Set particle mother

Parameters
particleThe mother particle

Definition at line 69 of file Ex02Particle.cxx.

70{
71 /// Set particle mother
72 /// \param particle The mother particle
73
74 fMother.SetObject(particle);
75}

◆ AddDaughter()

void Ex02Particle::AddDaughter ( Ex02Particle * particle)

Add particles daughter

Parameters
particleThe daughter particle

Definition at line 78 of file Ex02Particle.cxx.

79{
80 /// Add particles daughter
81 /// \param particle The daughter particle
82
83 fDaughters.Add(particle);
84}

◆ Print()

void Ex02Particle::Print ( Option_t * option = "") const
virtual

Print particle properties.

Definition at line 87 of file Ex02Particle.cxx.

88{
89 /// Print particle properties.
90
91 cout << "Track ID: " << fID << endl;
92
93 fParticle->Print();
94
95 if (GetMother()) {
96 cout << "Mother: " << GetMother()->GetParticle()->GetName()
97 << " with ID: " << GetMother()->GetID() << endl;
98 }
99 else
100 cout << "Primary " << endl;
101
102 cout << "Number of daughters: " << GetNofDaughters() << endl;
103 cout << endl;
104}
Int_t GetID() const
Int_t GetNofDaughters() const
Ex02Particle * GetMother() const
TParticle * GetParticle() const

◆ PrintDaughters()

void Ex02Particle::PrintDaughters ( ) const

Print particles daughters.

Definition at line 107 of file Ex02Particle.cxx.

108{
109 /// Print particles daughters.
110
111 for (Int_t i = 0; i < GetNofDaughters(); i++) {
112 cout << i << "th daughter: " << endl;
113 if (GetDaughter(i))
114 GetDaughter(i)->Print();
115 else
116 cout << "0x0";
117 }
118 cout << endl;
119}
Ex02Particle * GetDaughter(Int_t i) const
virtual void Print(Option_t *option="") const

◆ GetID()

Int_t Ex02Particle::GetID ( ) const
Returns
The particle Id.

Definition at line 122 of file Ex02Particle.cxx.

123{
124 /// \return The particle Id.
125
126 return fID;
127}

◆ GetParticle()

TParticle * Ex02Particle::GetParticle ( ) const
Returns
The particle definition (TParticle).

Definition at line 130 of file Ex02Particle.cxx.

131{
132 /// \return The particle definition (TParticle).
133
134 return fParticle;
135}

◆ GetMother()

Ex02Particle * Ex02Particle::GetMother ( ) const
Returns
The particle mother.

Definition at line 138 of file Ex02Particle.cxx.

139{
140 /// \return The particle mother.
141
142 return (Ex02Particle*)fMother.GetObject();
143}
Extended TParticle with pointers to mother and daughter particles.

◆ GetNofDaughters()

Int_t Ex02Particle::GetNofDaughters ( ) const
Returns
The number of daughters.

Definition at line 146 of file Ex02Particle.cxx.

147{
148 /// \return The number of daughters.
149
150 return fDaughters.GetEntriesFast();
151}

◆ GetDaughter()

Ex02Particle * Ex02Particle::GetDaughter ( Int_t i) const
Returns
i -th daughter
Parameters
iThe daughter index

Definition at line 154 of file Ex02Particle.cxx.

155{
156 /// \return \em i -th daughter
157 /// \param i The daughter index
158
159 if (i < 0 || i >= GetNofDaughters())
160 Fatal("GetDaughter", "Index out of range");
161
162 return (Ex02Particle*)fDaughters.At(i);
163}

Member Data Documentation

◆ fID

Int_t Ex02Particle::fID
private

The particle Id.

Definition at line 56 of file Ex02Particle.h.

◆ fParticle

TParticle* Ex02Particle::fParticle
private

The particle definition.

Definition at line 57 of file Ex02Particle.h.

◆ fMother

TRef Ex02Particle::fMother
private

The particle mother.

Definition at line 58 of file Ex02Particle.h.

◆ fDaughters

TRefArray Ex02Particle::fDaughters
private

The particle daughters.

Definition at line 59 of file Ex02Particle.h.


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