Geant4  10.01
G4hCoulombScatteringModel.cc
Go to the documentation of this file.
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: G4hCoulombScatteringModel.cc 81579 2014-06-03 10:15:54Z gcosmo $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class file
31 //
32 //
33 // File name: G4hCoulombScatteringModel
34 //
35 // Author: Vladimir Ivanchenko
36 //
37 // Creation date: 08.06.2012 from G4eCoulombScatteringModel
38 //
39 // Modifications:
40 //
41 //
42 // Class Description:
43 //
44 // -------------------------------------------------------------------
45 //
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
48 
50 #include "G4PhysicalConstants.hh"
51 #include "G4SystemOfUnits.hh"
52 #include "Randomize.hh"
53 #include "G4DataVector.hh"
54 #include "G4ElementTable.hh"
56 #include "G4Proton.hh"
57 #include "G4ParticleTable.hh"
58 #include "G4IonTable.hh"
59 #include "G4ProductionCutsTable.hh"
60 #include "G4NucleiProperties.hh"
61 #include "G4Pow.hh"
62 #include "G4LossTableManager.hh"
63 #include "G4LossTableBuilder.hh"
64 #include "G4NistManager.hh"
65 
66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
67 
68 using namespace std;
69 
71  : G4VEmModel("eCoulombScattering"),
72  cosThetaMin(1.0),
73  cosThetaMax(-1.0),
74  isCombined(combined),
75  isInitialised(false)
76 {
77  fParticleChange = 0;
81  currentMaterial = 0;
82 
83  pCuts = 0;
84 
85  lowEnergyThreshold = 1*keV; // particle will be killed for lower energy
86  recoilThreshold = 0.*keV; // by default does not work
87 
88  particle = 0;
89  currentCouple = 0;
90  wokvi = new G4WentzelVIRelXSection(combined);
91 
93 
94  cosTetMinNuc = 1.0;
95  cosTetMaxNuc = -1.0;
96  elecRatio = 0.0;
97  mass = proton_mass_c2;
98 }
99 
100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
101 
103 {
104  delete wokvi;
105 }
106 
107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
108 
110  const G4DataVector& cuts)
111 {
112  SetupParticle(p);
113  currentCouple = 0;
114 
115  if(isCombined) {
116  cosThetaMin = 1.0;
117  G4double tet = PolarAngleLimit();
118  if(tet > pi) { cosThetaMin = -1.0; }
119  else if(tet > 0.0) { cosThetaMin = cos(tet); }
120  }
121 
123  /*
124  G4cout << "G4hCoulombScatteringModel: " << particle->GetParticleName()
125  << " 1-cos(ThetaLimit)= " << 1 - cosThetaMin
126  << " cos(thetaMax)= " << cosThetaMax
127  << G4endl;
128  */
129  pCuts = &cuts;
130  // G4ProductionCutsTable::GetProductionCutsTable()->GetEnergyCutsVector(3);
131  //G4cout << "!!! G4hCoulombScatteringModel::Initialise for "
132  // << p->GetParticleName() << " cos(TetMin)= " << cosThetaMin
133  // << " cos(TetMax)= " << cosThetaMax <<G4endl;
134  // G4cout << "cut0= " << cuts[0] << " cut1= " << cuts[1] << G4endl;
135  if(!isInitialised) {
136  isInitialised = true;
138  }
139  if(mass < GeV) {
141  }
142 }
143 
144 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
145 
147  const G4ParticleDefinition* p,
148  G4double kinEnergy,
149  G4double Z, G4double,
150  G4double cutEnergy, G4double)
151 {
152  //G4cout << "### G4hCoulombScatteringModel::ComputeCrossSectionPerAtom for "
153  // << p->GetParticleName()<<" Z= "<<Z<<" e(MeV)= "<< kinEnergy/MeV << G4endl;
154  G4double cross = 0.0;
155  if(p != particle) { SetupParticle(p); }
156 
157  // cross section is set to zero to avoid problems in sample secondary
158  if(kinEnergy <= 0.0) { return cross; }
161  if(cosThetaMax < cosTetMinNuc) {
162  G4int iz = G4int(Z);
163  cosTetMinNuc = wokvi->SetupTarget(iz, cutEnergy);
165  if(iz == 1 && cosTetMaxNuc < 0.0 && particle == theProton) {
166  cosTetMaxNuc = 0.0;
167  }
170  cross += elecRatio;
171  if(cross > 0.0) { elecRatio /= cross; }
172  }
173  /*
174  if(p->GetParticleName() == "e-")
175  G4cout << "e(MeV)= " << kinEnergy/MeV << " cross(b)= " << cross/barn
176  << " 1-cosTetMinNuc= " << 1-cosTetMinNuc
177  << " 1-cosTetMaxNuc= " << 1-cosTetMaxNuc
178  << G4endl;
179  */
180  return cross;
181 }
182 
183 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
184 
186  std::vector<G4DynamicParticle*>* fvect,
187  const G4MaterialCutsCouple* couple,
188  const G4DynamicParticle* dp,
189  G4double cutEnergy,
190  G4double)
191 {
192  G4double kinEnergy = dp->GetKineticEnergy();
193 
194  // absorb particle below low-energy limit to avoid situation
195  // when a particle has no energy loss
196  if(kinEnergy < lowEnergyThreshold) {
200  return;
201  }
203  DefineMaterial(couple);
204 
205  //G4cout << "G4hCoulombScatteringModel::SampleSecondaries e(MeV)= "
206  // << kinEnergy << " " << particle->GetParticleName()
207  // << " cut= " << cutEnergy<< G4endl;
208 
209  // Choose nucleus
210  const G4Element* currentElement =
211  SelectRandomAtom(couple,particle,kinEnergy,cutEnergy,kinEnergy);
212 
213  G4double Z = currentElement->GetZ();
214 
215  if(ComputeCrossSectionPerAtom(particle,kinEnergy, Z,
216  kinEnergy, cutEnergy, kinEnergy) == 0.0)
217  { return; }
218 
219  G4int iz = G4int(Z);
220  G4int ia = SelectIsotopeNumber(currentElement);
221  G4double targetMass = G4NucleiProperties::GetNuclearMass(ia, iz);
222  wokvi->SetTargetMass(targetMass);
223 
224  G4ThreeVector newDirection =
226  G4double cost = newDirection.z();
227 
228  G4ThreeVector direction = dp->GetMomentumDirection();
229  newDirection.rotateUz(direction);
230 
232 
233  // recoil sampling assuming a small recoil
234  // and first order correction to primary 4-momentum
235  G4double mom2 = wokvi->GetMomentumSquare();
236  G4double trec = mom2*(1.0 - cost)
237  /(targetMass + (mass + kinEnergy)*(1.0 - cost));
238 
239  // the check likely not needed
240  if(trec > kinEnergy) { trec = kinEnergy; }
241  G4double finalT = kinEnergy - trec;
242  G4double edep = 0.0;
243  //G4cout<<"G4eCoulombScatteringModel: finalT= "<<finalT<<" Trec= "
244  // <<trec << " Z= " << iz << " A= " << ia<<G4endl;
245 
246  G4double tcut = recoilThreshold;
247  if(pCuts) { tcut= std::max(tcut,(*pCuts)[currentMaterialIndex]); }
248 
249  if(trec > tcut) {
251  G4ThreeVector dir = (direction*sqrt(mom2) -
252  newDirection*sqrt(finalT*(2*mass + finalT))).unit();
253  G4DynamicParticle* newdp = new G4DynamicParticle(ion, dir, trec);
254  fvect->push_back(newdp);
255  } else {
256  edep = trec;
258  }
259 
260  // finelize primary energy and energy balance
261  // this threshold may be applied only because for low-enegry
262  // e+e- msc model is applied
263  if(finalT <= lowEnergyThreshold) {
264  edep += finalT;
265  finalT = 0.0;
266  }
269 }
270 
271 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
272 
273 
const G4ParticleDefinition * theProton
G4double ComputeNuclearCrossSection(G4double CosThetaMin, G4double CosThetaMax)
static G4double GetNuclearMass(const G4double A, const G4double Z)
G4ThreeVector SampleSingleScattering(G4double CosThetaMin, G4double CosThetaMax, G4double elecRatio=0.0)
G4double GetKineticEnergy() const
CLHEP::Hep3Vector G4ThreeVector
void InitialiseElementSelectors(const G4ParticleDefinition *, const G4DataVector &)
Definition: G4VEmModel.cc:161
void DefineMaterial(const G4MaterialCutsCouple *)
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
Definition: G4IonTable.cc:463
const G4double pi
G4double GetZ() const
Definition: G4Element.hh:131
const std::vector< G4double > * pCuts
G4ParticleDefinition * GetDefinition() const
void SetupParticle(const G4ParticleDefinition *)
int G4int
Definition: G4Types.hh:78
static G4NistManager * Instance()
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
G4double SetupKinematic(G4double kinEnergy, const G4Material *mat)
G4double SetupTarget(G4int Z, G4double cut=DBL_MAX)
const G4MaterialCutsCouple * currentCouple
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4double GetMomentumSquare() const
G4IonTable * GetIonTable() const
const G4MaterialCutsCouple * CurrentCouple() const
Definition: G4VEmModel.hh:433
const G4ParticleDefinition * particle
void ProposeNonIonizingEnergyDeposit(G4double anEnergyPart)
bool G4bool
Definition: G4Types.hh:79
const G4ThreeVector & GetMomentumDirection() const
G4double iz
Definition: TRTMaterials.hh:39
static G4Proton * Proton()
Definition: G4Proton.cc:93
static const double GeV
Definition: G4SIunits.hh:196
G4int SelectIsotopeNumber(const G4Element *)
Definition: G4VEmModel.hh:566
G4ParticleChangeForGamma * fParticleChange
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
G4hCoulombScatteringModel(G4bool combined=true)
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A, G4double cut, G4double emax)
static G4ParticleTable * GetParticleTable()
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4double PolarAngleLimit() const
Definition: G4VEmModel.hh:643
void SetProposedKineticEnergy(G4double proposedKinEnergy)
G4double ComputeElectronCrossSection(G4double CosThetaMin, G4double CosThetaMax)
static const double keV
Definition: G4SIunits.hh:195
void Initialise(const G4ParticleDefinition *, G4double CosThetaLim)
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
double G4double
Definition: G4Types.hh:76
void SetTargetMass(G4double value)
const G4Element * SelectRandomAtom(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
Definition: G4VEmModel.hh:525
G4ParticleChangeForGamma * GetParticleChangeForGamma()
Definition: G4VEmModel.cc:147