00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef G4ReactionProduct_h
00035 #define G4ReactionProduct_h 1
00036
00037 #include "globals.hh"
00038 #include "G4Allocator.hh"
00039 #include "G4DynamicParticle.hh"
00040 #include "G4HadProjectile.hh"
00041 #include "G4HadronicException.hh"
00042
00043
00044 class G4ReactionProduct;
00045 #if defined G4HADRONIC_ALLOC_EXPORT
00046 extern G4DLLEXPORT G4Allocator<G4ReactionProduct> aRPAllocator;
00047 #else
00048 extern G4DLLIMPORT G4Allocator<G4ReactionProduct> aRPAllocator;
00049 #endif
00050
00051 class G4ReactionProduct
00052 {
00053 friend G4ReactionProduct operator+(
00054 const G4ReactionProduct & p1, const G4ReactionProduct &p2 );
00055
00056 friend G4ReactionProduct operator-(
00057 const G4ReactionProduct & p1, const G4ReactionProduct &p2 );
00058
00059 friend G4ReactionProduct operator*(
00060 const G4double aDouble, const G4ReactionProduct &p2 )
00061 {
00062 G4ReactionProduct result;
00063 result.SetMomentum(aDouble*p2.GetMomentum());
00064 result.SetMass(p2.GetMass());
00065 result.SetTotalEnergy(std::sqrt(result.GetMass()*result.GetMass()+
00066 result.GetMomentum()*result.GetMomentum()));
00067 return result;
00068 }
00069
00070 public:
00071 G4ReactionProduct();
00072
00073 G4ReactionProduct( G4ParticleDefinition *aParticleDefinition );
00074
00075 ~G4ReactionProduct() {}
00076
00077 G4ReactionProduct( const G4ReactionProduct &right );
00078
00079
00080 inline void* operator new(size_t) {
00081 return (void *)aRPAllocator.MallocSingle();
00082 }
00083 #ifdef __IBMCPP__
00084 inline void* operator new(size_t, void *p) {
00085 return p;
00086 }
00087 #endif
00088 inline void operator delete(void* aReactionProduct) {
00089 aRPAllocator.FreeSingle((G4ReactionProduct*)aReactionProduct);
00090 }
00091
00092 G4ReactionProduct &operator= ( const G4ReactionProduct &right );
00093
00094 G4ReactionProduct &operator= ( const G4DynamicParticle &right );
00095
00096 G4ReactionProduct &operator= ( const G4HadProjectile &right );
00097
00098 inline G4bool operator== ( const G4ReactionProduct &right ) const
00099 { return ( this == (G4ReactionProduct*) &right ); }
00100
00101 inline G4bool operator!= ( const G4ReactionProduct &right ) const
00102 { return ( this != (G4ReactionProduct*) &right ); }
00103
00104 inline G4ParticleDefinition *GetDefinition() const
00105 { return theParticleDefinition; }
00106
00107 void SetDefinition( G4ParticleDefinition *aParticleDefinition );
00108
00109 void SetDefinitionAndUpdateE( G4ParticleDefinition *aParticleDefinition );
00110
00111 void SetMomentum( const G4double x, const G4double y, const G4double z );
00112
00113 void SetMomentum( const G4double x, const G4double y );
00114
00115 void SetMomentum( const G4double z );
00116
00117 inline void SetMomentum( const G4ThreeVector &mom )
00118 { momentum = mom; }
00119
00120 inline G4ThreeVector GetMomentum() const
00121 { return momentum; }
00122
00123 inline G4double GetTotalMomentum() const
00124 { return std::sqrt(std::abs(kineticEnergy*(totalEnergy+mass))); }
00125
00126 inline G4double GetTotalEnergy() const
00127 { return totalEnergy; }
00128
00129 inline void SetKineticEnergy( const G4double en )
00130 {
00131 kineticEnergy = en;
00132 totalEnergy = kineticEnergy + mass;
00133 }
00134
00135 inline G4double GetKineticEnergy() const
00136 { return kineticEnergy; }
00137
00138 inline void SetTotalEnergy( const G4double en )
00139 {
00140 totalEnergy = en;
00141 kineticEnergy = totalEnergy - mass;
00142 }
00143
00144 inline void SetMass( const G4double mas )
00145 { mass = mas; }
00146
00147 inline G4double GetMass() const
00148 { return mass; }
00149
00150 inline void SetTOF( const G4double t )
00151 { timeOfFlight = t; }
00152
00153 inline G4double GetTOF() const
00154 { return timeOfFlight; }
00155
00156 inline void SetSide( const G4int sid )
00157 { side = sid; }
00158
00159 inline G4int GetSide() const
00160 { return side; }
00161
00162 inline void SetNewlyAdded( const G4bool f )
00163 { NewlyAdded = f; }
00164
00165 inline G4bool GetNewlyAdded() const
00166 { return NewlyAdded; }
00167
00168 inline void SetMayBeKilled( const G4bool f )
00169 { MayBeKilled = f; }
00170
00171 inline G4bool GetMayBeKilled() const
00172 { return MayBeKilled; }
00173
00174 void SetZero();
00175
00176 void Lorentz( const G4ReactionProduct &p1, const G4ReactionProduct &p2 );
00177
00178 G4double Angle( const G4ReactionProduct &p ) const;
00179
00180 inline void SetPositionInNucleus(G4double x, G4double y, G4double z)
00181 {
00182 positionInNucleus.setX(x);
00183 positionInNucleus.setY(y);
00184 positionInNucleus.setZ(z);
00185 }
00186
00187 inline void SetPositionInNucleus( G4ThreeVector & aPosition )
00188 {
00189 positionInNucleus = aPosition;
00190 }
00191
00192 inline G4ThreeVector GetPositionInNucleus() const {return positionInNucleus; }
00193 inline G4double GetXPositionInNucleus() const { return positionInNucleus.x(); }
00194 inline G4double GetYPositionInNucleus() const { return positionInNucleus.y(); }
00195 inline G4double GetZPositionInNucleus() const { return positionInNucleus.z(); }
00196
00197 inline void SetFormationTime(G4double aTime) { formationTime = aTime; }
00198
00199 inline G4double GetFormationTime() const { return formationTime; }
00200
00201 inline void HasInitialStateParton(G4bool aFlag) { hasInitialStateParton = aFlag; }
00202
00203 inline G4bool HasInitialStateParton() const { return hasInitialStateParton; }
00204
00205 #ifdef PRECOMPOUND_TEST
00206 void SetCreatorModel(const G4String& aModel) { theCreatorModel = aModel; }
00207 G4String GetCreatorModel() const { return theCreatorModel; }
00208 #endif
00209
00210 private:
00211
00212 G4ParticleDefinition *theParticleDefinition;
00213
00214
00215 G4ThreeVector positionInNucleus;
00216 G4double formationTime;
00217 G4bool hasInitialStateParton;
00218
00219
00220
00221 G4double mass;
00222
00223 G4ThreeVector momentum;
00224
00225 G4double totalEnergy;
00226 G4double kineticEnergy;
00227
00228 G4double timeOfFlight;
00229
00230
00231
00232 G4int side;
00233
00234
00235
00236 G4bool NewlyAdded;
00237 G4bool MayBeKilled;
00238
00239 #ifdef PRECOMPOUND_TEST
00240 G4String theCreatorModel;
00241 #endif
00242 };
00243
00244 #endif
00245