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: G4StepLimiterPerRegion.cc,v 1.4 2007/05/16 16:27:53 vnivanch Exp $ |
---|
27 | // GEANT4 tag $Name: $ |
---|
28 | // |
---|
29 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
30 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
31 | |
---|
32 | #include "G4StepLimiterPerRegion.hh" |
---|
33 | #include "G4StepLimiterMessenger.hh" |
---|
34 | #include "G4VPhysicalVolume.hh" |
---|
35 | #include "Histo.hh" |
---|
36 | |
---|
37 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
38 | |
---|
39 | G4StepLimiterPerRegion::G4StepLimiterPerRegion(const G4String& processName) |
---|
40 | : G4VDiscreteProcess(processName), |
---|
41 | MaxChargedStep(DBL_MAX) |
---|
42 | { |
---|
43 | pMess = new G4StepLimiterMessenger(this); |
---|
44 | gasVolume = Histo::GetPointer()->GasVolume(); |
---|
45 | } |
---|
46 | |
---|
47 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
48 | |
---|
49 | G4StepLimiterPerRegion::~G4StepLimiterPerRegion() |
---|
50 | { |
---|
51 | delete pMess; |
---|
52 | } |
---|
53 | |
---|
54 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
55 | |
---|
56 | G4bool G4StepLimiterPerRegion::IsApplicable(const G4ParticleDefinition& particle) |
---|
57 | { |
---|
58 | return (particle.GetPDGCharge() != 0. && !(particle.IsShortLived())); |
---|
59 | } |
---|
60 | |
---|
61 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
62 | |
---|
63 | void G4StepLimiterPerRegion::SetMaxStep(G4double step) |
---|
64 | { |
---|
65 | MaxChargedStep = step; |
---|
66 | } |
---|
67 | |
---|
68 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
69 | |
---|
70 | G4double G4StepLimiterPerRegion::PostStepGetPhysicalInteractionLength( |
---|
71 | const G4Track& aTrack, |
---|
72 | G4double, |
---|
73 | G4ForceCondition* condition ) |
---|
74 | { |
---|
75 | // condition is set to "Not Forced" |
---|
76 | *condition = NotForced; |
---|
77 | ProposedStep = MaxChargedStep; |
---|
78 | if(aTrack.GetVolume() == gasVolume) ProposedStep = 0.0; |
---|
79 | return ProposedStep; |
---|
80 | } |
---|
81 | |
---|
82 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
83 | |
---|
84 | G4VParticleChange* G4StepLimiterPerRegion::PostStepDoIt(const G4Track& aTrack, |
---|
85 | const G4Step&) |
---|
86 | { |
---|
87 | aParticleChange.Initialize(aTrack); |
---|
88 | if(aTrack.GetVolume() == gasVolume) |
---|
89 | aParticleChange.ProposeTrackStatus(fStopAndKill); |
---|
90 | return &aParticleChange; |
---|
91 | } |
---|
92 | |
---|
93 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|