Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 102637 2017-02-10 11:08:17Z gcosmo $
27 //
28 // Author: Mathieu Karamitros
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 "G4KDNode.hh"
55 
57 // To implement your own IT class, you should use
58 // ITDef(MyClass) in the class define in your MyClass.hh
59 // and ITImp(MyClass) in your MyClass.cc
60 // For instance, see G4Molecule
62 
63 class G4IT;
64 template<>
66 
68 //template<typename PointT> class G4KDNode;
69 class G4KDNode_Base;
70 class G4ITBox;
71 class G4Track;
72 
73 G4IT* GetIT(const G4Track* track);
74 G4IT* GetIT(const G4Track& track);
75 
76 template<class OBJECT> class G4FastListNode;
78 
88 class G4IT : public virtual G4VUserTrackInformation
89 {
90 public:
91  G4IT();
92  G4IT(G4Track*);
93  virtual ~G4IT();
94 
95 // inline void *operator new(size_t);
96 // inline void operator delete(void *aIT);
97 
98  virtual void Print() const
99  {
100  ;
101  }
102  virtual const G4String& GetName() const = 0;
103 
105  // You should not worried of implementing diff, equal
106  // and GetType.
107  // When using ITDef(MyClass) this will be done.
108  // However, you need to implement in the concrete class
109  // even fake operators for < and ==
110  // They will be used by diff and equal.
112  virtual G4bool diff(const G4IT& right) const = 0;
113  virtual G4bool equal(const G4IT& right) const = 0;
114  G4bool operator<(const G4IT& right) const;
115  G4bool operator==(const G4IT& right) const;
116  G4bool operator!=(const G4IT& right) const;
117 
118  void SetTrack(G4Track*);
119  inline G4Track* GetTrack();
120  inline const G4Track* GetTrack() const;
121 
123  const G4ThreeVector& GetPosition() const;
124  double operator[](int i) const;
125  const G4ThreeVector& GetPreStepPosition() const;
128 
129  inline void SetPrevious(G4IT*);
130  inline void SetNext(G4IT*);
131  inline G4IT* GetPrevious();
132  inline G4IT* GetNext();
133  inline const G4IT* GetPrevious() const;
134  inline const G4IT* GetNext() const;
135  inline void SetITBox(G4ITBox*);
136  inline const G4ITBox* GetITBox() const;
137  void TakeOutBox();
138  inline void SetNode(G4KDNode_Base*);
139  inline G4KDNode_Base* GetNode() const;
140 
141  inline void SetParentID(int, int);
142  inline void GetParentID(int&, int&);
143 
145  {
146  return fpTrackingInformation;
147  }
148 
150  {
151  return fpTrackNode;
152  }
153  inline void SetListNode(G4TrackListNode* node)
154  {
155  fpTrackNode = node;
156  }
157 
158  virtual const G4ITType GetITType() const = 0;
159 
160  virtual G4ITType GetITSubType() const
161  {
162  return 0;
163  }
164 
165 protected:
166  G4IT(const G4IT&);
167  G4IT& operator=(const G4IT&);
169 
170 private:
171  G4ITBox * fpITBox;
172  G4IT* fpPreviousIT;
173  G4IT* fpNextIT;
174  G4KDNode_Base* fpKDNode;
175 
176  int fParentID_A;
177  int fParentID_B;
178 
179  G4TrackingInformation* fpTrackingInformation;
180  G4TrackListNode* fpTrackNode;
181 };
182 //------------------------------------------------------------------------------
183 
184 inline const G4ITBox* G4IT::GetITBox() const
185 {
186  return fpITBox;
187 }
188 
189 inline void G4IT::SetITBox(G4ITBox * aITBox)
190 {
191  fpITBox = aITBox;
192 }
193 
194 inline void G4IT::SetPrevious(G4IT* aIT)
195 {
196  fpPreviousIT = aIT;
197 }
198 
199 inline void G4IT::SetNext(G4IT* aIT)
200 {
201  fpNextIT = aIT;
202 }
203 
205 {
206  return fpPreviousIT;
207 }
208 
210 {
211  return fpNextIT;
212 }
213 
214 inline void G4IT::SetTrack(G4Track* track)
215 {
216  fpTrack = track;
217 }
218 
220 {
221  return fpTrack;
222 }
223 
224 inline const G4Track* G4IT::GetTrack() const
225 {
226  return fpTrack;
227 }
228 
229 inline void G4IT::SetParentID(int p_a, int p_b)
230 {
231  fParentID_A = p_a;
232  fParentID_B = p_b;
233 }
234 
235 inline void G4IT::GetParentID(int& p_a, int&p_b)
236 {
237  p_a = fParentID_A;
238  p_b = fParentID_B;
239 }
240 
241 inline const G4IT* G4IT::GetPrevious() const
242 {
243  return fpPreviousIT;
244 }
245 
246 inline const G4IT* G4IT::GetNext() const
247 {
248  return fpNextIT;
249 }
250 
251 inline void G4IT::SetNode(G4KDNode_Base* aNode)
252 {
253  fpKDNode = aNode;
254 }
255 
257 {
258  return fpKDNode;
259 }
260 #endif
Definition: G4IT.hh:88
const G4ITBox * GetITBox() const
Definition: G4IT.hh:184
virtual G4bool equal(const G4IT &right) const =0
void SetNext(G4IT *)
Definition: G4IT.hh:199
void TakeOutBox()
Definition: G4IT.cc:140
G4TrackListNode * GetListNode()
Definition: G4IT.hh:149
void SetParentID(int, int)
Definition: G4IT.hh:229
G4KDNode_Base * GetNode() const
Definition: G4IT.hh:256
G4IT()
Definition: G4IT.cc:68
const G4ThreeVector & GetPreStepPosition() const
Definition: G4IT.cc:239
void SetNode(G4KDNode_Base *)
Definition: G4IT.hh:251
void SetITBox(G4ITBox *)
Definition: G4IT.hh:189
void RecordCurrentPositionNTime()
Definition: G4IT.cc:221
G4IT * GetPrevious()
Definition: G4IT.hh:204
G4bool operator<(const G4IT &right) const
Definition: G4IT.cc:181
virtual const G4String & GetName() const =0
G4IT * GetNext()
Definition: G4IT.hh:209
void SetTrack(G4Track *)
Definition: G4IT.hh:214
void SetListNode(G4TrackListNode *node)
Definition: G4IT.hh:153
virtual ~G4KDNode()
G4IT * GetIT(const G4Track *track)
Definition: G4IT.cc:49
bool G4bool
Definition: G4Types.hh:79
G4Track * fpTrack
Definition: G4IT.hh:168
G4bool operator==(const G4IT &right) const
Definition: G4IT.cc:194
G4IT & operator=(const G4IT &)
Definition: G4IT.cc:98
G4double GetPreStepLocalTime() const
Definition: G4IT.cc:234
void GetParentID(int &, int &)
Definition: G4IT.hh:235
virtual G4bool diff(const G4IT &right) const =0
void SetPrevious(G4IT *)
Definition: G4IT.hh:194
G4TrackingInformation * GetTrackingInfo()
Definition: G4IT.hh:144
double operator[](int i) const
Definition: G4IT.cc:208
virtual G4ITType GetITSubType() const
Definition: G4IT.hh:160
virtual const G4ITType GetITType() const =0
G4Track * GetTrack()
Definition: G4IT.hh:219
double G4double
Definition: G4Types.hh:76
virtual ~G4IT()
Definition: G4IT.cc:161
G4double GetPreStepGlobalTime() const
Definition: G4IT.cc:229
G4FastListNode< G4Track > G4TrackListNode
Definition: G4IT.hh:76
const G4ThreeVector & GetPosition() const
Definition: G4IT.cc:215
virtual void Print() const
Definition: G4IT.hh:98
G4bool operator!=(const G4IT &right) const
Definition: G4IT.cc:203