Geant4  10.01.p03
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 90900 2015-06-11 08:06:17Z gcosmo $
27 //
28 // Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
29 
30 // The code is developed in the framework of the ESA AO7146
31 //
32 // We would be very happy hearing from you, send us your feedback! :)
33 //
34 // In order for Geant4-DNA to be maintained and still open-source,
35 // article citations are crucial.
36 // If you use Geant4-DNA chemistry and you publish papers about your software,
37 // in addition to the general paper on Geant4-DNA:
38 //
39 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178
40 //
41 // we would be very happy if you could please also cite the following
42 // reference papers on chemistry:
43 //
44 // J. Comput. Phys. 274 (2014) 841-882
45 // Prog. Nucl. Sci. Tec. 2 (2011) 503-508
46 
47 #ifndef G4IT_h
48 #define G4IT_h 1
49 
50 #include "globals.hh"
51 #include "G4ITType.hh"
52 #include "G4ThreeVector.hh"
54 #include "G4TrackingInformation.hh"
55 #include <CLHEP/Utility/memory.h>
56 #include "G4Allocator.hh"
57 
59 // To implement your own IT class, you should use
60 // ITDef(MyClass) in the class define in your MyClass.hh
61 // and ITImp(MyClass) in your MyClass.cc
62 // For instance, see G4Molecule
64 
65 class G4IT;
66 //template<typename PointT> class G4KDNode;
67 class G4KDNode_Base;
68 class G4ITBox;
69 class G4Track;
70 
71 G4IT* GetIT(const G4Track* track);
72 G4IT* GetIT(const G4Track& track);
73 
74 #if defined G4EM_ALLOC_EXPORT
76 #else
78 #endif
79 
80 template<class OBJECT> class G4FastListNode;
82 
94 class G4IT : public virtual G4VUserTrackInformation
95 {
96 public:
97  G4IT();
98  G4IT(G4Track*);
99  virtual ~G4IT();
100 
101  inline void *operator new(size_t);
102  inline void operator delete(void *aIT);
103 
104  virtual void Print() const
105  {
106  ;
107  }
108  virtual const G4String& GetName() const = 0;
109 
111  // You should not worried of implementing diff, equal
112  // and GetType.
113  // When using ITDef(MyClass) this will be done.
114  // However, you need to implement in the concrete class
115  // even fake operators for < and ==
116  // They will be used by diff and equal.
118  virtual G4bool diff(const G4IT& right) const = 0;
119  virtual G4bool equal(const G4IT& right) const = 0;
120  G4bool operator<(const G4IT& right) const;
121  G4bool operator==(const G4IT& right) const;
122  G4bool operator!=(const G4IT& right) const;
123 
124  void SetTrack(G4Track*);
125  inline G4Track* GetTrack();
126  inline const G4Track* GetTrack() const;
127 
128  virtual const G4ThreeVector& GetPosition() const;
129  double operator[](int i) const;
130 
132 
133  inline void SetPrevious(G4IT*);
134  inline void SetNext(G4IT*);
135  inline G4IT* GetPrevious();
136  inline G4IT* GetNext();
137  inline const G4IT* GetPrevious() const;
138  inline const G4IT* GetNext() const;
139  inline void SetITBox(G4ITBox*);
140  inline const G4ITBox* GetITBox() const;
141  void TakeOutBox();
142  inline void SetNode(G4KDNode_Base*);
143 
144  inline void SetParentID(int, int);
145  inline void GetParentID(int&, int&);
146 
147  inline const G4ThreeVector& GetPreStepPosition() const;
148  inline G4double GetPreStepLocalTime() const;
149  inline G4double GetPreStepGlobalTime() const;
150  inline G4KDNode_Base* GetNode() const;
151 
153  {
154  return &fTrackingInformation;
155  }
156 
158  {
159  return fpTrackNode;
160  }
161  inline void SetListNode(G4TrackListNode* node)
162  {
163  fpTrackNode = node;
164  }
165 
166  virtual const G4ITType GetITType() const = 0;
167 
168  virtual G4ITType GetITSubType() const
169  {
170  return 0;
171  }
172 
173 protected:
174  G4IT(const G4IT&);
175  G4IT& operator=(const G4IT&);
177 
178 private:
183 
186 
189 };
190 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
192 // Inline methods
194 inline void* G4IT::operator new(size_t)
195 {
197  return (void *) aITAllocator->MallocSingle();
198 }
199 
200 inline void G4IT::operator delete(void *aIT)
201 {
202  aITAllocator->FreeSingle((G4IT *) aIT);
203 }
204 
205 inline const G4ITBox* G4IT::GetITBox() const
206 {
207  return fpITBox;
208 }
209 
210 inline void G4IT::SetITBox(G4ITBox * aITBox)
211 {
212  fpITBox = aITBox;
213 }
214 
215 inline void G4IT::SetPrevious(G4IT* aIT)
216 {
217  fpPreviousIT = aIT;
218 }
219 
220 inline void G4IT::SetNext(G4IT* aIT)
221 {
222  fpNextIT = aIT;
223 }
224 
226 {
227  return fpPreviousIT;
228 }
229 
231 {
232  return fpNextIT;
233 }
234 
235 inline void G4IT::SetTrack(G4Track* track)
236 {
237  fpTrack = track;
238 }
239 
241 {
242  return fpTrack;
243 }
244 
245 inline const G4Track* G4IT::GetTrack() const
246 {
247  return fpTrack;
248 }
249 
250 inline void G4IT::SetParentID(int p_a, int p_b)
251 {
252  fParentID_A = p_a;
253  fParentID_B = p_b;
254 }
255 
256 inline void G4IT::GetParentID(int& p_a, int&p_b)
257 {
258  p_a = fParentID_A;
259  p_b = fParentID_B;
260 }
261 
263 {
265 }
266 
268 {
270 }
271 
273 {
275 }
276 
277 inline const G4IT* G4IT::GetPrevious() const
278 {
279  return fpPreviousIT;
280 }
281 
282 inline const G4IT* G4IT::GetNext() const
283 {
284  return fpNextIT;
285 }
286 
287 inline void G4IT::SetNode(G4KDNode_Base* aNode)
288 {
289  fpKDNode = aNode;
290 }
291 
293 {
294  return fpKDNode;
295 }
296 #endif
G4FastListNode is the entity actually stored by the G4FastList.
Definition: G4FastList.hh:124
const G4ITBox * GetITBox() const
Definition: G4IT.hh:205
virtual G4bool equal(const G4IT &right) const =0
void SetNext(G4IT *)
Definition: G4IT.hh:220
void TakeOutBox()
Definition: G4IT.cc:136
#define G4DLLEXPORT
Definition: G4Types.hh:62
G4TrackListNode * GetListNode()
Definition: G4IT.hh:157
G4double GetPreStepGlobalTime() const
CLHEP::Hep3Vector G4ThreeVector
void SetParentID(int, int)
Definition: G4IT.hh:250
G4KDNode_Base * fpKDNode
Definition: G4IT.hh:182
#define G4DLLIMPORT
Definition: G4Types.hh:63
G4KDNode_Base * GetNode() const
Definition: G4IT.hh:292
G4IT()
Definition: G4IT.cc:62
const G4ThreeVector & GetPreStepPosition() const
Definition: G4IT.hh:272
void SetNode(G4KDNode_Base *)
Definition: G4IT.hh:287
Tag the G4IT Should be automatically setup by G4IT using : ITDef(MyIT) and ITImp(MyIT) ...
Definition: G4ITType.hh:60
void SetITBox(G4ITBox *)
Definition: G4IT.hh:210
void RecordCurrentPositionNTime()
Definition: G4IT.cc:174
G4IT * GetPrevious()
Definition: G4IT.hh:225
G4bool operator<(const G4IT &right) const
Definition: G4IT.cc:182
The class G4TrackingInformation (hold by G4IT) emcompasses processes informations computed at the PS/...
virtual const G4String & GetName() const =0
G4IT * GetNext()
Definition: G4IT.hh:230
#define G4ThreadLocal
Definition: tls.hh:89
void SetTrack(G4Track *)
Definition: G4IT.hh:235
void SetListNode(G4TrackListNode *node)
Definition: G4IT.hh:161
G4ITBox * fpITBox
Definition: G4IT.hh:179
G4IT * GetIT(const G4Track *track)
Definition: G4IT.cc:49
G4DLLIMPORT G4ThreadLocal G4Allocator< G4IT > * aITAllocator
Definition: G4IT.cc:44
bool G4bool
Definition: G4Types.hh:79
G4Track * fpTrack
Definition: G4IT.hh:176
G4bool operator==(const G4IT &right) const
Definition: G4IT.cc:195
G4IT & operator=(const G4IT &)
Definition: G4IT.cc:95
G4double GetPreStepLocalTime() const
G4double GetPreStepLocalTime() const
Definition: G4IT.hh:267
const G4ThreeVector & GetPreStepPosition() const
void GetParentID(int &, int &)
Definition: G4IT.hh:256
G4TrackingInformation fTrackingInformation
Definition: G4IT.hh:187
virtual G4bool diff(const G4IT &right) const =0
void SetPrevious(G4IT *)
Definition: G4IT.hh:215
G4ITBox behaves just like a stack for G4IT.
Definition: G4ITBox.hh:61
G4TrackingInformation * GetTrackingInfo()
Definition: G4IT.hh:152
int fParentID_A
Definition: G4IT.hh:184
double operator[](int i) const
Definition: G4IT.cc:215
int fParentID_B
Definition: G4IT.hh:185
virtual G4ITType GetITSubType() const
Definition: G4IT.hh:168
virtual const G4ITType GetITType() const =0
G4Track * GetTrack()
Definition: G4IT.hh:240
double G4double
Definition: G4Types.hh:76
virtual ~G4IT()
Definition: G4IT.cc:156
G4double GetPreStepGlobalTime() const
Definition: G4IT.hh:262
G4FastListNode< G4Track > G4TrackListNode
Definition: G4IT.hh:80
virtual const G4ThreeVector & GetPosition() const
Definition: G4IT.cc:209
{ Class description:
G4IT * fpNextIT
Definition: G4IT.hh:181
virtual void Print() const
Definition: G4IT.hh:104
G4TrackListNode * fpTrackNode
Definition: G4IT.hh:188
G4IT * fpPreviousIT
Definition: G4IT.hh:180
G4bool operator!=(const G4IT &right) const
Definition: G4IT.cc:204