Geant4  10.02
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 //
27 // $Id: G4Step.cc 68795 2013-04-05 13:24:46Z gcosmo $
28 //
29 //
30 //---------------------------------------------------------------
31 //
32 // G4Step.cc
33 //
34 // Description:
35 // This class represents the Step of a particle tracked.
36 // It includes information of
37 // 1) List of Step points which compose the Step,
38 // 2) static information of particle which generated the
39 // Step,
40 // 3) trackID and parent particle ID of the Step,
41 // 4) termination condition of the Step,
42 //
43 // Contact:
44 // Questions and comments to this code should be sent to
45 // Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
46 // Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
47 //
48 // ---------------------------------------------------------------
49 
50 #include "G4Step.hh"
51 
55  : fTotalEnergyDeposit(0.0),fNonIonizingEnergyDeposit(0.0),
56  fStepLength(0.), fpTrack(0),
57  fpSteppingControlFlag(NormalCondition),
58  fFirstStepInVolume(false),
59  fLastStepInVolume(false),
60  fSecondary(0),
61  nSecondaryByLastStep(0), secondaryInCurrentStep(),
62  fpVectorOfAuxiliaryPointsPointer(0)
63 {
66 
67  secondaryInCurrentStep = new std::vector<CT>;
68 }
69 
73 {
74  delete fpPreStepPoint;
75  delete fpPostStepPoint;
76 
77  secondaryInCurrentStep->clear();
79 
80  if (fSecondary !=0 ) {
81  fSecondary->clear();
82  delete fSecondary;
83  }
84 }
85 
86 // Copy Counstructor and assignment operator
87 
91  : fTotalEnergyDeposit(right.fTotalEnergyDeposit),
92  fNonIonizingEnergyDeposit(right.fNonIonizingEnergyDeposit),
93  fStepLength(right.fStepLength),
94  fpTrack(right.fpTrack),
95  fpSteppingControlFlag(right.fpSteppingControlFlag),
96  fFirstStepInVolume(right.fFirstStepInVolume),
97  fLastStepInVolume(right.fLastStepInVolume),
98  nSecondaryByLastStep(right.nSecondaryByLastStep),
99  secondaryInCurrentStep(right.secondaryInCurrentStep),
100  fpVectorOfAuxiliaryPointsPointer(right.fpVectorOfAuxiliaryPointsPointer)
101 {
102  if (right.fpPreStepPoint !=0) {
103  fpPreStepPoint = new G4StepPoint(*(right.fpPreStepPoint));
104  } else {
105  fpPreStepPoint = new G4StepPoint();
106  }
107  if (right.fpPostStepPoint !=0) {
109  } else {
111  }
112 
113  if (right.fSecondary !=0) {
114  fSecondary = new G4TrackVector(*(right.fSecondary));
115  } else {
116  fSecondary = new G4TrackVector();
117  }
118  secondaryInCurrentStep = new std::vector<CT>;
119 }
120 
123 {
125  if (this != &right){
128  fStepLength = right.fStepLength;
129  fpTrack = right.fpTrack;
136 
137  if (fpPreStepPoint !=0 ) delete fpPreStepPoint;
138  if (right.fpPreStepPoint !=0) {
139  fpPreStepPoint = new G4StepPoint(*(right.fpPreStepPoint));
140  } else {
141  fpPreStepPoint = new G4StepPoint();
142  }
143  if (fpPostStepPoint !=0 ) delete fpPostStepPoint;
144  if (right.fpPostStepPoint !=0) {
146  } else {
148  }
149  if (right.fSecondary !=0) {
150  fSecondary = new G4TrackVector(*(right.fSecondary));
151  } else {
152  fSecondary = new G4TrackVector();
153  }
154  }
155  return *this;
156 }
157 
161 {
162  static G4ThreadLocal G4bool isFirstTime = true;
163  if (isFirstTime) {
164  isFirstTime = false;
165 #ifdef G4VERBOSE
166  G4Exception( "G4Step::GetDeltaMomentum()","Warning", JustWarning,
167  "This method is obsolete and will be removed soon");
168 #endif
169  }
170 
171  return fpPostStepPoint->GetMomentum()
173 }
174 
178 {
179  static G4ThreadLocal G4bool isFirstTime = true;
180  if (isFirstTime) {
181  isFirstTime = false;
182 #ifdef G4VERBOSE
183  G4Exception( "G4Step::GetDeltaEnergy()","Warning", JustWarning,
184  "This method is obsolete and will be removed soon");
185 #endif
186  }
187 
190 }
191 
193 const std::vector<const G4Track*>* G4Step::GetSecondaryInCurrentStep() const
195 {
196  secondaryInCurrentStep->clear();
197  G4int nSecondary = fSecondary->size();
198  for (G4int i=nSecondaryByLastStep; i<nSecondary; i++) {
199  secondaryInCurrentStep->push_back((*fSecondary)[i]);
200  }
201  return secondaryInCurrentStep;
202 }
203 
G4double GetDeltaEnergy() const
Definition: G4Step.cc:176
G4double fTotalEnergyDeposit
Definition: G4Step.hh:176
CLHEP::Hep3Vector G4ThreeVector
G4StepPoint * fpPostStepPoint
Definition: G4Step.hh:188
G4double fNonIonizingEnergyDeposit
Definition: G4Step.hh:179
G4ThreeVector GetMomentum() const
std::vector< CT > * secondaryInCurrentStep
Definition: G4Step.hh:232
#define G4ThreadLocal
Definition: tls.hh:89
int G4int
Definition: G4Types.hh:78
G4StepPoint * fpPreStepPoint
Definition: G4Step.hh:187
bool G4bool
Definition: G4Types.hh:79
G4Step()
Definition: G4Step.cc:53
G4TrackVector * fSecondary
Definition: G4Step.hh:226
G4Track * fpTrack
Definition: G4Step.hh:192
G4bool fLastStepInVolume
Definition: G4Step.hh:199
G4int nSecondaryByLastStep
Definition: G4Step.hh:229
G4ThreeVector GetDeltaMomentum() const
Definition: G4Step.cc:159
Definition: G4Step.hh:76
const std::vector< const G4Track * > * GetSecondaryInCurrentStep() const
Definition: G4Step.cc:193
G4Step & operator=(const G4Step &)
Definition: G4Step.cc:122
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4double fStepLength
Definition: G4Step.hh:189
std::vector< G4Track * > G4TrackVector
G4bool fFirstStepInVolume
Definition: G4Step.hh:198
std::vector< G4ThreeVector > * fpVectorOfAuxiliaryPointsPointer
Definition: G4Step.hh:248
~G4Step()
Definition: G4Step.cc:71
G4double GetKineticEnergy() const
double G4double
Definition: G4Types.hh:76
G4SteppingControl fpSteppingControlFlag
Definition: G4Step.hh:194