Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/hadronic/models/coherent_elastic/src/G4LEHadronProtonElastic.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 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/coherent_elastic/src/G4LEHadronProtonElastic.cc (Version 11.3.0) and /processes/hadronic/models/coherent_elastic/src/G4LEHadronProtonElastic.cc (Version 10.2)


  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 // G4 Low energy model: n-p scattering             27 // G4 Low energy model: n-p scattering
 28 // F.W. Jones, L.G. Greeniaus, H.P. Wellisch       28 // F.W. Jones, L.G. Greeniaus, H.P. Wellisch
 29                                                    29 
 30 // 11-OCT-2007 F.W. Jones: removed erroneous c     30 // 11-OCT-2007 F.W. Jones: removed erroneous code for identity
 31 //             exchange of particles.              31 //             exchange of particles.
 32 // FWJ 27-AUG-2010: extended to 5 GeV by Tony      32 // FWJ 27-AUG-2010: extended to 5 GeV by Tony Kwan TRIUMF
 33 // 06-Aug-15 A.Ribon migrating to G4Pow            33 // 06-Aug-15 A.Ribon migrating to G4Pow
 34                                                    34 
 35 #include "G4LEHadronProtonElastic.hh"              35 #include "G4LEHadronProtonElastic.hh"
 36 #include "G4PhysicalConstants.hh"                  36 #include "G4PhysicalConstants.hh"
 37 #include "G4SystemOfUnits.hh"                      37 #include "G4SystemOfUnits.hh"
 38 #include "Randomize.hh"                            38 #include "Randomize.hh"
 39 #include "G4ios.hh"                                39 #include "G4ios.hh"
                                                   >>  40 
 40 #include "G4Pow.hh"                                41 #include "G4Pow.hh"
 41 #include "G4PhysicsModelCatalog.hh"            << 
 42                                                    42 
 43                                                    43 
 44 G4LEHadronProtonElastic::G4LEHadronProtonElast     44 G4LEHadronProtonElastic::G4LEHadronProtonElastic():
 45  G4HadronElastic("G4LEHadronProtonElastic")        45  G4HadronElastic("G4LEHadronProtonElastic") 
 46 {                                                  46 {
 47   secID = G4PhysicsModelCatalog::GetModelID( " << 
 48   SetMinEnergy(0.);                                47   SetMinEnergy(0.);
 49   SetMaxEnergy(20.*MeV);                           48   SetMaxEnergy(20.*MeV);
 50 }                                                  49 }
 51                                                    50 
 52 G4LEHadronProtonElastic::~G4LEHadronProtonElas     51 G4LEHadronProtonElastic::~G4LEHadronProtonElastic()
 53 {                                                  52 {
 54       theParticleChange.Clear();                   53       theParticleChange.Clear();
 55 }                                                  54 }
 56                                                    55 
 57 G4HadFinalState*                                   56 G4HadFinalState*
 58 G4LEHadronProtonElastic::ApplyYourself(const G     57 G4LEHadronProtonElastic::ApplyYourself(const G4HadProjectile& aTrack, 
 59                             G4Nucleus& targetN     58                             G4Nucleus& targetNucleus)
 60 {                                                  59 {
 61     theParticleChange.Clear();                     60     theParticleChange.Clear();
 62     const G4HadProjectile* aParticle = &aTrack     61     const G4HadProjectile* aParticle = &aTrack;
 63                                                    62 
 64     G4double P = aParticle->GetTotalMomentum()     63     G4double P = aParticle->GetTotalMomentum();
 65     G4double Px = aParticle->Get4Momentum().x(     64     G4double Px = aParticle->Get4Momentum().x();
 66     G4double Py = aParticle->Get4Momentum().y(     65     G4double Py = aParticle->Get4Momentum().y();
 67     G4double Pz = aParticle->Get4Momentum().z(     66     G4double Pz = aParticle->Get4Momentum().z();
 68     G4double ek = aParticle->GetKineticEnergy(     67     G4double ek = aParticle->GetKineticEnergy();
 69     G4ThreeVector theInitial = aParticle->Get4     68     G4ThreeVector theInitial = aParticle->Get4Momentum().vect();
 70                                                    69 
 71     if (verboseLevel > 1)                          70     if (verboseLevel > 1) 
 72     {                                              71     {
 73       G4double E = aParticle->GetTotalEnergy()     72       G4double E = aParticle->GetTotalEnergy();
 74       G4double E0 = aParticle->GetDefinition()     73       G4double E0 = aParticle->GetDefinition()->GetPDGMass();
 75       G4double Q = aParticle->GetDefinition()-     74       G4double Q = aParticle->GetDefinition()->GetPDGCharge();
 76       G4int A = targetNucleus.GetA_asInt();        75       G4int A = targetNucleus.GetA_asInt();
 77       G4int Z = targetNucleus.GetZ_asInt();        76       G4int Z = targetNucleus.GetZ_asInt();
 78       G4cout << "G4LEHadronProtonElastic:Apply     77       G4cout << "G4LEHadronProtonElastic:ApplyYourself: incident particle: "
 79              << aParticle->GetDefinition()->Ge     78              << aParticle->GetDefinition()->GetParticleName() << G4endl;
 80       G4cout << "P = " << P/GeV << " GeV/c"        79       G4cout << "P = " << P/GeV << " GeV/c"
 81              << ", Px = " << Px/GeV << " GeV/c     80              << ", Px = " << Px/GeV << " GeV/c"
 82              << ", Py = " << Py/GeV << " GeV/c     81              << ", Py = " << Py/GeV << " GeV/c"
 83              << ", Pz = " << Pz/GeV << " GeV/c     82              << ", Pz = " << Pz/GeV << " GeV/c" << G4endl;
 84       G4cout << "E = " << E/GeV << " GeV"          83       G4cout << "E = " << E/GeV << " GeV"
 85              << ", kinetic energy = " << ek/Ge     84              << ", kinetic energy = " << ek/GeV << " GeV"
 86              << ", mass = " << E0/GeV << " GeV     85              << ", mass = " << E0/GeV << " GeV"
 87              << ", charge = " << Q << G4endl;      86              << ", charge = " << Q << G4endl;
 88       G4cout << "G4LEHadronProtonElastic:Apply     87       G4cout << "G4LEHadronProtonElastic:ApplyYourself: material:" << G4endl;
 89       G4cout << "A = " << A                        88       G4cout << "A = " << A
 90              << ", Z = " << Z                      89              << ", Z = " << Z
 91              << ", atomic mass "                   90              << ", atomic mass " 
 92              <<  G4Proton::Proton()->GetPDGMas     91              <<  G4Proton::Proton()->GetPDGMass()/GeV << "GeV" 
 93              << G4endl;                            92              << G4endl;
 94       //                                           93       //
 95       // GHEISHA ADD operation to get total en     94       // GHEISHA ADD operation to get total energy, mass, charge
 96       //                                           95       //
 97       E += proton_mass_c2;                         96       E += proton_mass_c2;
 98       G4double E02 = E*E - P*P;                    97       G4double E02 = E*E - P*P;
 99       E0 = std::sqrt(std::abs(E02));               98       E0 = std::sqrt(std::abs(E02));
100       if (E02 < 0)E0 *= -1;                        99       if (E02 < 0)E0 *= -1;
101       Q += Z;                                     100       Q += Z;
102       G4cout << "G4LEHadronProtonElastic:Apply    101       G4cout << "G4LEHadronProtonElastic:ApplyYourself: total:" << G4endl;
103       G4cout << "E = " << E/GeV << " GeV"         102       G4cout << "E = " << E/GeV << " GeV"
104              << ", mass = " << E0/GeV << " GeV    103              << ", mass = " << E0/GeV << " GeV"
105              << ", charge = " << Q << G4endl;     104              << ", charge = " << Q << G4endl;
106     }                                             105     }
107                                                   106 
108     G4double theta = (0.5)*pi/180.;               107     G4double theta = (0.5)*pi/180.;
109                                                   108 
110     // Get the target particle                    109     // Get the target particle
111                                                   110 
112     G4DynamicParticle* targetParticle = target    111     G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle();
113                                                   112 
114     G4double E1 = aParticle->GetTotalEnergy();    113     G4double E1 = aParticle->GetTotalEnergy();
115     G4double M1 = aParticle->GetDefinition()->    114     G4double M1 = aParticle->GetDefinition()->GetPDGMass();
116     G4double E2 = targetParticle->GetTotalEner    115     G4double E2 = targetParticle->GetTotalEnergy();
117     G4double M2 = targetParticle->GetDefinitio    116     G4double M2 = targetParticle->GetDefinition()->GetPDGMass();
118     G4double totalEnergy = E1 + E2;               117     G4double totalEnergy = E1 + E2;
119     G4double pseudoMass = std::sqrt(totalEnerg    118     G4double pseudoMass = std::sqrt(totalEnergy*totalEnergy - P*P);
120                                                   119 
121     // Transform into centre of mass system       120     // Transform into centre of mass system
122                                                   121 
123     G4double px = (M2/pseudoMass)*Px;             122     G4double px = (M2/pseudoMass)*Px;
124     G4double py = (M2/pseudoMass)*Py;             123     G4double py = (M2/pseudoMass)*Py;
125     G4double pz = (M2/pseudoMass)*Pz;             124     G4double pz = (M2/pseudoMass)*Pz;
126     G4double p = std::sqrt(px*px + py*py + pz*    125     G4double p = std::sqrt(px*px + py*py + pz*pz);
127                                                   126 
128     if (verboseLevel > 1) {                       127     if (verboseLevel > 1) {
129       G4cout << "  E1, M1 (GeV) " << E1/GeV <<    128       G4cout << "  E1, M1 (GeV) " << E1/GeV << " " << M1/GeV << G4endl;
130       G4cout << "  E2, M2 (GeV) " << E2/GeV <<    129       G4cout << "  E2, M2 (GeV) " << E2/GeV << " " << M2/GeV << G4endl;
131       G4cout << "  particle  1 momentum in CM     130       G4cout << "  particle  1 momentum in CM " << px/GeV << " " << py/GeV << " "
132            << pz/GeV << " " << p/GeV << G4endl    131            << pz/GeV << " " << p/GeV << G4endl;
133     }                                             132     }
134                                                   133 
135     // First scatter w.r.t. Z axis                134     // First scatter w.r.t. Z axis
136     G4double phi = G4UniformRand()*twopi;         135     G4double phi = G4UniformRand()*twopi;
137     G4double pxnew = p*std::sin(theta)*std::co    136     G4double pxnew = p*std::sin(theta)*std::cos(phi);
138     G4double pynew = p*std::sin(theta)*std::si    137     G4double pynew = p*std::sin(theta)*std::sin(phi);
139     G4double pznew = p*std::cos(theta);           138     G4double pznew = p*std::cos(theta);
140                                                   139 
141     // Rotate according to the direction of th    140     // Rotate according to the direction of the incident particle
142     if (px*px + py*py > 0)                        141     if (px*px + py*py > 0) 
143     {                                             142     {
144       G4double cost, sint, ph, cosp, sinp;        143       G4double cost, sint, ph, cosp, sinp;
145       cost = pz/p;                                144       cost = pz/p;
146       sint = (std::sqrt(std::fabs((1-cost)*(1+    145       sint = (std::sqrt(std::fabs((1-cost)*(1+cost))) 
147             + std::sqrt(px*px+py*py)/p)/2;        146             + std::sqrt(px*px+py*py)/p)/2;
148       py < 0 ? ph = 3*halfpi : ph = halfpi;       147       py < 0 ? ph = 3*halfpi : ph = halfpi;
149       if (std::abs(px) > 0.000001*GeV) ph = st    148       if (std::abs(px) > 0.000001*GeV) ph = std::atan2(py,px);
150       cosp = std::cos(ph);                        149       cosp = std::cos(ph);
151       sinp = std::sin(ph);                        150       sinp = std::sin(ph);
152       px = (cost*cosp*pxnew - sinp*pynew + sin    151       px = (cost*cosp*pxnew - sinp*pynew + sint*cosp*pznew);
153       py = (cost*sinp*pxnew + cosp*pynew + sin    152       py = (cost*sinp*pxnew + cosp*pynew + sint*sinp*pznew);
154       pz = (-sint*pxnew                  + cos    153       pz = (-sint*pxnew                  + cost*pznew);
155     }                                             154     }
156     else {                                        155     else {
157       px = pxnew;                                 156       px = pxnew;
158       py = pynew;                                 157       py = pynew;
159       pz = pznew;                                 158       pz = pznew;
160     }                                             159     }
161                                                   160 
162     if (verboseLevel > 1) {                       161     if (verboseLevel > 1) {
163       G4cout << "  AFTER SCATTER..." << G4endl    162       G4cout << "  AFTER SCATTER..." << G4endl;
164       G4cout << "  particle 1 momentum in CM "    163       G4cout << "  particle 1 momentum in CM " << px/GeV 
165              << " " << py/GeV << " " << pz/GeV    164              << " " << py/GeV << " " << pz/GeV << " " << p/GeV 
166              << G4endl;                           165              << G4endl;
167     }                                             166     }
168                                                   167 
169     // Transform to lab system                    168     // Transform to lab system
170                                                   169 
171     G4double E1pM2 = E1 + M2;                     170     G4double E1pM2 = E1 + M2;
172     G4double betaCM  = P/E1pM2;                   171     G4double betaCM  = P/E1pM2;
173     G4double betaCMx = Px/E1pM2;                  172     G4double betaCMx = Px/E1pM2;
174     G4double betaCMy = Py/E1pM2;                  173     G4double betaCMy = Py/E1pM2;
175     G4double betaCMz = Pz/E1pM2;                  174     G4double betaCMz = Pz/E1pM2;
176     G4double gammaCM = E1pM2/std::sqrt(E1pM2*E    175     G4double gammaCM = E1pM2/std::sqrt(E1pM2*E1pM2 - P*P);
177                                                   176 
178     if (verboseLevel > 1) {                       177     if (verboseLevel > 1) {
179       G4cout << "  betaCM " << betaCMx << " "     178       G4cout << "  betaCM " << betaCMx << " " << betaCMy << " "
180              << betaCMz << " " << betaCM << G4    179              << betaCMz << " " << betaCM << G4endl;
181       G4cout << "  gammaCM " << gammaCM << G4e    180       G4cout << "  gammaCM " << gammaCM << G4endl;
182     }                                             181     }
183                                                   182 
184     // Now following GLOREN...                    183     // Now following GLOREN...
185                                                   184 
186     G4double BETA[5], PA[5], PB[5];               185     G4double BETA[5], PA[5], PB[5];
187     BETA[1] = -betaCMx;                           186     BETA[1] = -betaCMx;
188     BETA[2] = -betaCMy;                           187     BETA[2] = -betaCMy;
189     BETA[3] = -betaCMz;                           188     BETA[3] = -betaCMz;
190     BETA[4] = gammaCM;                            189     BETA[4] = gammaCM;
191                                                   190 
192     //The incident particle...                    191     //The incident particle...
193                                                   192 
194     PA[1] = px;                                   193     PA[1] = px;
195     PA[2] = py;                                   194     PA[2] = py;
196     PA[3] = pz;                                   195     PA[3] = pz;
197     PA[4] = std::sqrt(M1*M1 + p*p);               196     PA[4] = std::sqrt(M1*M1 + p*p);
198                                                   197 
199     G4double BETPA  = BETA[1]*PA[1] + BETA[2]*    198     G4double BETPA  = BETA[1]*PA[1] + BETA[2]*PA[2] + BETA[3]*PA[3];
200     G4double BPGAM  = (BETPA * BETA[4]/(BETA[4    199     G4double BPGAM  = (BETPA * BETA[4]/(BETA[4] + 1.) - PA[4]) * BETA[4];
201                                                   200 
202     PB[1] = PA[1] + BPGAM  * BETA[1];             201     PB[1] = PA[1] + BPGAM  * BETA[1];
203     PB[2] = PA[2] + BPGAM  * BETA[2];             202     PB[2] = PA[2] + BPGAM  * BETA[2];
204     PB[3] = PA[3] + BPGAM  * BETA[3];             203     PB[3] = PA[3] + BPGAM  * BETA[3];
205     PB[4] = (PA[4] - BETPA) * BETA[4];            204     PB[4] = (PA[4] - BETPA) * BETA[4];
206                                                   205 
207     G4DynamicParticle* newP = new G4DynamicPar    206     G4DynamicParticle* newP = new G4DynamicParticle;
208     newP->SetDefinition(aParticle->GetDefiniti    207     newP->SetDefinition(aParticle->GetDefinition());
209     newP->SetMomentum(G4ThreeVector(PB[1], PB[    208     newP->SetMomentum(G4ThreeVector(PB[1], PB[2], PB[3]));
210                                                   209 
211     //The target particle...                      210     //The target particle...
212                                                   211 
213     PA[1] = -px;                                  212     PA[1] = -px;
214     PA[2] = -py;                                  213     PA[2] = -py;
215     PA[3] = -pz;                                  214     PA[3] = -pz;
216     PA[4] = std::sqrt(M2*M2 + p*p);               215     PA[4] = std::sqrt(M2*M2 + p*p);
217                                                   216 
218     BETPA  = BETA[1]*PA[1] + BETA[2]*PA[2] + B    217     BETPA  = BETA[1]*PA[1] + BETA[2]*PA[2] + BETA[3]*PA[3];
219     BPGAM  = (BETPA * BETA[4]/(BETA[4] + 1.) -    218     BPGAM  = (BETPA * BETA[4]/(BETA[4] + 1.) - PA[4]) * BETA[4];
220                                                   219 
221     PB[1] = PA[1] + BPGAM  * BETA[1];             220     PB[1] = PA[1] + BPGAM  * BETA[1];
222     PB[2] = PA[2] + BPGAM  * BETA[2];             221     PB[2] = PA[2] + BPGAM  * BETA[2];
223     PB[3] = PA[3] + BPGAM  * BETA[3];             222     PB[3] = PA[3] + BPGAM  * BETA[3];
224     PB[4] = (PA[4] - BETPA) * BETA[4];            223     PB[4] = (PA[4] - BETPA) * BETA[4];
225                                                   224 
226     targetParticle->SetMomentum(G4ThreeVector(    225     targetParticle->SetMomentum(G4ThreeVector(PB[1], PB[2], PB[3]));
227                                                   226 
228     if (verboseLevel > 1) {                       227     if (verboseLevel > 1) {
229       G4cout << "  particle 1 momentum in LAB     228       G4cout << "  particle 1 momentum in LAB " 
230            << newP->GetMomentum()*(1./GeV)        229            << newP->GetMomentum()*(1./GeV) 
231            << " " << newP->GetTotalMomentum()/    230            << " " << newP->GetTotalMomentum()/GeV << G4endl;
232       G4cout << "  particle 2 momentum in LAB     231       G4cout << "  particle 2 momentum in LAB " 
233            << targetParticle->GetMomentum()*(1    232            << targetParticle->GetMomentum()*(1./GeV) 
234            << " " << targetParticle->GetTotalM    233            << " " << targetParticle->GetTotalMomentum()/GeV << G4endl;
235       G4cout << "  TOTAL momentum in LAB "        234       G4cout << "  TOTAL momentum in LAB " 
236            << (newP->GetMomentum()+targetParti    235            << (newP->GetMomentum()+targetParticle->GetMomentum())*(1./GeV) 
237            << " "                                 236            << " " 
238            << (newP->GetMomentum()+targetParti    237            << (newP->GetMomentum()+targetParticle->GetMomentum()).mag()/GeV
239            << G4endl;                             238            << G4endl;
240     }                                             239     }
241                                                   240 
242     theParticleChange.SetMomentumChange(newP->    241     theParticleChange.SetMomentumChange(newP->GetMomentumDirection());
243     theParticleChange.SetEnergyChange(newP->Ge    242     theParticleChange.SetEnergyChange(newP->GetKineticEnergy());
244     delete newP;                                  243     delete newP;
245     theParticleChange.AddSecondary(targetParti << 244     theParticleChange.AddSecondary(targetParticle);    
246                                                   245 
247     return &theParticleChange;                    246     return &theParticleChange;
248 }                                                 247 }
249                                                   248 
250 //////////////////////////////////////////////    249 ////////////////////////////////////////////////////////////////////
251 //                                                250 //
252 // sample momentum transfer using Lab. momentu    251 // sample momentum transfer using Lab. momentum
253                                                   252 
254 G4double                                          253 G4double 
255 G4LEHadronProtonElastic::SampleInvariantT(cons    254 G4LEHadronProtonElastic::SampleInvariantT(const G4ParticleDefinition* p, 
256             G4double plab, G4int , G4int )        255             G4double plab, G4int , G4int )
257 {                                                 256 {
258   G4double hMass = p->GetPDGMass();               257   G4double hMass = p->GetPDGMass();
259   G4double pCMS = 0.5*plab;                       258   G4double pCMS = 0.5*plab;
260   // pCMS *= 50;                                  259   // pCMS *= 50;
261   G4double hEcms = std::sqrt(pCMS*pCMS+hMass*h    260   G4double hEcms = std::sqrt(pCMS*pCMS+hMass*hMass);
262   // G4double gamma = hEcms/hMass;                261   // G4double gamma = hEcms/hMass;
263   // gamma  *= 15;                                262   // gamma  *= 15;
264   G4double beta =  pCMS/hEcms; // std::sqrt(1-    263   G4double beta =  pCMS/hEcms; // std::sqrt(1-1./gamma/gamma); //
265   // beta /= 0.8; // 0.95; // 1.0; // 1.1 // 0    264   // beta /= 0.8; // 0.95; // 1.0; // 1.1 // 0.5*pi; // pi; twopi;
266   G4double cosDipole =  RandCosThetaDipPen();     265   G4double cosDipole =  RandCosThetaDipPen();
267   G4double cosTheta = cosDipole + beta;           266   G4double cosTheta = cosDipole + beta;
268   cosTheta /= 1. + cosDipole*beta;                267   cosTheta /= 1. + cosDipole*beta;
269   G4double t = 2.*pCMS*pCMS*(1.-cosTheta);        268   G4double t = 2.*pCMS*pCMS*(1.-cosTheta);
270   return t;                                       269   return t;
271                                                   270 
272 }                                                 271 }
273                                                   272 
274 //////////////////////////////////////////////    273 ///////////////////////////////////////////////////////////////
275 //                                                274 //
276 // 1 + cos^2(theta) random distribution in the    275 // 1 + cos^2(theta) random distribution in the projectile rest frame, Penelope algorithm
277                                                   276 
278 G4double G4LEHadronProtonElastic::RandCosTheta    277 G4double G4LEHadronProtonElastic::RandCosThetaDipPen()
279 {                                                 278 {
280   G4double x, cosTheta, signX, modX, power = 1    279   G4double x, cosTheta, signX, modX, power = 1./3.;
281                                                   280 
282   if( G4UniformRand() > 0.25)                     281   if( G4UniformRand() > 0.25) 
283   {                                               282   {
284     cosTheta = 2.*G4UniformRand()-1.;             283     cosTheta = 2.*G4UniformRand()-1.;
285   }                                               284   }
286   else                                            285   else
287   {                                               286   {
288     x     = 2.*G4UniformRand()-1.;                287     x     = 2.*G4UniformRand()-1.;
289                                                   288 
290     if ( x < 0. )                                 289     if ( x < 0. ) 
291     {                                             290     {
292       modX = -x;                                  291       modX = -x;
293       signX = -1.;                                292       signX = -1.;
294     }                                             293     }
295     else                                          294     else
296     {                                             295     {
297       modX = x;                                   296       modX = x;
298       signX = 1.;                                 297       signX = 1.;
299     }                                             298     }
300     cosTheta = signX*G4Pow::GetInstance()->pow    299     cosTheta = signX*G4Pow::GetInstance()->powA(modX,power);
301   }                                               300   }
302   return cosTheta;                                301   return cosTheta; 
303 }                                                 302 }
304                                                   303 
305  // end of file                                   304  // end of file
306                                                   305