source: trunk/source/processes/electromagnetic/standard/src/G4CoulombScattering.cc @ 1006

Last change on this file since 1006 was 1005, checked in by garnier, 15 years ago

fichier oublies

File size: 5.3 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: G4CoulombScattering.cc,v 1.20 2009/02/20 12:06:37 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-02-ref-02 $
28//
29// -------------------------------------------------------------------
30//
31// GEANT4 Class file
32//
33//
34// File name:     G4CoulombScattering
35//
36// Author:        Vladimir Ivanchenko
37//
38// Creation date: 22.08.2004
39//
40// Modifications:
41// 01.08.06 V.Ivanchenko add choice between G4eCoulombScatteringModel and
42//          G4CoulombScatteringModel
43//
44
45//
46// -------------------------------------------------------------------
47//
48//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
49//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
50
51#include "G4CoulombScattering.hh"
52#include "G4CoulombScatteringModel.hh"
53#include "G4eCoulombScatteringModel.hh"
54#include "G4Electron.hh"
55
56//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
57
58using namespace std;
59
60G4CoulombScattering::G4CoulombScattering(const G4String& name)
61  : G4VEmProcess(name),thetaMin(0.0),thetaMax(pi),q2Max(TeV*TeV),
62    isInitialised(false)
63{
64  SetBuildTableFlag(true);
65  SetStartFromNullFlag(false);
66  SetIntegral(true);
67  thEnergy = PeV;
68  thEnergyElec = PeV;
69  if(name == "CoulombScat") {
70    thEnergy = 10.*MeV;
71    thEnergyElec = 10.*GeV;
72  }
73  SetSecondaryParticle(G4Electron::Electron());
74  SetProcessSubType(fCoulombScattering);
75}
76
77//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
78
79G4CoulombScattering::~G4CoulombScattering()
80{}
81
82//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
83
84G4bool G4CoulombScattering::IsApplicable(const G4ParticleDefinition& p)
85{
86  return (p.GetPDGCharge() != 0.0 && !p.IsShortLived());
87}
88
89//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
90
91void G4CoulombScattering::InitialiseProcess(const G4ParticleDefinition* p)
92{
93  // second initialisation
94  if(isInitialised) {
95    G4VEmModel* mod = GetModelByIndex(0);
96    mod->SetPolarAngleLimit(PolarAngleLimit());
97    mod = GetModelByIndex(1);
98    if(mod) mod->SetPolarAngleLimit(PolarAngleLimit());
99
100    // first initialisation
101  } else {
102    isInitialised = true;
103    aParticle = p;
104    G4double mass = p->GetPDGMass();
105    if (mass > GeV || p->GetParticleType() == "nucleus") {
106      SetBuildTableFlag(false);
107      verboseLevel = 0;
108    } else {
109      G4String name = p->GetParticleName();
110      if(name != "e-" && name != "e+" &&
111         name != "mu+" && name != "mu-" && name != "pi+" && 
112         name != "kaon+" && name != "proton" ) verboseLevel = 0;
113    }
114
115    G4double emin = MinKinEnergy();
116    G4double emax = MaxKinEnergy();
117    G4double eth  = thEnergy;
118    if(mass < MeV) eth  = thEnergyElec; 
119    if(eth > emin) {
120      G4eCoulombScatteringModel* model = new G4eCoulombScatteringModel();
121      model->SetPolarAngleLimit(PolarAngleLimit());
122      model->SetLowEnergyLimit(emin);
123      model->SetHighEnergyLimit(std::min(eth,emax));
124      AddEmModel(1, model);
125    }
126    if(eth < emax) {
127      G4CoulombScatteringModel* model = new G4CoulombScatteringModel();
128      model->SetPolarAngleLimit(PolarAngleLimit());
129      model->SetLowEnergyLimit(eth);
130      model->SetHighEnergyLimit(emax);
131      AddEmModel(2, model);
132    }
133  }
134}
135
136//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
137
138void G4CoulombScattering::PrintInfo()
139{
140  G4cout << "      " << PolarAngleLimit()/degree
141         << " < Theta(degree) < 180" 
142         << ", Eth(MeV)= ";
143  if(aParticle->GetPDGMass() < MeV) G4cout << thEnergyElec;
144  else                              G4cout << thEnergy;
145
146  if(q2Max < DBL_MAX) G4cout << "; q2Max(GeV^2)= " << q2Max/(GeV*GeV);
147  G4cout << G4endl;
148}
149
150//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Note: See TracBrowser for help on using the repository browser.