Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:05

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4DecayTable
0027 //
0028 // Class description:
0029 //
0030 // G4DecayTable is the table of pointers to G4VDecayChannel.
0031 // Decay channels inside are sorted by using decay branching ratio
0032 
0033 // Author: H.Kurashige, 7 July 1996
0034 // --------------------------------------------------------------------
0035 #ifndef G4DecayTable_hh
0036 #define G4DecayTable_hh 1
0037 
0038 #include "G4ParticleDefinition.hh"
0039 #include "G4VDecayChannel.hh"
0040 #include "G4ios.hh"
0041 #include "globals.hh"
0042 
0043 #include <vector>
0044 
0045 class G4DecayTable
0046 {
0047   public:
0048     using G4VDecayChannelVector = std::vector<G4VDecayChannel*>;
0049 
0050     G4DecayTable();
0051     ~G4DecayTable();
0052 
0053     G4DecayTable(const G4DecayTable&) = delete;
0054     G4DecayTable& operator=(const G4DecayTable&) = delete;
0055 
0056     // Equality operators
0057     inline G4bool operator==(const G4DecayTable& right) const;
0058     inline G4bool operator!=(const G4DecayTable& right) const;
0059 
0060     // Insert a decay channel at proper position
0061     // (i.e. sorted by using branching ratio )
0062     void Insert(G4VDecayChannel* aChannel);
0063 
0064     // Returns number of decay channels inside
0065     inline G4int entries() const;
0066 
0067     // A decay channel is selected at random according to the branching ratio
0068     G4VDecayChannel* SelectADecayChannel(G4double parentMass = -1.);
0069 
0070     // Get index-th decay channel
0071     inline G4VDecayChannel* GetDecayChannel(G4int index) const;
0072     inline G4VDecayChannel* operator[](G4int index);
0073 
0074     void DumpInfo() const;
0075 
0076   private:
0077     G4ParticleDefinition* parent = nullptr;
0078     G4VDecayChannelVector* channels = nullptr;
0079 };
0080 
0081 // ------------------------
0082 // Inline methods
0083 // ------------------------
0084 
0085 inline G4bool G4DecayTable::operator==(const G4DecayTable& right) const
0086 {
0087   return (this == &right);
0088 }
0089 
0090 inline G4bool G4DecayTable::operator!=(const G4DecayTable& right) const
0091 {
0092   return (this != &right);
0093 }
0094 
0095 inline G4int G4DecayTable::entries() const
0096 {
0097   return G4int(channels->size());
0098 }
0099 
0100 inline G4VDecayChannel* G4DecayTable::operator[](G4int index)
0101 {
0102   return (*channels)[index];
0103 }
0104 
0105 inline G4VDecayChannel* G4DecayTable::GetDecayChannel(G4int index) const
0106 {
0107   G4VDecayChannel* selectedChannel = nullptr;
0108   if ((index >= 0) && (index < G4int(channels->size()))) {
0109     selectedChannel = (*channels)[index];
0110   }
0111   return selectedChannel;
0112 }
0113 
0114 #endif