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
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #include "globals.hh"
00043 #include "G4SystemOfUnits.hh"
00044 #include "G4HadronicException.hh"
00045 #include "G4ios.hh"
00046 #include "G4PartialWidthTable.hh"
00047 #include "G4KineticTrack.hh"
00048
00049 G4PartialWidthTable::G4PartialWidthTable(const G4double* energies, G4int entries) : nEnergies(entries)
00050 {
00051
00052 G4int i;
00053 for (i=0; i<entries; i++)
00054 {
00055 G4double e = *(energies + i) * GeV;
00056 energy.push_back(e);
00057 }
00058 }
00059
00060
00061 G4PartialWidthTable::~G4PartialWidthTable()
00062 { }
00063
00064
00065 G4bool G4PartialWidthTable::operator==(const G4PartialWidthTable &right) const
00066 {
00067 return (this == (G4PartialWidthTable *) &right);
00068 }
00069
00070
00071 G4bool G4PartialWidthTable::operator!=(const G4PartialWidthTable &right) const
00072 {
00073 return (this != (G4PartialWidthTable *) &right);
00074 }
00075
00076
00077 G4int G4PartialWidthTable::NumberOfChannels() const
00078 {
00079 return widths.size();
00080 }
00081
00082
00083 const G4PhysicsVector* G4PartialWidthTable::Width(const G4String& name1, const G4String& name2) const
00084 {
00085
00086 G4int i;
00087 G4PhysicsVector* width = 0;
00088 G4int n = 0;
00089 G4int entries = widths.size();
00090 for (i=0; i<entries; i++)
00091 {
00092 if ( (daughter1[i] == name1 && daughter2[i] == name2) ||
00093 (daughter2[i] == name1 && daughter1[i] == name2) )
00094 {
00095 width = (G4PhysicsVector*) (widths[i]);
00096 n++;
00097 }
00098 }
00099 if (n > 1) throw G4HadronicException(__FILE__, __LINE__, "G4PartialWidthTable::Width - ambiguity");
00100
00101 return width;
00102 }
00103
00104
00105 void G4PartialWidthTable::AddWidths(const G4double* channelWidth,
00106 const G4String& name1, const G4String& name2)
00107 {
00108 G4PhysicsFreeVector* width = new G4PhysicsFreeVector(nEnergies);
00109 G4int i;
00110 for (i=0; i<nEnergies; i++)
00111 {
00112 G4double value = *(channelWidth+ i) * GeV;
00113 G4double e = energy[i];
00114 width->PutValue(i,e,value);
00115 }
00116
00117 widths.push_back(width);
00118 daughter1.push_back(name1);
00119 daughter2.push_back(name2);
00120
00121 return;
00122 }
00123
00124
00125 void G4PartialWidthTable::Dump() const
00126 {
00127 G4int entries = widths.size();
00128
00129 G4int i;
00130 for (i=0; i<entries; i++)
00131 {
00132 G4cout << " Channel " << i << ": "
00133 << daughter1[i] << " " << daughter2[i] << G4endl;
00134 G4PhysicsFreeVector* width = widths[i];
00135 G4int j;
00136 for (j=0; j<nEnergies; j++)
00137 {
00138 G4bool dummy = false;
00139 G4double e = energy[i];
00140 G4double w = width->GetValue(e,dummy);
00141 G4cout << j << ") Energy = " << e << ", Width = " << w << G4endl;
00142 }
00143 }
00144 return;
00145 }