Geant4 Cross Reference |
>> 1 // This code implementation is the intellectual property of >> 2 // the GEANT4 collaboration. 1 // 3 // 2 // ******************************************* << 4 // By copying, distributing or modifying the Program (or any work 3 // * License and Disclaimer << 5 // based on the Program) you indicate your acceptance of this statement, 4 // * << 6 // and all its terms. 5 // * The Geant4 software is copyright of th << 6 // * the Geant4 Collaboration. It is provided << 7 // * conditions of the Geant4 Software License << 8 // * LICENSE and available at http://cern.ch/ << 9 // * include a list of copyright holders. << 10 // * << 11 // * Neither the authors of this software syst << 12 // * institutes,nor the agencies providing fin << 13 // * work make any representation or warran << 14 // * regarding this software system or assum << 15 // * use. Please see the license in the file << 16 // * for the full disclaimer and the limitatio << 17 // * << 18 // * This code implementation is the result << 19 // * technical work of the GEANT4 collaboratio << 20 // * By using, copying, modifying or distri << 21 // * any work based on the software) you ag << 22 // * use in resulting scientific publicati << 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* << 25 // 7 // 26 // G4DecayProducts << 8 // $Id: G4DecayProducts.hh,v 1.6 2000/10/20 11:34:44 kurasige Exp $ >> 9 // GEANT4 tag $Name: geant4-03-00 $ 27 // 10 // 28 // Class description: << 29 // 11 // 30 // Container for decay products of dynamic par << 12 // ------------------------------------------------------------ >> 13 // GEANT 4 class header file >> 14 // >> 15 // For information related to this code contact: >> 16 // CERN, CN Division, ASD group >> 17 // History: first implementation, based on object model of >> 18 // 12 Dec 1997 H.Kurashige >> 19 // ------------------------------------------------------------ 31 20 32 // Author: H.Kurashige, 12 July 1996 << 21 #ifndef G4DecayProducts_h 33 // ------------------------------------------- << 22 #define G4DecayProducts_h 1 34 #ifndef G4DecayProducts_hh << 35 #define G4DecayProducts_hh 1 << 36 23 37 #include "G4DynamicParticle.hh" << 38 #include "G4ios.hh" 24 #include "G4ios.hh" 39 #include "globals.hh" 25 #include "globals.hh" 40 << 26 #include "G4DynamicParticle.hh" 41 #include <vector> << 27 #include "G4Allocator.hh" 42 28 43 class G4DecayProducts 29 class G4DecayProducts 44 { 30 { 45 public: << 31 public: // With Description 46 // Constructors << 32 >> 33 // constructors 47 G4DecayProducts(); 34 G4DecayProducts(); 48 G4DecayProducts(const G4DynamicParticle& a << 35 G4DecayProducts(const G4DynamicParticle &aParticle); 49 36 50 // Copy constructor and assignment operato << 37 public: 51 // Deep copy: for G4DynamicParticle pointe << 38 // copy constructor and assignment operator 52 G4DecayProducts(const G4DecayProducts& rig << 39 // Deep copy: for G4DynamicParticle pointer 53 G4DecayProducts& operator=(const G4DecayPr << 40 G4DecayProducts(const G4DecayProducts &right); >> 41 G4DecayProducts & operator=(const G4DecayProducts &right); 54 42 55 // Destructor << 43 //destructor 56 ~G4DecayProducts(); 44 ~G4DecayProducts(); 57 45 58 // Equality operators << 46 // new & delete operators for G4Allocator 59 inline G4bool operator==(const G4DecayProd << 47 inline void *operator new(size_t); 60 inline G4bool operator!=(const G4DecayProd << 48 inline void operator delete(void *G4DecayProducts); 61 << 49 62 // Set-get methods for the parent particle << 50 // (un)equal operator 63 // to get information of parent particle w << 51 G4int operator==(const G4DecayProducts &right) const; 64 // New G4DynamicParticle object is created << 52 G4int operator!=(const G4DecayProducts &right) const; 65 inline const G4DynamicParticle* GetParentP << 53 66 void SetParentParticle(const G4DynamicPart << 54 public: // With Description >> 55 // set-get methods for the parent particle >> 56 // theParentPaticle is used to get information of parent particle >> 57 // when decay products are filled >> 58 // new G4DynamicParticle object is created in set methods >> 59 const G4DynamicParticle* GetParentParticle() const {return theParentParticle;}; >> 60 void SetParentParticle(const G4DynamicParticle &aParticle); 67 61 68 // Boost all products << 62 // boost all products 69 void Boost(G4double totalEnergy, const G4T << 63 void Boost(G4double totalEnergy, const G4ThreeVector &momentumDirection); 70 void Boost(G4double betax, G4double betay, 64 void Boost(G4double betax, G4double betay, G4double betaz); 71 << 65 72 // Push/pop methods for decay products poi << 66 // push-pop methods for decay products pointer 73 G4DynamicParticle* PopProducts(); 67 G4DynamicParticle* PopProducts(); 74 G4int PushProducts(G4DynamicParticle* aPar << 68 G4int PushProducts(G4DynamicParticle *aParticle); 75 69 76 G4DynamicParticle* operator[](G4int anInde 70 G4DynamicParticle* operator[](G4int anIndex) const; 77 71 78 inline G4int entries() const { return numb << 72 G4int entries() const {return numberOfProducts;}; 79 << 80 // Check energy/momentum of products << 81 G4bool IsChecked() const; << 82 73 >> 74 // check energy/momentum of products >> 75 G4bool IsChecked() const; >> 76 >> 77 // 83 void DumpInfo() const; 78 void DumpInfo() const; 84 79 85 using G4DecayProductVector = std::vector<G << 80 protected: >> 81 enum {MaxNumberOfProducts = 64}; >> 82 >> 83 private: >> 84 G4DynamicParticle* theParentParticle; >> 85 G4int numberOfProducts; >> 86 G4DynamicParticle* theProductVector[MaxNumberOfProducts]; 86 87 87 private: << 88 G4int numberOfProducts = 0; << 89 G4DynamicParticle* theParentParticle = nul << 90 G4DecayProductVector* theProductVector = n << 91 }; 88 }; 92 89 93 // ------------------------ 90 // ------------------------ 94 // Inline methods << 91 // Inlined operators 95 // ------------------------ 92 // ------------------------ >> 93 extern G4Allocator<G4DecayProducts> aDecayProductsAllocator; >> 94 >> 95 inline void * G4DecayProducts::operator new(size_t) >> 96 { >> 97 void * aDecayProducts; >> 98 aDecayProducts = (void *) aDecayProductsAllocator.MallocSingle(); >> 99 return aDecayProducts; >> 100 } 96 101 97 inline G4bool G4DecayProducts::operator==(cons << 102 inline void G4DecayProducts::operator delete(void * aDecayProducts) 98 { 103 { 99 return (this == (G4DecayProducts*)&right); << 104 aDecayProductsAllocator.FreeSingle((G4DecayProducts *) aDecayProducts); 100 } 105 } 101 106 102 inline G4bool G4DecayProducts::operator!=(cons << 107 inline >> 108 G4int G4DecayProducts::operator==(const G4DecayProducts &right) const 103 { 109 { 104 return (this != (G4DecayProducts*)&right); << 110 return (this == (G4DecayProducts *) &right); 105 } 111 } 106 112 107 inline const G4DynamicParticle* G4DecayProduct << 113 inline >> 114 G4int G4DecayProducts::operator!=(const G4DecayProducts &right) const 108 { 115 { 109 return theParentParticle; << 116 return (this != (G4DecayProducts *) &right); 110 } 117 } 111 118 112 #endif 119 #endif >> 120 113 121