Geant4  10.00.p03
G4VCollision.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 //
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 
36 { }
37 
39 {
40 }
41 
42 
44 {
45  return (this == (G4VCollision *) &right);
46 }
47 
48 
50 {
51  return (this != (G4VCollision *) &right);
52 }
53 
54 
56  const G4KineticTrack& aTrk2) const
57 {
58  G4double sigma = 0.;
59 
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 
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  if (components)
90  {
91  for (iter = components->begin(); iter != components->end(); ++iter)
92  {
93  G4cout << "---- " << name << " ---- Component " << i << G4endl;
94  ((*iter))->Print();
95  i++;
96  }
97  }
98 
99 }
100 
101 
103  const G4KineticTrack& trk2) const
104 {
105  G4String name = GetName();
106 
107  if (IsInCharge(trk1,trk2))
108  {
109  G4cout << "---- " << name << "is in charge ---- " << G4endl;
110  }
111  else
112  {
113  G4cout << "---- " << name << "is not in charge ---- " << G4endl;
114  }
115 
116  G4cout << "---- " << name << "---- Cross section" << G4endl;
117 
118  const G4VCrossSectionSource* xSource = GetCrossSectionSource();
119  if (xSource) xSource->Print();
120  G4cout << "Cross section = " << CrossSection(trk1,trk2) << G4endl;
121 
122  G4int nComponents = 0;
123  const G4CollisionVector* components = GetComponents();
124  if (components)
125  {
126  nComponents = components->size();
127  }
128  G4cout << "---- " << name << "has " << nComponents << " components" <<G4endl;
129 
130  G4int i = 0;
131  G4CollisionVector::const_iterator iter;
132  if (components)
133  {
134  for (iter = components->begin(); iter != components->end(); ++iter)
135  {
136  G4cout << "Component " << i << G4endl;
137  ((*iter))->Print();
138  i++;
139  }
140  }
141 }
142 
143 G4VCollision::G4VCollision(void*, void*, void *, void *, void *, void *, void *){}
virtual G4bool IsInCharge(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const =0
G4String name
Definition: TRTMaterials.hh:40
G4int nComponents
Definition: TRTMaterials.hh:41
int G4int
Definition: G4Types.hh:78
void establish_G4MT_TLS_G4VCollision()
virtual ~G4VCollision()
Definition: G4VCollision.cc:38
virtual void Print() const
Definition: G4VCollision.cc:71
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
virtual G4double CrossSection(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
Definition: G4VCollision.cc:55
std::vector< G4VCollision * > G4CollisionVector
G4bool operator==(const G4VCollision &right) const
Definition: G4VCollision.cc:43
G4bool operator!=(const G4VCollision &right) const
Definition: G4VCollision.cc:49
virtual const G4VCrossSectionSource * GetCrossSectionSource() const =0
virtual G4String GetName() const =0
virtual void Print() const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
virtual const G4CollisionVector * GetComponents() const
Definition: G4VCollision.hh:80
virtual G4double CrossSection(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const =0