source: trunk/source/processes/hadronic/models/cascade/cascade/src/G4PreCompoundInuclCollider.cc @ 1337

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

tag geant4.9.4 beta 1 + modifs locales

File size: 7.4 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: G4PreCompoundInuclCollider.cc,v 1.10 2010/06/25 09:45:02 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// 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 "G4PreCompoundInuclCollider.hh"
37#include "G4BigBanger.hh"
38#include "G4CollisionOutput.hh"
39#include "G4ElementaryParticleCollider.hh"
40#include "G4IntraNucleiCascader.hh"
41#include "G4InuclElementaryParticle.hh"
42#include "G4LorentzConvertor.hh"
43#include "G4NonEquilibriumEvaporator.hh"
44
45         
46G4PreCompoundInuclCollider::G4PreCompoundInuclCollider()
47  : G4VCascadeCollider("G4PreCompoundInuclCollider"),
48    theElementaryParticleCollider(new G4ElementaryParticleCollider),
49    theIntraNucleiCascader(new G4IntraNucleiCascader),
50    theNonEquilibriumEvaporator(new G4NonEquilibriumEvaporator),
51    theBigBanger(new G4BigBanger) {}
52
53G4PreCompoundInuclCollider::~G4PreCompoundInuclCollider() {
54  delete theElementaryParticleCollider;
55  delete theIntraNucleiCascader;
56  delete theNonEquilibriumEvaporator;
57  delete theBigBanger;
58}
59
60
61void G4PreCompoundInuclCollider::collide(G4InuclParticle* bullet,
62                                         G4InuclParticle* target,
63                                         G4CollisionOutput& globalOutput) {
64  if (verboseLevel > 3) {
65    G4cout << " >>> G4PreCompoundInuclCollider::collide" << G4endl;
66  }
67
68  const G4int itry_max = 1000;
69                     
70  if (useEPCollider(bullet,target)) {
71    if (verboseLevel > 2) {
72      bullet->printParticle();
73      target->printParticle();
74    }
75
76    theElementaryParticleCollider->collide(bullet, target, globalOutput);
77  } else { // needs to call all machinery       
78    G4LorentzConvertor convertToTargetRestFrame;
79
80    interCase.set(bullet, target);
81     
82    if (interCase.valid()) { // ok
83      G4InuclNuclei* ntarget =
84        dynamic_cast<G4InuclNuclei*>(interCase.getTarget());
85
86      convertToTargetRestFrame.setTarget(ntarget);
87      G4int btype = 0;
88      G4double ab = 0.0;
89      G4double zb = 0.0;
90      G4double at = ntarget->getA();
91      G4double zt = ntarget->getZ();
92       
93      if (interCase.hadNucleus()) { // particle with nuclei
94        G4InuclElementaryParticle* pbullet = 
95          dynamic_cast<G4InuclElementaryParticle*>(interCase.getBullet());
96         
97        if (pbullet->isPhoton()) {
98          G4cout << " InuclCollider -> can not collide with photon " << G4endl;
99
100          globalOutput.trivialise(bullet, target);
101          return;
102        } else {
103          convertToTargetRestFrame.setBullet(pbullet);   
104          btype = pbullet->type();
105        }; 
106
107      } else { // nuclei with nuclei
108        G4InuclNuclei* nbullet = 
109          dynamic_cast<G4InuclNuclei*>(interCase.getBullet());
110
111        convertToTargetRestFrame.setBullet(nbullet);   
112        ab = nbullet->getA();
113        zb = nbullet->getZ();
114      };
115       
116      G4double ekin = convertToTargetRestFrame.getKinEnergyInTheTRS();
117
118      if (verboseLevel > 3) {
119        G4cout << " ekin in trs " << ekin << G4endl;
120      }
121
122      if (inelasticInteractionPossible(bullet, target, ekin)) {
123        convertToTargetRestFrame.toTheTargetRestFrame();
124
125        if (verboseLevel > 3) {
126          G4cout << " degenerated? " << convertToTargetRestFrame.trivial() << G4endl;
127        }
128
129        G4LorentzVector bmom;
130        bmom.setZ(convertToTargetRestFrame.getTRSMomentum());
131
132        G4InuclNuclei ntarget(at, zt);          // Default is at rest
133
134        theIntraNucleiCascader->setInteractionCase(interCase.code());
135         
136        G4bool bad = true;
137        G4int itry = 0;
138         
139        G4CollisionOutput TRFoutput;
140        G4CollisionOutput output;
141        while (bad && itry < itry_max) {
142          itry++;
143
144          output.reset();       // Clear buffers for this attempt
145          TRFoutput.reset();
146
147          if (interCase.hadNucleus()) {
148            G4InuclElementaryParticle pbullet(bmom, btype);
149
150            theIntraNucleiCascader->collide(&pbullet, &ntarget, output);
151          } else {
152            G4InuclNuclei nbullet(bmom, ab, zb);
153            theIntraNucleiCascader->collide(&nbullet, &ntarget, output);
154          };   
155
156          if (verboseLevel > 3) {
157            G4cout << " After Cascade " << G4endl;
158            output.printCollisionOutput();
159          }
160         
161          // the rest, if any
162          TRFoutput.addOutgoingParticles(output.getOutgoingParticles());
163
164          if (output.numberOfNucleiFragments() == 1) { // there is smth. after
165            G4InuclNuclei cascad_rec_nuclei = output.getNucleiFragments()[0];
166            if (explosion(&cascad_rec_nuclei)) {
167              if (verboseLevel > 3) {
168                G4cout << " big bang after cascade " << G4endl;
169              };
170
171              theBigBanger->collide(0,&cascad_rec_nuclei, TRFoutput);
172            } else {
173              output.reset();
174              theNonEquilibriumEvaporator->collide(0, &cascad_rec_nuclei, output);
175
176              if (verboseLevel > 3) {
177                G4cout << " After NonEquilibriumEvaporator " << G4endl;
178                output.printCollisionOutput();
179              };
180
181              TRFoutput.addOutgoingParticles(output.getOutgoingParticles()); 
182              TRFoutput.addTargetFragments(output.getNucleiFragments());
183            };
184          };
185         
186          // convert to the LAB       
187          TRFoutput.boostToLabFrame(convertToTargetRestFrame);
188
189          globalOutput.addOutgoingParticles(TRFoutput.getOutgoingParticles());
190          globalOutput.addTargetFragments(TRFoutput.getNucleiFragments());
191          globalOutput.setOnShell(bullet, target);
192          if (globalOutput.acceptable()) return;
193
194          globalOutput.reset();         // Clear and try again
195        };
196
197        if (verboseLevel > 3) {
198          G4cout << " InuclCollider -> can not generate acceptable inter. after " 
199                 << itry_max << " attempts " << G4endl;
200        }
201      } else {
202        if (verboseLevel > 3) {
203          G4cout << " InuclCollider -> inelastic interaction is impossible " << G4endl
204                 << " due to the coulomb barirer " << G4endl;
205        }
206      }
207       
208      globalOutput.trivialise(bullet, target);
209      return;
210    } else {
211      if (verboseLevel > 3) {
212        G4cout << " InuclCollider -> inter case " << interCase.code() << G4endl;
213      };
214    };       
215  };
216
217  return;
218}
Note: See TracBrowser for help on using the repository browser.