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: G4VMscModel.cc,v 1.10 2009/02/24 09:56:03 vnivanch Exp $ |
---|
27 | // GEANT4 tag $Name: geant4-09-02-ref-02 $ |
---|
28 | // |
---|
29 | // ------------------------------------------------------------------- |
---|
30 | // |
---|
31 | // GEANT4 Class file |
---|
32 | // |
---|
33 | // |
---|
34 | // File name: G4VMscModel |
---|
35 | // |
---|
36 | // Author: Vladimir Ivanchenko |
---|
37 | // |
---|
38 | // Creation date: 07.03.2008 |
---|
39 | // |
---|
40 | // Modifications: |
---|
41 | // |
---|
42 | // |
---|
43 | // Class Description: |
---|
44 | // |
---|
45 | // General interface to msc models |
---|
46 | |
---|
47 | // ------------------------------------------------------------------- |
---|
48 | // |
---|
49 | |
---|
50 | #include "G4VMscModel.hh" |
---|
51 | #include "G4ParticleChangeForMSC.hh" |
---|
52 | #include "G4TransportationManager.hh" |
---|
53 | |
---|
54 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
55 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
56 | |
---|
57 | G4VMscModel::G4VMscModel(const G4String& nam): |
---|
58 | G4VEmModel(nam), |
---|
59 | safetyHelper(0), |
---|
60 | facrange(0.02), |
---|
61 | facgeom(2.5), |
---|
62 | facsafety(0.25), |
---|
63 | skin(3.0), |
---|
64 | dtrl(0.05), |
---|
65 | lambdalimit(mm), |
---|
66 | geommax(1.e50*mm), |
---|
67 | steppingAlgorithm(fUseSafety), |
---|
68 | samplez(false), |
---|
69 | latDisplasment(true) |
---|
70 | {} |
---|
71 | |
---|
72 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
73 | |
---|
74 | G4VMscModel::~G4VMscModel() |
---|
75 | {} |
---|
76 | |
---|
77 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
78 | |
---|
79 | void G4VMscModel::InitialiseSafetyHelper() |
---|
80 | { |
---|
81 | if(!safetyHelper) { |
---|
82 | safetyHelper = G4TransportationManager::GetTransportationManager() |
---|
83 | ->GetSafetyHelper(); |
---|
84 | safetyHelper->InitialiseHelper(); |
---|
85 | } |
---|
86 | } |
---|
87 | |
---|
88 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
89 | |
---|
90 | void G4VMscModel::ComputeDisplacement(G4ParticleChangeForMSC* fParticleChange, |
---|
91 | const G4ThreeVector& dir, |
---|
92 | G4double displacement, |
---|
93 | G4double postsafety) |
---|
94 | { |
---|
95 | const G4ThreeVector* pos = fParticleChange->GetProposedPosition(); |
---|
96 | G4double r = displacement; |
---|
97 | if(r > postsafety) { |
---|
98 | G4double newsafety = safetyHelper->ComputeSafety(*pos); |
---|
99 | if(r > newsafety) r = newsafety; |
---|
100 | } |
---|
101 | if(r > 0.) { |
---|
102 | |
---|
103 | // compute new endpoint of the Step |
---|
104 | G4ThreeVector newPosition = *pos + r*dir; |
---|
105 | |
---|
106 | // definitely not on boundary |
---|
107 | if(displacement == r) { |
---|
108 | safetyHelper->ReLocateWithinVolume(newPosition); |
---|
109 | |
---|
110 | } else { |
---|
111 | // check safety after displacement |
---|
112 | G4double postsafety = safetyHelper->ComputeSafety(newPosition); |
---|
113 | |
---|
114 | // displacement to boundary |
---|
115 | if(postsafety <= 0.0) { |
---|
116 | safetyHelper->Locate(newPosition, |
---|
117 | *fParticleChange->GetProposedMomentumDirection()); |
---|
118 | |
---|
119 | // not on the boundary |
---|
120 | } else { |
---|
121 | safetyHelper->ReLocateWithinVolume(newPosition); |
---|
122 | } |
---|
123 | } |
---|
124 | fParticleChange->ProposePosition(newPosition); |
---|
125 | } |
---|
126 | } |
---|
127 | |
---|
128 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
129 | |
---|
130 | void G4VMscModel::SampleSecondaries(std::vector<G4DynamicParticle*>*, |
---|
131 | const G4MaterialCutsCouple*, |
---|
132 | const G4DynamicParticle*, |
---|
133 | G4double, G4double) |
---|
134 | {} |
---|
135 | |
---|
136 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|