00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id: G4VElasticCollision.cc,v 1.3 2006-06-29 20:41:53 gunter Exp $ // 00028 00029 #include "globals.hh" 00030 #include "G4VElasticCollision.hh" 00031 #include "G4KineticTrack.hh" 00032 #include "G4VCrossSectionSource.hh" 00033 #include "G4Proton.hh" 00034 #include "G4Neutron.hh" 00035 #include "G4XNNElastic.hh" 00036 #include "G4AngularDistribution.hh" 00037 #include "G4ThreeVector.hh" 00038 #include "G4LorentzVector.hh" 00039 #include "G4LorentzRotation.hh" 00040 #include "G4KineticTrackVector.hh" 00041 #include "G4AngularDistributionNP.hh" // np scattering 00042 #include "G4AngularDistributionPP.hh" // nn and pp scattering 00043 #include <typeinfo> 00044 00045 G4VElasticCollision::G4VElasticCollision() 00046 { 00047 } 00048 00049 00050 G4VElasticCollision::~G4VElasticCollision() 00051 { } 00052 00053 00054 G4KineticTrackVector* G4VElasticCollision::FinalState(const G4KineticTrack& trk1, 00055 const G4KineticTrack& trk2) const 00056 { 00057 const G4VAngularDistribution* angDistribution; 00058 00059 angDistribution = GetAngularDistribution(); 00060 00061 00062 G4LorentzVector pCM=trk1.Get4Momentum() + trk2.Get4Momentum(); 00063 00064 G4LorentzRotation toLabFrame(pCM.boostVector()); 00065 G4LorentzVector Ptmp=toLabFrame.inverse() * trk1.Get4Momentum(); //trk1 in CMS 00066 G4LorentzRotation toZ; 00067 toZ.rotateZ(-Ptmp.phi()); 00068 toZ.rotateY(-Ptmp.theta()); 00069 toLabFrame *= toZ.inverse(); 00070 00071 G4double S = pCM.mag2(); 00072 G4double m10 = trk1.GetDefinition()->GetPDGMass(); 00073 G4double m20 = trk2.GetDefinition()->GetPDGMass(); 00074 if(S-(m10+m20)*(m10+m20) < 0) return new G4KineticTrackVector; 00075 00076 G4double m_1 = trk1.GetActualMass(); 00077 G4double m_2 = trk2.GetActualMass(); 00078 00079 // Angles of outgoing particles 00080 G4double cosTheta = angDistribution->CosTheta(S,m_1,m_2); 00081 00082 if ( (trk1.GetDefinition() == G4Proton::Proton() || trk1.GetDefinition() == G4Neutron::Neutron() ) 00083 &&(trk2.GetDefinition() == G4Proton::Proton() || trk2.GetDefinition() == G4Neutron::Neutron() ) ) 00084 { 00085 if ( trk1.GetDefinition() == trk2.GetDefinition() ) 00086 { 00087 if ( trk1.GetDefinition() == G4Proton::Proton() ) 00088 { 00089 // G4cout << "scatterangle pp " << cosTheta 00090 // << " " << typeid(*angDistribution).name() << G4endl; 00091 } else { 00092 // G4cout << "scatterangle nn " << cosTheta 00093 // << " " << typeid(*angDistribution).name() << G4endl; 00094 } 00095 } else { 00096 // G4cout << "scatterangle pn " << cosTheta 00097 // << " " << typeid(*angDistribution).name() << G4endl; 00098 } 00099 } else { 00100 // G4cout << "scatterangle other " << cosTheta 00101 // << " " << typeid(*angDistribution).name() << G4endl; 00102 } 00103 00104 G4double phi = angDistribution->Phi(); 00105 G4double Theta = std::acos(cosTheta); 00106 00107 // Unit vector of three-momentum 00108 G4ThreeVector pFinal1(std::sin(Theta)*std::cos(phi), std::sin(Theta)*std::sin(phi), cosTheta); 00109 // Three momentum in cm system 00110 G4double pInCM = std::sqrt((S-(m10+m20)*(m10+m20))*(S-(m10-m20)*(m10-m20))/(4.*S)); 00111 pFinal1 = pFinal1 * pInCM; 00112 G4ThreeVector pFinal2 = -pFinal1; 00113 00114 G4double eFinal1 = std::sqrt(pFinal1.mag2() + m10*m10); 00115 G4double eFinal2 = std::sqrt(pFinal2.mag2() + m20*m20); 00116 00117 G4LorentzVector p4Final1(pFinal1, eFinal1); 00118 G4LorentzVector p4Final2(pFinal2, eFinal2); 00119 00120 // Lorentz transformation 00121 p4Final1 *= toLabFrame; 00122 p4Final2 *= toLabFrame; 00123 00124 // Final tracks are copies of incoming ones, with modified 4-momenta 00125 G4KineticTrack* final1 = new G4KineticTrack(trk1); 00126 final1->Set4Momentum(p4Final1); 00127 G4KineticTrack* final2 = new G4KineticTrack(trk2); 00128 final2->Set4Momentum(p4Final2); 00129 00130 G4KineticTrackVector* finalTracks = new G4KineticTrackVector; 00131 finalTracks->push_back(final1); 00132 finalTracks->push_back(final2); 00133 00134 return finalTracks; 00135 }