Geant4  10.01.p03
G4PreCompoundDeexcitation.cc
Go to the documentation of this file.
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: G4PreCompoundDeexcitation.cc 71942 2013-06-28 19:08:11Z mkelsey $
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 // 20110214 M. Kelsey -- Follow G4InuclParticle::Model enumerator migration
39 // 20110803 M. Kelsey -- Add post-deexcitation diagnostic messages
40 // 20120120 V. Ivanchenko -- Pre-compound model and its handler should not be deleted here
41 // 20130621 Replace collide() interface with deExcite() using G4Fragment ref
42 // 20130622 Inherit from G4CascadeDeexciteBase, add verbosity interface
43 // to pass to PreCompound
44 // 20140508 Per V. Ivanchenko, attempt to use common instance of PreCompound.
45 
47 #include "G4HadronicInteraction.hh"
50 #include "G4InuclNuclei.hh"
51 #include "G4InuclParticle.hh"
52 #include "G4InuclParticleNames.hh"
53 #include "G4PreCompoundModel.hh"
55 
56 using namespace G4InuclParticleNames;
57 
58 
59 // Constructor and destructor
60 
62  : G4CascadeDeexciteBase("G4PreCompoundDeexcitation"),
63  theExcitationHandler(0), theDeExcitation(0) {
64  // Access common instance of PreCompound instead of creating new one
67 
68  // If not found, or cast fails, create a local instance
69  theDeExcitation = static_cast<G4PreCompoundModel*>(p);
70  if (!theDeExcitation) {
73  }
74 }
75 
77  // Per V.I. -- do not delete locally; handled in hadronic registry
78  //delete theExcitationHandler;
79  //delete theDeExcitation;
80 }
81 
85  // NOTE: G4ExcitationHandler doesn't have verbosity
86 }
87 
88 
89 // Main processing
90 
92  G4CollisionOutput& globalOutput) {
93  if (verboseLevel)
94  G4cout << " >>> G4PreCompoundDeexcitation::deExcite" << G4endl;
95 
96  if (verboseLevel > 1) G4cout << fragment << G4endl;
97 
98  G4ReactionProductVector* precompoundProducts = 0;
99 
100  // FIXME: in principle, the explosion(...) stuff should also
101  // handle properly the case of Z=0 (neutron blob)
102  if (explosion(fragment) && theExcitationHandler) {
103  if (verboseLevel) G4cout << " calling BreakItUp" << G4endl;
104  precompoundProducts = theExcitationHandler->BreakItUp(fragment);
105  } else {
106  if (verboseLevel) G4cout << " calling DeExcite" << G4endl;
107  // NOTE: DeExcite() interface takes a *non-const* reference
108  precompoundProducts =
109  theDeExcitation->DeExcite(const_cast<G4Fragment&>(fragment));
110  }
111 
112  // Transfer output of de-excitation back into Bertini objects
113  if (precompoundProducts) {
114  if (verboseLevel>1) {
115  G4cout << " Got " << precompoundProducts->size()
116  << " secondaries back from PreCompound:" << G4endl;
117  }
118 
119  globalOutput.setVerboseLevel(verboseLevel); // For debugging
120  globalOutput.addOutgoingParticles(precompoundProducts);
121  globalOutput.setVerboseLevel(0);
122 
123  for ( size_t i = 0; i < precompoundProducts->size(); i++ ) {
124  if ( (*precompoundProducts)[ i ] ) {
125  delete (*precompoundProducts)[ i ];
126  (*precompoundProducts)[ i ] = 0;
127  }
128  }
129  precompoundProducts->clear();
130  delete precompoundProducts;
131  }
132 }
void setVerboseLevel(G4int verbose)
virtual void setVerboseLevel(G4int verbose=0)
virtual G4ReactionProductVector * DeExcite(G4Fragment &aFragment)=0
virtual void deExcite(const G4Fragment &fragment, G4CollisionOutput &globalOutput)
int G4int
Definition: G4Types.hh:78
G4ReactionProductVector * BreakItUp(const G4Fragment &theInitialState)
std::vector< G4ReactionProduct * > G4ReactionProductVector
G4GLOB_DLL std::ostream G4cout
virtual void setVerboseLevel(G4int verbose)
G4HadronicInteraction * FindModel(const G4String &name)
void addOutgoingParticles(const std::vector< G4InuclElementaryParticle > &particles)
virtual G4bool explosion(const G4Fragment &target) const
G4VPreCompoundModel * theDeExcitation
static G4HadronicInteractionRegistry * Instance()
virtual void SetVerboseLevel(G4int value)
#define G4endl
Definition: G4ios.hh:61
G4ExcitationHandler * theExcitationHandler