source: trunk/source/processes/hadronic/models/cascade/cascade/src/G4InuclCollider.cc @ 1315

Last change on this file since 1315 was 1315, checked in by garnier, 14 years ago

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

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