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 #include <sstream>
00031 #include <iomanip>
00032
00033 #include "G4MCTSimVertex.hh"
00034
00035 #include "globals.hh"
00036 #include "G4SystemOfUnits.hh"
00037 #include "G4ios.hh"
00038 #include "G4MCTSimParticle.hh"
00039
00040
00041
00042
00043
00044
00045
00047 G4MCTSimVertex::G4MCTSimVertex()
00048 : inParticleTrackID(0),id(-1), time(0.),
00049 volumeName(""), volumeNumber(-1),
00050 creatorProcessName("none"),
00051 storeFlag(false)
00053 {
00054 }
00055
00057 G4MCTSimVertex::G4MCTSimVertex(const G4ThreeVector& x, double t)
00058 : inParticleTrackID(0), id(-1), position(x), time(t),
00059 volumeName(""), volumeNumber(-1),
00060 creatorProcessName("none"), storeFlag(false)
00062 {
00063 }
00064
00066 G4MCTSimVertex::G4MCTSimVertex(const G4ThreeVector& x, double t,
00067 std::string vname, int ncopy, std::string pname)
00068 : inParticleTrackID(0), id(-1), position(x), time(t),
00069 volumeName(vname), volumeNumber(ncopy),
00070 creatorProcessName(pname), storeFlag(false)
00072 {
00073 }
00074
00076 G4MCTSimVertex::~G4MCTSimVertex()
00078 {
00079 outParticleTrackIDList.clear();
00080 }
00081
00083 void G4MCTSimVertex::Print(std::ostream& ostr) const
00085 {
00086 std::ostringstream os;
00087 char cq=' ';
00088 if(storeFlag) cq='+';
00089 os << cq << id << '\0';
00090 std::string sid(os.str());
00091
00092 ostr.unsetf(std::ios::fixed);
00093 ostr.setf(std::ios::scientific|std::ios::right|std::ios::showpoint);
00094
00095 ostr << std::setw(6) << sid;
00096 ostr << " : X(" << std::setw(9) << std::setprecision(2)
00097 << position.x()/mm
00098 << "," << std::setw(9) << std::setprecision(2)
00099 << position.y()/mm
00100 << "," << std::setw(9) << std::setprecision(2)
00101 << position.z()/mm
00102 << "," << std::setw(9) << std::setprecision(2)
00103 << time/ns << ")";
00104 ostr.unsetf(std::ios::scientific);
00105 ostr << "@" << volumeName
00106 << "-" << volumeNumber
00107 << "%" << creatorProcessName
00108 << G4endl;
00109
00110 ostr << " " << std::setw(4) << inParticleTrackID << "-> ";
00111 size_t np= outParticleTrackIDList.size();
00112 for (size_t i=0; i<np; i++) ostr << outParticleTrackIDList[i] << ", ";
00113 ostr << G4endl;
00114 }
00115