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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/electromagnetic/standard/src/G4eSingleCoulombScatteringModel.cc (Version 11.3.0) and /processes/electromagnetic/standard/src/G4eSingleCoulombScatteringModel.cc (Version 8.2.p1)


  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 //  G4eSingleCoulombScatteringModel.cc            
 27 // -------------------------------------------    
 28 //                                                
 29 // GEANT4 Class header file                       
 30 //                                                
 31 // File name:    G4eSingleCoulombScatteringMod    
 32 //                                                
 33 // Author:      Cristina Consolandi               
 34 //                                                
 35 // Creation date: 20.10.2012                      
 36 //                                                
 37 //  Class Description:                            
 38 //  Single Scattering model for electron-nucle    
 39 //  Suitable for high energy electrons and low    
 40 //                                                
 41 //                                                
 42 // Reference:                                     
 43 //      M.J. Boschini et al. "Non Ionizing Ene    
 44 //      in the Space Environment" Proc. of the    
 45 //      on Particle Physics and Advanced Techn    
 46 //                                                
 47 //  (13th ICPPAT, Como 3-7/10/2011), World Sci    
 48 //  Available at: http://arxiv.org/abs/1111.40    
 49 //                                                
 50 //                                                
 51 // -------------------------------------------    
 52 //                                                
 53 //....oooOO0OOooo........oooOO0OOooo........oo    
 54                                                   
 55                                                   
 56 #include "G4eSingleCoulombScatteringModel.hh"     
 57 #include "G4PhysicalConstants.hh"                 
 58 #include "G4SystemOfUnits.hh"                     
 59 #include "Randomize.hh"                           
 60 #include "G4ParticleChangeForGamma.hh"            
 61 #include "G4Proton.hh"                            
 62 #include "G4ProductionCutsTable.hh"               
 63 #include "G4NucleiProperties.hh"                  
 64 #include "G4NistManager.hh"                       
 65 #include "G4ParticleTable.hh"                     
 66 #include "G4IonTable.hh"                          
 67                                                   
 68 #include "G4UnitsTable.hh"                        
 69 #include "G4EmParameters.hh"                      
 70                                                   
 71 //....oooOO0OOooo........oooOO0OOooo........oo    
 72                                                   
 73 using namespace std;                              
 74                                                   
 75 G4eSingleCoulombScatteringModel::G4eSingleCoul    
 76   : G4VEmModel(nam),                              
 77     cosThetaMin(1.0)                              
 78 {                                                 
 79   fNistManager = G4NistManager::Instance();       
 80   theIonTable = G4ParticleTable::GetParticleTa    
 81   fParticleChange = nullptr;                      
 82                                                   
 83   pCuts=nullptr;                                  
 84   currentMaterial = nullptr;                      
 85   currentElement  = nullptr;                      
 86   currentCouple = nullptr;                        
 87                                                   
 88   lowEnergyLimit  = 0*keV;                        
 89   recoilThreshold = 0.*eV;                        
 90   XSectionModel = 1;                              
 91   FormFactor = 0;                                 
 92   particle = nullptr;                             
 93   mass=0.0;                                       
 94   currentMaterialIndex = -1;                      
 95                                                   
 96   Mottcross = new G4ScreeningMottCrossSection(    
 97   //G4cout <<"## G4eSingleCoulombScatteringMod    
 98 }                                                 
 99                                                   
100 //....oooOO0OOooo........oooOO0OOooo........oo    
101                                                   
102 G4eSingleCoulombScatteringModel::~G4eSingleCou    
103 {                                                 
104   //G4cout <<"## G4eSingleCoulombScatteringMod    
105   delete Mottcross;                               
106 }                                                 
107                                                   
108 //....oooOO0OOooo........oooOO0OOooo........oo    
109                                                   
110 void G4eSingleCoulombScatteringModel::Initiali    
111              const G4DataVector&  cuts)           
112 {                                                 
113   G4EmParameters* param = G4EmParameters::Inst    
114                                                   
115   SetupParticle(p);                               
116   currentCouple = nullptr;                        
117   currentMaterialIndex = -1;                      
118   //cosThetaMin = cos(PolarAngleLimit());         
119   Mottcross->Initialise(p,cosThetaMin);           
120                                                   
121   pCuts = &cuts;                                  
122   //G4ProductionCutsTable::GetProductionCutsTa    
123                                                   
124   /*                                              
125   G4cout << "!!! G4eSingleCoulombScatteringMod    
126          << part->GetParticleName() << "  cos(    
127          << "  cos(TetMax)= " << cosThetaMax <    
128   G4cout << "cut= " << (*pCuts)[0] << "  cut1=    
129   */                                              
130                                                   
131   if(!fParticleChange) {                          
132     fParticleChange = GetParticleChangeForGamm    
133   }                                               
134                                                   
135   if(IsMaster()) {                                
136     InitialiseElementSelectors(p,cuts);           
137   }                                               
138                                                   
139   FormFactor=param->NuclearFormfactorType();      
140                                                   
141   //G4cout<<"NUCLEAR FORM FACTOR: "<<FormFacto    
142 }                                                 
143                                                   
144 //....oooOO0OOooo........oooOO0OOooo........oo    
145                                                   
146 void                                              
147 G4eSingleCoulombScatteringModel::InitialiseLoc    
148                                                   
149 {                                                 
150   SetElementSelectors(masterModel->GetElementS    
151 }                                                 
152                                                   
153 //....oooOO0OOooo........oooOO0OOooo........oo    
154                                                   
155 void G4eSingleCoulombScatteringModel::SetXSect    
156 {                                                 
157   if(model == "Fast" || model == "fast")          
158   else if(model == "Precise" || model == "prec    
159   else {                                          
160     G4cout<<"G4eSingleCoulombScatteringModel W    
161     <<" is not a valid model name"<<G4endl;       
162   }                                               
163 }                                                 
164                                                   
165 //....oooOO0OOooo........oooOO0OOooo........oo    
166                                                   
167 G4double G4eSingleCoulombScatteringModel::Comp    
168                                 const G4Partic    
169         G4double kinEnergy,                       
170         G4double Z,                               
171         G4double ,                                
172         G4double,                                 
173         G4double )                                
174 {                                                 
175   SetupParticle(p);                               
176                                                   
177   G4double cross =0.0;                            
178   if(kinEnergy < lowEnergyLimit) return cross;    
179                                                   
180   DefineMaterial(CurrentCouple());                
181                                                   
182   //Total Cross section                           
183   Mottcross->SetupKinematic(kinEnergy, Z);        
184   cross = Mottcross->NuclearCrossSection(FormF    
185                                                   
186   //cout<< "Compute Cross Section....cross "<<    
187                                                   
188   //G4cout<<"Energy: "<<kinEnergy/MeV<<" Total    
189   return cross;                                   
190 }                                                 
191                                                   
192 //....oooOO0OOooo........oooOO0OOooo........oo    
193                                                   
194 void G4eSingleCoulombScatteringModel::SampleSe    
195              std::vector<G4DynamicParticle*>*     
196              const G4MaterialCutsCouple* coupl    
197              const G4DynamicParticle* dp,         
198              G4double cutEnergy,                  
199              G4double)                            
200 {                                                 
201   G4double kinEnergy = dp->GetKineticEnergy();    
202   //cout<<"--- kinEnergy "<<kinEnergy<<endl;      
203                                                   
204   if(kinEnergy < lowEnergyLimit) return;          
205                                                   
206   DefineMaterial(couple);                         
207   SetupParticle(dp->GetDefinition());             
208                                                   
209   // Choose nucleus                               
210   //last two :cutEnergy= min e kinEnergy=max      
211   currentElement = SelectTargetAtom(couple, pa    
212                                dp->GetLogKinet    
213   G4int iz    = currentElement->GetZasInt();      
214   G4int ia = SelectIsotopeNumber(currentElemen    
215   G4double mass2 = G4NucleiProperties::GetNucl    
216                                                   
217   //G4cout<<"..Z: "<<Z<<" ..iz: "<<iz<<" ..ia:    
218                                                   
219   Mottcross->SetupKinematic(kinEnergy, iz);       
220   G4double cross= Mottcross->NuclearCrossSecti    
221   if(cross == 0.0) { return; }                    
222   //cout<< "Energy: "<<kinEnergy/MeV<<" Z: "<<    
223                                                   
224   G4double z1 = Mottcross->GetScatteringAngle(    
225   G4double sint = sin(z1);                        
226   G4double cost = cos(z1);                        
227   G4double phi  = twopi* G4UniformRand();         
228                                                   
229   // kinematics in the Lab system                 
230   G4double ptot = sqrt(kinEnergy*(kinEnergy +     
231   G4double e1   = mass + kinEnergy;               
232                                                   
233   // Lab. system kinematics along projectile d    
234   G4LorentzVector v0 = G4LorentzVector(0, 0, p    
235   G4LorentzVector v1 = G4LorentzVector(0, 0, p    
236   G4ThreeVector bst = v0.boostVector();           
237   v1.boost(-bst);                                 
238   // CM projectile                                
239   G4double momCM = v1.pz();                       
240                                                   
241   // Momentum after scattering of incident par    
242   v1.setX(momCM*sint*cos(phi));                   
243   v1.setY(momCM*sint*sin(phi));                   
244   v1.setZ(momCM*cost);                            
245                                                   
246   // CM--->Lab                                    
247   v1.boost(bst);                                  
248                                                   
249   // Rotate to global system                      
250   G4ThreeVector dir = dp->GetMomentumDirection    
251   G4ThreeVector newDirection = v1.vect().unit(    
252   newDirection.rotateUz(dir);                     
253                                                   
254   fParticleChange->ProposeMomentumDirection(ne    
255                                                   
256   // recoil                                       
257   v0 -= v1;                                       
258   G4double trec = std::max(v0.e() - mass2, 0.0    
259   G4double edep = 0.0;                            
260                                                   
261   G4double tcut = recoilThreshold;                
262                                                   
263   //G4cout<<" Energy Transfered: "<<trec/eV<<G    
264                                                   
265   if(pCuts) {                                     
266     tcut= std::max(tcut,(*pCuts)[currentMateri    
267     //G4cout<<"Cuts: "<<(*pCuts)[currentMateri    
268     //G4cout<<"Threshold: "<<tcut/eV<<" eV"<<G    
269   }                                               
270                                                   
271   if(trec > tcut) {                               
272     G4ParticleDefinition* ion = theIonTable->G    
273     newDirection = v0.vect().unit();              
274     newDirection.rotateUz(dir);                   
275     auto newdp  = new G4DynamicParticle(ion, n    
276     fvect->push_back(newdp);                      
277   } else if(trec > 0.0) {                         
278     edep = trec;                                  
279     fParticleChange->ProposeNonIonizingEnergyD    
280   }                                               
281                                                   
282   // finelize primary energy and energy balanc    
283   G4double finalT = v1.e() - mass;                
284   //G4cout<<"Final Energy: "<<finalT/eV<<G4end    
285   if(finalT <= lowEnergyLimit) {                  
286     edep += finalT;                               
287     finalT = 0.0;                                 
288   }                                               
289   edep = std::max(edep, 0.0);                     
290   fParticleChange->SetProposedKineticEnergy(fi    
291   fParticleChange->ProposeLocalEnergyDeposit(e    
292                                                   
293 }                                                 
294                                                   
295 //....oooOO0OOooo........oooOO0OOooo........oo    
296