source: trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadParticle.cc @ 1337

Last change on this file since 1337 was 1337, checked in by garnier, 14 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 3.5 KB
Line 
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: G4CascadParticle.cc,v 1.15 2010/06/25 09:44:00 gunter Exp $
27// Geant4 tag: $Name: geant4-09-04-beta-01 $
28//
29// 20100112  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
30// 20100114  M. Kelsey -- Replace vector<G4Double> position with G4ThreeVector
31
32#include "G4CascadParticle.hh"
33#include "G4ios.hh"
34#include <cmath>
35
36G4CascadParticle::G4CascadParticle()
37  : verboseLevel(0), current_zone(-1), current_path(-1.), movingIn(false),
38    reflectionCounter(0), reflected(false), generation(-1) {
39  if (verboseLevel > 3) {
40    G4cout << " >>> G4CascadParticle::G4CascadParticle" << G4endl;
41  }
42}
43
44G4double G4CascadParticle::getPathToTheNextZone(G4double rz_in, 
45                                                G4double rz_out) {
46  if (verboseLevel > 3) {
47    G4cout << " >>> G4CascadParticle::getPathToTheNextZone" << G4endl;
48  }
49
50  const G4LorentzVector& mom = getMomentum();
51
52  G4double path = -1.0;
53  G4double rp = mom.vect().dot(position);
54  G4double rr = position.mag2();
55  G4double pp = mom.vect().mag2();
56
57  G4double ra = rr - rp * rp / pp;
58  pp = std::sqrt(pp);
59  G4double ds;
60  G4double d2;
61 
62  if (current_zone == 0 || rp > 0.0) {
63    d2 = rz_out * rz_out - ra;
64    ds = 1.0;
65    movingIn = false; 
66  } else { 
67    d2 = rz_in * rz_in - ra;
68    if (d2 > 0.0) {
69      ds = -1.0;
70      movingIn = true;
71    } else {
72      d2 = rz_out * rz_out - ra;
73      ds = 1.0;
74      movingIn = false;
75    }
76  }
77
78  path = ds * std::sqrt(d2) - rp / pp;
79
80  return path;   
81}
82
83void G4CascadParticle::propagateAlongThePath(G4double path) {
84  if (verboseLevel > 3) {
85    G4cout << " >>> G4CascadParticle::propagateAlongThePath" << G4endl;
86  }
87
88  position += getMomentum().vect().unit()*path;
89}
90
91void G4CascadParticle::print() const {
92  theParticle.printParticle();
93  G4cout << " zone " << current_zone << " current_path " << current_path
94         << " reflectionCounter " << reflectionCounter << G4endl
95         << " x " << position.x() << " y " << position.y()
96         << " z " << position.z() << G4endl;
97}
98
Note: See TracBrowser for help on using the repository browser.