Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4IT.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// $Id: G4IT.hh 65022 2012-11-12 16:43:12Z gcosmo $
27//
28// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
29//
30// WARNING : This class is released as a prototype.
31// It might strongly evolve or even disapear in the next releases.
32//
33// History:
34// -----------
35// 10 Oct 2011 M.Karamitros created
36//
37// -------------------------------------------------------------------
38
39#ifndef G4IT_h
40#define G4IT_h 1
41
42#include "globals.hh"
43#include "G4ITType.hh"
44#include "G4ThreeVector.hh"
47
48///
49// To implement your own IT class, you should use
50// ITDef(MyClass) in the class define in your MyClass.hh
51// and ITImp(MyClass) in your MyClass.cc
52// For instance, see G4Molecule
53///
54
55class G4IT;
56class G4KDNode;
57class G4ITBox;
58class G4Track;
59
60G4IT* GetIT(const G4Track* track) ;
61G4IT* GetIT(const G4Track& track) ;
62
63#if defined G4EM_ALLOC_EXPORT
65#else
67#endif
68
69class G4TrackListNode;
70
71/**
72 * G4IT is a interface which allows the inheriting object :
73 * - to be included in ITManager for the search of nearest
74 * neighbour
75 * - to be tracked using G4ITStepManager
76 * The inheriting class must implement the operator < , ==
77 * and != in order to enable the sorting out.
78 * also the concrete header of MyIT ("MyIt.hh") should contain : ITDef(MyIT)
79 * and the source of MyIT.cc : ITImp(MyIT)
80 */
81
82class G4IT : public virtual G4VUserTrackInformation
83{
84public :
85 G4IT();
86 G4IT(G4Track*);
87 virtual ~G4IT();
88
89 inline void *operator new(size_t);
90 inline void operator delete(void *aIT);
91
92 virtual void Print() const {}
93 virtual const G4String& GetName() const = 0 ;
94
95 ///
96 // You should not worried of implementing diff, equal
97 // and GetType.
98 // When using ITDef(MyClass) this will be done.
99 // However, you need to implement in the concrete class
100 // even fake operators for < and ==
101 // They will be used by diff and equal.
102 ///
103 virtual G4bool diff(const G4IT& right) const = 0 ;
104 virtual G4bool equal(const G4IT& right) const = 0 ;
105 G4bool operator<(const G4IT& right) const;
106 G4bool operator==(const G4IT& right) const;
107 G4bool operator!=(const G4IT& right) const;
108
109 void SetTrack(G4Track*);
110 inline G4Track* GetTrack();
111 inline const G4Track* GetTrack() const;
112
114
115 inline void SetPrevious(G4IT*);
116 inline void SetNext(G4IT*);
117 inline G4IT* GetPrevious();
118 inline G4IT* GetNext();
119 inline const G4IT* GetPrevious() const;
120 inline const G4IT* GetNext() const;
121 inline void SetITBox(G4ITBox*);
122 inline const G4ITBox* GetITBox() const;
123 void TakeOutBox();
124 inline void SetNode(G4KDNode*);
125
126 inline void SetParentID(int,int);
127 inline void GetParentID(int&,int&);
128
129 inline const G4ThreeVector& GetPreStepPosition() const;
130 inline G4double GetPreStepLocalTime() const;
131 inline G4double GetPreStepGlobalTime() const;
132 inline G4KDNode* GetNode() const;
133
134 inline G4TrackingInformation* GetTrackingInfo(){return &fTrackingInformation;}
135
136 inline G4TrackListNode* GetTrackListNode(){return fpTrackNode;}
137 inline void SetTrackListNode(G4TrackListNode* node){ fpTrackNode = node;}
138
139 virtual const G4ITType GetITType() const = 0 ;
140
141protected :
142 G4IT(const G4IT&);
143 G4IT& operator=(const G4IT&);
145
146private :
147 G4ITBox * fpITBox;
148 G4IT* fpPreviousIT;
149 G4IT* fpNextIT;
150 G4KDNode* fpKDNode ;
151
152 int fParentID_A;
153 int fParentID_B;
154
155 G4TrackingInformation fTrackingInformation ;
156 G4TrackListNode* fpTrackNode;
157};
158//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
159///
160// Inline methods
161///
162inline void* G4IT::operator new(size_t)
163{
164 void *aIT;
165 aIT = (void *) aITAllocator.MallocSingle();
166 return aIT;
167}
168
169inline void G4IT::operator delete(void *aIT)
170{ aITAllocator.FreeSingle((G4IT *) aIT);}
171
172inline const G4ITBox* G4IT::GetITBox() const
173{
174 return fpITBox ;
175}
176
177inline void G4IT::SetITBox(G4ITBox * aITBox)
178{
179 fpITBox = aITBox;
180}
181
182inline void G4IT::SetPrevious(G4IT* aIT)
183{
184 fpPreviousIT = aIT;
185}
186
187inline void G4IT::SetNext(G4IT* aIT)
188{
189 fpNextIT = aIT;
190}
191
193{
194 return fpPreviousIT;
195}
196
198{
199 return fpNextIT;
200}
201
202inline void G4IT::SetTrack(G4Track* track)
203{
204 fpTrack = track;
205}
206
208{
209 return fpTrack;
210}
211
212inline const G4Track* G4IT::GetTrack() const
213{
214 return fpTrack;
215}
216
217inline void G4IT::SetParentID(int p_a, int p_b)
218{
219 fParentID_A = p_a;
220 fParentID_B = p_b;
221}
222
223inline void G4IT::GetParentID(int& p_a,int&p_b)
224{
225 p_a = fParentID_A;
226 p_b = fParentID_B ;
227}
228
230{
231 return fTrackingInformation.GetPreStepGlobalTime();
232}
233
235{
236 return fTrackingInformation.GetPreStepLocalTime();
237}
238
240{
241 return fTrackingInformation.GetPreStepPosition();
242}
243
244inline const G4IT* G4IT::GetPrevious() const
245{
246 return fpPreviousIT ;
247}
248
249inline const G4IT* G4IT::GetNext() const
250{
251 return fpNextIT ;
252}
253
254inline void G4IT::SetNode(G4KDNode* aNode)
255{
256 fpKDNode = aNode ;
257}
258
259inline G4KDNode* G4IT::GetNode() const
260{
261 return fpKDNode ;
262}
263#endif
264
265
266
G4DLLIMPORT G4Allocator< G4IT > aITAllocator
Definition: G4IT.cc:43
G4IT * GetIT(const G4Track *track)
Definition: G4IT.cc:48
double G4double
Definition: G4Types.hh:64
#define G4DLLIMPORT
Definition: G4Types.hh:56
#define G4DLLEXPORT
Definition: G4Types.hh:55
bool G4bool
Definition: G4Types.hh:67
Definition: G4IT.hh:83
G4bool operator!=(const G4IT &right) const
Definition: G4IT.cc:187
void SetITBox(G4ITBox *)
Definition: G4IT.hh:177
void SetTrack(G4Track *)
Definition: G4IT.hh:202
virtual G4bool equal(const G4IT &right) const =0
void GetParentID(int &, int &)
Definition: G4IT.hh:223
virtual void Print() const
Definition: G4IT.hh:92
const G4ThreeVector & GetPreStepPosition() const
Definition: G4IT.hh:239
void TakeOutBox()
Definition: G4IT.cc:125
const G4ITBox * GetITBox() const
Definition: G4IT.hh:172
virtual const G4ITType GetITType() const =0
G4double GetPreStepGlobalTime() const
Definition: G4IT.hh:229
G4TrackingInformation * GetTrackingInfo()
Definition: G4IT.hh:134
G4double GetPreStepLocalTime() const
Definition: G4IT.hh:234
G4Track * fpTrack
Definition: G4IT.hh:144
void SetPrevious(G4IT *)
Definition: G4IT.hh:182
G4IT & operator=(const G4IT &)
Definition: G4IT.cc:89
G4IT * GetNext()
Definition: G4IT.hh:197
void SetTrackListNode(G4TrackListNode *node)
Definition: G4IT.hh:137
G4bool operator==(const G4IT &right) const
Definition: G4IT.cc:178
virtual ~G4IT()
Definition: G4IT.cc:139
G4IT()
Definition: G4IT.cc:61
void SetNode(G4KDNode *)
Definition: G4IT.hh:254
void SetParentID(int, int)
Definition: G4IT.hh:217
G4bool operator<(const G4IT &right) const
Definition: G4IT.cc:165
void RecordCurrentPositionNTime()
Definition: G4IT.cc:157
G4IT * GetPrevious()
Definition: G4IT.hh:192
virtual const G4String & GetName() const =0
G4KDNode * GetNode() const
Definition: G4IT.hh:259
G4TrackListNode * GetTrackListNode()
Definition: G4IT.hh:136
void SetNext(G4IT *)
Definition: G4IT.hh:187
virtual G4bool diff(const G4IT &right) const =0
G4Track * GetTrack()
Definition: G4IT.hh:207
G4double GetPreStepLocalTime() const
G4double GetPreStepGlobalTime() const
const G4ThreeVector & GetPreStepPosition() const