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 | // |
---|
27 | // $Id: G4VCollision.cc,v 1.3 2006/06/29 20:41:49 gunter Exp $ // |
---|
28 | |
---|
29 | #include "globals.hh" |
---|
30 | #include "G4ios.hh" |
---|
31 | #include "G4VCollision.hh" |
---|
32 | #include "G4VCrossSectionSource.hh" |
---|
33 | #include "G4KineticTrack.hh" |
---|
34 | |
---|
35 | G4VCollision::G4VCollision() |
---|
36 | { } |
---|
37 | |
---|
38 | G4VCollision::~G4VCollision() |
---|
39 | { |
---|
40 | } |
---|
41 | |
---|
42 | |
---|
43 | G4bool G4VCollision::operator==(const G4VCollision &right) const |
---|
44 | { |
---|
45 | return (this == (G4VCollision *) &right); |
---|
46 | } |
---|
47 | |
---|
48 | |
---|
49 | G4bool G4VCollision::operator!=(const G4VCollision &right) const |
---|
50 | { |
---|
51 | return (this != (G4VCollision *) &right); |
---|
52 | } |
---|
53 | |
---|
54 | |
---|
55 | G4double G4VCollision::CrossSection(const G4KineticTrack& aTrk1, |
---|
56 | const G4KineticTrack& aTrk2) const |
---|
57 | { |
---|
58 | G4double sigma = 0.; |
---|
59 | |
---|
60 | const G4VCrossSectionSource* xSource = GetCrossSectionSource(); |
---|
61 | |
---|
62 | if (xSource != 0) |
---|
63 | { |
---|
64 | // There is a cross section for this Collision |
---|
65 | sigma = xSource->CrossSection(aTrk1,aTrk2); |
---|
66 | } |
---|
67 | return sigma; |
---|
68 | } |
---|
69 | |
---|
70 | |
---|
71 | void G4VCollision::Print() const |
---|
72 | { |
---|
73 | G4String name = GetName(); |
---|
74 | |
---|
75 | G4cout << "---- " << name << "---- Cross section" << G4endl; |
---|
76 | |
---|
77 | const G4VCrossSectionSource* xSource = GetCrossSectionSource(); |
---|
78 | if (xSource) xSource->Print(); |
---|
79 | |
---|
80 | G4int nComponents = 0; |
---|
81 | const G4CollisionVector* components = GetComponents(); |
---|
82 | if (components) |
---|
83 | { |
---|
84 | nComponents = components->size(); |
---|
85 | } |
---|
86 | G4cout << "---- " << name << "---- has " << nComponents << " components" <<G4endl; |
---|
87 | G4int i = 0; |
---|
88 | G4CollisionVector::const_iterator iter; |
---|
89 | for (iter = components->begin(); iter != components->end(); ++iter) |
---|
90 | { |
---|
91 | G4cout << "---- " << name << " ---- Component " << i << G4endl; |
---|
92 | ((*iter))->Print(); |
---|
93 | i++; |
---|
94 | } |
---|
95 | |
---|
96 | // G4int i; |
---|
97 | // for (i=0; i<nComponents; i++) |
---|
98 | // { |
---|
99 | // G4VCollision* component = (*components)[i]; |
---|
100 | // G4cout << "---- " << name << " ---- Component " << i << G4endl; |
---|
101 | // component->Print(); |
---|
102 | // } |
---|
103 | } |
---|
104 | |
---|
105 | |
---|
106 | void G4VCollision::Print(const G4KineticTrack& trk1, |
---|
107 | const G4KineticTrack& trk2) const |
---|
108 | { |
---|
109 | G4String name = GetName(); |
---|
110 | |
---|
111 | if (IsInCharge(trk1,trk2)) |
---|
112 | { |
---|
113 | G4cout << "---- " << name << "is in charge ---- " << G4endl; |
---|
114 | } |
---|
115 | else |
---|
116 | { |
---|
117 | G4cout << "---- " << name << "is not in charge ---- " << G4endl; |
---|
118 | } |
---|
119 | |
---|
120 | G4cout << "---- " << name << "---- Cross section" << G4endl; |
---|
121 | |
---|
122 | const G4VCrossSectionSource* xSource = GetCrossSectionSource(); |
---|
123 | if (xSource) xSource->Print(); |
---|
124 | G4cout << "Cross section = " << CrossSection(trk1,trk2) << G4endl; |
---|
125 | |
---|
126 | G4int nComponents = 0; |
---|
127 | const G4CollisionVector* components = GetComponents(); |
---|
128 | if (components) |
---|
129 | { |
---|
130 | nComponents = components->size(); |
---|
131 | } |
---|
132 | G4cout << "---- " << name << "has " << nComponents << " components" <<G4endl; |
---|
133 | |
---|
134 | G4int i = 0; |
---|
135 | G4CollisionVector::const_iterator iter; |
---|
136 | for (iter = components->begin(); iter != components->end(); ++iter) |
---|
137 | { |
---|
138 | G4cout << "Component " << i << G4endl; |
---|
139 | ((*iter))->Print(); |
---|
140 | i++; |
---|
141 | } |
---|
142 | } |
---|
143 | |
---|
144 | |
---|