G4MCTSimVertex.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 //   G4MCTSimVertex.cc
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 // class description
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   //ostr << std::setw(4) << id;
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 

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