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