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
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// ********************************************************************
[1315]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 $
[819]27//
[1315]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
[819]36#include "G4InuclCollider.hh"
[1315]37#include "G4BigBanger.hh"
38#include "G4CollisionOutput.hh"
39#include "G4ElementaryParticleCollider.hh"
40#include "G4EquilibriumEvaporator.hh"
41#include "G4IntraNucleiCascader.hh"
[819]42#include "G4InuclElementaryParticle.hh"
43#include "G4LorentzConvertor.hh"
[1315]44#include "G4NonEquilibriumEvaporator.hh"
[819]45
[1315]46
[819]47G4InuclCollider::G4InuclCollider()
[1315]48  : G4VCascadeCollider("G4InuclCollider"),
49    theElementaryParticleCollider(new G4ElementaryParticleCollider),
50    theIntraNucleiCascader(new G4IntraNucleiCascader),
51    theNonEquilibriumEvaporator(new G4NonEquilibriumEvaporator),
52    theEquilibriumEvaporator(new G4EquilibriumEvaporator),
53    theBigBanger(new G4BigBanger) {}
[819]54
[1315]55G4InuclCollider::~G4InuclCollider() {
56  delete theElementaryParticleCollider;
57  delete theIntraNucleiCascader;
58  delete theNonEquilibriumEvaporator;
59  delete theEquilibriumEvaporator;
60  delete theBigBanger;
[819]61}
62
63
[1315]64void G4InuclCollider::collide(G4InuclParticle* bullet, G4InuclParticle* target,
65                              G4CollisionOutput& globalOutput) {
[819]66  if (verboseLevel > 3) {
67    G4cout << " >>> G4InuclCollider::collide" << G4endl;
68  }
69
70  const G4int itry_max = 1000;
71                     
[1315]72  if (useEPCollider(bullet,target)) {
[819]73    if (verboseLevel > 2) {
[1315]74      bullet->printParticle();
75      target->printParticle();
[819]76    }
77
[1315]78    theElementaryParticleCollider->collide(bullet, target, globalOutput);
[819]79  } else { // needs to call all machinery       
80    G4LorentzConvertor convertToTargetRestFrame;
[1315]81
82    interCase.set(bullet,target);
83    if (interCase.valid()) { // ok
[819]84      G4InuclNuclei* ntarget =
85        dynamic_cast<G4InuclNuclei*>(interCase.getTarget());
86
[1315]87      convertToTargetRestFrame.setTarget(ntarget);
[819]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       
[1315]94      if (interCase.hadNucleus()) { // particle with nuclei
[819]95        G4InuclElementaryParticle* pbullet = 
96          dynamic_cast<G4InuclElementaryParticle*>(interCase.getBullet());
97         
[1315]98        if (pbullet->isPhoton()) {
99          G4cerr << " InuclCollider -> can not collide with photon " << G4endl;
[819]100
101          globalOutput.trivialise(bullet, target);
[1315]102          return;
[819]103        } else {
[1315]104          convertToTargetRestFrame.setBullet(pbullet);   
[819]105          btype = pbullet->type();
106        }; 
107
108      } else { // nuclei with nuclei
109        G4InuclNuclei* nbullet = 
110          dynamic_cast<G4InuclNuclei*>(interCase.getBullet());
111
[1315]112        convertToTargetRestFrame.setBullet(nbullet);   
[819]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
[1315]130        G4LorentzVector bmom;
131        bmom.setZ(convertToTargetRestFrame.getTRSMomentum());
[819]132
[1315]133        G4InuclNuclei ntarget(at, zt);          // Default is at rest
[819]134
[1315]135        theIntraNucleiCascader->setInteractionCase(interCase.code());
[819]136         
137        G4bool bad = true;
138        G4int itry = 0;
139         
[1315]140        G4CollisionOutput TRFoutput;
141        G4CollisionOutput output;
[819]142        while (bad && itry < itry_max) {
[1315]143          itry++;
[819]144
[1315]145          output.reset();       // Clear buffers for this attempt
146          TRFoutput.reset();
147
148          if (interCase.hadNucleus()) {
[819]149            G4InuclElementaryParticle pbullet(bmom, btype);
150
[1315]151            theIntraNucleiCascader->collide(&pbullet, &ntarget, output);
[819]152          } else {
[1315]153            G4InuclNuclei nbullet(bmom, ab, zb);
154            theIntraNucleiCascader->collide(&nbullet, &ntarget, output);
[819]155          };   
156
157          if (verboseLevel > 3) {
158            G4cout << " After Cascade " << G4endl;
159            output.printCollisionOutput();
160          }
161         
162          // the rest, if any
[1315]163          // FIXME:  The code below still does too much copying!
[819]164          TRFoutput.addOutgoingParticles(output.getOutgoingParticles());
165
[1315]166          if (output.numberOfNucleiFragments() == 1) { // there is smth. after
[819]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
[1315]173              theBigBanger->collide(0,&cascad_rec_nuclei, TRFoutput);
[819]174            } else {
[1315]175              output.reset();
176              theNonEquilibriumEvaporator->collide(0, &cascad_rec_nuclei, output);
[819]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
[1315]186              output.reset();
187              theEquilibriumEvaporator->collide(0, &exiton_rec_nuclei, output);
188
[819]189              if (verboseLevel > 3) {
190                G4cout << " After EquilibriumEvaporator " << G4endl;
191                output.printCollisionOutput();
192              };
193
194              TRFoutput.addOutgoingParticles(output.getOutgoingParticles()); 
[1315]195              TRFoutput.addTargetFragments(output.getNucleiFragments());
[819]196            };
197          };
198         
[1315]199          // convert to the LAB
200          TRFoutput.boostToLabFrame(convertToTargetRestFrame);
[819]201
[1315]202          globalOutput.addOutgoingParticles(TRFoutput.getOutgoingParticles());
203          globalOutput.addTargetFragments(TRFoutput.getNucleiFragments());
[819]204          globalOutput.setOnShell(bullet, target);
[1315]205          if (globalOutput.acceptable()) return;
[819]206
[1315]207          globalOutput.reset();         // Clear and try again
[819]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        }
[1315]219      }
[819]220
[1315]221      globalOutput.trivialise(bullet, target);
222      return;
[819]223    } else {
224      if (verboseLevel > 3) {
[1315]225        G4cout << " InuclCollider -> inter case " << interCase.code() << G4endl;
[819]226      };
227    };       
228  };
229
[1315]230  return;
[819]231}
Note: See TracBrowser for help on using the repository browser.