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 "globals.hh" |
---|
31 | #include <sstream> |
---|
32 | #include <iomanip> |
---|
33 | #include "G4ios.hh" |
---|
34 | #include "G4MCTSimParticle.hh" |
---|
35 | #include "G4MCTSimVertex.hh" |
---|
36 | |
---|
37 | // ==================================================================== |
---|
38 | // |
---|
39 | // class description |
---|
40 | // |
---|
41 | // ==================================================================== |
---|
42 | |
---|
43 | ///////////////////////////////////// |
---|
44 | G4MCTSimVertex::G4MCTSimVertex() |
---|
45 | : inParticleTrackID(0),id(-1), |
---|
46 | volumeName(""), volumeNumber(-1), |
---|
47 | creatorProcessName("none"), |
---|
48 | storeFlag(false) |
---|
49 | ///////////////////////////////////// |
---|
50 | { |
---|
51 | } |
---|
52 | |
---|
53 | ///////////////////////////////////////////////////////// |
---|
54 | G4MCTSimVertex::G4MCTSimVertex(const G4ThreeVector& x, double t) |
---|
55 | : inParticleTrackID(0), id(-1), position(x), time(t), |
---|
56 | volumeName(""), volumeNumber(-1), |
---|
57 | creatorProcessName("none"), storeFlag(false) |
---|
58 | ///////////////////////////////////////////////////////// |
---|
59 | { |
---|
60 | } |
---|
61 | |
---|
62 | /////////////////////////////////////////////////////////////// |
---|
63 | G4MCTSimVertex::G4MCTSimVertex(const G4ThreeVector& x, double t, |
---|
64 | std::string vname, int ncopy, std::string pname) |
---|
65 | : inParticleTrackID(0), id(-1), position(x), time(t), |
---|
66 | volumeName(vname), volumeNumber(ncopy), |
---|
67 | creatorProcessName(pname), storeFlag(false) |
---|
68 | /////////////////////////////////////////////////////////////// |
---|
69 | { |
---|
70 | } |
---|
71 | |
---|
72 | ///////////////////////////// |
---|
73 | G4MCTSimVertex::~G4MCTSimVertex() |
---|
74 | ///////////////////////////// |
---|
75 | { |
---|
76 | outParticleTrackIDList.clear(); |
---|
77 | } |
---|
78 | |
---|
79 | ////////////////////////////////////////////////// |
---|
80 | void G4MCTSimVertex::Print(std::ostream& ostr) const |
---|
81 | ////////////////////////////////////////////////// |
---|
82 | { |
---|
83 | std::ostringstream os; |
---|
84 | char cq=' '; |
---|
85 | if(storeFlag) cq='+'; |
---|
86 | os << cq << id << '\0'; |
---|
87 | std::string sid(os.str()); |
---|
88 | |
---|
89 | ostr.unsetf(std::ios::fixed); |
---|
90 | ostr.setf(std::ios::scientific|std::ios::right|std::ios::showpoint); |
---|
91 | //ostr << std::setw(4) << id; |
---|
92 | ostr << std::setw(6) << sid; |
---|
93 | ostr << " : X(" << std::setw(9) << std::setprecision(2) |
---|
94 | << position.x()/mm |
---|
95 | << "," << std::setw(9) << std::setprecision(2) |
---|
96 | << position.y()/mm |
---|
97 | << "," << std::setw(9) << std::setprecision(2) |
---|
98 | << position.z()/mm |
---|
99 | << "," << std::setw(9) << std::setprecision(2) |
---|
100 | << time/ns << ")"; |
---|
101 | ostr.unsetf(std::ios::scientific); |
---|
102 | ostr << "@" << volumeName |
---|
103 | << "-" << volumeNumber |
---|
104 | << "%" << creatorProcessName |
---|
105 | << G4endl; |
---|
106 | |
---|
107 | ostr << " " << std::setw(4) << inParticleTrackID << "-> "; |
---|
108 | size_t np= outParticleTrackIDList.size(); |
---|
109 | for (size_t i=0; i<np; i++) ostr << outParticleTrackIDList[i] << ", "; |
---|
110 | ostr << G4endl; |
---|
111 | } |
---|
112 | |
---|