source: trunk/source/processes/electromagnetic/utils/src/G4VEmModel.cc @ 948

Last change on this file since 948 was 819, checked in by garnier, 16 years ago

import all except CVS

File size: 3.9 KB
Line 
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: G4VEmModel.cc,v 1.8 2007/09/25 10:19:07 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-01-patch-02 $
28//
29// -------------------------------------------------------------------
30//
31// GEANT4 Class file
32//
33//
34// File name:     G4VEmModel
35//
36// Author:        Vladimir Ivanchenko
37//
38// Creation date: 25.07.2005
39//
40// Modifications:
41// 25.10.2005 Set default highLimit=100.TeV (V.Ivanchenko)
42// 06.02.2006 add method ComputeMeanFreePath() (mma)
43//
44//
45// Class Description:
46//
47// Abstract interface to energy loss models
48
49// -------------------------------------------------------------------
50//
51
52#include "G4VEmModel.hh"
53
54//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
56
57G4VEmModel::G4VEmModel(const G4String& nam):
58 lowLimit(0.1*keV), highLimit(100.0*TeV), fluc(0), name(nam), pParticleChange(0)
59{}
60
61//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
62
63G4VEmModel::~G4VEmModel()
64{}
65
66//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
67
68G4double G4VEmModel::CrossSectionPerVolume(const G4Material* material,
69                                           const G4ParticleDefinition* p,
70                                                 G4double ekin,
71                                                 G4double emin,
72                                                 G4double emax)
73{
74  G4double cross = 0.0;
75  const G4ElementVector* theElementVector = material->GetElementVector();
76  const G4double* theAtomNumDensityVector = material->GetVecNbOfAtomsPerVolume();
77  size_t nelm = material->GetNumberOfElements();
78  for (size_t i=0; i<nelm; i++) {
79    const G4Element* elm = (*theElementVector)[i];
80    cross += theAtomNumDensityVector[i]*
81      ComputeCrossSectionPerAtom(p,ekin,elm->GetZ(),elm->GetN(),emin,emax);
82    xsec[i] = cross;
83  }
84  return cross;
85}
86
87//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
88
89G4double G4VEmModel::ComputeMeanFreePath(const G4ParticleDefinition* p,
90                                               G4double ekin,
91                                         const G4Material* material,     
92                                               G4double emin,
93                                               G4double emax)
94{
95  G4double mfp = DBL_MAX;
96  G4double cross = CrossSectionPerVolume(material,p,ekin,emin,emax);
97  if (cross > DBL_MIN) mfp = 1./cross;
98  return mfp;
99}
100
101//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
102
103
Note: See TracBrowser for help on using the repository browser.