Geant4  10.00.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 71125 2013-06-11 15:39:09Z 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"
46 #include "G4TrackingInformation.hh"
47 
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
54 
55 class G4IT;
56 class G4KDNode;
57 class G4ITBox;
58 class G4Track;
59 
60 G4IT* GetIT(const G4Track* track) ;
61 G4IT* GetIT(const G4Track& track) ;
62 
63 #if defined G4EM_ALLOC_EXPORT
65 #else
67 #endif
68 
69 class G4TrackListNode;
70 
82 class G4IT : public virtual G4VUserTrackInformation
83 {
84 public :
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 
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.
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 
135 
137  inline void SetTrackListNode(G4TrackListNode* node){fpTrackNode = node;}
138 
139  virtual const G4ITType GetITType() const = 0 ;
140 
141 protected :
142  G4IT(const G4IT&);
143  G4IT& operator=(const G4IT&);
145 
146 private :
151 
154 
157 };
158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
160 // Inline methods
162 inline void* G4IT::operator new(size_t)
163 {
165  return (void *) aITAllocator->MallocSingle();
166 }
167 
168 inline void G4IT::operator delete(void *aIT)
169 {
170  aITAllocator->FreeSingle((G4IT *) aIT);
171 }
172 
173 inline const G4ITBox* G4IT::GetITBox() const
174 {
175  return fpITBox ;
176 }
177 
178 inline void G4IT::SetITBox(G4ITBox * aITBox)
179 {
180  fpITBox = aITBox;
181 }
182 
183 inline void G4IT::SetPrevious(G4IT* aIT)
184 {
185  fpPreviousIT = aIT;
186 }
187 
188 inline void G4IT::SetNext(G4IT* aIT)
189 {
190  fpNextIT = aIT;
191 }
192 
194 {
195  return fpPreviousIT;
196 }
197 
199 {
200  return fpNextIT;
201 }
202 
203 inline void G4IT::SetTrack(G4Track* track)
204 {
205  fpTrack = track;
206 }
207 
209 {
210  return fpTrack;
211 }
212 
213 inline const G4Track* G4IT::GetTrack() const
214 {
215  return fpTrack;
216 }
217 
218 inline void G4IT::SetParentID(int p_a, int p_b)
219 {
220  fParentID_A = p_a;
221  fParentID_B = p_b;
222 }
223 
224 inline void G4IT::GetParentID(int& p_a,int&p_b)
225 {
226  p_a = fParentID_A;
227  p_b = fParentID_B ;
228 }
229 
231 {
233 }
234 
236 {
238 }
239 
241 {
243 }
244 
245 inline const G4IT* G4IT::GetPrevious() const
246 {
247  return fpPreviousIT ;
248 }
249 
250 inline const G4IT* G4IT::GetNext() const
251 {
252  return fpNextIT ;
253 }
254 
255 inline void G4IT::SetNode(G4KDNode* aNode)
256 {
257  fpKDNode = aNode ;
258 }
259 
260 inline G4KDNode* G4IT::GetNode() const
261 {
262  return fpKDNode ;
263 }
264 #endif
G4IT is a interface which allows the inheriting object :
Definition: G4IT.hh:82
const G4ITBox * GetITBox() const
Definition: G4IT.hh:173
virtual G4bool equal(const G4IT &right) const =0
void SetNode(G4KDNode *)
Definition: G4IT.hh:255
G4TrackListNode is the entity actually stored by the G4TrackList.
Definition: G4TrackList.hh:72
void SetNext(G4IT *)
Definition: G4IT.hh:188
void TakeOutBox()
Definition: G4IT.cc:127
#define G4DLLEXPORT
Definition: G4Types.hh:62
G4KDNode * GetNode() const
Definition: G4IT.hh:260
G4double GetPreStepGlobalTime() const
CLHEP::Hep3Vector G4ThreeVector
void SetParentID(int, int)
Definition: G4IT.hh:218
#define G4DLLIMPORT
Definition: G4Types.hh:63
G4IT()
Definition: G4IT.cc:61
const G4ThreeVector & GetPreStepPosition() const
Definition: G4IT.hh:240
Tag the G4IT Should be automatically setup by G4IT using : ITDef(MyIT) and ITImp(MyIT) ...
Definition: G4ITType.hh:51
void SetITBox(G4ITBox *)
Definition: G4IT.hh:178
void RecordCurrentPositionNTime()
Definition: G4IT.cc:159
G4IT * GetPrevious()
Definition: G4IT.hh:193
G4bool operator<(const G4IT &right) const
Definition: G4IT.cc:167
The class G4TrackingInformation (hold by G4IT) emcompasses processes informations computed at the PS/...
virtual const G4String & GetName() const =0
G4IT * GetNext()
Definition: G4IT.hh:198
#define G4ThreadLocal
Definition: tls.hh:52
void SetTrack(G4Track *)
Definition: G4IT.hh:203
G4ITBox * fpITBox
Definition: G4IT.hh:147
G4IT * GetIT(const G4Track *track)
Definition: G4IT.cc:48
G4DLLIMPORT G4ThreadLocal G4Allocator< G4IT > * aITAllocator
Definition: G4IT.cc:43
bool G4bool
Definition: G4Types.hh:79
G4TrackListNode * GetTrackListNode()
Definition: G4IT.hh:136
G4Track * fpTrack
Definition: G4IT.hh:144
G4bool operator==(const G4IT &right) const
Definition: G4IT.cc:180
G4IT & operator=(const G4IT &)
Definition: G4IT.cc:90
G4double GetPreStepLocalTime() const
G4double GetPreStepLocalTime() const
Definition: G4IT.hh:235
G4KDNode stores one entity in G4KDTree This class is for internal use only.
Definition: G4KDNode.hh:50
const G4ThreeVector & GetPreStepPosition() const
void SetTrackListNode(G4TrackListNode *node)
Definition: G4IT.hh:137
void GetParentID(int &, int &)
Definition: G4IT.hh:224
G4TrackingInformation fTrackingInformation
Definition: G4IT.hh:155
virtual G4bool diff(const G4IT &right) const =0
void SetPrevious(G4IT *)
Definition: G4IT.hh:183
A G4ITBox contains all IT of the same kind.
Definition: G4ITBox.hh:50
G4TrackingInformation * GetTrackingInfo()
Definition: G4IT.hh:134
int fParentID_A
Definition: G4IT.hh:152
int fParentID_B
Definition: G4IT.hh:153
virtual const G4ITType GetITType() const =0
G4KDNode * fpKDNode
Definition: G4IT.hh:150
G4Track * GetTrack()
Definition: G4IT.hh:208
double G4double
Definition: G4Types.hh:76
virtual ~G4IT()
Definition: G4IT.cc:141
G4double GetPreStepGlobalTime() const
Definition: G4IT.hh:230
G4IT * fpNextIT
Definition: G4IT.hh:149
virtual void Print() const
Definition: G4IT.hh:92
G4TrackListNode * fpTrackNode
Definition: G4IT.hh:156
G4IT * fpPreviousIT
Definition: G4IT.hh:148
G4bool operator!=(const G4IT &right) const
Definition: G4IT.cc:189