00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 #ifndef G4HadFinalState_hh 00027 #define G4HadFinalState_hh 00028 00029 // Modifications: 00030 // 20110810 M. Kelsey -- Store secondaries by value, not by pointer. 00031 // Improve constness of argument passing. Drop stale flag. 00032 // 20110907 M. Kelsey -- Improve constness of functions, discard add pointer, 00033 // add function to concatenate vectors 00034 00035 #include "globals.hh" 00036 #include "G4DynamicParticle.hh" 00037 #include "G4HadSecondary.hh" 00038 #include "G4LorentzRotation.hh" 00039 #include "G4ThreeVector.hh" 00040 #include <vector> 00041 00042 enum G4HadFinalStateStatus{isAlive, stopAndKill, suspend}; 00043 00044 00045 class G4HadFinalState 00046 { 00047 public: 00048 G4HadFinalState(); 00049 00050 G4int GetNumberOfSecondaries() const; 00051 void SetEnergyChange(G4double anEnergy); 00052 G4double GetEnergyChange() const; 00053 void SetMomentumChange(const G4ThreeVector& aV); 00054 void SetMomentumChange(G4double x, G4double y, G4double z) ; 00055 const G4ThreeVector& GetMomentumChange() const; 00056 void AddSecondary(G4DynamicParticle* aP); 00057 void AddSecondary(const G4HadSecondary& aHS) { theSecs.push_back(aHS); } 00058 void SetStatusChange(G4HadFinalStateStatus aS); 00059 G4HadFinalStateStatus GetStatusChange() const; 00060 void Clear(); 00061 const G4LorentzRotation& GetTrafoToLab() const; 00062 void SetTrafoToLab(const G4LorentzRotation & aT); 00063 void SetWeightChange(G4double aW); 00064 G4double GetWeightChange() const; 00065 G4HadSecondary* GetSecondary(size_t i); 00066 const G4HadSecondary* GetSecondary(size_t i) const; 00067 void SetLocalEnergyDeposit(G4double aE); 00068 G4double GetLocalEnergyDeposit() const; 00069 void SecondariesAreStale(); // Deprecated; not needed for values 00070 void ClearSecondaries(); 00071 00072 // Concatenate lists efficiently 00073 void AddSecondaries(const std::vector<G4HadSecondary>& addSecs); 00074 00075 void AddSecondaries(const G4HadFinalState& addHFS) { 00076 AddSecondaries(addHFS.theSecs); 00077 } 00078 00079 void AddSecondaries(const G4HadFinalState* addHFS) { 00080 if (addHFS) AddSecondaries(addHFS->theSecs); 00081 } 00082 00083 private: 00084 G4ThreeVector theDirection; 00085 G4double theEnergy; 00086 std::vector<G4HadSecondary> theSecs; 00087 G4HadFinalStateStatus theStat; 00088 G4LorentzRotation theT; 00089 G4double theW; 00090 G4double theEDep; 00091 }; 00092 00093 #endif