00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "G4HadFinalState.hh"
00032 #include "G4HadronicException.hh"
00033
00034
00035 G4HadFinalState::G4HadFinalState()
00036 : theDirection(0,0,1), theEnergy(-1), theStat(isAlive),
00037 theW(1.), theEDep(0.) {}
00038
00039
00040 G4int G4HadFinalState::GetNumberOfSecondaries() const {return theSecs.size();}
00041
00042 void G4HadFinalState::SetEnergyChange(G4double anEnergy)
00043 {
00044 theEnergy=anEnergy;
00045 if(theEnergy<0)
00046 {
00047 std::cout << "Final state energy was: E = "<<theEnergy<<G4endl;
00048 throw G4HadronicException(__FILE__, __LINE__, "G4HadFinalState: fatal - negative energy");
00049 }
00050 }
00051
00052 G4double G4HadFinalState::GetEnergyChange() const {return theEnergy;}
00053
00054 void G4HadFinalState::SetMomentumChange(const G4ThreeVector& aV) {
00055 theDirection=aV;
00056 }
00057
00058 void G4HadFinalState::SetMomentumChange(G4double x, G4double y, G4double z)
00059 {
00060 theDirection.set(x,y,z);
00061 if(std::fabs(theDirection.mag()-1)>0.001)
00062 {
00063 G4cout <<"We have negative theDirection.mag() = "<<theDirection.mag()<<G4endl;
00064 throw G4HadronicException(__FILE__, __LINE__, "G4HadFinalState: fatal - negative direction.mag().");
00065 }
00066 }
00067
00068 const G4ThreeVector& G4HadFinalState::GetMomentumChange() const {return theDirection;}
00069
00070 void G4HadFinalState::AddSecondary(G4DynamicParticle *aP) {
00071
00072 if (aP) theSecs.push_back(G4HadSecondary(aP));
00073 }
00074
00075
00076 void G4HadFinalState::AddSecondaries(const std::vector<G4HadSecondary>& addSecs)
00077 {
00078 theSecs.insert(theSecs.end(),addSecs.begin(),addSecs.end());
00079 }
00080
00081 void G4HadFinalState::SetStatusChange(G4HadFinalStateStatus aS){theStat=aS;}
00082
00083 G4HadFinalStateStatus G4HadFinalState::GetStatusChange() const {return theStat;}
00084
00085 void G4HadFinalState::ClearSecondaries() {
00086 theSecs.clear();
00087 }
00088
00089 void G4HadFinalState::Clear()
00090 {
00091 theDirection.set(0,0,1);
00092 theEnergy = -1;
00093 theStat = isAlive;
00094 theW = 1.;
00095 theEDep = 0.;
00096 ClearSecondaries();
00097 }
00098
00099 void G4HadFinalState::SecondariesAreStale() { }
00100
00101 const G4LorentzRotation& G4HadFinalState::GetTrafoToLab() const {return theT;}
00102
00103 void G4HadFinalState::SetTrafoToLab(const G4LorentzRotation & aT) {theT = aT;}
00104
00105 void G4HadFinalState::SetWeightChange(G4double aW){ theW=aW;}
00106
00107 G4double G4HadFinalState::GetWeightChange() const {return theW;}
00108
00109 G4HadSecondary * G4HadFinalState::GetSecondary(size_t i)
00110 {
00111 if(i>theSecs.size())
00112 {
00113 throw G4HadronicException(__FILE__, __LINE__,
00114 "Trying direct access to secondary beyond end of list");
00115 }
00116 return &theSecs[i];
00117 }
00118
00119 const G4HadSecondary* G4HadFinalState::GetSecondary(size_t i) const
00120 {
00121 if(i>theSecs.size())
00122 {
00123 throw G4HadronicException(__FILE__, __LINE__,
00124 "Trying direct access to secondary beyond end of list");
00125 }
00126 return &theSecs[i];
00127 }
00128
00129 void G4HadFinalState::SetLocalEnergyDeposit(G4double aE) {theEDep=aE;}
00130
00131 G4double G4HadFinalState::GetLocalEnergyDeposit() const {return theEDep;}