Ignore:
Timestamp:
Jun 18, 2010, 11:42:07 AM (14 years ago)
Author:
garnier
Message:

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadParticle.cc

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     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 $
    2527//
     28// 20100112  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     29// 20100114  M. Kelsey -- Replace vector<G4Double> position with G4ThreeVector
     30
    2631#include "G4CascadParticle.hh"
     32#include "G4ios.hh"
     33#include <cmath>
    2734
    2835G4CascadParticle::G4CascadParticle()
    29   : verboseLevel(2) {
    30 
     36  : verboseLevel(0), current_zone(-1), current_path(-1.), movingIn(false),
     37    reflectionCounter(0), reflected(false), generation(-1) {
    3138  if (verboseLevel > 3) {
    3239    G4cout << " >>> G4CascadParticle::G4CascadParticle" << G4endl;
     
    3643G4double G4CascadParticle::getPathToTheNextZone(G4double rz_in,
    3744                                                G4double rz_out) {
    38   verboseLevel = 2;
    39 
    4045  if (verboseLevel > 3) {
    4146    G4cout << " >>> G4CascadParticle::getPathToTheNextZone" << G4endl;
    4247  }
    4348
     49  const G4LorentzVector& mom = getMomentum();
     50
    4451  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();
    5555
    5656  G4double ra = rr - rp * rp / pp;
     
    6363    ds = 1.0;
    6464    movingIn = false;
    65  
    6665  } else {
    67 
    6866    d2 = rz_in * rz_in - ra;
    69 
    7067    if (d2 > 0.0) {
    7168      ds = -1.0;
    7269      movingIn = true;
    73  
    7470    } else {
    75 
    7671      d2 = rz_out * rz_out - ra;
    7772      ds = 1.0;
    7873      movingIn = false;
    79     };
    80   };
     74    }
     75  }
    8176
    8277  path = ds * std::sqrt(d2) - rp / pp;
     
    8681
    8782void G4CascadParticle::propagateAlongThePath(G4double path) {
    88 
    8983  if (verboseLevel > 3) {
    9084    G4cout << " >>> G4CascadParticle::propagateAlongThePath" << G4endl;
    9185  }
    9286
    93   const G4CascadeMomentum& mom = theParticle.getMomentum();
    94   G4double pmod = theParticle.getMomModule();
     87  position += getMomentum().vect().unit()*path;
     88}
    9589
    96   for(G4int i = 0; i < 3; i++) position[i] += mom[i + 1] * path / pmod;
     90void 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}
    9797
    98 }
Note: See TracChangeset for help on using the changeset viewer.