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 // G4DecayTable << 8 // $Id: G4DecayTable.hh,v 1.3.2.1 1999/12/07 20:49:49 gunter Exp $ >> 9 // GEANT4 tag $Name: geant4-01-00 $ 27 // 10 // 28 // Class description: << 29 // 11 // 30 // G4DecayTable is the table of pointers to G4 << 12 // ------------------------------------------------------------ 31 // Decay channels inside are sorted by using d << 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 // 7 July 1996 H.Kurashige >> 19 // 14 June 1997 H.Kurashige >> 20 // ------------------------------------------------------------ 32 21 33 // Author: H.Kurashige, 7 July 1996 << 22 #ifndef G4DecayTable_h 34 // ------------------------------------------- << 23 #define G4DecayTable_h 1 35 #ifndef G4DecayTable_hh << 36 #define G4DecayTable_hh 1 << 37 24 38 #include "G4ParticleDefinition.hh" << 39 #include "G4VDecayChannel.hh" << 40 #include "G4ios.hh" 25 #include "G4ios.hh" >> 26 #include "g4rw/tpsrtvec.h" 41 #include "globals.hh" 27 #include "globals.hh" >> 28 #include "G4ParticleDefinition.hh" >> 29 #include "G4VDecayChannel.hh" 42 30 43 #include <vector> << 31 class G4DecayTable 44 << 45 class G4DecayTable << 46 { 32 { 47 public: << 33 public: 48 using G4VDecayChannelVector = std::vector< << 34 typedef G4RWTPtrSortedVector<G4VDecayChannel> G4VDecayChannelVector; 49 35 >> 36 //constructors >> 37 public: 50 G4DecayTable(); 38 G4DecayTable(); 51 ~G4DecayTable(); 39 ~G4DecayTable(); 52 40 53 G4DecayTable(const G4DecayTable&) = delete << 41 private: 54 G4DecayTable& operator=(const G4DecayTable << 42 // hide copy constructor and assignment operator by declaring "private" 55 << 43 // (Implementation does not make sense ) 56 // Equality operators << 44 G4DecayTable(const G4DecayTable &){}; 57 inline G4bool operator==(const G4DecayTabl << 45 G4DecayTable & operator=(const G4DecayTable &){return *this;}; 58 inline G4bool operator!=(const G4DecayTabl << 46 59 << 47 public: 60 // Insert a decay channel at proper positi << 48 // equality operators 61 // (i.e. sorted by using branching ratio ) << 49 G4int operator==(const G4DecayTable &right) const {return (this == &right);}; 62 void Insert(G4VDecayChannel* aChannel); << 50 G4int operator!=(const G4DecayTable &right) const {return (this != &right);}; 63 << 51 64 // Returns number of decay channels inside << 52 public: 65 inline G4int entries() const; << 53 void Insert( G4VDecayChannel* aChannel); 66 << 54 G4int entries() const; 67 // A decay channel is selected at random a << 55 68 G4VDecayChannel* SelectADecayChannel(G4dou << 56 public: 69 << 57 G4VDecayChannel* SelectADecayChannel(); 70 // Get index-th decay channel << 58 G4VDecayChannel* GetDecayChannel(G4int index) const; 71 inline G4VDecayChannel* GetDecayChannel(G4 << 59 G4VDecayChannel* operator[](G4int index); 72 inline G4VDecayChannel* operator[](G4int i << 73 << 74 void DumpInfo() const; 60 void DumpInfo() const; 75 61 76 private: << 62 private: 77 G4ParticleDefinition* parent = nullptr; << 63 G4ParticleDefinition *parent; 78 G4VDecayChannelVector* channels = nullptr; << 64 G4VDecayChannelVector *channels; 79 }; 65 }; 80 66 81 // ------------------------ << 67 inline 82 // Inline methods << 68 G4int G4DecayTable::entries() const 83 // ------------------------ << 84 << 85 inline G4bool G4DecayTable::operator==(const G << 86 { << 87 return (this == &right); << 88 } << 89 << 90 inline G4bool G4DecayTable::operator!=(const G << 91 { 69 { 92 return (this != &right); << 70 return channels->entries(); 93 } 71 } 94 72 95 inline G4int G4DecayTable::entries() const << 73 inline >> 74 G4VDecayChannel* G4DecayTable::operator[](G4int index) 96 { 75 { 97 return G4int(channels->size()); << 76 return (*channels)(index); 98 } 77 } 99 78 100 inline G4VDecayChannel* G4DecayTable::operator << 79 inline >> 80 G4VDecayChannel* G4DecayTable::GetDecayChannel(G4int index) const 101 { 81 { 102 return (*channels)[index]; << 82 G4VDecayChannel* selectedChannel = 0; 103 } << 83 if ( (index>=0) && (index<channels->entries()) ){ 104 << 84 selectedChannel = (*channels)(index); 105 inline G4VDecayChannel* G4DecayTable::GetDecay << 106 { << 107 G4VDecayChannel* selectedChannel = nullptr; << 108 if ((index >= 0) && (index < G4int(channels- << 109 selectedChannel = (*channels)[index]; << 110 } 85 } 111 return selectedChannel; 86 return selectedChannel; 112 } 87 } 113 << 88 >> 89 114 #endif 90 #endif 115 91