- Timestamp:
- Jun 18, 2010, 11:42:07 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadParticle.cc
r962 r1315 23 23 // * acceptance of all terms of the Geant4 Software license. * 24 24 // ******************************************************************** 25 // $Id: G4CascadParticle.cc,v 1.14 2010/03/16 22:10:26 mkelsey Exp $ 26 // Geant4 tag: $Name: geant4-09-04-beta-cand-01 $ 25 27 // 28 // 20100112 M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly 29 // 20100114 M. Kelsey -- Replace vector<G4Double> position with G4ThreeVector 30 26 31 #include "G4CascadParticle.hh" 32 #include "G4ios.hh" 33 #include <cmath> 27 34 28 35 G4CascadParticle::G4CascadParticle() 29 : verboseLevel( 2) {30 36 : verboseLevel(0), current_zone(-1), current_path(-1.), movingIn(false), 37 reflectionCounter(0), reflected(false), generation(-1) { 31 38 if (verboseLevel > 3) { 32 39 G4cout << " >>> G4CascadParticle::G4CascadParticle" << G4endl; … … 36 43 G4double G4CascadParticle::getPathToTheNextZone(G4double rz_in, 37 44 G4double rz_out) { 38 verboseLevel = 2;39 40 45 if (verboseLevel > 3) { 41 46 G4cout << " >>> G4CascadParticle::getPathToTheNextZone" << G4endl; 42 47 } 43 48 49 const G4LorentzVector& mom = getMomentum(); 50 44 51 G4double path = -1.0; 45 G4double rp = 0.0; 46 G4double rr = 0.0; 47 G4double pp = 0.0; 48 const G4CascadeMomentum& mom = theParticle.getMomentum(); 49 50 for (G4int i = 1; i < 4; i++) { 51 rp += mom[i] * position[i - 1]; 52 rr += position[i - 1] * position[i - 1]; 53 pp += mom[i] * mom[i]; 54 }; 52 G4double rp = mom.vect().dot(position); 53 G4double rr = position.mag2(); 54 G4double pp = mom.vect().mag2(); 55 55 56 56 G4double ra = rr - rp * rp / pp; … … 63 63 ds = 1.0; 64 64 movingIn = false; 65 66 65 } else { 67 68 66 d2 = rz_in * rz_in - ra; 69 70 67 if (d2 > 0.0) { 71 68 ds = -1.0; 72 69 movingIn = true; 73 74 70 } else { 75 76 71 d2 = rz_out * rz_out - ra; 77 72 ds = 1.0; 78 73 movingIn = false; 79 } ;80 } ;74 } 75 } 81 76 82 77 path = ds * std::sqrt(d2) - rp / pp; … … 86 81 87 82 void G4CascadParticle::propagateAlongThePath(G4double path) { 88 89 83 if (verboseLevel > 3) { 90 84 G4cout << " >>> G4CascadParticle::propagateAlongThePath" << G4endl; 91 85 } 92 86 93 const G4CascadeMomentum& mom = theParticle.getMomentum();94 G4double pmod = theParticle.getMomModule(); 87 position += getMomentum().vect().unit()*path; 88 } 95 89 96 for(G4int i = 0; i < 3; i++) position[i] += mom[i + 1] * path / pmod; 90 void G4CascadParticle::print() const { 91 theParticle.printParticle(); 92 G4cout << " zone " << current_zone << " current_path " << current_path 93 << " reflectionCounter " << reflectionCounter << G4endl 94 << " x " << position.x() << " y " << position.y() 95 << " z " << position.z() << G4endl; 96 } 97 97 98 }
Note: See TracChangeset
for help on using the changeset viewer.