Geant4-11
G4Step.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// G4Step class implementation
27//
28// Authors:
29// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
30// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
31// Revisions:
32// Hisaya Kurashige, 1998-2007
33// --------------------------------------------------------------------
34
35#include "G4Step.hh"
36
37// --------------------------------------------------------------------
39{
42
43 secondaryInCurrentStep = new std::vector<const G4Track*>;
44}
45
46// --------------------------------------------------------------------
48{
49 delete fpPreStepPoint;
50 fpPreStepPoint = nullptr;
51 delete fpPostStepPoint;
52 fpPostStepPoint = nullptr;
53
56 secondaryInCurrentStep = nullptr;
57
58 if(fSecondary != nullptr)
59 {
60 fSecondary->clear();
61 delete fSecondary;
62 }
63 fSecondary = nullptr;
64}
65
66// --------------------------------------------------------------------
68 : fTotalEnergyDeposit(right.fTotalEnergyDeposit)
69 , fNonIonizingEnergyDeposit(right.fNonIonizingEnergyDeposit)
70 , fStepLength(right.fStepLength)
71 , fpTrack(right.fpTrack)
72 , fpSteppingControlFlag(right.fpSteppingControlFlag)
73 , fFirstStepInVolume(right.fFirstStepInVolume)
74 , fLastStepInVolume(right.fLastStepInVolume)
75 , nSecondaryByLastStep(right.nSecondaryByLastStep)
76 , secondaryInCurrentStep(right.secondaryInCurrentStep)
77 , fpVectorOfAuxiliaryPointsPointer(right.fpVectorOfAuxiliaryPointsPointer)
78{
79 if(right.fpPreStepPoint != nullptr)
80 {
82 }
83 else
84 {
86 }
87 if(right.fpPostStepPoint != nullptr)
88 {
90 }
91 else
92 {
94 }
95
96 if(right.fSecondary != nullptr)
97 {
98 fSecondary = new G4TrackVector(*(right.fSecondary));
99 }
100 else
101 {
103 }
104
105 // secondaryInCurrentStep is cleared
106 secondaryInCurrentStep = new std::vector<const G4Track*>;
107}
108
109// --------------------------------------------------------------------
111{
112 if(this != &right)
113 {
116 fStepLength = right.fStepLength;
117 fpTrack = right.fpTrack;
124
125 if(fpPreStepPoint != nullptr)
126 {
127 delete fpPreStepPoint;
128 }
129 if(right.fpPreStepPoint != nullptr)
130 {
132 }
133 else
134 {
136 }
137 if(fpPostStepPoint != nullptr)
138 {
139 delete fpPostStepPoint;
140 }
141 if(right.fpPostStepPoint != nullptr)
142 {
144 }
145 else
146 {
148 }
149
150 if(fSecondary != nullptr)
151 {
152 fSecondary->clear();
153 delete fSecondary;
154 }
155 if(right.fSecondary != nullptr)
156 {
157 fSecondary = new G4TrackVector(*(right.fSecondary));
158 }
159 else
160 {
162 }
163
164 // secondaryInCurrentStep is not copied
165 if(secondaryInCurrentStep != nullptr)
166 {
167 secondaryInCurrentStep->clear();
169 }
170 secondaryInCurrentStep = new std::vector<const G4Track*>;
171 }
172 return *this;
173}
174
175// --------------------------------------------------------------------
177{
178 static G4ThreadLocal G4bool isFirstTime = true;
179 if(isFirstTime)
180 {
181 isFirstTime = false;
182#ifdef G4VERBOSE
183 G4Exception("G4Step::GetDeltaMomentum()", "Warning", JustWarning,
184 "This method is obsolete and will be removed soon");
185#endif
186 }
187
189}
190
191// --------------------------------------------------------------------
193{
194 static G4ThreadLocal G4bool isFirstTime = true;
195 if(isFirstTime)
196 {
197 isFirstTime = false;
198#ifdef G4VERBOSE
199 G4Exception("G4Step::GetDeltaEnergy()", "Warning", JustWarning,
200 "This method is obsolete and will be removed soon");
201#endif
202 }
203
206}
207
208// --------------------------------------------------------------------
209const std::vector<const G4Track*>* G4Step::GetSecondaryInCurrentStep() const
210{
211 secondaryInCurrentStep->clear();
212 G4int nSecondary = fSecondary->size();
213 for(G4int i = nSecondaryByLastStep; i < nSecondary; ++i)
214 {
215 secondaryInCurrentStep->push_back((*fSecondary)[i]);
216 }
218}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::vector< G4Track * > G4TrackVector
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4ThreeVector GetMomentum() const
G4double GetKineticEnergy() const
Definition: G4Step.hh:62
std::vector< const G4Track * > * secondaryInCurrentStep
Definition: G4Step.hh:203
G4StepPoint * fpPreStepPoint
Definition: G4Step.hh:182
std::vector< G4ThreeVector > * fpVectorOfAuxiliaryPointsPointer
Definition: G4Step.hh:205
~G4Step()
Definition: G4Step.cc:47
G4double GetDeltaEnergy() const
Definition: G4Step.cc:192
std::size_t nSecondaryByLastStep
Definition: G4Step.hh:200
G4Track * fpTrack
Definition: G4Step.hh:188
G4ThreeVector GetDeltaMomentum() const
Definition: G4Step.cc:176
G4Step()
Definition: G4Step.cc:38
G4Step & operator=(const G4Step &)
Definition: G4Step.cc:110
G4double fStepLength
Definition: G4Step.hh:184
G4TrackVector * fSecondary
Definition: G4Step.hh:197
const std::vector< const G4Track * > * GetSecondaryInCurrentStep() const
Definition: G4Step.cc:209
G4bool fLastStepInVolume
Definition: G4Step.hh:194
G4bool fFirstStepInVolume
Definition: G4Step.hh:193
G4double fNonIonizingEnergyDeposit
Definition: G4Step.hh:177
G4SteppingControl fpSteppingControlFlag
Definition: G4Step.hh:190
G4StepPoint * fpPostStepPoint
Definition: G4Step.hh:183
G4double fTotalEnergyDeposit
Definition: G4Step.hh:174
#define G4ThreadLocal
Definition: tls.hh:77