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 // 00027 // $Id$ 00028 // 00029 // 00030 // ------------------------------------------------------------ 00031 // GEANT 4 class header file 00032 // 00033 // History: first implementation, based on object model of 00034 // 7 July 1996 H.Kurashige 00035 // 00036 // ---------------------------------------- 00037 // implementation for STL 14 Feb. 2000 H.Kurashige 00038 // 00039 // ------------------------------------------------------------ 00040 00041 #ifndef G4DecayTable_h 00042 #define G4DecayTable_h 1 00043 00044 #include "G4ios.hh" 00045 #include <vector> 00046 #include "globals.hh" 00047 #include "G4ParticleDefinition.hh" 00048 #include "G4VDecayChannel.hh" 00049 00050 class G4DecayTable 00051 { 00052 // Class Description 00053 // G4DecayTable is the table of pointer to G4VDecayChannel. 00054 // Decay channels inside is sorted by using decay branching ratio 00055 // 00056 00057 public: 00058 typedef std::vector<G4VDecayChannel*> G4VDecayChannelVector; 00059 00060 //constructors 00061 public: 00062 G4DecayTable(); 00063 ~G4DecayTable(); 00064 00065 private: 00066 // hide copy constructor and assignment operator by declaring "private" 00067 // (Implementation does not make sense ) 00068 G4DecayTable(const G4DecayTable &){}; 00069 G4DecayTable & operator=(const G4DecayTable &){return *this;}; 00070 00071 public: 00072 // equality operators 00073 G4int operator==(const G4DecayTable &right) const {return (this == &right);}; 00074 G4int operator!=(const G4DecayTable &right) const {return (this != &right);}; 00075 00076 public: // With Description 00077 void Insert( G4VDecayChannel* aChannel); 00078 // Insert a decay channel at proper position 00079 // (i.e. sorted by using branching ratio ) 00080 00081 G4int entries() const; 00082 // Returns number of decay channels inside 00083 00084 public: // With Description 00085 G4VDecayChannel* SelectADecayChannel(); 00086 // A decay channel is selected at random according to the branching ratio 00087 00088 G4VDecayChannel* GetDecayChannel(G4int index) const; 00089 G4VDecayChannel* operator[](G4int index); 00090 // Get index-th Decay channel 00091 00092 void DumpInfo() const; 00093 00094 private: 00095 G4ParticleDefinition *parent; 00096 G4VDecayChannelVector *channels; 00097 }; 00098 00099 inline 00100 G4int G4DecayTable::entries() const 00101 { 00102 return channels->size(); 00103 } 00104 00105 inline 00106 G4VDecayChannel* G4DecayTable::operator[](G4int index) 00107 { 00108 return (*channels)[index]; 00109 } 00110 00111 00112 inline 00113 G4VDecayChannel* G4DecayTable::GetDecayChannel(G4int index) const 00114 { 00115 G4VDecayChannel* selectedChannel = 0; 00116 if ( (index>=0) && (index<G4int(channels->size())) ){ 00117 selectedChannel = (*channels)[index]; 00118 } 00119 return selectedChannel; 00120 } 00121 00122 00123 #endif