Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ITBox Class Reference

#include <G4ITBox.hh>

Public Member Functions

 G4ITBox ()
 
 ~G4ITBox ()
 
void ResetStack ()
 
void Push (G4IT *)
 
void Extract (G4IT *)
 
G4ITFindIT (const G4Track &)
 
const G4ITFindIT (const G4Track &) const
 
void TransferTo (G4ITBox *)
 
G4bool Empty () const
 
G4int GetNTrack () const
 
G4ITGetFirstIT ()
 
G4ITGetLastIT ()
 
const G4ITGetFirstIT () const
 
const G4ITGetLastIT () const
 
void SetNextBox (G4ITBox *box)
 
G4ITBoxGetNextBox ()
 
void SetPreviousBox (G4ITBox *box)
 
G4ITBoxGetPreviousBox ()
 

Detailed Description

A G4ITBox contains all IT of the same kind. eg : all °OH It behaves just like a stack.

Definition at line 50 of file G4ITBox.hh.

Constructor & Destructor Documentation

◆ G4ITBox()

G4ITBox::G4ITBox ( )

Definition at line 38 of file G4ITBox.cc.

38 : fNbIT(0), fpFirstIT(0), fpLastIT(0), fpPreviousBox(0), fpNextBox(0)
39{;}

◆ ~G4ITBox()

G4ITBox::~G4ITBox ( )

Definition at line 41 of file G4ITBox.cc.

42{
43 if( fNbIT != 0 )
44 {
45 G4IT * aIT = fpFirstIT;
46 G4IT * nextIT;
47
48 while( aIT != 0 )
49 {
50 nextIT = aIT->GetNext();
51 delete aIT;
52 aIT = nextIT;
53 }
54 }
55
56 if(fpPreviousBox) fpPreviousBox->SetNextBox(fpNextBox) ;
57 if(fpNextBox) fpNextBox->SetPreviousBox(fpPreviousBox);
58}
void SetPreviousBox(G4ITBox *box)
Definition: G4ITBox.hh:132
void SetNextBox(G4ITBox *box)
Definition: G4ITBox.hh:122
Definition: G4IT.hh:83
G4IT * GetNext()
Definition: G4IT.hh:197

Member Function Documentation

◆ Empty()

G4bool G4ITBox::Empty ( ) const
inline

Definition at line 95 of file G4ITBox.hh.

96{
97 return (fNbIT==0);
98}

◆ Extract()

void G4ITBox::Extract ( G4IT aStackedIT)

Definition at line 87 of file G4ITBox.cc.

88{
89 if( aStackedIT == fpFirstIT )
90 {
91 fpFirstIT = aStackedIT->GetNext();
92 }
93 else if( aStackedIT == fpLastIT )
94 {
95 fpLastIT = aStackedIT->GetPrevious();
96
97 }
98
99 if( aStackedIT->GetNext())
100 aStackedIT->GetNext()->SetPrevious(aStackedIT->GetPrevious());
101 if( aStackedIT->GetPrevious())
102 aStackedIT->GetPrevious()->SetNext(aStackedIT->GetNext());
103
104 aStackedIT->SetNext(0);
105 aStackedIT->SetPrevious(0);
106 aStackedIT->SetITBox(0);
107 fNbIT--;
108}
void SetITBox(G4ITBox *)
Definition: G4IT.hh:177
void SetPrevious(G4IT *)
Definition: G4IT.hh:182
G4IT * GetPrevious()
Definition: G4IT.hh:192
void SetNext(G4IT *)
Definition: G4IT.hh:187

Referenced by G4IT::TakeOutBox(), and TransferTo().

◆ FindIT() [1/2]

G4IT * G4ITBox::FindIT ( const G4Track track)

The FindIT methods are used for check only. Those methods are not effective due to the linear search. It is better to use GetIT(track) in order to retrieve the IT and GetIT(track)->GetBox() in order to check which is the box pointer.

Definition at line 110 of file G4ITBox.cc.

