Back to home page

EIC code displayed by LXR

 
 

    


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

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 //
0027 // -------------------------------------------------------------------
0028 //
0029 //      GEANT4 header file 
0030 //
0031 //      File name:     G4NucLevel
0032 //
0033 //      Author:        V.Ivanchenko
0034 // 
0035 //      Creation date: 4 January 2012
0036 //
0037 //      Modifications:
0038 //      
0039 // -------------------------------------------------------------------
0040 //
0041 //  Container class keeping information about gamma transition
0042 //  and for a given nuclear level
0043 //
0044 
0045 #ifndef G4NUCLEVEL_HH
0046 #define G4NUCLEVEL_HH 1
0047 
0048 #include "globals.hh"
0049 #include <vector>
0050 #include <iostream>
0051 
0052 class G4NucLevel 
0053 {
0054 public:
0055 
0056   explicit G4NucLevel(std::size_t ntrans, G4double  tgamma,
0057                   const std::vector<G4int>&   vTrans,
0058                   const std::vector<G4float>& wLevelGamma,
0059                   const std::vector<G4float>& wGamma,
0060                   const std::vector<G4float>& vRatio,
0061                       const std::vector<const std::vector<G4float>*>& wShell);
0062 
0063   ~G4NucLevel();
0064 
0065   inline std::size_t NumberOfTransitions() const;
0066 
0067   inline std::size_t FinalExcitationIndex(std::size_t idx) const;
0068 
0069   inline G4int TransitionType(std::size_t idx) const;
0070 
0071   inline G4double GetTimeGamma() const;
0072 
0073   inline G4float GammaProbability(std::size_t idx) const;
0074 
0075   inline G4float GammaCumProbability(std::size_t idx) const;
0076 
0077   inline G4float MultipolarityRatio(std::size_t idx) const;
0078 
0079   inline std::size_t SampleGammaTransition(G4double rndm) const;
0080 
0081   inline G4int SampleShell(std::size_t idx, G4double rndm) const;
0082 
0083   inline const std::vector<G4float>* ShellProbabilty(std::size_t idx) const;
0084 
0085   void StreamInfo(std::ostream& os) const;
0086 
0087   G4NucLevel(const G4NucLevel &right) = delete;
0088   G4bool operator==(const G4NucLevel &right) const = delete;
0089   G4bool operator!=(const G4NucLevel &right) const = delete;
0090   G4bool operator<(const G4NucLevel &right) const = delete;
0091   const G4NucLevel& operator=(const G4NucLevel &right) = delete;
0092 
0093 private:  
0094 
0095   std::size_t   length;
0096   G4double fTimeGamma;
0097   
0098   std::vector<G4int>    fTrans;
0099   std::vector<G4float>  fGammaCumProbability;
0100   std::vector<G4float>  fGammaProbability;
0101   std::vector<G4float>  fMpRatio;
0102   std::vector<const std::vector<G4float>*> fShellProbability;
0103 };
0104 
0105 inline std::size_t G4NucLevel::NumberOfTransitions() const
0106 {
0107   return length;
0108 }
0109 
0110 inline std::size_t G4NucLevel::FinalExcitationIndex(const std::size_t idx) const
0111 {
0112   return (std::size_t)(fTrans[idx]/10000);
0113 }
0114 
0115 inline G4int G4NucLevel::TransitionType(const std::size_t idx) const
0116 {
0117   return fTrans[idx]%10000;
0118 }
0119 
0120 inline G4double G4NucLevel::GetTimeGamma() const
0121 {
0122   return fTimeGamma;
0123 }
0124 
0125 inline G4float G4NucLevel::GammaProbability(const std::size_t idx) const
0126 {
0127   return fGammaProbability[idx];
0128 }
0129 
0130 inline G4float G4NucLevel::GammaCumProbability(const std::size_t idx) const
0131 {
0132   return fGammaCumProbability[idx];
0133 }
0134 
0135 inline G4float G4NucLevel::MultipolarityRatio(const std::size_t idx) const
0136 {
0137   return fMpRatio[idx];
0138 }
0139 
0140 inline std::size_t G4NucLevel::SampleGammaTransition(const G4double rndm) const
0141 {
0142   G4float x = rndm;
0143   std::size_t idx = 0;
0144   for(; idx<length; ++idx) { 
0145     if(x <= fGammaCumProbability[idx]) { break; } 
0146   }
0147   return idx;
0148 }
0149 
0150 inline G4int 
0151 G4NucLevel::SampleShell(const std::size_t idx, const G4double rndm) const
0152 {
0153   const std::vector<G4float>* prob = fShellProbability[idx];
0154   G4int i(-1);
0155   if(nullptr != prob) {
0156     G4int nn = (G4int)prob->size();
0157     G4float x = rndm;
0158     for(i=0; i<nn; ++i) { if(x <= (*prob)[i]) { break; } }
0159   } 
0160   return i;
0161 }
0162 
0163 inline const std::vector<G4float>* 
0164 G4NucLevel::ShellProbabilty(std::size_t idx) const
0165 {
0166   return fShellProbability[idx];
0167 }
0168 
0169 #endif