G4INCLClusterUtils.cc

Go to the documentation of this file.
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 // INCL++ intra-nuclear cascade model
00027 // Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
00028 // Davide Mancusi, CEA
00029 // Alain Boudard, CEA
00030 // Sylvie Leray, CEA
00031 // Joseph Cugnon, University of Liege
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 }

Generated on Mon May 27 17:48:34 2013 for Geant4 by  doxygen 1.4.7