Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4IT.cc
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.cc 65022 2012-11-12 16:43:12Z 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 
41 using namespace std;
42 
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
46 // Static functions
48 G4IT* GetIT(const G4Track* track)
49 {
50  return (dynamic_cast<G4IT*>(track->GetUserInformation()));
51 }
52 
53 G4IT* GetIT(const G4Track& track)
54 {
55  return (dynamic_cast<G4IT*>(track.GetUserInformation()));
56 }
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
59 // Constructors / Destructors
62  fpTrack (0),
63  fpPreviousIT(0), fpNextIT(0),
64  fTrackingInformation()
65 // fpTrackingInformation(new G4TrackingInformation())
66 {
67  fpITBox=0;
68  fpKDNode = 0 ;
69  fpTrackNode = 0;
70  fParentID_A = 0;
71  fParentID_B = 0;
72 }
73 
74 // Use only by inheriting classes
75 G4IT::G4IT(const G4IT& /*right*/) : G4VUserTrackInformation("G4IT"),
76  fpTrack (0),
77  fpPreviousIT(0), fpNextIT(0),
78  fTrackingInformation()
79 // fpTrackingInformation(new G4TrackingInformation())
80 {
81  fpITBox=0;
82  fpKDNode = 0 ;
83  fpTrackNode = 0;
84  fParentID_A = 0;
85  fParentID_B = 0;
86 }
87 
88 // Should not be used
90 {
91  G4ExceptionDescription exceptionDescription;
92  exceptionDescription << "The assignment operator of G4IT should not be used, this feature is not supported."
93  << "If really needed, please contact the developers.";
94  G4Exception("G4IT::operator=(const G4IT& right)","G4IT001",FatalException,exceptionDescription);
95 
96  if(this == &right) return *this;
97 
98  fpTrack = 0;
99  fpITBox = 0;
100  fpPreviousIT = 0;
101  fpNextIT = 0;
102  fpKDNode = 0 ;
103  fParentID_A = 0;
104  fParentID_B = 0;
105 // fpTrackingInformation = 0;
106  fpTrackNode = 0;
107 
108  return *this;
109 }
110 
112  fpPreviousIT(0), fpNextIT(0),
113  fTrackingInformation()
114 // fpTrackingInformation(new G4TrackingInformation())
115 {
116  fpITBox = 0;
117  fpTrack = aTrack;
118  fpKDNode = 0 ;
119  fpTrackNode = 0;
120  fParentID_A = 0;
121  fParentID_B = 0;
123 }
124 
126 {
127  if(fpITBox)
128  {
129  fpITBox->Extract(this);
130  }
131 
132  if(fpKDNode)
133  {
134  InactiveNode(fpKDNode);
135  fpKDNode = 0;
136  }
137 }
138 
140 {
141  TakeOutBox();
142 
143 // if(fpTrackingInformation)
144 // {
145 // delete fpTrackingInformation;
146 // fpTrackingInformation = 0;
147 // }
148 
149  // Note :
150  // G4ITTrackingManager will delete fTrackNode.
151  // fKDNode will be deleted when the KDTree is rebuilt
152 }
153 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
155 // Methods
158 {
159  if(fpTrack)
160  {
161  fTrackingInformation.RecordCurrentPositionNTime(fpTrack);
162  }
163 }
164 
166 {
167  if(GetITType() == right.GetITType() )
168  {
169  return (this->diff(right)) ;
170  }
171  else
172  {
173  return (GetITType() < right.GetITType());
174  }
175  return false;
176 }
177 
179 {
180  if(GetITType() == right.GetITType() )
181  {
182  return this->equal(right);
183  }
184  return false;
185 }
186 
188 {
189  return !(this->operator==(right));
190 }