111{
112 if( fNbIT == 0 ) return 0;
113
114 G4IT * temp = fpLastIT;
115 G4bool find = false;
116
117 while(find == false && temp != 0)
118 {
119 if(temp-> GetTrack() == &track)
120 {
121 find = true;
122 break;
123 }
124 temp = temp->GetPrevious();
125 }
126
127 return temp;
128}
bool G4bool
Definition: G4Types.hh:67

◆ FindIT() [2/2]

const G4IT * G4ITBox::FindIT ( const G4Track track) const

Definition at line 130 of file G4ITBox.cc.

131{
132 if( fNbIT == 0 ) return 0;
133
134 const G4IT * temp = fpLastIT;
135 G4bool find = false;
136
137 while(find == false && temp != 0)
138 {
139 if(temp-> GetTrack() == &track)
140 {
141 find = true;
142 break;
143 }
144 temp = temp->GetPrevious();
145 }
146
147 return temp;
148}

◆ GetFirstIT() [1/2]

G4IT * G4ITBox::GetFirstIT ( )
inline

Definition at line 104 of file G4ITBox.hh.

105{
106 return fpFirstIT ;
107}

◆ GetFirstIT() [2/2]

const G4IT * G4ITBox::GetFirstIT ( ) const
inline

Definition at line 113 of file G4ITBox.hh.

114{
115 return fpFirstIT ;
116}

◆ GetLastIT() [1/2]

G4IT * G4ITBox::GetLastIT ( )
inline

Definition at line 108 of file G4ITBox.hh.

109{
110 return fpLastIT ;
111}

◆ GetLastIT() [2/2]

const G4IT * G4ITBox::GetLastIT ( ) const
inline

Definition at line 117 of file G4ITBox.hh.

118{
119 return fpLastIT ;
120}

◆ GetNextBox()

G4ITBox * G4ITBox::GetNextBox ( )
inline

Definition at line 127 of file G4ITBox.hh.

128{
129 return fpNextBox ;
130}

Referenced by G4ITManager< T >::GetNextBox().

◆ GetNTrack()

G4int G4ITBox::GetNTrack ( ) const
inline

Definition at line 100 of file G4ITBox.hh.

101{
102 return fNbIT ;
103}

◆ GetPreviousBox()

G4ITBox * G4ITBox::GetPreviousBox ( )
inline

Definition at line 137 of file G4ITBox.hh.

138{
139 return fpPreviousBox ;
140}

◆ Push()

void G4ITBox::Push ( G4IT aIT)

Definition at line 70 of file G4ITBox.cc.

71{
72 if( fNbIT == 0 )
73 {
74 aIT->SetPrevious( 0 );
75 fpFirstIT = aIT;
76 }
77 else
78 {
79 fpLastIT->SetNext( aIT );
80 aIT->SetPrevious( fpLastIT );
81 }
82 fpLastIT = aIT;
83 fNbIT++;
84 aIT->SetITBox(this);
85}

Referenced by TransferTo().

◆ ResetStack()

void G4ITBox::ResetStack ( )

◆ SetNextBox()

void G4ITBox::SetNextBox ( G4ITBox box)
inline

Definition at line 122 of file G4ITBox.hh.

123{
124 fpNextBox = box;
125}

Referenced by ~G4ITBox().

◆ SetPreviousBox()

void G4ITBox::SetPreviousBox ( G4ITBox box)
inline

Definition at line 132 of file G4ITBox.hh.

133{
134 fpPreviousBox = box;
135}

Referenced by ~G4ITBox().

◆ TransferTo()

void G4ITBox::TransferTo ( G4ITBox aStack)

Definition at line 150 of file G4ITBox.cc.

151{
152 G4IT * ITToTransfer = fpFirstIT;
153 while(fNbIT)
154 {
155 Extract(ITToTransfer);
156 aStack->Push(ITToTransfer);
157 ITToTransfer = ITToTransfer->GetNext();
158 }
159}
void Extract(G4IT *)
Definition: G4ITBox.cc:87
void Push(G4IT *)
Definition: G4ITBox.cc:70

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