source: trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionElasticChampion.cc @ 989

Last change on this file since 989 was 968, checked in by garnier, 15 years ago

fichier ajoutes

File size: 3.8 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: G4CrossSectionElasticChampion.cc,v 1.4 2008/12/05 11:58:16 sincerti Exp $
27// GEANT4 tag $Name: geant4-09-02-ref-02 $
28// -------------------------------------------------------------------
29
30#include "G4CrossSectionElasticChampion.hh"
31
32//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
33
34G4CrossSectionElasticChampion::G4CrossSectionElasticChampion()
35{
36  lowEnergyLimit = 0.*eV; 
37  highEnergyLimit = 10. * keV;
38
39  G4double scaleFactor = 1e-16*cm*cm;
40
41  G4String fileElectron("dna/sigma_elastic_e_champion");
42
43  G4ParticleDefinition* electronDef = G4Electron::ElectronDefinition();
44  G4String electron;
45 
46  if (electronDef != 0)
47  {
48    electron = electronDef->GetParticleName();
49    tableFile[electron] = fileElectron;
50
51    G4DNACrossSectionDataSet* tableE = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
52    tableE->LoadData(fileElectron);
53    tableData[electron] = tableE;
54  }
55  else
56  {
57    G4Exception("G4CrossSectionElasticChampion constructor: electron is not defined");
58  }
59}
60
61//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
62
63G4CrossSectionElasticChampion::~G4CrossSectionElasticChampion()
64{
65  std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
66  for (pos = tableData.begin(); pos != tableData.end(); ++pos)
67  {
68    G4DNACrossSectionDataSet* table = pos->second;
69    delete table;
70  }
71}
72
73//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
74
75G4double G4CrossSectionElasticChampion::CrossSection(const G4Track& track )
76{
77  const G4DynamicParticle* particle = track.GetDynamicParticle();
78  G4double k = particle->GetKineticEnergy();
79 
80  G4double sigma = 0.;
81
82  const G4String& particleName = particle->GetDefinition()->GetParticleName();
83 
84  if (k >= lowEnergyLimit && k < highEnergyLimit)
85  {
86        std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
87        pos = tableData.find(particleName);
88       
89        if (pos != tableData.end())
90        {
91          G4DNACrossSectionDataSet* table = pos->second;
92          if (table != 0)
93          {
94            sigma = table->FindValue(k);
95          }
96        }
97        else
98        {
99            G4Exception("G4CrossSectionElasticChampion::CrossSection: attempting to calculate cross section for wrong particle");
100        }
101  }
102  return sigma;
103}
Note: See TracBrowser for help on using the repository browser.