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.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/utils/src/G4VEmModel.cc (Version 11.3.0) and /processes/electromagnetic/utils/src/G4VEmModel.cc (Version 8.0)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                    <<   3 // * DISCLAIMER                                                       *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th <<   5 // * The following disclaimer summarizes all the specific disclaimers *
  6 // * the Geant4 Collaboration.  It is provided <<   6 // * of contributors to this software. The specific disclaimers,which *
  7 // * conditions of the Geant4 Software License <<   7 // * govern, are listed with their locations in:                      *
  8 // * LICENSE and available at  http://cern.ch/ <<   8 // *   http://cern.ch/geant4/license                                  *
  9 // * include a list of copyright holders.      << 
 10 // *                                                9 // *                                                                  *
 11 // * Neither the authors of this software syst     10 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     11 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     12 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     13 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  <<  14 // * use.                                                             *
 16 // * for the full disclaimer and the limitatio << 
 17 // *                                               15 // *                                                                  *
 18 // * This  code  implementation is the result  <<  16 // * This  code  implementation is the  intellectual property  of the *
 19 // * technical work of the GEANT4 collaboratio <<  17 // * GEANT4 collaboration.                                            *
 20 // * By using,  copying,  modifying or  distri <<  18 // * By copying,  distributing  or modifying the Program (or any work *
 21 // * any work based  on the software)  you  ag <<  19 // * based  on  the Program)  you indicate  your  acceptance of  this *
 22 // * use  in  resulting  scientific  publicati <<  20 // * statement, and all its terms.                                    *
 23 // * acceptance of all terms of the Geant4 Sof << 
 24 // *******************************************     21 // ********************************************************************
 25 //                                                 22 //
                                                   >>  23 // $Id: G4VEmModel.cc,v 1.3 2005/10/25 18:28:58 vnivanch Exp $
                                                   >>  24 // GEANT4 tag $Name: geant4-08-00 $
                                                   >>  25 //
 26 // -------------------------------------------     26 // -------------------------------------------------------------------
 27 //                                                 27 //
 28 // GEANT4 Class file                               28 // GEANT4 Class file
 29 //                                                 29 //
 30 //                                                 30 //
 31 // File name:     G4VEmModel                       31 // File name:     G4VEmModel
 32 //                                                 32 //
 33 // Author:        Vladimir Ivanchenko              33 // Author:        Vladimir Ivanchenko
 34 //                                                 34 //
 35 // Creation date: 25.07.2005                       35 // Creation date: 25.07.2005
 36 //                                                 36 //
 37 // Modifications:                                  37 // Modifications:
 38 // 25.10.2005 Set default highLimit=100.TeV (V     38 // 25.10.2005 Set default highLimit=100.TeV (V.Ivanchenko)
 39 // 06.02.2006 add method ComputeMeanFreePath() << 
 40 // 16.02.2009 Move implementations of virtual  << 
 41 //                                                 39 //
 42 //                                                 40 //
 43 // Class Description:                              41 // Class Description:
 44 //                                                 42 //
 45 // Abstract interface to energy loss models        43 // Abstract interface to energy loss models
 46                                                    44 
 47 // -------------------------------------------     45 // -------------------------------------------------------------------
 48 //                                                 46 //
 49                                                    47 
 50 #include "G4VEmModel.hh"                           48 #include "G4VEmModel.hh"
 51 #include "G4ElementData.hh"                    << 
 52 #include "G4LossTableManager.hh"               << 
 53 #include "G4LossTableBuilder.hh"               << 
 54 #include "G4ProductionCutsTable.hh"            << 
 55 #include "G4ParticleChangeForLoss.hh"          << 
 56 #include "G4ParticleChangeForGamma.hh"         << 
 57 #include "G4EmParameters.hh"                   << 
 58 #include "G4SystemOfUnits.hh"                  << 
 59 #include "G4EmUtility.hh"                      << 
 60 #include "G4Log.hh"                            << 
 61 #include "Randomize.hh"                        << 
 62 #include <iostream>                            << 
 63                                                    49 
 64 //....oooOO0OOooo........oooOO0OOooo........oo <<  50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 65 //....oooOO0OOooo........oooOO0OOooo........oo <<  51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 66                                                    52 
 67 G4VEmModel::G4VEmModel(const G4String& nam):       53 G4VEmModel::G4VEmModel(const G4String& nam):
 68   inveplus(1.0/CLHEP::eplus),                  <<  54   lowLimit(0.1*keV), highLimit(100.0*TeV), fluc(0), name(nam), pParticleChange(0)
 69   lowLimit(0.1*CLHEP::keV),                    << 
 70   highLimit(100.0*CLHEP::TeV),                 << 
 71   polarAngleLimit(CLHEP::pi),                  << 
 72   name(nam)                                    << 
 73 {                                              << 
 74   xsec.resize(nsec);                           << 
 75   fEmManager = G4LossTableManager::Instance(); << 
 76   fEmManager->Register(this);                  << 
 77   isMaster = fEmManager->IsMaster();           << 
 78                                                << 
 79   G4LossTableBuilder* bld = fEmManager->GetTab << 
 80   theDensityFactor = bld->GetDensityFactors(); << 
 81   theDensityIdx = bld->GetCoupleIndexes();     << 
 82 }                                              << 
 83                                                << 
 84 //....oooOO0OOooo........oooOO0OOooo........oo << 
 85                                                << 
 86 G4VEmModel::~G4VEmModel()                      << 
 87 {                                              << 
 88   if(localElmSelectors) {                      << 
 89     for(G4int i=0; i<nSelectors; ++i) {        << 
 90       delete (*elmSelectors)[i];               << 
 91     }                                          << 
 92     delete elmSelectors;                       << 
 93   }                                            << 
 94   delete anglModel;                            << 
 95                                                << 
 96   if(localTable && xSectionTable != nullptr) { << 
 97     xSectionTable->clearAndDestroy();          << 
 98     delete xSectionTable;                      << 
 99     xSectionTable = nullptr;                   << 
100   }                                            << 
101   fEmManager->DeRegister(this);                << 
102 }                                              << 
103                                                << 
104 //....oooOO0OOooo........oooOO0OOooo........oo << 
105                                                << 
106 G4ParticleChangeForLoss* G4VEmModel::GetPartic << 
107 {                                              << 
108   G4ParticleChangeForLoss* p = nullptr;        << 
109   if (pParticleChange != nullptr) {            << 
110     p = static_cast<G4ParticleChangeForLoss*>( << 
111   } else {                                     << 
112     p = new G4ParticleChangeForLoss();         << 
113     pParticleChange = p;                       << 
114   }                                            << 
115   if(fTripletModel != nullptr) { fTripletModel << 
116   return p;                                    << 
117 }                                              << 
118                                                << 
119 //....oooOO0OOooo........oooOO0OOooo........oo << 
120                                                << 
121 G4ParticleChangeForGamma* G4VEmModel::GetParti << 
122 {                                              << 
123   G4ParticleChangeForGamma* p = nullptr;       << 
124   if (pParticleChange != nullptr) {            << 
125     p = static_cast<G4ParticleChangeForGamma*> << 
126   } else {                                     << 
127     p = new G4ParticleChangeForGamma();        << 
128     pParticleChange = p;                       << 
129   }                                            << 
130   if(fTripletModel != nullptr) { fTripletModel << 
131   return p;                                    << 
132 }                                              << 
133                                                << 
134 //....oooOO0OOooo........oooOO0OOooo........oo << 
135                                                << 
136 void G4VEmModel::InitialiseElementSelectors(co << 
137                                             co << 
138 {                                              << 
139   if(highLimit <= lowLimit) { return; }        << 
140   G4EmUtility::InitialiseElementSelectors(this << 
141   localElmSelectors = true;                    << 
142 }                                              << 
143                                                << 
144 //....oooOO0OOooo........oooOO0OOooo........oo << 
145                                                << 
146 void G4VEmModel::InitialiseLocal(const G4Parti << 
147 {}                                                 55 {}
148                                                    56 
149 //....oooOO0OOooo........oooOO0OOooo........oo <<  57 G4VEmModel::~G4VEmModel()
150                                                << 
151 void G4VEmModel::InitialiseForMaterial(const G << 
152                                        const G << 
153 {                                              << 
154   if(material != nullptr) {                    << 
155     G4int n = (G4int)material->GetNumberOfElem << 
156     for(G4int i=0; i<n; ++i) {                 << 
157       G4int Z = material->GetElement(i)->GetZa << 
158       InitialiseForElement(part, Z);           << 
159     }                                          << 
160   }                                            << 
161 }                                              << 
162                                                << 
163 //....oooOO0OOooo........oooOO0OOooo........oo << 
164                                                << 
165 void G4VEmModel::InitialiseForElement(const G4 << 
166 {}                                                 58 {}
167                                                    59 
168 //....oooOO0OOooo........oooOO0OOooo........oo <<  60 G4double G4VEmModel::CrossSectionPerVolume(
169                                                <<  61                                         const G4Material* material,
170 G4double G4VEmModel::ComputeDEDXPerVolume(cons <<  62           const G4ParticleDefinition* p,
171                                           cons <<  63                 G4double ekin,
172                                           G4do <<  64                 G4double emin,
                                                   >>  65                                               G4double emax)
173 {                                                  66 {
174   return 0.0;                                  << 
175 }                                              << 
176                                                << 
177 //....oooOO0OOooo........oooOO0OOooo........oo << 
178                                                << 
179 G4double G4VEmModel::CrossSectionPerVolume(con << 
180                                            con << 
181                                            G4d << 
182                                            G4d << 
183                                            G4d << 
184 {                                              << 
185   SetupForMaterial(p, mat, ekin);              << 
186   const G4double* theAtomNumDensityVector = ma << 
187   G4int nelm = (G4int)mat->GetNumberOfElements << 
188   if(nelm > nsec) {                            << 
189     xsec.resize(nelm);                         << 
190     nsec = nelm;                               << 
191   }                                            << 
192   G4double cross = 0.0;                            67   G4double cross = 0.0;
193   for (G4int i=0; i<nelm; ++i) {               <<  68   const G4ElementVector* theElementVector = material->GetElementVector();
                                                   >>  69   const G4double* theAtomNumDensityVector = material->GetVecNbOfAtomsPerVolume();
                                                   >>  70   size_t nelm = material->GetNumberOfElements();
                                                   >>  71   for (size_t i=0; i<nelm; i++) {
                                                   >>  72     const G4Element* elm = (*theElementVector)[i];
194     cross += theAtomNumDensityVector[i]*           73     cross += theAtomNumDensityVector[i]*
195       ComputeCrossSectionPerAtom(p,mat->GetEle <<  74              ComputeCrossSectionPerAtom(p,ekin,elm->GetZ(),elm->GetN(),emin,emax);
196     xsec[i] = cross;                               75     xsec[i] = cross;
197   }                                                76   }
198   return cross;                                    77   return cross;
199 }                                                  78 }
200                                                    79 
201 //....oooOO0OOooo........oooOO0OOooo........oo << 
202                                                << 
203 G4double G4VEmModel::GetPartialCrossSection(co << 
204                                             co << 
205                                             G4 << 
206 {                                              << 
207   return 0.0;                                  << 
208 }                                              << 
209                                                << 
210 //....oooOO0OOooo........oooOO0OOooo........oo << 
211                                                << 
212 void G4VEmModel::StartTracking(G4Track*)       << 
213 {}                                             << 
214                                                << 
215 //....oooOO0OOooo........oooOO0OOooo........oo << 
216                                                << 
217 const G4Element* G4VEmModel::SelectRandomAtom( << 
218                                                << 
219                                                << 
220                                                << 
221                                                << 
222 {                                              << 
223   G4int n = (G4int)mat->GetNumberOfElements(); << 
224   fCurrentElement = mat->GetElement(0);        << 
225   if (n > 1) {                                 << 
226     const G4double x = G4UniformRand()*        << 
227       G4VEmModel::CrossSectionPerVolume(mat,pd << 
228     for(G4int i=0; i<n; ++i) {                 << 
229       if (x <= xsec[i]) {                      << 
230         fCurrentElement = mat->GetElement(i);  << 
231         break;                                 << 
232       }                                        << 
233     }                                          << 
234   }                                            << 
235   return fCurrentElement;                      << 
236 }                                              << 
237                                                << 
238 //....oooOO0OOooo........oooOO0OOooo........oo << 
239                                                << 
240 const G4Element* G4VEmModel::GetCurrentElement << 
241 {                                              << 
242   const G4Element* elm = fCurrentElement;      << 
243   if(nullptr == elm && nullptr != mat) {       << 
244     elm = G4EmUtility::SampleRandomElement(mat << 
245   }                                            << 
246   return elm;                                  << 
247 }                                              << 
248                                                << 
249 //....oooOO0OOooo........oooOO0OOooo........oo << 
250                                                << 
251 G4int G4VEmModel::SelectRandomAtomNumber(const << 
252 {                                              << 
253   const G4Element* elm = GetCurrentElement(mat << 
254   return (nullptr == elm) ? 0 : elm->GetZasInt << 
255 }                                              << 
256                                                << 
257 //....oooOO0OOooo........oooOO0OOooo........oo << 
258                                                << 
259 const G4Isotope* G4VEmModel::GetCurrentIsotope << 
260 {                                              << 
261   const G4Isotope* iso = nullptr;              << 
262   const G4Element* el = elm;                   << 
263   if(nullptr == el && nullptr != fCurrentCoupl << 
264     el = GetCurrentElement(fCurrentCouple->Get << 
265   }                                            << 
266   if(nullptr != el) {                          << 
267     iso = G4EmUtility::SampleRandomIsotope(el) << 
268   }                                            << 
269   return iso;                                  << 
270 }                                              << 
271                                                << 
272 //....oooOO0OOooo........oooOO0OOooo........oo << 
273                                                << 
274 G4int G4VEmModel::SelectIsotopeNumber(const G4 << 
275 {                                              << 
276   auto iso = GetCurrentIsotope(elm);           << 
277   return (nullptr != iso) ? iso->GetN() : 0;   << 
278 }                                              << 
279                                                << 
280 //....oooOO0OOooo........oooOO0OOooo........oo << 
281                                                << 
282 G4double G4VEmModel::ComputeCrossSectionPerAto << 
283                                                << 
284                                                << 
285 {                                              << 
286   return 0.0;                                  << 
287 }                                              << 
288                                                << 
289 //....oooOO0OOooo........oooOO0OOooo........oo << 
290                                                << 
291 G4double                                       << 
292 G4VEmModel::ComputeCrossSectionPerShell(const  << 
293                                         G4int, << 
294                                         G4doub << 
295 {                                              << 
296   return 0.0;                                  << 
297 }                                              << 
298                                                << 
299 //....oooOO0OOooo........oooOO0OOooo........oo << 
300                                                << 
301 void G4VEmModel::DefineForRegion(const G4Regio << 
302 {}                                             << 
303                                                << 
304 //....oooOO0OOooo........oooOO0OOooo........oo << 
305                                                << 
306 void G4VEmModel::FillNumberOfSecondaries(G4int << 
307                                          G4int << 
308 {                                              << 
309   numberOfTriplets = 0;                        << 
310   numberOfRecoil = 0;                          << 
311 }                                              << 
312                                                << 
313 //....oooOO0OOooo........oooOO0OOooo........oo << 
314                                                << 
315 G4double G4VEmModel::ChargeSquareRatio(const G << 
316 {                                              << 
317   return GetChargeSquareRatio(track.GetParticl << 
318                               track.GetMateria << 
319 }                                              << 
320                                                << 
321 //....oooOO0OOooo........oooOO0OOooo........oo << 
322                                                << 
323 G4double G4VEmModel::GetChargeSquareRatio(cons << 
324                                           cons << 
325 {                                              << 
326   const G4double q = p->GetPDGCharge()*inveplu << 
327   return q*q;                                  << 
328 }                                              << 
329                                                << 
330 //....oooOO0OOooo........oooOO0OOooo........oo << 
331                                                << 
332 G4double G4VEmModel::GetParticleCharge(const G << 
333                                        const G << 
334 {                                              << 
335   return p->GetPDGCharge();                    << 
336 }                                              << 
337                                                << 
338 //....oooOO0OOooo........oooOO0OOooo........oo << 
339                                                << 
340 void G4VEmModel::CorrectionsAlongStep(const G4 << 
341                                       const G4 << 
342                                       const G4 << 
343 {}                                             << 
344                                                << 
345 //....oooOO0OOooo........oooOO0OOooo........oo << 
346                                                << 
347 G4double G4VEmModel::Value(const G4MaterialCut << 
348                            const G4ParticleDef << 
349 {                                              << 
350   SetCurrentCouple(couple);                    << 
351   return pFactor*e*e*CrossSectionPerVolume(pBa << 
352 }                                              << 
353                                                << 
354 //....oooOO0OOooo........oooOO0OOooo........oo << 
355                                                << 
356 G4double G4VEmModel::MinPrimaryEnergy(const G4 << 
357                                       const G4 << 
358                                       G4double << 
359 {                                              << 
360   return 0.0;                                  << 
361 }                                              << 
362                                                << 
363 //....oooOO0OOooo........oooOO0OOooo........oo << 
364                                                << 
365 G4double G4VEmModel::MinEnergyCut(const G4Part << 
366                                   const G4Mate << 
367 {                                              << 
368   return 0.0;                                  << 
369 }                                              << 
370                                                << 
371 //....oooOO0OOooo........oooOO0OOooo........oo << 
372                                                << 
373 G4double G4VEmModel::MaxSecondaryEnergy(const  << 
374                                         G4doub << 
375 {                                              << 
376   return kineticEnergy;                        << 
377 }                                              << 
378                                                << 
379 //....oooOO0OOooo........oooOO0OOooo........oo << 
380                                                << 
381 void G4VEmModel::SetupForMaterial(const G4Part << 
382                                   const G4Mate << 
383 {                                              << 
384   GetChargeSquareRatio(p, mat, ekin);          << 
385 }                                              << 
386                                                << 
387 //....oooOO0OOooo........oooOO0OOooo........oo << 
388                                                << 
389 void                                           << 
390 G4VEmModel::SetParticleChange(G4VParticleChang << 
391 {                                              << 
392   if(p != nullptr && pParticleChange != p) { p << 
393   if(flucModel != f) { flucModel = f; }        << 
394 }                                              << 
395                                                << 
396 //....oooOO0OOooo........oooOO0OOooo........oo << 
397                                                << 
398 void G4VEmModel::SetCrossSectionTable(G4Physic << 
399 {                                              << 
400   xSectionTable = p;                           << 
401   localTable = isLocal;                        << 
402 }                                              << 
403                                                << 
404 //....oooOO0OOooo........oooOO0OOooo........oo << 
405                                                << 
406 void G4VEmModel::SetLPMFlag(G4bool)            << 
407 {                                              << 
408   if (G4EmParameters::Instance()->Verbose() >  << 
409     G4ExceptionDescription ed;                 << 
410     ed << "The obsolete method SetLPMFlag(..)  << 
411        << " is called. Please, use G4EmParamet << 
412        << " instead";                          << 
413     G4Exception("G4VEmModel::SetLPMFlag", "em0 << 
414   }                                            << 
415 }                                              << 
416                                                << 
417 //....oooOO0OOooo........oooOO0OOooo........oo     80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
418                                                    81 
419 void G4VEmModel::SetMasterThread(G4bool)       << 
420 {}                                             << 
421                                                << 
422 //....oooOO0OOooo........oooOO0OOooo........oo << 
423                                                << 
424 void  G4VEmModel::ModelDescription(std::ostrea << 
425 {                                              << 
426   outFile << "The description for this model h << 
427 }                                              << 
428                                                    82 
429 //....oooOO0OOooo........oooOO0OOooo........oo << 
430                                                    83