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 #define INCLXX_IN_GEANT4_MODE 1
00034
00035 #include "globals.hh"
00036
00037 #include "G4INCLClusterUtils.hh"
00038
00039 namespace G4INCL {
00040
00041 G4double ClusterUtils::getTotalEnergy(const ParticleList &pl) {
00042 G4double E = 0.0;
00043 for(ParticleIter i = pl.begin(); i != pl.end(); ++i) {
00044 E += (*i)->getEnergy();
00045 }
00046 return E;
00047 }
00048
00049 G4double ClusterUtils::getKineticEnergy(const ParticleList &pl) {
00050 G4double Ekin = 0.0;
00051 for(ParticleIter i = pl.begin(); i != pl.end(); ++i) {
00052 Ekin += std::sqrt(std::pow((*i)->getEnergy(), 2) - std::pow((*i)->getMass(), 2));;
00053 }
00054 return Ekin;
00055 }
00056
00057 G4int ClusterUtils::getZ(const ParticleList &pl) {
00058 G4int Z = 0;
00059 for(ParticleIter i = pl.begin(); i != pl.end(); ++i) {
00060 Z += (*i)->getZ();
00061 }
00062 return Z;
00063 }
00064
00065 G4int ClusterUtils::getZ(const ParticleList &pl, Particle *p) {
00066 return (ClusterUtils::getZ(pl) + p->getZ());
00067 }
00068
00069 G4int ClusterUtils::getA(const ParticleList &pl) {
00070 G4int A = 0;
00071 for(ParticleIter i = pl.begin(); i != pl.end(); ++i) {
00072 A += (*i)->getA();
00073 }
00074 return A;
00075 }
00076
00077 G4int ClusterUtils::getA(const ParticleList &pl, Particle *p) {
00078 return (ClusterUtils::getA(pl) + p->getA());
00079 }
00080
00081 ThreeVector ClusterUtils::getNewPositionVector(const ParticleList &pl)
00082 {
00083 ThreeVector pos(0.0, 0.0, 0.0);
00084 G4int A = 1;
00085 for(ParticleIter i = pl.begin(); i != pl.end(); ++i) {
00086 pos += (pos * A)*ParticleTable::clusterPosFact[A];
00087 ++A;
00088 }
00089 return pos;
00090 }
00091
00092 ThreeVector ClusterUtils::getNewPositionVector(const ParticleList &pl, Particle *p)
00093 {
00094 ThreeVector pos = ClusterUtils::getNewPositionVector(pl);
00095 return ((pos * pl.size()) + p->getPosition()) * ParticleTable::clusterPosFact[pl.size() + 1];
00096 }
00097
00098 ThreeVector ClusterUtils::getNewPositionVector(const ThreeVector &oldPosition, const ParticleList &pl, Particle *p) {
00099 ThreeVector newPosition = oldPosition;
00100 newPosition *= pl.size();
00101 newPosition += p->getPosition();
00102 newPosition *= ParticleTable::clusterPosFact[pl.size() + 1];
00103 return newPosition;
00104 }
00105
00106 G4double ClusterUtils::getPhaseSpace(const ThreeVector &clusterPosition,
00107 const ThreeVector &clusterMomentum,
00108 G4int clusterA,
00109 Particle *p) {
00110 G4double psSpace = (p->getPosition() - clusterPosition).mag2();
00111 G4double psMomentum = (p->getMomentum() - clusterMomentum).mag2();
00112 return psSpace * psMomentum * ParticleTable::clusterPosFact2[clusterA + p->getA()];
00113 }
00114
00115 G4bool ClusterUtils::isBetterCluster(ParticleList *, ParticleList *) {
00116 return true;
00117 }
00118 }