Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4IT.cc
이 파일의 문서화 페이지로 가기
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.cc 103042 2017-03-10 11:50:07Z gcosmo $
27 //
28 // Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
29 //
30 // History:
31 // -----------
32 // 10 Oct 2011 M.Karamitros created
33 //
34 // -------------------------------------------------------------------
35 
36 #include "G4IT.hh"
37 #include "G4KDTree.hh"
38 #include "G4ITBox.hh"
39 #include "G4Track.hh"
40 #include "G4TrackList.hh"
41 #include "G4TrackingInformation.hh"
42 
43 using namespace std;
44 
45 //------------------------------------------------------------------------------
46 //
47 // Static functions
48 //
50 {
51  return (dynamic_cast<G4IT*>(track->GetUserInformation()));
52 }
53 
55 {
56  return (dynamic_cast<G4IT*>(track.GetUserInformation()));
57 }
58 
59 template<>
61  fPoint->SetNode(nullptr);
62 }
63 
64 //------------------------------------------------------------------------------
65 //
66 // Constructors / Destructors
67 //
70  fpTrack(nullptr),
71  fpPreviousIT(nullptr),
72  fpNextIT(nullptr),
73  fpTrackingInformation(new G4TrackingInformation())
74 {
75  fpITBox = nullptr;
76  fpKDNode = nullptr;
77  fpTrackNode = nullptr;
78  fParentID_A = 0;
79  fParentID_B = 0;
80 }
81 
82 // Use only by inheriting classes
83 G4IT::G4IT(const G4IT& /*right*/) :
85  fpTrack(nullptr),
86  fpPreviousIT(nullptr),
87  fpNextIT(nullptr),
88  fpTrackingInformation(new G4TrackingInformation())
89 {
90  fpITBox = nullptr;
91  fpKDNode = nullptr;
92  fpTrackNode = nullptr;
93  fParentID_A = 0;
94  fParentID_B = 0;
95 }
96 
97 // Should not be used
99 {
100  G4ExceptionDescription exceptionDescription;
101  exceptionDescription
102  << "The assignment operator of G4IT should not be used, "
103  "this feature is not supported."
104  << "If really needed, please contact the developers.";
105  G4Exception("G4IT::operator=(const G4IT& right)",
106  "G4IT001",
108  exceptionDescription);
109 
110  if (this == &right) return *this;
111 
112  fpTrack = nullptr;
113  fpITBox = nullptr;
114  fpPreviousIT = nullptr;
115  fpNextIT = nullptr;
116  fpKDNode = nullptr;
117  fParentID_A = 0;
118  fParentID_B = 0;
119  fpTrackingInformation = nullptr;
120  fpTrackNode = nullptr;
121 
122  return *this;
123 }
124 
125 G4IT::G4IT(G4Track * aTrack) :
126  G4VUserTrackInformation("G4IT"),
127  fpPreviousIT(0),
128  fpNextIT(0),
129  fpTrackingInformation(new G4TrackingInformation())
130 {
131  fpITBox = 0;
132  fpTrack = aTrack;
133  fpKDNode = nullptr;
134  fpTrackNode = nullptr;
135  fParentID_A = 0;
136  fParentID_B = 0;
138 }
139 
141 {
142  if(fpITBox)
143  {
144  fpITBox->Extract(this);
145  fpITBox = nullptr;
146  }
147 
148  if(fpTrackNode)
149  {
150  delete fpTrackNode;
151  fpTrackNode = nullptr;
152  }
153 
154  if(fpKDNode)
155  {
157  fpKDNode = nullptr;
158  }
159 }
160 
162 {
163  TakeOutBox();
164 
166  {
167  delete fpTrackingInformation;
168  fpTrackingInformation = nullptr;
169  }
170 
171 // Note :
172 // G4ITTrackingManager will delete fTrackNode.
173 // fKDNode will be deleted when the KDTree is rebuilt
174 }
175 
176 //------------------------------------------------------------------------------
178 // Methods
180 
182 {
183  if (GetITType() == right.GetITType())
184  {
185  return (this->diff(right));
186  }
187  else
188  {
189  return (GetITType() < right.GetITType());
190  }
191  return false;
192 }
193 
195 {
196  if (GetITType() == right.GetITType())
197  {
198  return this->equal(right);
199  }
200  return false;
201 }
202 
204 {
205  return !(this->operator==(right));
206 }
207 
208 double G4IT::operator[](int i) const
209 {
210  return fpTrack->GetPosition()[i];
211 }
212 
213 //------------------------------------------------------------------------------
214 
216 {
217  if (fpTrack) return GetTrack()->GetPosition();
218  return *(new G4ThreeVector());
219 }
220 
222 {
223  if (fpTrack)
224  {
226  }
227 }
228 
230 {
232 }
233 
235 {
237 }
238 
240 {
242 }
243 
void TakeOutBox()
Definition: G4IT.cc:140
double operator[](int i) const
Definition: G4IT.cc:208
int fParentID_A
Definition: G4IT.hh:176
G4bool operator==(const G4IT &right) const
Definition: G4IT.cc:194
CLHEP::Hep3Vector G4ThreeVector
G4IT * fpPreviousIT
Definition: G4IT.hh:172
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:45
G4bool operator<(const G4IT &right) const
Definition: G4IT.cc:181
G4bool operator!=(const G4IT &right) const
Definition: G4IT.cc:203
G4Track * fpTrack
Definition: G4IT.hh:168
void RecordCurrentPositionNTime(G4Track *)
void Extract(G4IT *)
Definition: G4ITBox.cc:87
G4double GetPreStepGlobalTime() const
virtual ~G4KDNode()
G4TrackingInformation * fpTrackingInformation
Definition: G4IT.hh:179
G4double GetPreStepLocalTime() const
virtual G4bool equal(const G4IT &right) const =0
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
const G4ThreeVector & GetPreStepPosition() const
void RecordCurrentPositionNTime()
Definition: G4IT.cc:221
const G4ThreeVector & GetPosition() const
Definition: G4IT.cc:215
const G4ThreeVector & GetPreStepPosition() const
Definition: G4IT.cc:239
G4IT()
Definition: G4IT.cc:68
const G4ThreeVector & GetPosition() const
virtual ~G4IT()
Definition: G4IT.cc:161
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.hh:65
virtual const G4ITType GetITType() const =0
G4Track * GetTrack()
Definition: G4IT.hh:219
G4KDNode_Base * fpKDNode
Definition: G4IT.hh:174
G4ITBox * fpITBox
Definition: G4IT.hh:171
G4VUserTrackInformation * GetUserInformation() const
int fParentID_B
Definition: G4IT.hh:177
Definition: G4IT.hh:88
void InactiveNode(G4KDNode_Base *)
Definition: G4KDNode.cc:58
G4IT * fpNextIT
Definition: G4IT.hh:173
G4TrackListNode * fpTrackNode
Definition: G4IT.hh:180
G4double GetPreStepGlobalTime() const
Definition: G4IT.cc:229
G4double GetPreStepLocalTime() const
Definition: G4IT.cc:234
virtual G4bool diff(const G4IT &right) const =0
G4IT & operator=(const G4IT &)
Definition: G4IT.cc:98
G4IT * GetIT(const G4Track *track)
Definition: G4IT.cc:49