Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4MCTSimVertex.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // G4MCTSimVertex.cc
27 //
28 // ====================================================================
29 
30 #include <sstream>
31 #include <iomanip>
32 
33 #include "G4MCTSimVertex.hh"
34 
35 #include "globals.hh"
36 #include "G4SystemOfUnits.hh"
37 #include "G4ios.hh"
38 #include "G4MCTSimParticle.hh"
39 
40 // ====================================================================
41 //
42 // class description
43 //
44 // ====================================================================
45 
48  : inParticleTrackID(0),id(-1), time(0.),
49  volumeName(""), volumeNumber(-1),
50  creatorProcessName("none"),
51  storeFlag(false)
53 {
54 }
55 
58  : inParticleTrackID(0), id(-1), position(x), time(t),
59  volumeName(""), volumeNumber(-1),
60  creatorProcessName("none"), storeFlag(false)
62 {
63 }
64 
67  std::string vname, int ncopy, std::string pname)
68  : inParticleTrackID(0), id(-1), position(x), time(t),
69  volumeName(vname), volumeNumber(ncopy),
70  creatorProcessName(pname), storeFlag(false)
72 {
73 }
74 
78 {
79  outParticleTrackIDList.clear();
80 }
81 
83 void G4MCTSimVertex::Print(std::ostream& ostr) const
85 {
86  std::ostringstream os;
87  char cq=' ';
88  if(storeFlag) cq='+';
89  os << cq << id << '\0';
90  std::string sid(os.str());
91 
92  ostr.unsetf(std::ios::fixed);
93  ostr.setf(std::ios::scientific|std::ios::right|std::ios::showpoint);
94  //ostr << std::setw(4) << id;
95  ostr << std::setw(6) << sid;
96  ostr << " : X(" << std::setw(9) << std::setprecision(2)
97  << position.x()/mm
98  << "," << std::setw(9) << std::setprecision(2)
99  << position.y()/mm
100  << "," << std::setw(9) << std::setprecision(2)
101  << position.z()/mm
102  << "," << std::setw(9) << std::setprecision(2)
103  << time/ns << ")";
104  ostr.unsetf(std::ios::scientific);
105  ostr << "@" << volumeName
106  << "-" << volumeNumber
107  << "%" << creatorProcessName
108  << G4endl;
109 
110  ostr << " " << std::setw(4) << inParticleTrackID << "-> ";
111  size_t np= outParticleTrackIDList.size();
112  for (size_t i=0; i<np; i++) ostr << outParticleTrackIDList[i] << ", ";
113  ostr << G4endl;
114 }
115