source: trunk/source/processes/hadronic/stopping/src/G4PiMinusAbsorptionAtRest.cc@ 900

Last change on this file since 900 was 819, checked in by garnier, 17 years ago

import all except CVS

File size: 9.2 KB
RevLine 
[819]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// File name: G4PiMinusAbsorptionAtRest.hh
27//
28// Author: Maria Grazia Pia (pia@genova.infn.it)
29//
30// Creation date: 8 May 1998
31//
32// Modifications:
33// MGP 4 Jul 1998 Changed excitation energy calculation
34// MGP 14 Sep 1998 Fixed excitation energy calculation
35//
36// -------------------------------------------------------------------
37
38#include "G4ios.hh"
39
40#include "G4PiMinusAbsorptionAtRest.hh"
41
42#include "G4PiMinusStopLi.hh"
43#include "G4PiMinusStopC.hh"
44#include "G4PiMinusStopN.hh"
45#include "G4PiMinusStopO.hh"
46#include "G4PiMinusStopAl.hh"
47#include "G4PiMinusStopCu.hh"
48#include "G4PiMinusStopCo.hh"
49#include "G4PiMinusStopTa.hh"
50#include "G4PiMinusStopPb.hh"
51#include "G4StopTheoDeexcitation.hh"
52#include "G4StopDummyDeexcitation.hh"
53#include "G4DynamicParticle.hh"
54#include "G4DynamicParticleVector.hh"
55#include "G4NucleiPropertiesTable.hh"
56#include "Randomize.hh"
57#include "G4ThreeVector.hh"
58#include "G4LorentzVector.hh"
59
60// Constructor
61
62G4PiMinusAbsorptionAtRest::G4PiMinusAbsorptionAtRest(const G4String& processName,
63 G4ProcessType aType ) :
64 G4VRestProcess (processName, aType)
65{
66 // _stopAbsorption = 0;
67 // _stopDeexcitation = 0;
68
69 _indexDeexcitation = 0;
70
71 if (verboseLevel>0)
72 { G4cout << GetProcessName() << " is created "<< G4endl; }
73}
74
75
76// Destructor
77
78G4PiMinusAbsorptionAtRest::~G4PiMinusAbsorptionAtRest()
79{}
80
81
82G4VParticleChange* G4PiMinusAbsorptionAtRest::AtRestDoIt(const G4Track& track, const G4Step& )
83{
84 const G4DynamicParticle* stoppedHadron = track.GetDynamicParticle();
85
86 // Check applicability
87 if (! IsApplicable(*(stoppedHadron->GetDefinition())))
88 {
89 G4cerr
90 << "G4PiMinusAbsorptionAtRest: ERROR, particle must be a pion minus!"
91 << G4endl;
92 return NULL;
93 }
94
95 // Get the current material
96 const G4Material* material = track.GetMaterial();
97
98 G4double A=-1;
99 G4double Z=-1;
100 G4double random = G4UniformRand();
101 const G4ElementVector* theElementVector = material->GetElementVector();
102 unsigned int i;
103 G4double sum = 0;
104 G4double totalsum=0;
105 for(i=0; i<material->GetNumberOfElements(); ++i)
106 {
107 if((*theElementVector)[i]->GetZ()!=1) totalsum+=material->GetFractionVector()[i];
108 }
109 for (i = 0; i<material->GetNumberOfElements(); ++i)
110 {
111 if((*theElementVector)[i]->GetZ()!=1) sum += material->GetFractionVector()[i];
112 if ( sum/totalsum > random )
113 {
114 A = (*theElementVector)[i]->GetA()*mole/g;
115 Z = (*theElementVector)[i]->GetZ();
116 break;
117 }
118 }
119
120 // Do the interaction with the nucleon cluster
121
122 G4PiMinusStopMaterial* algorithm = LoadAlgorithm(static_cast<G4int>(Z));
123 G4PiMinusStopAbsorption stopAbsorption(algorithm,Z,A);
124 stopAbsorption.SetVerboseLevel(verboseLevel);
125
126 G4DynamicParticleVector* absorptionProducts = stopAbsorption.DoAbsorption();
127
128 // Deal with the leftover nucleus
129
130 G4double pionEnergy = stoppedHadron->GetTotalEnergy();
131 G4double excitation = pionEnergy - stopAbsorption.Energy();
132 if (excitation < 0.)
133 {
134 G4Exception("G4PiMinusAbsorptionAtRest", "007", FatalException,
135 "AtRestDoIt -- excitation energy < 0");
136 }
137 if (verboseLevel>0) { G4cout << " excitation " << excitation << G4endl; }
138
139 G4StopDeexcitationAlgorithm* nucleusAlgorithm = LoadNucleusAlgorithm();
140 G4StopDeexcitation stopDeexcitation(nucleusAlgorithm);
141
142 G4double newZ = Z - stopAbsorption.NProtons();
143 G4double newN = A - Z - stopAbsorption.NNeutrons();
144 G4double newA = newZ + newN;
145 G4double pNucleus = (stopAbsorption.RecoilMomentum()).mag();
146 G4ReactionProductVector* fragmentationProducts = stopDeexcitation.DoBreakUp(newA,newZ,excitation,pNucleus);
147
148 unsigned int nAbsorptionProducts = 0;
149 if (absorptionProducts != 0)
150 { nAbsorptionProducts = absorptionProducts->size(); }
151
152 unsigned int nFragmentationProducts = 0;
153 if (fragmentationProducts != 0)
154 { nFragmentationProducts = fragmentationProducts->size(); }
155
156 if (verboseLevel>0)
157 {
158 G4cout << "nAbsorptionProducts = " << nAbsorptionProducts
159 << " nFragmentationProducts = " << nFragmentationProducts
160 << G4endl;
161 }
162
163 // Deal with ParticleChange final state
164
165 aParticleChange.Initialize(track);
166 aParticleChange.SetNumberOfSecondaries(G4int(nAbsorptionProducts + nFragmentationProducts));
167
168 for (i = 0; i<nAbsorptionProducts; i++)
169 { aParticleChange.AddSecondary((*absorptionProducts)[i]); }
170
171// for (i = 0; i<nFragmentationProducts; i++)
172// { aParticleChange.AddSecondary(fragmentationProducts->at(i)); }
173 for(i=0; i<nFragmentationProducts; i++)
174 {
175 G4DynamicParticle * aNew =
176 new G4DynamicParticle((*fragmentationProducts)[i]->GetDefinition(),
177 (*fragmentationProducts)[i]->GetMomentum());
178 G4double newTime = aParticleChange.GetGlobalTime((*fragmentationProducts)[i]->GetFormationTime());
179 aParticleChange.AddSecondary(aNew, newTime);
180 delete (*fragmentationProducts)[i];
181 }
182
183 if (fragmentationProducts != 0) delete fragmentationProducts;
184
185 if (_indexDeexcitation == 1) aParticleChange.ProposeLocalEnergyDeposit(excitation);
186
187 // Kill the absorbed pion
188 aParticleChange.ProposeTrackStatus(fStopAndKill);
189
190 return &aParticleChange;
191
192}
193
194G4PiMinusStopMaterial* G4PiMinusAbsorptionAtRest::LoadAlgorithm(int Z)
195{
196 if (verboseLevel>0)
197 {
198 G4cout << "Load material algorithm " << Z << G4endl;
199 }
200
201 G4int index = 3;
202 if (Z <= 3) { index = 3;}
203 if (Z > 3 && Z<= 6) {index = 6;}
204 if (Z == 7) {index = 7;}
205 if (Z >= 8 && Z<= 11) {index = 8;}
206 if (Z >= 12 && Z<= 18) {index = 13;}
207 if (Z >=19 && Z<= 27) {index = 27;}
208 if (Z >= 28 && Z<= 51) {index = 29;}
209 if (Z >=52 ) {index = 73;}
210
211 switch (index)
212 {
213 case 3:
214 if (verboseLevel>0)
215 { G4cout << " =================== Load Li algorithm " << G4endl; }
216 return new G4PiMinusStopLi();
217 case 6:
218 if (verboseLevel>0)
219 { G4cout << " =================== Load C algorithm " << G4endl; }
220 return new G4PiMinusStopC();
221 case 7:
222 if (verboseLevel>0)
223 { G4cout << " =================== Load N algorithm " << G4endl; }
224 return new G4PiMinusStopN();
225 case 8:
226 if (verboseLevel>0)
227 { G4cout << " =================== Load O algorithm " << G4endl; }
228 return new G4PiMinusStopO();
229 case 13:
230 if (verboseLevel>0)
231 { G4cout << " =================== Load Al algorithm " << G4endl; }
232 return new G4PiMinusStopAl();
233 case 27:
234 if (verboseLevel>0)
235 { G4cout << " =================== Load Cu algorithm " << G4endl; }
236 return new G4PiMinusStopCu();
237 case 29:
238 if (verboseLevel>0)
239 { G4cout << " =================== Load Co algorithm " << G4endl; }
240 return new G4PiMinusStopCo();
241 case 73:
242 if (verboseLevel>0)
243 { G4cout << " =================== Load Ta algorithm " << G4endl; }
244 return new G4PiMinusStopTa();
245 default:
246 if (verboseLevel>0)
247 { G4cout << " =================== Load default material algorithm " << G4endl; }
248 return new G4PiMinusStopC();
249 }
250}
251
252G4StopDeexcitationAlgorithm* G4PiMinusAbsorptionAtRest::LoadNucleusAlgorithm()
253{
254
255 switch (_indexDeexcitation)
256 {
257 case 0:
258 if (verboseLevel>0)
259 { G4cout << " =================== Load Theo deexcitation " << G4endl; }
260 return new G4StopTheoDeexcitation();
261 case 1:
262 if (verboseLevel>0)
263 { G4cout << " =================== Load Dummy deexcitation " << G4endl; }
264 return new G4StopDummyDeexcitation();
265 default:
266 if (verboseLevel>0)
267 { G4cout << " =================== Load default deexcitation " << G4endl; }
268 return new G4StopTheoDeexcitation();
269 }
270}
271
272void G4PiMinusAbsorptionAtRest::SetDeexcitationAlgorithm(G4int index)
273{
274 _indexDeexcitation = index;
275}
Note: See TracBrowser for help on using the repository browser.