Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4TablesForExtrapolator.cc
이 파일의 문서화 페이지로 가기
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4TablesForExtrapolator.cc 75145 2013-10-28 18:34:48Z vnivanch $
27 //
28 //---------------------------------------------------------------------------
29 //
30 // ClassName: G4TablesForExtrapolator
31 //
32 // Description: This class provide calculation of energy loss, fluctuation,
33 // and msc angle
34 //
35 // Author: 09.12.04 V.Ivanchenko
36 //
37 // Modification:
38 // 08-04-05 Rename Propogator -> Extrapolator (V.Ivanchenko)
39 // 16-03-06 Add muon tables and fix bug in units (V.Ivanchenko)
40 // 21-03-06 Add verbosity defined in the constructor and Initialisation
41 // start only when first public method is called (V.Ivanchenko)
42 // 03-05-06 Remove unused pointer G4Material* from number of methods (VI)
43 // 12-05-06 SEt linLossLimit=0.001 (VI)
44 //
45 //----------------------------------------------------------------------------
46 //
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
49 
51 #include "G4PhysicalConstants.hh"
52 #include "G4SystemOfUnits.hh"
53 #include "G4PhysicsLogVector.hh"
54 #include "G4ParticleDefinition.hh"
55 #include "G4Material.hh"
56 #include "G4MaterialCutsCouple.hh"
57 #include "G4Electron.hh"
58 #include "G4Positron.hh"
59 #include "G4Proton.hh"
60 #include "G4MuonPlus.hh"
61 #include "G4MuonMinus.hh"
62 #include "G4EmParameters.hh"
63 #include "G4MollerBhabhaModel.hh"
64 #include "G4BetheBlochModel.hh"
68 #include "G4ProductionCuts.hh"
69 #include "G4LossTableBuilder.hh"
70 #include "G4WentzelVIModel.hh"
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
73 
75  G4double e1, G4double e2)
76  : verbose(verb), nbins(bins), emin(e1), emax(e2)
77 {
79 }
80 
81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
82 
84 {
85  for(G4int i=0; i<nmat; i++) {delete couples[i];}
86 
100 
101  delete dedxElectron;
102  delete dedxPositron;
103  delete dedxProton;
104  delete dedxMuon;
105  delete rangeElectron;
106  delete rangePositron;
107  delete rangeProton;
108  delete rangeMuon;
109  delete invRangeElectron;
110  delete invRangePositron;
111  delete invRangeProton;
112  delete invRangeMuon;
113  delete mscElectron;
114  delete pcuts;
115 }
116 
117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
118 
119 const G4PhysicsTable*
121 {
122  const G4PhysicsTable* table = nullptr;
123  switch (type)
124  {
125  case fDedxElectron:
126  table = dedxElectron;
127  break;
128  case fDedxPositron:
129  table = dedxPositron;
130  break;
131  case fDedxProton:
132  table = dedxProton;
133  break;
134  case fDedxMuon:
135  table = dedxMuon;
136  break;
137  case fRangeElectron:
138  table = rangeElectron;
139  break;
140  case fRangePositron:
141  table = rangePositron;
142  break;
143  case fRangeProton:
144  table = rangeProton;
145  break;
146  case fRangeMuon:
147  table = rangeMuon;
148  break;
149  case fInvRangeElectron:
150  table = invRangeElectron;
151  break;
152  case fInvRangePositron:
153  table = invRangePositron;
154  break;
155  case fInvRangeProton:
156  table = invRangeProton;
157  break;
158  case fInvRangeMuon:
159  table = invRangeMuon;
160  break;
161  case fMscElectron:
162  table = mscElectron;
163  }
164  return table;
165 }
166 
167 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
168 
170 {
171  if(verbose>1) {
172  G4cout << "### G4TablesForExtrapolator::Initialisation" << G4endl;
173  }
174  currentParticle = nullptr;
175 
181 
182  mass = charge2 = 0.0;
183 
186  pcuts = new G4ProductionCuts();
187 
188  couples.resize(nmat,0);
189  cuts.resize(nmat,DBL_MAX);
190 
191  for(G4int i=0; i<nmat; ++i) {
192  couples[i] = new G4MaterialCutsCouple((*mtable)[i],pcuts);
193  }
194 
196 
210 
211  G4LossTableBuilder builder;
212 
213  if(verbose>1) {
214  G4cout << "### G4TablesForExtrapolator Builds electron tables"
215  << G4endl;
216  }
220 
221  if(verbose>1) {
222  G4cout << "### G4TablesForExtrapolator Builds positron tables"
223  << G4endl;
224  }
228 
229  if(verbose>1) {
230  G4cout << "### G4TablesForExtrapolator Builds muon tables" << G4endl;
231  }
235  /*
236  G4cout << "DEDX MUON" << G4endl
237  G4cout << *dedxMuon << G4endl;
238  G4cout << "RANGE MUON" << G4endl
239  G4cout << *rangeMuon << G4endl;
240  G4cout << "INVRANGE MUON" << G4endl
241  G4cout << *invRangeMuon << G4endl;
242  */
243  if(verbose>1) {
244  G4cout << "### G4TablesForExtrapolator Builds proton tables"
245  << G4endl;
246  }
250 
252 }
253 
254 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
255 
257 {
258  G4PhysicsTable* table = new G4PhysicsTable();
259 
260  for(G4int i=0; i<nmat; ++i) {
261 
263  v->SetSpline(splineFlag);
264  table->push_back(v);
265  }
266  return table;
267 }
268 
269 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
270 
272  const G4ParticleDefinition* part,
273  G4PhysicsTable* table)
274 {
277  ioni->Initialise(part, cuts);
278  brem->Initialise(part, cuts);
279 
281  charge2 = 1.0;
283 
285  if(0<verbose) {
286  G4cout << "G4TablesForExtrapolator::ComputeElectronDEDX for "
287  << part->GetParticleName()
288  << G4endl;
289  }
290  for(G4int i=0; i<nmat; ++i) {
291 
292  const G4Material* mat = (*mtable)[i];
293  if(1<verbose) {
294  G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl;
295  }
296  const G4MaterialCutsCouple* couple = couples[i];
297  G4PhysicsVector* aVector = (*table)[i];
298 
299  for(G4int j=0; j<=nbins; ++j) {
300 
301  G4double e = aVector->Energy(j);
302  G4double dedx = ioni->ComputeDEDX(couple,part,e,e)
303  + brem->ComputeDEDX(couple,part,e,e);
304  if(1<verbose) {
305  G4cout << "j= " << j
306  << " e(MeV)= " << e/MeV
307  << " dedx(Mev/cm)= " << dedx*cm/MeV
308  << " dedx(Mev.cm2/g)= "
309  << dedx/((MeV*mat->GetDensity())/(g/cm2))
310  << G4endl;
311  }
312  aVector->PutValue(j,dedx);
313  }
314  if(splineFlag) { aVector->FillSecondDerivatives(); }
315  }
316  delete ioni;
317  delete brem;
318 }
319 
320 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
321 
322 void
324  G4PhysicsTable* table)
325 {
326  G4BetheBlochModel* ioni = new G4BetheBlochModel();
329  ioni->Initialise(part, cuts);
330  pair->Initialise(part, cuts);
331  brem->Initialise(part, cuts);
332 
333  mass = part->GetPDGMass();
334  charge2 = 1.0;
336 
338 
339  if(0<verbose) {
340  G4cout << "G4TablesForExtrapolator::ComputeMuonDEDX for "
341  << part->GetParticleName()
342  << G4endl;
343  }
344 
345  for(G4int i=0; i<nmat; ++i) {
346 
347  const G4Material* mat = (*mtable)[i];
348  if(1<verbose) {
349  G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl;
350  }
351  const G4MaterialCutsCouple* couple = couples[i];
352  G4PhysicsVector* aVector = (*table)[i];
353  for(G4int j=0; j<=nbins; j++) {
354 
355  G4double e = aVector->Energy(j);
356  G4double dedx = ioni->ComputeDEDX(couple,part,e,e) +
357  pair->ComputeDEDX(couple,part,e,e) +
358  brem->ComputeDEDX(couple,part,e,e);
359  aVector->PutValue(j,dedx);
360  if(1<verbose) {
361  G4cout << "j= " << j
362  << " e(MeV)= " << e/MeV
363  << " dedx(Mev/cm)= " << dedx*cm/MeV
364  << " dedx(Mev/(g/cm2)= "
365  << dedx/((MeV*mat->GetDensity())/(g/cm2))
366  << G4endl;
367  }
368  }
369  if(splineFlag) { aVector->FillSecondDerivatives(); }
370  }
371  delete ioni;
372 }
373 
374 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
375 
376 void
378  G4PhysicsTable* table)
379 {
380  G4BetheBlochModel* ioni = new G4BetheBlochModel();
381  ioni->Initialise(part, cuts);
382 
383  mass = part->GetPDGMass();
384  charge2 = 1.0;
386 
388 
389  if(0<verbose) {
390  G4cout << "G4TablesForExtrapolator::ComputeProtonDEDX for "
391  << part->GetParticleName()
392  << G4endl;
393  }
394 
395  for(G4int i=0; i<nmat; ++i) {
396 
397  const G4Material* mat = (*mtable)[i];
398  if(1<verbose)
399  G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl;
400  const G4MaterialCutsCouple* couple = couples[i];
401  G4PhysicsVector* aVector = (*table)[i];
402  for(G4int j=0; j<=nbins; j++) {
403 
404  G4double e = aVector->Energy(j);
405  G4double dedx = ioni->ComputeDEDX(couple,part,e,e);
406  aVector->PutValue(j,dedx);
407  if(1<verbose) {
408  G4cout << "j= " << j
409  << " e(MeV)= " << e/MeV
410  << " dedx(Mev/cm)= " << dedx*cm/MeV
411  << " dedx(Mev.cm2/g)= " << dedx/((mat->GetDensity())/(g/cm2))
412  << G4endl;
413  }
414  }
415  if(splineFlag) { aVector->FillSecondDerivatives(); }
416  }
417  delete ioni;
418 }
419 
420 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
421 
422 void
424  G4PhysicsTable* table)
425 {
426  G4WentzelVIModel* msc = new G4WentzelVIModel();
428  msc->Initialise(part, cuts);
429 
430  mass = part->GetPDGMass();
431  charge2 = 1.0;
433 
435 
436  if(0<verbose) {
437  G4cout << "G4TablesForExtrapolator::ComputeProtonDEDX for "
438  << part->GetParticleName()
439  << G4endl;
440  }
441 
442  for(G4int i=0; i<nmat; ++i) {
443 
444  const G4Material* mat = (*mtable)[i];
445  msc->SetCurrentCouple(couples[i]);
446  if(1<verbose)
447  G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl;
448  G4PhysicsVector* aVector = (*table)[i];
449  for(G4int j=0; j<=nbins; j++) {
450 
451  G4double e = aVector->Energy(j);
452  G4double xs = msc->CrossSectionPerVolume(mat,part,e);
453  aVector->PutValue(j,xs);
454  if(1<verbose) {
455  G4cout << "j= " << j << " e(MeV)= " << e/MeV
456  << " xs(1/mm)= " << xs*mm << G4endl;
457  }
458  }
459  if(splineFlag) { aVector->FillSecondDerivatives(); }
460  }
461  delete msc;
462 }
463 
464 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
465 
G4double Energy(size_t index) const
void ComputeTrasportXS(const G4ParticleDefinition *part, G4PhysicsTable *table)
void BuildRangeTable(const G4PhysicsTable *dedxTable, G4PhysicsTable *rangeTable, G4bool isIonisation=false)
G4TablesForExtrapolator(G4int verb, G4int bins, G4double e1, G4double e2)
void ComputeProtonDEDX(const G4ParticleDefinition *part, G4PhysicsTable *table)
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:600
static constexpr double MeV
Definition: G4SIunits.hh:214
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:593
static constexpr double mm
Definition: G4SIunits.hh:115
#define G4endl
Definition: G4ios.hh:61
std::vector< const G4MaterialCutsCouple * > couples
const G4String & GetParticleName() const
void BuildInverseRangeTable(const G4PhysicsTable *rangeTable, G4PhysicsTable *invRangeTable, G4bool isIonisation=false)
static const G4double emax
static G4MuonMinus * MuonMinus()
Definition: G4MuonMinus.cc:100
static G4Proton * Proton()
Definition: G4Proton.cc:93
void SetCurrentCouple(const G4MaterialCutsCouple *)
Definition: G4VEmModel.hh:455
G4double GetPDGMass() const
const G4String & GetName() const
Definition: G4Material.hh:179
static constexpr double g
Definition: G4SIunits.hh:183
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &) override
double G4double
Definition: G4Types.hh:76
TString part[npart]
Definition: Style.C:32
const G4ParticleDefinition * positron
static constexpr double cm2
Definition: G4SIunits.hh:120
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &) override
const G4ParticleDefinition * proton
static constexpr double electron_mass_c2
void SetSpline(G4bool)
void FillSecondDerivatives()
virtual G4double ComputeDEDX(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=DBL_MAX)
Definition: G4VEmModel.hh:500
void SetPolarAngleLimit(G4double)
Definition: G4VEmModel.hh:742
static G4Positron * Positron()
Definition: G4Positron.cc:94
const G4PhysicsTable * GetPhysicsTable(ExtTableType type) const
Float_t mat
const G4ParticleDefinition * muonPlus
static G4Electron * Electron()
Definition: G4Electron.cc:94
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &) override
std::vector< G4Material * > G4MaterialTable
virtual G4double CrossSectionPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
Definition: G4VEmModel.cc:252
void push_back(G4PhysicsVector *)
void ComputeMuonDEDX(const G4ParticleDefinition *part, G4PhysicsTable *table)
int G4int
Definition: G4Types.hh:78
const G4ParticleDefinition * currentParticle
static G4MuonPlus * MuonPlus()
Definition: G4MuonPlus.cc:99
static constexpr double cm
Definition: G4SIunits.hh:119
G4GLOB_DLL std::ostream G4cout
void clearAndDestroy()
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &) override
void ComputeElectronDEDX(const G4ParticleDefinition *part, G4PhysicsTable *table)
const G4ParticleDefinition * muonMinus
#define DBL_MAX
Definition: templates.hh:83
const G4ParticleDefinition * electron
G4bool Spline() const
static G4EmParameters * Instance()
void PutValue(size_t index, G4double theValue)
static constexpr double pi
Definition: SystemOfUnits.h:54
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &) override
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &) override
G4double GetDensity() const
Definition: G4Material.hh:181