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 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/hadronic/models/im_r_matrix/src/G4VElasticCollision.cc (Version 11.3.0) and /processes/hadronic/models/im_r_matrix/src/G4VElasticCollision.cc (Version 11.1.1)


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