| [826] | 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 | //
|
|---|
| [850] | 27 | // $Id: G4Step.icc,v 1.19 2008/02/05 01:46:57 kurasige Exp $
|
|---|
| [1058] | 28 | // GEANT4 tag $Name: geant4-09-02-ref-02 $
|
|---|
| [826] | 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | //---------------------------------------------------------------
|
|---|
| 32 | //
|
|---|
| 33 | //-----------------------------------------------------------------
|
|---|
| 34 | // In-line definitions
|
|---|
| 35 | //-----------------------------------------------------------------
|
|---|
| 36 |
|
|---|
| 37 | // Get/Set functions
|
|---|
| 38 | inline
|
|---|
| 39 | G4StepPoint* G4Step::GetPreStepPoint() const
|
|---|
| 40 | {
|
|---|
| 41 | return fpPreStepPoint;
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 | inline
|
|---|
| 45 | void G4Step::SetPreStepPoint(G4StepPoint* value)
|
|---|
| 46 | {
|
|---|
| 47 | fpPreStepPoint = value;
|
|---|
| 48 | }
|
|---|
| 49 |
|
|---|
| 50 | inline
|
|---|
| 51 | G4StepPoint* G4Step::GetPostStepPoint() const
|
|---|
| 52 | {
|
|---|
| 53 | return fpPostStepPoint;
|
|---|
| 54 | }
|
|---|
| 55 |
|
|---|
| 56 | inline
|
|---|
| 57 | void G4Step::SetPostStepPoint(G4StepPoint* value)
|
|---|
| 58 | {
|
|---|
| 59 | fpPostStepPoint = value;
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| 62 | inline
|
|---|
| 63 | G4double G4Step::GetStepLength() const
|
|---|
| 64 | {
|
|---|
| 65 | return fStepLength;
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | inline
|
|---|
| 69 | void G4Step::SetStepLength(G4double value)
|
|---|
| 70 | {
|
|---|
| 71 | fStepLength = value;
|
|---|
| 72 | }
|
|---|
| 73 |
|
|---|
| 74 | inline
|
|---|
| 75 | G4ThreeVector G4Step::GetDeltaPosition() const
|
|---|
| 76 | {
|
|---|
| 77 | return fpPostStepPoint->GetPosition()
|
|---|
| 78 | - fpPreStepPoint->GetPosition();
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|
| 81 | inline
|
|---|
| 82 | G4double G4Step::GetDeltaTime() const
|
|---|
| 83 | {
|
|---|
| 84 | return fpPostStepPoint->GetLocalTime()
|
|---|
| 85 | - fpPreStepPoint->GetLocalTime();
|
|---|
| 86 | }
|
|---|
| 87 |
|
|---|
| 88 | inline
|
|---|
| 89 | G4ThreeVector G4Step::GetDeltaMomentum() const
|
|---|
| 90 | {
|
|---|
| 91 | return fpPostStepPoint->GetMomentum()
|
|---|
| 92 | - fpPreStepPoint->GetMomentum();
|
|---|
| 93 | }
|
|---|
| 94 |
|
|---|
| 95 | inline
|
|---|
| 96 | G4double G4Step::GetDeltaEnergy() const
|
|---|
| 97 | {
|
|---|
| 98 | return fpPostStepPoint->GetKineticEnergy()
|
|---|
| 99 | - fpPreStepPoint->GetKineticEnergy();
|
|---|
| 100 | }
|
|---|
| 101 |
|
|---|
| 102 | inline
|
|---|
| 103 | G4double G4Step::GetTotalEnergyDeposit() const
|
|---|
| 104 | {
|
|---|
| 105 | return fTotalEnergyDeposit;
|
|---|
| 106 | }
|
|---|
| 107 |
|
|---|
| 108 | inline
|
|---|
| 109 | void G4Step::SetTotalEnergyDeposit(G4double value)
|
|---|
| 110 | {
|
|---|
| 111 | fTotalEnergyDeposit = value;
|
|---|
| 112 | }
|
|---|
| 113 |
|
|---|
| 114 | inline
|
|---|
| 115 | G4double G4Step::GetNonIonizingEnergyDeposit() const
|
|---|
| 116 | {
|
|---|
| 117 | return fNonIonizingEnergyDeposit;
|
|---|
| 118 | }
|
|---|
| 119 |
|
|---|
| 120 | inline
|
|---|
| 121 | void G4Step::SetNonIonizingEnergyDeposit(G4double value)
|
|---|
| 122 | {
|
|---|
| 123 | fNonIonizingEnergyDeposit = value;
|
|---|
| 124 | }
|
|---|
| 125 |
|
|---|
| 126 | inline
|
|---|
| 127 | void G4Step::AddTotalEnergyDeposit(G4double value)
|
|---|
| 128 | {
|
|---|
| 129 | fTotalEnergyDeposit += value;
|
|---|
| 130 | }
|
|---|
| 131 |
|
|---|
| 132 | inline
|
|---|
| 133 | void G4Step::ResetTotalEnergyDeposit()
|
|---|
| 134 | {
|
|---|
| 135 | fTotalEnergyDeposit = 0.;
|
|---|
| [850] | 136 | fNonIonizingEnergyDeposit = 0.;
|
|---|
| [826] | 137 | }
|
|---|
| 138 |
|
|---|
| 139 | inline
|
|---|
| 140 | void G4Step::AddNonIonizingEnergyDeposit(G4double value)
|
|---|
| 141 | {
|
|---|
| 142 | fNonIonizingEnergyDeposit += value;
|
|---|
| 143 | }
|
|---|
| 144 |
|
|---|
| 145 | inline
|
|---|
| 146 | void G4Step::ResetNonIonizingEnergyDeposit()
|
|---|
| 147 | {
|
|---|
| 148 | fNonIonizingEnergyDeposit = 0.;
|
|---|
| 149 | }
|
|---|
| 150 |
|
|---|
| 151 | inline
|
|---|
| 152 | void G4Step::SetControlFlag(G4SteppingControl value)
|
|---|
| 153 | {
|
|---|
| 154 | fpSteppingControlFlag = value;
|
|---|
| 155 | }
|
|---|
| 156 |
|
|---|
| 157 | inline
|
|---|
| 158 | G4SteppingControl G4Step::GetControlFlag() const
|
|---|
| 159 | {
|
|---|
| 160 | return fpSteppingControlFlag;
|
|---|
| 161 | }
|
|---|
| 162 |
|
|---|
| 163 | inline
|
|---|
| 164 | void G4Step::CopyPostToPreStepPoint( )
|
|---|
| 165 | {
|
|---|
| 166 | *(fpPreStepPoint) = *(fpPostStepPoint);
|
|---|
| 167 | fpPostStepPoint->SetStepStatus(fUndefined);
|
|---|
| 168 | }
|
|---|
| 169 |
|
|---|
| 170 |
|
|---|
| 171 | //-------------------------------------------------------------
|
|---|
| 172 | // To implement bi-directional association between G4Step and
|
|---|
| 173 | // and G4Track, a combined usage of 'forward declaration' and
|
|---|
| 174 | // 'include' is necessary.
|
|---|
| 175 | //-------------------------------------------------------------
|
|---|
| 176 | #include "G4Track.hh"
|
|---|
| 177 |
|
|---|
| 178 | inline
|
|---|
| 179 | G4Track* G4Step::GetTrack() const
|
|---|
| 180 | {
|
|---|
| 181 | return fpTrack;
|
|---|
| 182 | }
|
|---|
| 183 |
|
|---|
| 184 | inline
|
|---|
| 185 | void G4Step::SetTrack(G4Track* value)
|
|---|
| 186 | {
|
|---|
| 187 | fpTrack = value;
|
|---|
| 188 | }
|
|---|
| 189 |
|
|---|
| 190 |
|
|---|
| 191 | // Other member functions
|
|---|
| 192 | inline
|
|---|
| 193 | void G4Step::InitializeStep( G4Track* aValue )
|
|---|
| 194 | {
|
|---|
| 195 | // Initialize G4Step attributes
|
|---|
| 196 | fStepLength = 0.;
|
|---|
| 197 | fTotalEnergyDeposit = 0.;
|
|---|
| 198 | fNonIonizingEnergyDeposit = 0.;
|
|---|
| 199 | fpTrack = aValue;
|
|---|
| 200 | fpTrack->SetStepLength(0.);
|
|---|
| 201 |
|
|---|
| 202 | // Initialize G4StepPoint attributes.
|
|---|
| 203 | // To avoid the circular dependency between G4Track, G4Step
|
|---|
| 204 | // and G4StepPoint, G4Step has to manage the copy actions.
|
|---|
| 205 | fpPreStepPoint->SetPosition(fpTrack->GetPosition());
|
|---|
| 206 | fpPreStepPoint->SetGlobalTime(fpTrack->GetGlobalTime());
|
|---|
| 207 | fpPreStepPoint->SetLocalTime(fpTrack->GetLocalTime());
|
|---|
| 208 | fpPreStepPoint->SetProperTime(fpTrack->GetProperTime());
|
|---|
| 209 | fpPreStepPoint->SetMomentumDirection(fpTrack->GetMomentumDirection());
|
|---|
| 210 | fpPreStepPoint->SetKineticEnergy(fpTrack->GetKineticEnergy());
|
|---|
| 211 | fpPreStepPoint->SetVelocity(fpTrack->GetVelocity());
|
|---|
| 212 | fpPreStepPoint->SetTouchableHandle(fpTrack->GetTouchableHandle());
|
|---|
| 213 | fpPreStepPoint->SetMaterial( fpTrack->GetTouchable()->GetVolume()->GetLogicalVolume()->GetMaterial());
|
|---|
| 214 | fpPreStepPoint->SetMaterialCutsCouple( fpTrack->GetTouchable()->GetVolume()->GetLogicalVolume()->GetMaterialCutsCouple());
|
|---|
| 215 | fpPreStepPoint->SetSensitiveDetector( fpTrack->GetTouchable()->GetVolume()->GetLogicalVolume()->GetSensitiveDetector());
|
|---|
| 216 | fpPreStepPoint->SetPolarization(fpTrack->GetPolarization());
|
|---|
| 217 | fpPreStepPoint->SetSafety(0.);
|
|---|
| 218 | fpPreStepPoint->SetStepStatus(fUndefined);
|
|---|
| 219 | fpPreStepPoint->SetProcessDefinedStep(0);
|
|---|
| 220 | fpPreStepPoint->SetMass(fpTrack->GetDynamicParticle()->GetMass());
|
|---|
| 221 | fpPreStepPoint->SetCharge(fpTrack->GetDynamicParticle()->GetCharge());
|
|---|
| 222 | fpPreStepPoint->SetWeight(fpTrack->GetWeight());
|
|---|
| 223 |
|
|---|
| 224 |
|
|---|
| 225 | (*fpPostStepPoint) = (*fpPreStepPoint);
|
|---|
| 226 | }
|
|---|
| 227 |
|
|---|
| 228 | inline
|
|---|
| 229 | void G4Step::UpdateTrack( )
|
|---|
| 230 | {
|
|---|
| 231 | // To avoid the circular dependency between G4Track, G4Step
|
|---|
| 232 | // and G4StepPoint, G4Step has to manage the update actions.
|
|---|
| 233 | // position, time
|
|---|
| 234 | fpTrack->SetPosition(fpPostStepPoint->GetPosition());
|
|---|
| 235 | fpTrack->SetGlobalTime(fpPostStepPoint->GetGlobalTime());
|
|---|
| 236 | fpTrack->SetLocalTime(fpPostStepPoint->GetLocalTime());
|
|---|
| 237 | fpTrack->SetProperTime(fpPostStepPoint->GetProperTime());
|
|---|
| 238 | // energy, momentum, polarization
|
|---|
| 239 | fpTrack->SetMomentumDirection(fpPostStepPoint->GetMomentumDirection());
|
|---|
| 240 | fpTrack->SetKineticEnergy(fpPostStepPoint->GetKineticEnergy());
|
|---|
| 241 | fpTrack->SetPolarization(fpPostStepPoint->GetPolarization());
|
|---|
| 242 | // mass charge
|
|---|
| 243 | G4DynamicParticle* pParticle = (G4DynamicParticle*)(fpTrack->GetDynamicParticle());
|
|---|
| 244 | pParticle->SetMass(fpPostStepPoint->GetMass());
|
|---|
| 245 | pParticle->SetCharge(fpPostStepPoint->GetCharge());
|
|---|
| 246 | // step length
|
|---|
| 247 | fpTrack->SetStepLength(fStepLength);
|
|---|
| 248 | // NextTouchable is updated
|
|---|
| 249 | // (G4Track::Touchable points touchable of Pre-StepPoint)
|
|---|
| 250 | fpTrack->SetNextTouchableHandle(fpPostStepPoint->GetTouchableHandle());
|
|---|
| 251 | fpTrack->SetWeight(fpPostStepPoint->GetWeight());
|
|---|
| 252 |
|
|---|
| 253 | // set velocity
|
|---|
| 254 | fpPostStepPoint->SetVelocity(fpTrack->GetVelocity());
|
|---|
| 255 | }
|
|---|
| 256 |
|
|---|
| 257 | inline G4TrackVector* G4Step::GetfSecondary() {
|
|---|
| 258 | return fSecondary;
|
|---|
| 259 | }
|
|---|
| 260 | inline G4TrackVector* G4Step::GetSecondary() const {
|
|---|
| 261 | return fSecondary;
|
|---|
| 262 | }
|
|---|
| 263 | inline void G4Step::SetSecondary(G4TrackVector* value) {
|
|---|
| 264 | fSecondary=value;
|
|---|
| 265 | }
|
|---|
| 266 | inline G4TrackVector* G4Step::NewSecondaryVector() {
|
|---|
| 267 | fSecondary=new G4TrackVector();
|
|---|
| 268 | return fSecondary;
|
|---|
| 269 | }
|
|---|
| 270 | inline void G4Step::DeleteSecondaryVector() {
|
|---|
| 271 | delete fSecondary;
|
|---|
| 272 | }
|
|---|
| 273 |
|
|---|
| 274 | inline G4bool G4Step::IsFirstStepInVolume() const
|
|---|
| 275 | {
|
|---|
| 276 | return fFirstStepInVolume;
|
|---|
| 277 | }
|
|---|
| 278 |
|
|---|
| 279 | inline G4bool G4Step::IsLastStepInVolume() const
|
|---|
| 280 | {
|
|---|
| 281 | return fLastStepInVolume;
|
|---|
| 282 | }
|
|---|
| 283 |
|
|---|
| 284 |
|
|---|
| 285 | inline void G4Step::SetFirstStepFlag()
|
|---|
| 286 | {
|
|---|
| 287 | fFirstStepInVolume = true;
|
|---|
| 288 | }
|
|---|
| 289 |
|
|---|
| 290 | inline void G4Step::ClearFirstStepFlag()
|
|---|
| 291 | {
|
|---|
| 292 | fFirstStepInVolume = false;
|
|---|
| 293 | }
|
|---|
| 294 |
|
|---|
| 295 | inline void G4Step::SetLastStepFlag()
|
|---|
| 296 | {
|
|---|
| 297 | fLastStepInVolume = true;
|
|---|
| 298 | }
|
|---|
| 299 |
|
|---|
| 300 | inline void G4Step::ClearLastStepFlag()
|
|---|
| 301 | {
|
|---|
| 302 | fLastStepInVolume = false;
|
|---|
| 303 | }
|
|---|
| 304 |
|
|---|