Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // G4DecayTable << 27 // 23 // 28 // Class description: << 24 // $Id: G4DecayTable.hh,v 1.8 2003/06/16 16:58:02 gunter Exp $ >> 25 // GEANT4 tag $Name: geant4-05-02-patch-01 $ 29 // 26 // 30 // G4DecayTable is the table of pointers to G4 << 27 // 31 // Decay channels inside are sorted by using d << 28 // ------------------------------------------------------------ >> 29 // GEANT 4 class header file >> 30 // >> 31 // History: first implementation, based on object model of >> 32 // 7 July 1996 H.Kurashige >> 33 // >> 34 // ---------------------------------------- >> 35 // implementation for STL 14 Feb. 2000 H.Kurashige >> 36 // >> 37 // ------------------------------------------------------------ 32 38 33 // Author: H.Kurashige, 7 July 1996 << 39 #ifndef G4DecayTable_h 34 // ------------------------------------------- << 40 #define G4DecayTable_h 1 35 #ifndef G4DecayTable_hh << 36 #define G4DecayTable_hh 1 << 37 41 38 #include "G4ParticleDefinition.hh" << 39 #include "G4VDecayChannel.hh" << 40 #include "G4ios.hh" 42 #include "G4ios.hh" 41 #include "globals.hh" << 42 << 43 #include <vector> 43 #include <vector> >> 44 #include "globals.hh" >> 45 #include "G4ParticleDefinition.hh" >> 46 #include "G4VDecayChannel.hh" 44 47 45 class G4DecayTable << 48 class G4DecayTable 46 { 49 { 47 public: << 50 // Class Description 48 using G4VDecayChannelVector = std::vector< << 51 // G4DecayTable is the table of pointer to G4VDecayChannel. >> 52 // Decay channels inside is sorted by using decay branching ratio >> 53 // >> 54 >> 55 public: >> 56 typedef std::vector<G4VDecayChannel*> G4VDecayChannelVector; 49 57 >> 58 //constructors >> 59 public: 50 G4DecayTable(); 60 G4DecayTable(); 51 ~G4DecayTable(); 61 ~G4DecayTable(); 52 62 53 G4DecayTable(const G4DecayTable&) = delete << 63 private: 54 G4DecayTable& operator=(const G4DecayTable << 64 // hide copy constructor and assignment operator by declaring "private" 55 << 65 // (Implementation does not make sense ) 56 // Equality operators << 66 G4DecayTable(const G4DecayTable &){}; 57 inline G4bool operator==(const G4DecayTabl << 67 G4DecayTable & operator=(const G4DecayTable &){return *this;}; 58 inline G4bool operator!=(const G4DecayTabl << 68 59 << 69 public: 60 // Insert a decay channel at proper positi << 70 // equality operators 61 // (i.e. sorted by using branching ratio ) << 71 G4int operator==(const G4DecayTable &right) const {return (this == &right);}; 62 void Insert(G4VDecayChannel* aChannel); << 72 G4int operator!=(const G4DecayTable &right) const {return (this != &right);}; >> 73 >> 74 public: // With Description >> 75 void Insert( G4VDecayChannel* aChannel); >> 76 // Insert a decay channel at proper position >> 77 // (i.e. sorted by using branching ratio ) 63 78 >> 79 G4int entries() const; 64 // Returns number of decay channels inside 80 // Returns number of decay channels inside 65 inline G4int entries() const; << 66 << 67 // A decay channel is selected at random a << 68 G4VDecayChannel* SelectADecayChannel(G4dou << 69 << 70 // Get index-th decay channel << 71 inline G4VDecayChannel* GetDecayChannel(G4 << 72 inline G4VDecayChannel* operator[](G4int i << 73 81 >> 82 public: // With Description >> 83 G4VDecayChannel* SelectADecayChannel(); >> 84 // A decay channel is selected at random according to the branching ratio >> 85 >> 86 G4VDecayChannel* GetDecayChannel(G4int index) const; >> 87 G4VDecayChannel* operator[](G4int index); >> 88 // Get index-th Decay channel >> 89 74 void DumpInfo() const; 90 void DumpInfo() const; 75 91 76 private: << 92 private: 77 G4ParticleDefinition* parent = nullptr; << 93 G4ParticleDefinition *parent; 78 G4VDecayChannelVector* channels = nullptr; << 94 G4VDecayChannelVector *channels; 79 }; 95 }; 80 96 81 // ------------------------ << 97 inline 82 // Inline methods << 98 G4int G4DecayTable::entries() const 83 // ------------------------ << 84 << 85 inline G4bool G4DecayTable::operator==(const G << 86 { 99 { 87 return (this == &right); << 100 return channels->size(); 88 } 101 } 89 102 90 inline G4bool G4DecayTable::operator!=(const G << 103 inline 91 { << 104 G4VDecayChannel* G4DecayTable::operator[](G4int index) 92 return (this != &right); << 93 } << 94 << 95 inline G4int G4DecayTable::entries() const << 96 { << 97 return G4int(channels->size()); << 98 } << 99 << 100 inline G4VDecayChannel* G4DecayTable::operator << 101 { 105 { 102 return (*channels)[index]; 106 return (*channels)[index]; 103 } 107 } 104 108 105 inline G4VDecayChannel* G4DecayTable::GetDecay << 109 >> 110 inline >> 111 G4VDecayChannel* G4DecayTable::GetDecayChannel(G4int index) const 106 { 112 { 107 G4VDecayChannel* selectedChannel = nullptr; << 113 G4VDecayChannel* selectedChannel = 0; 108 if ((index >= 0) && (index < G4int(channels- << 114 if ( (index>=0) && (index<G4int(channels->size())) ){ 109 selectedChannel = (*channels)[index]; 115 selectedChannel = (*channels)[index]; 110 } 116 } 111 return selectedChannel; 117 return selectedChannel; 112 } 118 } 113 << 119 >> 120 114 #endif 121 #endif 115 122