source: trunk/source/processes/hadronic/util/src/G4ReactionKinematics.cc @ 1231

Last change on this file since 1231 was 819, checked in by garnier, 16 years ago

import all except CVS

File size: 3.7 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//
27//
28//      CERN Geneva Switzerland
29//
30//      ------------ G4ReactionDynamics::TwoBody ------
31//                     new method TwoBodyScattering
32//                   by Christian V"olcker (CERN-Munich), September 1997
33//                     E-mail: Christian.Volcker@cern.ch
34// ************************************************************
35//-----------------------------------------------------------------------------
36
37#include "G4ReactionKinematics.hh"
38
39// ************************************************************
40void G4ReactionKinematics::TwoBodyScattering(
41           const G4DynamicParticle* pIn1, const G4DynamicParticle* pIn2,
42           G4DynamicParticle* pOut1, G4DynamicParticle* pOut2)
43// ************************************************************
44{           
45// initial particles:
46
47// - total invariant mass
48   G4LorentzVector sumIn(pIn1->Get4Momentum()+pIn2->Get4Momentum());
49   G4double invariantMass=sumIn.mag();
50
51// - beta of center-of-mass system
52   G4ThreeVector betaCMS=sumIn.boostVector();
53
54// final particles:
55
56// - get final particle masses
57   G4double massOut1=pOut1->GetMass();
58   G4double massOut2=pOut2->GetMass();
59
60// - calculate breakup momentum:
61   G4double breakupMomentum=BreakupMomentum(invariantMass, massOut1, massOut2);
62
63// - isotropic decay angle
64   G4double costheta = 2.0*G4UniformRand() - 1.0;
65   G4double sintheta = std::sqrt(1.0 - costheta*costheta);
66   G4double phi = 2.0*pi*G4UniformRand();
67
68// - setup LorentzVectors
69   G4double pz=costheta*breakupMomentum;
70   G4double px=sintheta*std::cos(phi)*breakupMomentum;
71   G4double py=sintheta*std::sin(phi)*breakupMomentum;
72   
73   G4double breakupMomentumSquared=breakupMomentum*breakupMomentum;
74   G4double energy1=std::sqrt(breakupMomentumSquared+massOut1*massOut1);
75   G4double energy2=std::sqrt(breakupMomentumSquared+massOut2*massOut2);
76
77   G4LorentzVector lorentz1(px, py, pz, energy1);
78   G4LorentzVector lorentz2(px, py, pz, energy2);
79
80// - back into lab system
81
82   lorentz1.boost(betaCMS);
83   lorentz2.boost(betaCMS);
84
85// fill in new particles:
86
87   pOut1->Set4Momentum(lorentz1);
88   pOut2->Set4Momentum(lorentz2);
89
90   return;
91}
Note: See TracBrowser for help on using the repository browser.