source: trunk/source/processes/hadronic/util/include/G4ReactionProduct.hh@ 1315

Last change on this file since 1315 was 819, checked in by garnier, 17 years ago

import all except CVS

File size: 7.5 KB
Line 
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//
28 // J.L. Chuma, TRIUMF, 31-Oct-1996
29 // last modified: 19-Dec-1996
30 // modified by J.L.Chuma, 24-Jul-1997 to include total momentum
31 // inluded operator *, and some minor modifications.
32 // modified by H.P.Wellisch to add functionality needed by string models,
33 // cascade and Nucleus. (Mon Mar 16 1998)
34
35#ifndef G4ReactionProduct_h
36#define G4ReactionProduct_h 1
37
38#include "globals.hh"
39#include "G4DynamicParticle.hh"
40#include "G4HadProjectile.hh"
41#include "G4HadronicException.hh"
42
43 class G4ReactionProduct
44 {
45 friend G4ReactionProduct operator+(
46 const G4ReactionProduct & p1, const G4ReactionProduct &p2 );
47
48 friend G4ReactionProduct operator-(
49 const G4ReactionProduct & p1, const G4ReactionProduct &p2 );
50
51 friend G4ReactionProduct operator*(
52 const G4double aDouble, const G4ReactionProduct &p2 )
53 {
54 G4ReactionProduct result;
55 result.SetMomentum(aDouble*p2.GetMomentum());
56 result.SetMass(p2.GetMass());
57 result.SetTotalEnergy(std::sqrt(result.GetMass()*result.GetMass()+
58 result.GetMomentum()*result.GetMomentum()));
59 return result;
60 }
61
62 public:
63 G4ReactionProduct();
64
65 G4ReactionProduct( G4ParticleDefinition *aParticleDefinition );
66
67 ~G4ReactionProduct() {}
68
69 G4ReactionProduct( const G4ReactionProduct &right );
70
71 G4ReactionProduct &operator= ( const G4ReactionProduct &right );
72
73 G4ReactionProduct &operator= ( const G4DynamicParticle &right );
74
75 G4ReactionProduct &operator= ( const G4HadProjectile &right );
76
77 inline G4bool operator== ( const G4ReactionProduct &right ) const
78 { return ( this == (G4ReactionProduct*) &right ); }
79
80 inline G4bool operator!= ( const G4ReactionProduct &right ) const
81 { return ( this != (G4ReactionProduct*) &right ); }
82
83 inline G4ParticleDefinition *GetDefinition() const
84 { return theParticleDefinition; }
85
86 void SetDefinition( G4ParticleDefinition *aParticleDefinition );
87
88 void SetDefinitionAndUpdateE( G4ParticleDefinition *aParticleDefinition );
89
90 void SetMomentum( const G4double x, const G4double y, const G4double z );
91
92 void SetMomentum( const G4double x, const G4double y );
93
94 void SetMomentum( const G4double z );
95
96 inline void SetMomentum( const G4ThreeVector &m )
97 { momentum = m; }
98
99 inline G4ThreeVector GetMomentum() const
100 { return momentum; }
101
102 inline G4double GetTotalMomentum() const
103 { return std::sqrt(std::abs(kineticEnergy*(totalEnergy+mass))); }
104
105 inline G4double GetTotalEnergy() const
106 { return totalEnergy; }
107
108 inline void SetKineticEnergy( const G4double e )
109 {
110 kineticEnergy = e;
111 totalEnergy = kineticEnergy + mass;
112 }
113
114 inline G4double GetKineticEnergy() const
115 { return kineticEnergy; }
116
117 inline void SetTotalEnergy( const G4double e )
118 {
119 totalEnergy = e;
120 kineticEnergy = totalEnergy - mass;
121 }
122
123 inline void SetMass( const G4double m )
124 { mass = m; }
125
126 inline G4double GetMass() const
127 { return mass; }
128
129 inline void SetTOF( const G4double t )
130 { timeOfFlight = t; }
131
132 inline G4double GetTOF() const
133 { return timeOfFlight; }
134
135 inline void SetSide( const G4int s )
136 { side = s; }
137
138 inline G4int GetSide() const
139 { return side; }
140
141 inline void SetNewlyAdded( const G4bool f )
142 { NewlyAdded = f; }
143
144 inline G4bool GetNewlyAdded() const
145 { return NewlyAdded; }
146
147 inline void SetMayBeKilled( const G4bool f )
148 { MayBeKilled = f; }
149
150 inline G4bool GetMayBeKilled() const
151 { return MayBeKilled; }
152
153 void SetZero();
154
155 void Lorentz( const G4ReactionProduct &p1, const G4ReactionProduct &p2 );
156
157 G4double Angle( const G4ReactionProduct &p ) const;
158
159 inline void SetPositionInNucleus(G4double x, G4double y, G4double z)
160 {
161 positionInNucleus.setX(x);
162 positionInNucleus.setY(y);
163 positionInNucleus.setZ(z);
164 }
165
166 inline void SetPositionInNucleus( G4ThreeVector & aPosition )
167 {
168 positionInNucleus = aPosition;
169 }
170
171 inline G4ThreeVector GetPositionInNucleus() const {return positionInNucleus; }
172 inline G4double GetXPositionInNucleus() const { return positionInNucleus.x(); }
173 inline G4double GetYPositionInNucleus() const { return positionInNucleus.y(); }
174 inline G4double GetZPositionInNucleus() const { return positionInNucleus.z(); }
175
176 inline void SetFormationTime(G4double aTime) { formationTime = aTime; }
177
178 inline G4double GetFormationTime() const { return formationTime; }
179
180 inline void HasInitialStateParton(G4bool aFlag) { hasInitialStateParton = aFlag; }
181
182 inline G4bool HasInitialStateParton() const { return hasInitialStateParton; }
183
184#ifdef PRECOMPOUND_TEST
185 void SetCreatorModel(const G4String& aModel) { theCreatorModel = aModel; }
186 G4String GetCreatorModel() const { return theCreatorModel; }
187#endif
188
189 private:
190
191 G4ParticleDefinition *theParticleDefinition;
192
193 // for use with string models and cascade.
194 G4ThreeVector positionInNucleus;
195 G4double formationTime;
196 G4bool hasInitialStateParton;
197
198 // mass is included here, since pseudo-particles are created with masses different
199 // than the standard particle masses, and we are not allowed to create particles
200 G4double mass;
201
202 G4ThreeVector momentum;
203
204 G4double totalEnergy;
205 G4double kineticEnergy;
206
207 G4double timeOfFlight;
208
209 // side refers to how the particles are distributed in the
210 // forward (+) and backward (-) hemispheres in the center of mass system
211 G4int side;
212
213 // NewlyAdded refers to particles added by "nuclear excitation", or as
214 // "black track" particles, or as deuterons, tritons, and alphas
215 G4bool NewlyAdded;
216 G4bool MayBeKilled;
217
218#ifdef PRECOMPOUND_TEST
219 G4String theCreatorModel;
220#endif
221};
222
223#endif
224
Note: See TracBrowser for help on using the repository browser.