00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // $Id$ 00027 // 00028 // Hadronic Process: Nuclear Preequilibrium 00029 // by V. Lara 00030 // 00031 // Modified: 00032 // 03.09.2008 by J. M. Quesada for external choice of inverse 00033 // cross section option 00034 // 06.09.2008 JMQ Also external choice has been added for: 00035 // - superimposed Coulomb barrier (if useSICB=true) 00036 // 27.08.2010 V.Ivanchenko simplify and make more efficient by adding extra 00037 // vector of probabilities, moved constructor and destructor to source, 00038 // simplify run time computations making inlined 00039 // 00040 00041 #ifndef G4PreCompoundFragmentVector_h 00042 #define G4PreCompoundFragmentVector_h 1 00043 00044 #include "G4VPreCompoundFragment.hh" 00045 #include "G4DataVector.hh" 00046 #include "Randomize.hh" 00047 #include "globals.hh" 00048 #include <vector> 00049 00050 typedef std::vector<G4VPreCompoundFragment*> pcfvector; 00051 00052 class G4PreCompoundFragmentVector 00053 { 00054 public: 00055 00056 G4PreCompoundFragmentVector(pcfvector * avector); 00057 00058 ~G4PreCompoundFragmentVector(); 00059 00060 void SetVector(pcfvector * avector); 00061 00062 void SetOPTxs(G4int); 00063 00064 void UseSICB(G4bool); 00065 00066 inline void Initialize(const G4Fragment & aFragment); 00067 00068 inline G4double CalculateProbabilities(const G4Fragment & aFragment); 00069 00070 inline G4VPreCompoundFragment * ChooseFragment(); 00071 00072 private: 00073 00074 G4PreCompoundFragmentVector(const G4PreCompoundFragmentVector &right); 00075 const G4PreCompoundFragmentVector& 00076 operator=(const G4PreCompoundFragmentVector &right); 00077 G4bool operator==(const G4PreCompoundFragmentVector &right) const; 00078 G4bool operator!=(const G4PreCompoundFragmentVector &right) const; 00079 00080 pcfvector * theChannels; 00081 G4DataVector probabilities; 00082 00083 G4int nChannels; 00084 00085 }; 00086 00087 inline void 00088 G4PreCompoundFragmentVector::Initialize(const G4Fragment & aFragment) 00089 { 00090 for (G4int i=0; i< nChannels; ++i) { 00091 (*theChannels)[i]->Initialize(aFragment); 00092 } 00093 } 00094 00095 inline G4double 00096 G4PreCompoundFragmentVector::CalculateProbabilities(const G4Fragment & aFragment) 00097 { 00098 //G4cout << "## G4PreCompoundFragmentVector::CalculateProbabilities" << G4endl; 00099 G4double probtot = 0.0; 00100 for (G4int i=0; i< nChannels; ++i) { 00101 G4double prob = (*theChannels)[i]->CalcEmissionProbability(aFragment); 00102 probtot += prob; 00103 probabilities[i] = probtot; 00104 //G4cout<<" prob= "<<prob<<" for "<<(*theChannels)[i]->GetName()<<G4endl; 00105 } 00106 return probtot; 00107 } 00108 00109 inline G4VPreCompoundFragment* G4PreCompoundFragmentVector::ChooseFragment() 00110 { 00111 G4double x = probabilities[nChannels-1]*G4UniformRand(); 00112 G4int i=0; 00113 for (; i<nChannels; ++i) { 00114 if(x <= probabilities[i]) { break; } 00115 } 00116 return (*theChannels)[i]; 00117 } 00118 00119 #endif 00120