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: G4InuclCollider.cc,v 1.30.2.1 2010/06/25 09:44:36 gunter Exp $ |
---|
27 | // Geant4 tag: $Name: geant4-09-04-beta-01 $ |
---|
28 | // |
---|
29 | // 20100114 M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly |
---|
30 | // 20100309 M. Kelsey -- Eliminate some unnecessary std::pow() |
---|
31 | // 20100413 M. Kelsey -- Pass G4CollisionOutput by ref to ::collide() |
---|
32 | // 20100418 M. Kelsey -- Move lab-frame transformation code to G4CollisonOutput |
---|
33 | // 20100429 M. Kelsey -- Change "photon()" to "isPhoton()" |
---|
34 | // 20100517 M. Kelsey -- Inherit from common base class, make other colliders |
---|
35 | // simple data members, consolidate code |
---|
36 | |
---|
37 | #include "G4InuclCollider.hh" |
---|
38 | #include "G4BigBanger.hh" |
---|
39 | #include "G4CollisionOutput.hh" |
---|
40 | #include "G4ElementaryParticleCollider.hh" |
---|
41 | #include "G4EquilibriumEvaporator.hh" |
---|
42 | #include "G4IntraNucleiCascader.hh" |
---|
43 | #include "G4InuclElementaryParticle.hh" |
---|
44 | #include "G4LorentzConvertor.hh" |
---|
45 | #include "G4NonEquilibriumEvaporator.hh" |
---|
46 | |
---|
47 | |
---|
48 | G4InuclCollider::G4InuclCollider() |
---|
49 | : G4VCascadeCollider("G4InuclCollider"), |
---|
50 | theElementaryParticleCollider(new G4ElementaryParticleCollider), |
---|
51 | theIntraNucleiCascader(new G4IntraNucleiCascader), |
---|
52 | theNonEquilibriumEvaporator(new G4NonEquilibriumEvaporator), |
---|
53 | theEquilibriumEvaporator(new G4EquilibriumEvaporator), |
---|
54 | theBigBanger(new G4BigBanger) {} |
---|
55 | |
---|
56 | G4InuclCollider::~G4InuclCollider() { |
---|
57 | delete theElementaryParticleCollider; |
---|
58 | delete theIntraNucleiCascader; |
---|
59 | delete theNonEquilibriumEvaporator; |
---|
60 | delete theEquilibriumEvaporator; |
---|
61 | delete theBigBanger; |
---|
62 | } |
---|
63 | |
---|
64 | |
---|
65 | void G4InuclCollider::collide(G4InuclParticle* bullet, G4InuclParticle* target, |
---|
66 | G4CollisionOutput& globalOutput) { |
---|
67 | if (verboseLevel > 3) { |
---|
68 | G4cout << " >>> G4InuclCollider::collide" << G4endl; |
---|
69 | } |
---|
70 | |
---|
71 | const G4int itry_max = 1000; |
---|
72 | |
---|
73 | if (useEPCollider(bullet,target)) { |
---|
74 | if (verboseLevel > 2) { |
---|
75 | bullet->printParticle(); |
---|
76 | target->printParticle(); |
---|
77 | } |
---|
78 | |
---|
79 | theElementaryParticleCollider->collide(bullet, target, globalOutput); |
---|
80 | } else { // needs to call all machinery |
---|
81 | G4LorentzConvertor convertToTargetRestFrame; |
---|
82 | |
---|
83 | interCase.set(bullet,target); |
---|
84 | if (interCase.valid()) { // ok |
---|
85 | G4InuclNuclei* ntarget = |
---|
86 | dynamic_cast<G4InuclNuclei*>(interCase.getTarget()); |
---|
87 | |
---|
88 | convertToTargetRestFrame.setTarget(ntarget); |
---|
89 | G4int btype = 0; |
---|
90 | G4double ab = 0.0; |
---|
91 | G4double zb = 0.0; |
---|
92 | G4double at = ntarget->getA(); |
---|
93 | G4double zt = ntarget->getZ(); |
---|
94 | |
---|
95 | if (interCase.hadNucleus()) { // particle with nuclei |
---|
96 | G4InuclElementaryParticle* pbullet = |
---|
97 | dynamic_cast<G4InuclElementaryParticle*>(interCase.getBullet()); |
---|
98 | |
---|
99 | if (pbullet->isPhoton()) { |
---|
100 | G4cerr << " InuclCollider -> can not collide with photon " << G4endl; |
---|
101 | |
---|
102 | globalOutput.trivialise(bullet, target); |
---|
103 | return; |
---|
104 | } else { |
---|
105 | convertToTargetRestFrame.setBullet(pbullet); |
---|
106 | btype = pbullet->type(); |
---|
107 | }; |
---|
108 | |
---|
109 | } else { // nuclei with nuclei |
---|
110 | G4InuclNuclei* nbullet = |
---|
111 | dynamic_cast<G4InuclNuclei*>(interCase.getBullet()); |
---|
112 | |
---|
113 | convertToTargetRestFrame.setBullet(nbullet); |
---|
114 | ab = nbullet->getA(); |
---|
115 | zb = nbullet->getZ(); |
---|
116 | }; |
---|
117 | |
---|
118 | G4double ekin = convertToTargetRestFrame.getKinEnergyInTheTRS(); |
---|
119 | |
---|
120 | if (verboseLevel > 3) { |
---|
121 | G4cout << " ekin in trs " << ekin << G4endl; |
---|
122 | } |
---|
123 | |
---|
124 | if (inelasticInteractionPossible(bullet, target, ekin)) { |
---|
125 | convertToTargetRestFrame.toTheTargetRestFrame(); |
---|
126 | |
---|
127 | if (verboseLevel > 3) { |
---|
128 | G4cout << " degenerated? " << convertToTargetRestFrame.trivial() << G4endl; |
---|
129 | } |
---|
130 | |
---|
131 | G4LorentzVector bmom; |
---|
132 | bmom.setZ(convertToTargetRestFrame.getTRSMomentum()); |
---|
133 | |
---|
134 | G4InuclNuclei ntarget(at, zt); // Default is at rest |
---|
135 | |
---|
136 | theIntraNucleiCascader->setInteractionCase(interCase.code()); |
---|
137 | |
---|
138 | G4bool bad = true; |
---|
139 | G4int itry = 0; |
---|
140 | |
---|
141 | G4CollisionOutput TRFoutput; |
---|
142 | G4CollisionOutput output; |
---|
143 | while (bad && itry < itry_max) { |
---|
144 | itry++; |
---|
145 | |
---|
146 | output.reset(); // Clear buffers for this attempt |
---|
147 | TRFoutput.reset(); |
---|
148 | |
---|
149 | if (interCase.hadNucleus()) { |
---|
150 | G4InuclElementaryParticle pbullet(bmom, btype); |
---|
151 | |
---|
152 | theIntraNucleiCascader->collide(&pbullet, &ntarget, output); |
---|
153 | } else { |
---|
154 | G4InuclNuclei nbullet(bmom, ab, zb); |
---|
155 | theIntraNucleiCascader->collide(&nbullet, &ntarget, output); |
---|
156 | }; |
---|
157 | |
---|
158 | if (verboseLevel > 3) { |
---|
159 | G4cout << " After Cascade " << G4endl; |
---|
160 | output.printCollisionOutput(); |
---|
161 | } |
---|
162 | |
---|
163 | // the rest, if any |
---|
164 | // FIXME: The code below still does too much copying! |
---|
165 | TRFoutput.addOutgoingParticles(output.getOutgoingParticles()); |
---|
166 | |
---|
167 | if (output.numberOfNucleiFragments() == 1) { // there is smth. after |
---|
168 | G4InuclNuclei cascad_rec_nuclei = output.getNucleiFragments()[0]; |
---|
169 | if (explosion(&cascad_rec_nuclei)) { |
---|
170 | if (verboseLevel > 3) { |
---|
171 | G4cout << " big bang after cascade " << G4endl; |
---|
172 | }; |
---|
173 | |
---|
174 | theBigBanger->collide(0,&cascad_rec_nuclei, TRFoutput); |
---|
175 | } else { |
---|
176 | output.reset(); |
---|
177 | theNonEquilibriumEvaporator->collide(0, &cascad_rec_nuclei, output); |
---|
178 | |
---|
179 | if (verboseLevel > 3) { |
---|
180 | G4cout << " After NonEquilibriumEvaporator " << G4endl; |
---|
181 | output.printCollisionOutput(); |
---|
182 | }; |
---|
183 | |
---|
184 | TRFoutput.addOutgoingParticles(output.getOutgoingParticles()); |
---|
185 | G4InuclNuclei exiton_rec_nuclei = output.getNucleiFragments()[0]; |
---|
186 | |
---|
187 | output.reset(); |
---|
188 | theEquilibriumEvaporator->collide(0, &exiton_rec_nuclei, output); |
---|
189 | |
---|
190 | if (verboseLevel > 3) { |
---|
191 | G4cout << " After EquilibriumEvaporator " << G4endl; |
---|
192 | output.printCollisionOutput(); |
---|
193 | }; |
---|
194 | |
---|
195 | TRFoutput.addOutgoingParticles(output.getOutgoingParticles()); |
---|
196 | TRFoutput.addTargetFragments(output.getNucleiFragments()); |
---|
197 | }; |
---|
198 | }; |
---|
199 | |
---|
200 | // convert to the LAB |
---|
201 | TRFoutput.boostToLabFrame(convertToTargetRestFrame); |
---|
202 | |
---|
203 | globalOutput.addOutgoingParticles(TRFoutput.getOutgoingParticles()); |
---|
204 | globalOutput.addTargetFragments(TRFoutput.getNucleiFragments()); |
---|
205 | globalOutput.setOnShell(bullet, target); |
---|
206 | if (globalOutput.acceptable()) return; |
---|
207 | |
---|
208 | globalOutput.reset(); // Clear and try again |
---|
209 | }; |
---|
210 | |
---|
211 | if (verboseLevel > 3) { |
---|
212 | G4cout << " InuclCollider -> can not generate acceptable inter. after " |
---|
213 | << itry_max << " attempts " << G4endl; |
---|
214 | } |
---|
215 | } else { |
---|
216 | if (verboseLevel > 3) { |
---|
217 | G4cout << " InuclCollider -> inelastic interaction is impossible " << G4endl |
---|
218 | << " due to the coulomb barirer " << G4endl; |
---|
219 | } |
---|
220 | } |
---|
221 | |
---|
222 | globalOutput.trivialise(bullet, target); |
---|
223 | return; |
---|
224 | } else { |
---|
225 | if (verboseLevel > 3) { |
---|
226 | G4cout << " InuclCollider -> inter case " << interCase.code() << G4endl; |
---|
227 | }; |
---|
228 | }; |
---|
229 | }; |
---|
230 | |
---|
231 | return; |
---|
232 | } |
---|