Changeset 1340 for trunk/source/processes/hadronic/models/pre_equilibrium/exciton_model/src/G4PreCompoundFragmentVector.cc
- Timestamp:
- Nov 5, 2010, 3:45:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/hadronic/models/pre_equilibrium/exciton_model/src/G4PreCompoundFragmentVector.cc
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4PreCompoundFragmentVector.cc,v 1.1 1 2009/02/10 16:01:37vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 4-beta-01$26 // $Id: G4PreCompoundFragmentVector.cc,v 1.12 2010/08/28 15:16:55 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-03-ref-09 $ 28 28 // 29 29 // Hadronic Process: Nuclear Preequilibrium 30 30 // by V. Lara 31 // 32 // Modified: 33 // 27.08.2010 V.Ivanchenko moved constructor and destructor to source, 34 // simplify run time computations making inlined 35 // 31 36 32 37 #include "G4PreCompoundFragmentVector.hh" 33 #include "G4HadronicException.hh"34 38 35 const G4PreCompoundFragmentVector & 36 G4PreCompoundFragmentVector:: 37 operator=(const G4PreCompoundFragmentVector &) 39 G4PreCompoundFragmentVector::G4PreCompoundFragmentVector(pcfvector * avector) 40 : theChannels(0), nChannels(0) 38 41 { 39 throw G4HadronicException(__FILE__, __LINE__, "G4PreCompoundFragmentVector::operator= meant to not be accessable"); 40 return *this; 42 SetVector(avector); 41 43 } 42 44 45 G4PreCompoundFragmentVector::~G4PreCompoundFragmentVector() 46 {} 43 47 44 G4bool G4PreCompoundFragmentVector:: 45 operator==(const G4PreCompoundFragmentVector &) const 48 void G4PreCompoundFragmentVector::SetVector(pcfvector * avector) 46 49 { 47 return false; 50 theChannels = avector; 51 if(theChannels) { 52 nChannels = theChannels->size(); 53 probabilities.resize(nChannels); 54 } 48 55 } 49 56 50 G4bool G4PreCompoundFragmentVector:: 51 operator!=(const G4PreCompoundFragmentVector &) const 52 { 53 return true; 57 //for inverse cross section choice 58 void G4PreCompoundFragmentVector::SetOPTxs(G4int opt) 59 { 60 for (G4int i=0; i< nChannels; ++i) { 61 (*theChannels)[i]->SetOPTxs(opt); 62 } 54 63 } 55 64 56 57 58 G4double G4PreCompoundFragmentVector:: 59 CalculateProbabilities(const G4Fragment & aFragment) 60 { 61 TotalEmissionProbability = 0.0; 62 pcfvector::iterator aChannel; 63 for (aChannel=theChannels->begin(); aChannel != theChannels->end(); 64 aChannel++) 65 { 66 // Calculate emission probailities 67 // Compute total (integrated over kinetic energy) emission 68 // probability of a fragment and 69 // Summing channel emission probabilities 70 TotalEmissionProbability += (*aChannel)->CalcEmissionProbability(aFragment); 71 } 72 return TotalEmissionProbability; 65 //for superimposed Coulomb Barrier for inverse cross sections 66 void G4PreCompoundFragmentVector::UseSICB(G4bool use) 67 { 68 for (G4int i=0; i< nChannels; ++i) { 69 (*theChannels)[i]->UseSICB(use); 70 } 73 71 } 74 72 75 76 G4VPreCompoundFragment * G4PreCompoundFragmentVector::77 ChooseFragment(void)78 {79 const G4int NumOfFrags = theChannels->size();80 std::vector<G4double> running;81 running.reserve(NumOfFrags);82 83 pcfvector::iterator i;84 G4double accumulation = 0.0;85 for (i = theChannels->begin(); i != theChannels->end(); ++i) {86 accumulation += (*i)->GetEmissionProbability();87 88 running.push_back(accumulation);89 }90 91 // Choose an emission channel92 G4double aChannel = G4UniformRand()*TotalEmissionProbability;93 G4int ChosenChannel = -1;94 std::vector<G4double>::iterator ich;95 for (ich = running.begin(); ich != running.end(); ++ich)96 {97 if (aChannel <= *ich)98 {99 #ifdef G4NO_ISO_VECDIST100 std::vector<G4double>::difference_type n = 0;101 std::distance(running.begin(),ich,n);102 ChosenChannel = n;103 #else104 ChosenChannel = std::distance(running.begin(),ich);105 #endif106 break;107 }108 }109 running.clear();110 if (ChosenChannel < 0)111 {112 G4cerr113 << "G4PreCompoundFragmentVector::ChooseFragment: I can't determine a channel\n"114 << "Probabilities: ";115 for (i = theChannels->begin(); i != theChannels->end(); ++i)116 {117 G4cout << (*i)->GetEmissionProbability() << " ";118 }119 G4cout << '\n';120 return 0;121 }122 else123 {124 for (i = theChannels->begin(); i != theChannels->end(); ++i)125 {126 (*i)->IncrementStage();127 }128 }129 130 return theChannels->operator[](ChosenChannel);131 }
Note: See TracChangeset
for help on using the changeset viewer.