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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/electromagnetic/standard/src/G4CoulombScattering.cc (Version 11.3.0) and /processes/electromagnetic/standard/src/G4CoulombScattering.cc (Version 11.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 // -------------------------------------------     27 // -------------------------------------------------------------------
 28 //                                                 28 //
 29 // GEANT4 Class file                               29 // GEANT4 Class file
 30 //                                                 30 //
 31 //                                                 31 //
 32 // File name:     G4CoulombScattering              32 // File name:     G4CoulombScattering
 33 //                                                 33 //
 34 // Author:        Vladimir Ivanchenko              34 // Author:        Vladimir Ivanchenko 
 35 //                                                 35 //
 36 // Creation date: 22.08.2004                       36 // Creation date: 22.08.2004
 37 //                                                 37 //
 38 // Modifications:                                  38 // Modifications:
 39 // 01.08.06 V.Ivanchenko add choice between G4     39 // 01.08.06 V.Ivanchenko add choice between G4eCoulombScatteringModel and
 40 //          G4CoulombScatteringModel               40 //          G4CoulombScatteringModel
 41 //                                                 41 //
 42                                                    42 
 43 //                                                 43 //
 44 // -------------------------------------------     44 // -------------------------------------------------------------------
 45 //                                                 45 //
 46 //....oooOO0OOooo........oooOO0OOooo........oo     46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 47 //....oooOO0OOooo........oooOO0OOooo........oo     47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 48                                                    48 
 49 #include "G4CoulombScattering.hh"                  49 #include "G4CoulombScattering.hh"
 50 #include "G4SystemOfUnits.hh"                      50 #include "G4SystemOfUnits.hh"
 51 #include "G4eCoulombScatteringModel.hh"            51 #include "G4eCoulombScatteringModel.hh"
 52 #include "G4IonCoulombScatteringModel.hh"          52 #include "G4IonCoulombScatteringModel.hh"
 53 #include "G4Proton.hh"                             53 #include "G4Proton.hh"
 54 #include "G4EmParameters.hh"                       54 #include "G4EmParameters.hh"
 55                                                    55 
 56 //....oooOO0OOooo........oooOO0OOooo........oo     56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 57                                                    57 
 58 G4CoulombScattering::G4CoulombScattering(const     58 G4CoulombScattering::G4CoulombScattering(const G4String& nam, G4bool comb)
 59   : G4VEmProcess(nam),                             59   : G4VEmProcess(nam),
 60     q2Max(CLHEP::TeV*CLHEP::TeV),                  60     q2Max(CLHEP::TeV*CLHEP::TeV),
 61     isCombined(comb)                               61     isCombined(comb)
 62 {                                                  62 {
 63   SetBuildTableFlag(true);                         63   SetBuildTableFlag(true);
 64   SetStartFromNullFlag(false);                     64   SetStartFromNullFlag(false);
 65   SetSplineFlag(false);                            65   SetSplineFlag(false);
 66   SetCrossSectionType(fEmOnePeak);                 66   SetCrossSectionType(fEmOnePeak);
 67   SetSecondaryParticle(G4Proton::Proton());        67   SetSecondaryParticle(G4Proton::Proton());
 68   SetProcessSubType(fCoulombScattering);           68   SetProcessSubType(fCoulombScattering);
 69 }                                                  69 }
 70                                                    70 
 71 //....oooOO0OOooo........oooOO0OOooo........oo     71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 72                                                    72 
 73 G4CoulombScattering::G4CoulombScattering(const     73 G4CoulombScattering::G4CoulombScattering(const G4String& nam)
 74   : G4CoulombScattering(nam, true)                 74   : G4CoulombScattering(nam, true)
 75 {}                                                 75 {}
 76                                                    76  
 77 //....oooOO0OOooo........oooOO0OOooo........oo     77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 78                                                    78 
 79 G4CoulombScattering::G4CoulombScattering(G4boo     79 G4CoulombScattering::G4CoulombScattering(G4bool comb)
 80   : G4CoulombScattering("CoulombScat", comb)       80   : G4CoulombScattering("CoulombScat", comb)
 81 {}                                                 81 {}
 82                                                    82  
 83 //....oooOO0OOooo........oooOO0OOooo........oo     83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 84                                                    84 
 85 G4CoulombScattering::~G4CoulombScattering() =      85 G4CoulombScattering::~G4CoulombScattering() = default;
 86                                                    86 
 87 //....oooOO0OOooo........oooOO0OOooo........oo     87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 88                                                    88 
 89 G4bool G4CoulombScattering::IsApplicable(const     89 G4bool G4CoulombScattering::IsApplicable(const G4ParticleDefinition& p)
 90 {                                                  90 {
 91   return (p.GetPDGCharge() != 0.0);                91   return (p.GetPDGCharge() != 0.0);
 92 }                                                  92 }
 93                                                    93 
 94 //....oooOO0OOooo........oooOO0OOooo........oo     94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 95                                                    95 
 96 void G4CoulombScattering::InitialiseProcess(co     96 void G4CoulombScattering::InitialiseProcess(const G4ParticleDefinition* p)
 97 {                                                  97 {
 98   // second initialisation not allowed for the     98   // second initialisation not allowed for the time being
 99   // this means that polar angle limit change      99   // this means that polar angle limit change will not be appled 
100   // after first initialisation                   100   // after first initialisation
101   if(isInitialised) { return; }                   101   if(isInitialised) { return; }
102                                                   102 
103   G4EmParameters* param = G4EmParameters::Inst    103   G4EmParameters* param = G4EmParameters::Instance();
104   G4double a = param->FactorForAngleLimit()*CL    104   G4double a = param->FactorForAngleLimit()*CLHEP::hbarc/CLHEP::fermi;
105   q2Max = 0.5*a*a;                                105   q2Max = 0.5*a*a;
106   G4double theta = param->MscThetaLimit();        106   G4double theta = param->MscThetaLimit();
107                                                   107 
108   // restricted or non-restricted cross sectio    108   // restricted or non-restricted cross section table
109   if(isCombined) {                                109   if(isCombined) {
110     if(theta == CLHEP::pi) {                      110     if(theta == CLHEP::pi) {
111       // for restriced single scattering chang    111       // for restriced single scattering change cross section shape
112       SetCrossSectionType(fEmIncreasing);         112       SetCrossSectionType(fEmIncreasing);
113       SetStartFromNullFlag(true);                 113       SetStartFromNullFlag(true);
114     }                                             114     }
115   } else {                                        115   } else {
116     SetSplineFlag(true);                          116     SetSplineFlag(true);
117     SetCrossSectionType(fEmDecreasing);           117     SetCrossSectionType(fEmDecreasing);
118   }                                               118   }
119   isInitialised = true;                           119   isInitialised = true;
120   G4double mass = p->GetPDGMass();                120   G4double mass = p->GetPDGMass();
121   G4String name = p->GetParticleName();           121   G4String name = p->GetParticleName();
122                                                   122   
123   G4bool ion = false;                             123   G4bool ion = false;
124   if (mass > CLHEP::GeV || p->GetParticleType(    124   if (mass > CLHEP::GeV || p->GetParticleType() == "nucleus") {
125     SetBuildTableFlag(false);                     125     SetBuildTableFlag(false);
126     ion = true;                                   126     ion = true;
127     if(name != "GenericIon") { SetVerboseLevel    127     if(name != "GenericIon") { SetVerboseLevel(0); }
128   } else {                                        128   } else {
129     if(name != "e-" && name != "e+" &&            129     if(name != "e-" && name != "e+" &&
130        name != "mu+" && name != "mu-" && name     130        name != "mu+" && name != "mu-" && name != "pi+" && 
131        name != "kaon+" && name != "proton" ) {    131        name != "kaon+" && name != "proton" ) { SetVerboseLevel(0); }
132   }                                               132   }
133   /*                                              133   /*
134   G4cout << "### G4CoulombScattering::Initiali    134   G4cout << "### G4CoulombScattering::InitialiseProcess: "
135      << p->GetParticleName()                      135      << p->GetParticleName()
136    << " Emin(MeV)= " << MinKinEnergy()/MeV        136    << " Emin(MeV)= " << MinKinEnergy()/MeV
137    << " Emax(TeV)= " << MaxKinEnergy()/TeV        137    << " Emax(TeV)= " << MaxKinEnergy()/TeV
138    << " nbins= " << LambdaBinning()               138    << " nbins= " << LambdaBinning()
139    << " theta= " << theta                         139    << " theta= " << theta
140    << " mass(MeV)= " << mass                      140    << " mass(MeV)= " << mass
141    << " isCombined=" << isCombined                141    << " isCombined=" << isCombined
142    << " ion=" << ion                              142    << " ion=" << ion
143    << G4endl;                                     143    << G4endl;
144   */                                              144   */
145   if(nullptr == EmModel(0)) {                     145   if(nullptr == EmModel(0)) { 
146     if(ion) { SetEmModel(new G4IonCoulombScatt    146     if(ion) { SetEmModel(new G4IonCoulombScatteringModel()); }
147     else { SetEmModel(new G4eCoulombScattering    147     else { SetEmModel(new G4eCoulombScatteringModel(isCombined)); } 
148   }                                               148   }
149   G4VEmModel* model = EmModel(0);                 149   G4VEmModel* model = EmModel(0);
150   G4double emin = std::max(param->MinKinEnergy    150   G4double emin = std::max(param->MinKinEnergy(),model->LowEnergyLimit());
151   G4double emax = std::min(param->MaxKinEnergy    151   G4double emax = std::min(param->MaxKinEnergy(),model->HighEnergyLimit());
152   model->SetPolarAngleLimit(theta);               152   model->SetPolarAngleLimit(theta);
153   model->SetLowEnergyLimit(emin);                 153   model->SetLowEnergyLimit(emin);
154   model->SetHighEnergyLimit(emax);                154   model->SetHighEnergyLimit(emax);
155   AddEmModel(1, model);                           155   AddEmModel(1, model);
156 }                                                 156 }
157                                                   157 
158 //....oooOO0OOooo........oooOO0OOooo........oo    158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
159                                                   159 
160 G4double G4CoulombScattering::MinPrimaryEnergy    160 G4double G4CoulombScattering::MinPrimaryEnergy(const G4ParticleDefinition* part,
161                  const G4Material* mat)           161                  const G4Material* mat)
162 {                                                 162 {
163   // Pure Coulomb scattering                      163   // Pure Coulomb scattering
164   G4double emin = 0.0;                            164   G4double emin = 0.0;
165                                                   165 
166   // Coulomb scattering combined with multiple    166   // Coulomb scattering combined with multiple or hadronic scattering
167   G4double theta = G4EmParameters::Instance()-    167   G4double theta = G4EmParameters::Instance()->MscThetaLimit();
168                                                   168 
169   if(0.0 < theta) {                               169   if(0.0 < theta) {
170     G4double p2 = q2Max*mat->GetIonisation()->    170     G4double p2 = q2Max*mat->GetIonisation()->GetInvA23()/(1.0 - std::cos(theta));
171     G4double mass = part->GetPDGMass();           171     G4double mass = part->GetPDGMass();
172     emin = p2/(std::sqrt(p2 + mass*mass) + mas    172     emin = p2/(std::sqrt(p2 + mass*mass) + mass);
173   }                                               173   }
174                                                   174 
175   return emin;                                    175   return emin;
176 }                                                 176 }
177                                                   177 
178 //....oooOO0OOooo........oooOO0OOooo........oo    178 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
179                                                   179 
180 void G4CoulombScattering::StreamProcessInfo(st    180 void G4CoulombScattering::StreamProcessInfo(std::ostream& outFile) const
181 {                                                 181 {
182   G4double tetmin = G4EmParameters::Instance()    182   G4double tetmin = G4EmParameters::Instance()->MscThetaLimit()/CLHEP::degree;
183   outFile << "      ";                            183   outFile << "      ";
184   if(tetmin > 179.) { outFile << "ThetaMin(p)"    184   if(tetmin > 179.) { outFile << "ThetaMin(p)"; }
185   else              { outFile << tetmin; }        185   else              { outFile << tetmin; }
186   outFile << " < Theta(degree) < 180";            186   outFile << " < Theta(degree) < 180";
187                                                   187 
188   if(q2Max < DBL_MAX) {                           188   if(q2Max < DBL_MAX) {
189     outFile << ", pLimit(GeV^1)= " << std::sqr    189     outFile << ", pLimit(GeV^1)= " << std::sqrt(q2Max)/GeV;
190   }                                               190   }
191   outFile << G4endl;                              191   outFile << G4endl;
192 }                                                 192 }
193                                                   193 
194 //....oooOO0OOooo........oooOO0OOooo........oo    194 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
195                                                   195 
196 void G4CoulombScattering::ProcessDescription(s    196 void G4CoulombScattering::ProcessDescription(std::ostream& out) const
197 {                                                 197 {
198   out <<                                          198   out <<
199   "  Coulomb scattering. Simulation of elastic    199   "  Coulomb scattering. Simulation of elastic scattering\n" << 
200   "    events individually. May be used in com    200   "    events individually. May be used in combination with multiple\n" << 
201   "    scattering, where Coulomb scattering is    201   "    scattering, where Coulomb scattering is used for hard (large angle)\n" <<
202   "    collisions and multiple scattering for     202   "    collisions and multiple scattering for soft collisions.";
203   G4VEmProcess::ProcessDescription(out);          203   G4VEmProcess::ProcessDescription(out);
204 }                                                 204 }
205                                                   205 
206 //....oooOO0OOooo........oooOO0OOooo........oo    206 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 
207                                                   207