source: trunk/source/processes/hadronic/models/im_r_matrix/src/G4VElasticCollision.cc @ 836

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

import all except CVS

File size: 5.1 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// $Id: G4VElasticCollision.cc,v 1.3 2006/06/29 20:41:53 gunter Exp $ //
28
29#include "globals.hh"
30#include "G4VElasticCollision.hh"
31#include "G4KineticTrack.hh"
32#include "G4VCrossSectionSource.hh"
33#include "G4Proton.hh"
34#include "G4Neutron.hh"
35#include "G4XNNElastic.hh"
36#include "G4AngularDistribution.hh"
37#include "G4ThreeVector.hh"
38#include "G4LorentzVector.hh"
39#include "G4LorentzRotation.hh"
40#include "G4KineticTrackVector.hh"
41#include "G4AngularDistributionNP.hh"   //  np scattering
42#include "G4AngularDistributionPP.hh"   //  nn and pp scattering
43#include <typeinfo>
44
45G4VElasticCollision::G4VElasticCollision()
46{ 
47}
48
49
50G4VElasticCollision::~G4VElasticCollision()
51{ }
52
53
54G4KineticTrackVector* G4VElasticCollision::FinalState(const G4KineticTrack& trk1,
55                                                      const G4KineticTrack& trk2) const
56{
57  const G4VAngularDistribution* angDistribution;
58
59  angDistribution = GetAngularDistribution();
60
61
62  G4LorentzVector pCM=trk1.Get4Momentum() + trk2.Get4Momentum();
63
64  G4LorentzRotation toLabFrame(pCM.boostVector());
65  G4LorentzVector Ptmp=toLabFrame.inverse() * trk1.Get4Momentum();  //trk1 in CMS
66  G4LorentzRotation toZ;
67  toZ.rotateZ(-Ptmp.phi());
68  toZ.rotateY(-Ptmp.theta());
69  toLabFrame *= toZ.inverse();
70
71  G4double s = pCM.mag2();
72  G4double m10 = trk1.GetDefinition()->GetPDGMass();
73  G4double m20 = trk2.GetDefinition()->GetPDGMass();
74  if(s-(m10+m20)*(m10+m20) < 0) return new G4KineticTrackVector;
75
76  G4double m1 = trk1.GetActualMass();
77  G4double m2 = trk2.GetActualMass();
78 
79  // Angles of outgoing particles
80  G4double cosTheta = angDistribution->CosTheta(s,m1,m2);
81
82   if ( (trk1.GetDefinition() == G4Proton::Proton() || trk1.GetDefinition() == G4Neutron::Neutron() )
83      &&(trk2.GetDefinition() == G4Proton::Proton() || trk2.GetDefinition() == G4Neutron::Neutron() ) )
84   {
85      if ( trk1.GetDefinition() == trk2.GetDefinition() )
86      {
87          if ( trk1.GetDefinition() == G4Proton::Proton() )
88          {
89//            G4cout << "scatterangle pp " << cosTheta
90//                   << " " << typeid(*angDistribution).name() << G4endl;
91          } else {
92//            G4cout << "scatterangle nn " << cosTheta
93//                   << " " << typeid(*angDistribution).name() << G4endl;
94          }
95      } else {
96//        G4cout << "scatterangle pn " << cosTheta
97//                   << " " << typeid(*angDistribution).name() << G4endl;
98      }
99   } else {
100//      G4cout << "scatterangle other " << cosTheta
101//                   << " " << typeid(*angDistribution).name() << G4endl;
102   }
103
104  G4double phi = angDistribution->Phi();
105  G4double Theta = std::acos(cosTheta);
106
107  // Unit vector of three-momentum
108  G4ThreeVector pFinal1(std::sin(Theta)*std::cos(phi), std::sin(Theta)*std::sin(phi), cosTheta);
109  // Three momentum in cm system
110  G4double pInCM = std::sqrt((s-(m10+m20)*(m10+m20))*(s-(m10-m20)*(m10-m20))/(4.*s));
111  pFinal1 = pFinal1 * pInCM;
112  G4ThreeVector pFinal2 = -pFinal1;
113
114  G4double eFinal1 = std::sqrt(pFinal1.mag2() + m10*m10);
115  G4double eFinal2 = std::sqrt(pFinal2.mag2() + m20*m20);
116
117  G4LorentzVector p4Final1(pFinal1, eFinal1);
118  G4LorentzVector p4Final2(pFinal2, eFinal2);
119
120  // Lorentz transformation
121  p4Final1 *= toLabFrame;
122  p4Final2 *= toLabFrame;
123
124  // Final tracks are copies of incoming ones, with modified 4-momenta
125  G4KineticTrack* final1 = new G4KineticTrack(trk1);
126  final1->Set4Momentum(p4Final1);
127  G4KineticTrack* final2 = new G4KineticTrack(trk2);
128  final2->Set4Momentum(p4Final2);
129
130  G4KineticTrackVector* finalTracks = new G4KineticTrackVector;
131  finalTracks->push_back(final1);
132  finalTracks->push_back(final2);
133
134  return finalTracks;
135}
Note: See TracBrowser for help on using the repository browser.