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