Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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
41using namespace std;
42
44//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
45///
46// Static functions
47///
48G4IT* GetIT(const G4Track* track)
49{
50 return (dynamic_cast<G4IT*>(track->GetUserInformation()));
51}
52
53G4IT* GetIT(const G4Track& track)
54{
55 return (dynamic_cast<G4IT*>(track.GetUserInformation()));
56}
57//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
58///
59// Constructors / Destructors
60///
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
75G4IT::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....
154///
155// Methods
156///
158{
159 if(fpTrack)
160 {
161 fTrackingInformation.RecordCurrentPositionNTime(fpTrack);
162 }
163}
164
165G4bool G4IT::operator<(const G4IT& right) const
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
178G4bool G4IT::operator==(const G4IT& right) const
179{
180 if(GetITType() == right.GetITType() )
181 {
182 return this->equal(right);
183 }
184 return false;
185}
186
187G4bool G4IT::operator!=(const G4IT& right) const
188{
189 return !(this->operator==(right));
190}
@ FatalException
G4IT * GetIT(const G4Track *track)
Definition: G4IT.cc:48
G4Allocator< G4IT > aITAllocator
Definition: G4IT.cc:43
void InactiveNode(G4KDNode *)
Definition: G4KDNode.cc:57
bool G4bool
Definition: G4Types.hh:67
void Extract(G4IT *)
Definition: G4ITBox.cc:87
Definition: G4IT.hh:83
G4bool operator!=(const G4IT &right) const
Definition: G4IT.cc:187
virtual G4bool equal(const G4IT &right) const =0
void TakeOutBox()
Definition: G4IT.cc:125
virtual const G4ITType GetITType() const =0
G4Track * fpTrack
Definition: G4IT.hh:144
G4IT & operator=(const G4IT &)
Definition: G4IT.cc:89
G4bool operator==(const G4IT &right) const
Definition: G4IT.cc:178
virtual ~G4IT()
Definition: G4IT.cc:139
G4IT()
Definition: G4IT.cc:61
G4bool operator<(const G4IT &right) const
Definition: G4IT.cc:165
void RecordCurrentPositionNTime()
Definition: G4IT.cc:157
virtual G4bool diff(const G4IT &right) const =0
G4VUserTrackInformation * GetUserInformation() const
void RecordCurrentPositionNTime(G4Track *)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76