source: trunk/source/processes/hadronic/models/cascade/cascade/src/G4PreCompoundDeexcitation.cc @ 1350

Last change on this file since 1350 was 1350, checked in by garnier, 13 years ago

update to last version 4.9.4

File size: 5.0 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: G4PreCompoundDeexcitation.cc,v 1.6 2010/09/27 04:03:43 mkelsey Exp $
26// Geant4 tag: $Name: hadr-casc-V09-03-85 $
27//
28// Takes an arbitrary excited or unphysical nuclear state and produces
29// a final state with evaporated particles and (possibly) a stable nucleus.
30//
31// 20100922  M. Kelsey -- Remove convertFragment() function, pass buffer
32//              instead of copying, clean up code somewhat
33// 20100925  M. Kelsey -- Use new G4InuclNuclei->G4Fragment conversion, and
34//              G4ReactionProducts -> G4CollisionOutput convertor.  Move Z==0
35//              explosion condition to base-class function.
36// 20100926  M. Kelsey -- Move to new G4VCascadeDeexcitation base class,
37//              replace getDeexcitationFragments() with deExcite().
38
39#include "G4PreCompoundDeexcitation.hh"
40#include "globals.hh"
41#include "G4InuclElementaryParticle.hh"
42#include "G4InuclNuclei.hh"
43#include "G4InuclParticle.hh"
44#include "G4InuclParticleNames.hh"
45#include "G4PreCompoundModel.hh"
46#include "G4ReactionProductVector.hh"
47
48using namespace G4InuclParticleNames;
49
50
51// Constructor and destructor
52
53G4PreCompoundDeexcitation::G4PreCompoundDeexcitation() 
54  : G4VCascadeDeexcitation("G4PreCompoundDeexcitation"),
55    theExcitationHandler(new G4ExcitationHandler),
56    theDeExcitation(new G4PreCompoundModel(theExcitationHandler)) {}
57
58G4PreCompoundDeexcitation::~G4PreCompoundDeexcitation() {
59  // we need to delete here because G4PreComp does NOT delete it
60  delete theExcitationHandler;
61  delete theDeExcitation;
62}
63
64// Main processing
65
66void G4PreCompoundDeexcitation::collide(G4InuclParticle* /*bullet*/, 
67                                        G4InuclParticle* target,
68                                        G4CollisionOutput& globalOutput) {
69  if (verboseLevel)
70    G4cout << " >>> G4PreCompoundDeexcitation::collide" << G4endl;
71 
72  // Ensure that input state is sensible
73  G4InuclNuclei* ntarget = dynamic_cast<G4InuclNuclei*>(target);
74  if (!ntarget) {
75    G4cerr << " G4PreCompoundDeexcitation ERROR:  residual fragment must be G4InuclNuclei"
76           << G4endl;
77    return;
78  }
79
80  // NOTE:  Should not get this case, as G4IntraNucleiCascade should catch it
81  if (ntarget->getA() == 1) {           // Just a nucleon; move to output list
82    G4int type = (ntarget->getZ() == 0) ? neutron : proton;
83    G4InuclElementaryParticle ptarget(target->getMomentum(), type, 9);
84
85    globalOutput.addOutgoingParticle(ptarget);
86    return;
87  }
88
89  G4Fragment frag(*ntarget);
90
91  output.reset();               // Use temporary buffer for conservation checks
92  deExcite(&frag, output);
93  validateOutput(0, target, output);
94
95  globalOutput.add(output);     // Return results
96}
97
98void G4PreCompoundDeexcitation::deExcite(G4Fragment* fragment,
99                                         G4CollisionOutput& globalOutput) {
100  if (verboseLevel)
101    G4cout << " >>> G4PreCompoundDeexcitation::deExcite" << G4endl;
102
103  if (!fragment) {
104    if (verboseLevel > 1) G4cerr << " NULL pointer fragment" << G4endl;
105    return;
106  }
107
108  if (verboseLevel > 1) G4cout << *fragment << G4endl;
109
110  G4ReactionProductVector* precompoundProducts = 0;
111
112  // FIXME: in principle, the explosion(...) stuff should also
113  //        handle properly the case of Z=0 (neutron blob)
114  if (explosion(fragment) && theExcitationHandler) {
115    precompoundProducts = theExcitationHandler->BreakItUp(*fragment);
116  } else {
117    precompoundProducts = theDeExcitation->DeExcite(*fragment);
118  }
119
120  // Transfer output of de-excitation back into Bertini objects
121  if (precompoundProducts) {
122    globalOutput.addOutgoingParticles(precompoundProducts);
123    precompoundProducts->clear();
124    delete precompoundProducts;
125  }
126}
Note: See TracBrowser for help on using the repository browser.