00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include "G4IT.hh"
00037 #include "G4KDTree.hh"
00038 #include "G4ITBox.hh"
00039 #include "G4Track.hh"
00040
00041 using namespace std;
00042
00043 G4Allocator<G4IT> aITAllocator;
00044
00046
00048 G4IT* GetIT(const G4Track* track)
00049 {
00050 return (dynamic_cast<G4IT*>(track->GetUserInformation()));
00051 }
00052
00053 G4IT* GetIT(const G4Track& track)
00054 {
00055 return (dynamic_cast<G4IT*>(track.GetUserInformation()));
00056 }
00057
00059
00061 G4IT::G4IT() : G4VUserTrackInformation("G4IT"),
00062 fpTrack (0),
00063 fpPreviousIT(0), fpNextIT(0),
00064 fTrackingInformation()
00065
00066 {
00067 fpITBox=0;
00068 fpKDNode = 0 ;
00069 fpTrackNode = 0;
00070 fParentID_A = 0;
00071 fParentID_B = 0;
00072 }
00073
00074
00075 G4IT::G4IT(const G4IT& ) : G4VUserTrackInformation("G4IT"),
00076 fpTrack (0),
00077 fpPreviousIT(0), fpNextIT(0),
00078 fTrackingInformation()
00079
00080 {
00081 fpITBox=0;
00082 fpKDNode = 0 ;
00083 fpTrackNode = 0;
00084 fParentID_A = 0;
00085 fParentID_B = 0;
00086 }
00087
00088
00089 G4IT& G4IT::operator=(const G4IT& right)
00090 {
00091 G4ExceptionDescription exceptionDescription;
00092 exceptionDescription << "The assignment operator of G4IT should not be used, this feature is not supported."
00093 << "If really needed, please contact the developers.";
00094 G4Exception("G4IT::operator=(const G4IT& right)","G4IT001",FatalException,exceptionDescription);
00095
00096 if(this == &right) return *this;
00097
00098 fpTrack = 0;
00099 fpITBox = 0;
00100 fpPreviousIT = 0;
00101 fpNextIT = 0;
00102 fpKDNode = 0 ;
00103 fParentID_A = 0;
00104 fParentID_B = 0;
00105
00106 fpTrackNode = 0;
00107
00108 return *this;
00109 }
00110
00111 G4IT::G4IT(G4Track * aTrack) : G4VUserTrackInformation("G4IT"),
00112 fpPreviousIT(0), fpNextIT(0),
00113 fTrackingInformation()
00114
00115 {
00116 fpITBox = 0;
00117 fpTrack = aTrack;
00118 fpKDNode = 0 ;
00119 fpTrackNode = 0;
00120 fParentID_A = 0;
00121 fParentID_B = 0;
00122 RecordCurrentPositionNTime();
00123 }
00124
00125 void G4IT::TakeOutBox()
00126 {
00127 if(fpITBox)
00128 {
00129 fpITBox->Extract(this);
00130 }
00131
00132 if(fpKDNode)
00133 {
00134 InactiveNode(fpKDNode);
00135 fpKDNode = 0;
00136 }
00137 }
00138
00139 G4IT::~G4IT()
00140 {
00141 TakeOutBox();
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152 }
00153
00155
00157 void G4IT::RecordCurrentPositionNTime()
00158 {
00159 if(fpTrack)
00160 {
00161 fTrackingInformation.RecordCurrentPositionNTime(fpTrack);
00162 }
00163 }
00164
00165 G4bool G4IT::operator<(const G4IT& right) const
00166 {
00167 if(GetITType() == right.GetITType() )
00168 {
00169 return (this->diff(right)) ;
00170 }
00171 else
00172 {
00173 return (GetITType() < right.GetITType());
00174 }
00175 return false;
00176 }
00177
00178 G4bool G4IT::operator==(const G4IT& right) const
00179 {
00180 if(GetITType() == right.GetITType() )
00181 {
00182 return this->equal(right);
00183 }
00184 return false;
00185 }
00186
00187 G4bool G4IT::operator!=(const G4IT& right) const
00188 {
00189 return !(this->operator==(right));
00190 }