Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // 23 // >> 24 // $Id: G4VElasticCollision.cc,v 1.1 2003/10/07 12:37:40 hpw Exp $ // 27 25 28 #include "globals.hh" 26 #include "globals.hh" 29 #include "G4VElasticCollision.hh" 27 #include "G4VElasticCollision.hh" 30 #include "G4KineticTrack.hh" 28 #include "G4KineticTrack.hh" 31 #include "G4VCrossSectionSource.hh" 29 #include "G4VCrossSectionSource.hh" 32 #include "G4Proton.hh" 30 #include "G4Proton.hh" 33 #include "G4Neutron.hh" 31 #include "G4Neutron.hh" 34 #include "G4XNNElastic.hh" 32 #include "G4XNNElastic.hh" 35 #include "G4AngularDistribution.hh" 33 #include "G4AngularDistribution.hh" 36 #include "G4ThreeVector.hh" 34 #include "G4ThreeVector.hh" 37 #include "G4LorentzVector.hh" 35 #include "G4LorentzVector.hh" 38 #include "G4LorentzRotation.hh" 36 #include "G4LorentzRotation.hh" 39 #include "G4KineticTrackVector.hh" 37 #include "G4KineticTrackVector.hh" 40 #include "G4AngularDistributionNP.hh" // np 38 #include "G4AngularDistributionNP.hh" // np scattering 41 #include "G4AngularDistributionPP.hh" // nn 39 #include "G4AngularDistributionPP.hh" // nn and pp scattering 42 #include <typeinfo> 40 #include <typeinfo> 43 41 44 G4VElasticCollision::G4VElasticCollision() 42 G4VElasticCollision::G4VElasticCollision() 45 { 43 { 46 } 44 } 47 45 48 46 49 G4VElasticCollision::~G4VElasticCollision() 47 G4VElasticCollision::~G4VElasticCollision() 50 { } 48 { } 51 49 52 50 53 G4KineticTrackVector* G4VElasticCollision::Fin 51 G4KineticTrackVector* G4VElasticCollision::FinalState(const G4KineticTrack& trk1, 54 const G4KineticTrack& trk2) 52 const G4KineticTrack& trk2) const 55 { 53 { 56 const G4VAngularDistribution* angDistributio 54 const G4VAngularDistribution* angDistribution; 57 55 58 angDistribution = GetAngularDistribution(); 56 angDistribution = GetAngularDistribution(); 59 57 60 58 61 G4LorentzVector pCM=trk1.Get4Momentum() + tr 59 G4LorentzVector pCM=trk1.Get4Momentum() + trk2.Get4Momentum(); 62 60 63 G4LorentzRotation toLabFrame(pCM.boostVector 61 G4LorentzRotation toLabFrame(pCM.boostVector()); 64 G4LorentzVector Ptmp=toLabFrame.inverse() * 62 G4LorentzVector Ptmp=toLabFrame.inverse() * trk1.Get4Momentum(); //trk1 in CMS 65 G4LorentzRotation toZ; 63 G4LorentzRotation toZ; 66 toZ.rotateZ(-Ptmp.phi()); 64 toZ.rotateZ(-Ptmp.phi()); 67 toZ.rotateY(-Ptmp.theta()); 65 toZ.rotateY(-Ptmp.theta()); 68 toLabFrame *= toZ.inverse(); 66 toLabFrame *= toZ.inverse(); 69 67 70 G4double S = pCM.mag2(); << 68 G4double s = pCM.mag2(); 71 G4double m10 = trk1.GetDefinition()->GetPDGM 69 G4double m10 = trk1.GetDefinition()->GetPDGMass(); 72 G4double m20 = trk2.GetDefinition()->GetPDGM 70 G4double m20 = trk2.GetDefinition()->GetPDGMass(); 73 if(S-(m10+m20)*(m10+m20) < 0) return new G4K << 71 if(s-(m10+m20)*(m10+m20) < 0) return new G4KineticTrackVector; 74 72 75 G4double m_1 = trk1.GetActualMass(); << 73 G4double m1 = trk1.GetActualMass(); 76 G4double m_2 = trk2.GetActualMass(); << 74 G4double m2 = trk2.GetActualMass(); 77 75 78 // Angles of outgoing particles 76 // Angles of outgoing particles 79 G4double cosTheta = angDistribution->CosThet << 77 G4double cosTheta = angDistribution->CosTheta(s,m1,m2); 80 78 81 if ( (trk1.GetDefinition() == G4Proton::Pro 79 if ( (trk1.GetDefinition() == G4Proton::Proton() || trk1.GetDefinition() == G4Neutron::Neutron() ) 82 &&(trk2.GetDefinition() == G4Proton::Pro 80 &&(trk2.GetDefinition() == G4Proton::Proton() || trk2.GetDefinition() == G4Neutron::Neutron() ) ) 83 { 81 { 84 if ( trk1.GetDefinition() == trk2.GetDef 82 if ( trk1.GetDefinition() == trk2.GetDefinition() ) 85 { 83 { 86 if ( trk1.GetDefinition() == G4Proton::Pro 84 if ( trk1.GetDefinition() == G4Proton::Proton() ) 87 { 85 { 88 // G4cout << "scatterangle pp " << cosT 86 // G4cout << "scatterangle pp " << cosTheta 89 // << " " << typeid(*angDistribu 87 // << " " << typeid(*angDistribution).name() << G4endl; 90 } else { 88 } else { 91 // G4cout << "scatterangle nn " << cosT 89 // G4cout << "scatterangle nn " << cosTheta 92 // << " " << typeid(*angDistribu 90 // << " " << typeid(*angDistribution).name() << G4endl; 93 } 91 } 94 } else { 92 } else { 95 // G4cout << "scatterangle pn " << cosTheta 93 // G4cout << "scatterangle pn " << cosTheta 96 // << " " << typeid(*angDistribu 94 // << " " << typeid(*angDistribution).name() << G4endl; 97 } 95 } 98 } else { 96 } else { 99 // G4cout << "scatterangle other " << cos 97 // G4cout << "scatterangle other " << cosTheta 100 // << " " << typeid(*angDistribu 98 // << " " << typeid(*angDistribution).name() << G4endl; 101 } 99 } 102 100 103 G4double phi = angDistribution->Phi(); 101 G4double phi = angDistribution->Phi(); 104 G4double Theta = std::acos(cosTheta); << 102 G4double Theta = acos(cosTheta); 105 103 106 // Unit vector of three-momentum 104 // Unit vector of three-momentum 107 G4ThreeVector pFinal1(std::sin(Theta)*std::c << 105 G4ThreeVector pFinal1(sin(Theta)*cos(phi), sin(Theta)*sin(phi), cosTheta); 108 // Three momentum in cm system 106 // Three momentum in cm system 109 G4double pInCM = std::sqrt((S-(m10+m20)*(m10 << 107 G4double pInCM = sqrt((s-(m10+m20)*(m10+m20))*(s-(m10-m20)*(m10-m20))/(4.*s)); 110 pFinal1 = pFinal1 * pInCM; 108 pFinal1 = pFinal1 * pInCM; 111 G4ThreeVector pFinal2 = -pFinal1; 109 G4ThreeVector pFinal2 = -pFinal1; 112 110 113 G4double eFinal1 = std::sqrt(pFinal1.mag2() << 111 G4double eFinal1 = sqrt(pFinal1.mag2() + m10*m10); 114 G4double eFinal2 = std::sqrt(pFinal2.mag2() << 112 G4double eFinal2 = sqrt(pFinal2.mag2() + m20*m20); 115 113 116 G4LorentzVector p4Final1(pFinal1, eFinal1); 114 G4LorentzVector p4Final1(pFinal1, eFinal1); 117 G4LorentzVector p4Final2(pFinal2, eFinal2); 115 G4LorentzVector p4Final2(pFinal2, eFinal2); 118 116 119 // Lorentz transformation 117 // Lorentz transformation 120 p4Final1 *= toLabFrame; 118 p4Final1 *= toLabFrame; 121 p4Final2 *= toLabFrame; 119 p4Final2 *= toLabFrame; 122 120 123 // Final tracks are copies of incoming ones, 121 // Final tracks are copies of incoming ones, with modified 4-momenta 124 G4KineticTrack* final1 = new G4KineticTrack( 122 G4KineticTrack* final1 = new G4KineticTrack(trk1); 125 final1->Set4Momentum(p4Final1); 123 final1->Set4Momentum(p4Final1); 126 G4KineticTrack* final2 = new G4KineticTrack( 124 G4KineticTrack* final2 = new G4KineticTrack(trk2); 127 final2->Set4Momentum(p4Final2); 125 final2->Set4Momentum(p4Final2); 128 126 129 G4KineticTrackVector* finalTracks = new G4Ki 127 G4KineticTrackVector* finalTracks = new G4KineticTrackVector; 130 finalTracks->push_back(final1); 128 finalTracks->push_back(final1); 131 finalTracks->push_back(final2); 129 finalTracks->push_back(final2); 132 130 133 return finalTracks; 131 return finalTracks; 134 } 132 } 135 133