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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/G4eDPWACoulombScatteringModel.cc (Version 11.3.0) and /processes/electromagnetic/standard/src/G4eDPWACoulombScatteringModel.cc (Version 10.2.p2)


  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 //                                                
 29 // GEANT4 Class header file                       
 30 //                                                
 31 //                                                
 32 // File name:     G4eDPWACoulombScatteringMode    
 33 //                                                
 34 // Author:        Mihaly Novak                    
 35 //                                                
 36 // Creation date: 02.07.2020                      
 37 //                                                
 38 // Modifications:                                 
 39 //                                                
 40 // -------------------------------------------    
 41                                                   
 42 #include "G4eDPWACoulombScatteringModel.hh"       
 43                                                   
 44 #include "G4eDPWAElasticDCS.hh"                   
 45 #include "G4ParticleChangeForGamma.hh"            
 46 #include "G4ParticleDefinition.hh"                
 47 #include "G4DataVector.hh"                        
 48                                                   
 49 #include "G4ProductionCutsTable.hh"               
 50 #include "G4Material.hh"                          
 51 #include "G4Element.hh"                           
 52 #include "G4ElementVector.hh"                     
 53                                                   
 54 #include "G4Electron.hh"                          
 55                                                   
 56 #include "G4PhysicalConstants.hh"                 
 57 #include "G4SystemOfUnits.hh"                     
 58 #include "Randomize.hh"                           
 59 #include "G4ThreeVector.hh"                       
 60                                                   
 61                                                   
 62 G4eDPWACoulombScatteringModel::G4eDPWACoulombS    
 63 : G4VEmModel("eDPWACoulombScattering"),           
 64   fIsMixedModel(ismixed),                         
 65   fIsScpCorrection(isscpcor),                     
 66   fMuMin(mumin),                                  
 67   fTheDCS(nullptr),                               
 68   fParticleChange(nullptr)                        
 69 {                                                 
 70   SetLowEnergyLimit (  0.0*CLHEP::eV);  // eki    
 71   SetHighEnergyLimit(100.0*CLHEP::MeV); // eki    
 72 }                                                 
 73                                                   
 74                                                   
 75 G4eDPWACoulombScatteringModel::~G4eDPWACoulomb    
 76 {                                                 
 77   if (IsMaster()) {                               
 78     delete fTheDCS;                               
 79   }                                               
 80 }                                                 
 81                                                   
 82                                                   
 83 void G4eDPWACoulombScatteringModel::Initialise    
 84                                                   
 85 {                                                 
 86   if(!fParticleChange) {                          
 87     fParticleChange = GetParticleChangeForGamm    
 88   }                                               
 89   fMuMin        = 0.5*(1.0-std::cos(PolarAngle    
 90   fIsMixedModel = (fMuMin > 0.0);                 
 91   if(IsMaster()) {                                
 92     // clean the G4eDPWAElasticDCS object if a    
 93     delete fTheDCS;                               
 94     fTheDCS = new G4eDPWAElasticDCS(pdef==G4El    
 95     // init only for the elements that are use    
 96     G4ProductionCutsTable* theCpTable = G4Prod    
 97     G4int numOfCouples = (G4int)theCpTable->Ge    
 98     for(G4int j=0; j<numOfCouples; ++j) {         
 99       const G4Material* mat = theCpTable->GetM    
100       const G4ElementVector* elV = mat->GetEle    
101       std::size_t numOfElem = mat->GetNumberOf    
102       for (std::size_t ie = 0; ie < numOfElem;    
103         fTheDCS->InitialiseForZ((*elV)[ie]->Ge    
104       }                                           
105     }                                             
106     // init scattering power correction           
107     if (fIsScpCorrection) {                       
108       fTheDCS->InitSCPCorrection(LowEnergyLimi    
109     }                                             
110     // will make use of the cross sections so     
111     InitialiseElementSelectors(pdef, prodcuts)    
112   }                                               
113 }                                                 
114                                                   
115                                                   
116 void G4eDPWACoulombScatteringModel::Initialise    
117                                                   
118 {                                                 
119   SetElementSelectors(masterModel->GetElementS    
120   SetTheDCS(static_cast<G4eDPWACoulombScatteri    
121 }                                                 
122                                                   
123                                                   
124 G4double                                          
125 G4eDPWACoulombScatteringModel::ComputeCrossSec    
126                                                   
127                                                   
128                                                   
129                                                   
130                                                   
131 {                                                 
132   // Cross sections are computed by numerical     
133   // DCS data between the muMin, muMax limits     
134   // In case of single scattering model (i.e.     
135   // In case of mixed simulation model  (i.e.     
136   // NOTE: cross sections will be zero if the     
137   //       [10 eV-100 MeV] range for which DCS    
138   //                                              
139   G4double elCS  = 0.0;          // elastic cr    
140   G4double tr1CS = 0.0;          // first tran    
141   G4double tr2CS = 0.0;          // second tra    
142   const G4double muMin = fMuMin;                  
143   const G4double muMax = 1.0;                     
144   fTheDCS->ComputeCSPerAtom((G4int)Z, ekin, el    
145   // scattering power correction: should be on    
146   if (fIsScpCorrection && CurrentCouple()) {      
147     const G4double theScpCor = fTheDCS->Comput    
148     elCS *= (theScpCor*(1.0+1.0/Z));              
149   }                                               
150   return std::max(0.0, elCS);                     
151 }                                                 
152                                                   
153                                                   
154 void                                              
155 G4eDPWACoulombScatteringModel::SampleSecondari    
156                                                   
157                                                   
158                                                   
159 {                                                 
160   const G4double    ekin   = dp->GetKineticEne    
161   const G4double    lekin  = dp->GetLogKinetic    
162   const G4Element*  target = SelectTargetAtom(    
163   const G4int       izet   = target->GetZasInt    
164   // sample cosine of the polar scattering ang    
165   CLHEP::HepRandomEngine* rndmEngine = G4Rando    
166   G4double cost = 1.0;                            
167   if (!fIsMixedModel) {                           
168     G4double rndm[3];                             
169     rndmEngine->flatArray(3, rndm);               
170     cost = fTheDCS->SampleCosineTheta(izet, le    
171   } else {                                        
172     //sample cost between costMax,costMin wher    
173     const G4double costMax = 1.0-2.0*fMuMin;      
174     const G4double costMin = -1.0;                
175     G4double rndm[2];                             
176     rndmEngine->flatArray(2, rndm);               
177     cost = fTheDCS->SampleCosineThetaRestricte    
178   }                                               
179   // compute the new direction in the scatteri    
180   const G4double sint = std::sqrt((1.0-cost)*(    
181   const G4double phi  = CLHEP::twopi*rndmEngin    
182   G4ThreeVector theNewDirection(sint*std::cos(    
183   // get original direction in lab frame and r    
184   G4ThreeVector theOrgDirectionLab = dp->GetMo    
185   theNewDirection.rotateUz(theOrgDirectionLab)    
186   // set new direction                            
187   fParticleChange->ProposeMomentumDirection(th    
188 }                                                 
189                                                   
190                                                   
191                                                   
192                                                   
193                                                   
194