Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4FermiChannels.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4FermiChannels.hh 85677 2014-11-03 17:44:12Z vnivanch $
27 //
28 // FermiBreakUp de-excitation model
29 // by V. Ivanchenko (July 2016)
30 //
31 
32 #ifndef G4FermiChannels_h
33 #define G4FermiChannels_h 1
34 
35 #include "globals.hh"
36 #include "G4FermiFragment.hh"
37 #include "G4FermiPair.hh"
38 #include <vector>
39 
41 {
42 public:
43 
44  explicit G4FermiChannels(size_t nmax, G4double ex, G4double gmass)
45  : nch(0), excitation(ex), ground_mass(gmass)
46  { fvect.reserve(nmax); cum_prob.reserve(nmax); };
47 
48  inline size_t GetNumberOfChannels() const;
49  inline const std::vector<const G4FermiPair*>& GetChannels() const;
50  inline const G4FermiPair* GetPair(size_t idx) const;
51  inline const G4FermiPair* SamplePair(G4double rand) const;
52 
53  inline void AddChannel(const G4FermiPair*);
54  inline std::vector<G4double>& GetProbabilities();
55 
56  inline G4double GetExcitation() const;
57  inline G4double GetMass() const;
58 
59 private:
60 
61  inline const G4FermiChannels& operator=(const G4FermiChannels&) = delete;
62  inline G4FermiChannels(const G4FermiChannels &) = delete;
63  inline G4bool operator==(const G4FermiChannels &) const = delete;
64  inline G4bool operator!=(const G4FermiChannels &) const = delete;
65 
66  size_t nch;
67  G4double excitation;
68  G4double ground_mass;
69  std::vector<const G4FermiPair*> fvect;
70  std::vector<G4double> cum_prob;
71 
72 };
73 
75 {
76  return nch;
77 }
78 
79 inline const std::vector<const G4FermiPair*>& G4FermiChannels::GetChannels() const
80 {
81  return fvect;
82 }
83 
84 inline const G4FermiPair* G4FermiChannels::GetPair(size_t idx) const
85 {
86  return (idx < nch) ? fvect[idx] : nullptr;
87 }
88 
90 {
91  const G4FermiPair* ptr = nullptr;
92  for(size_t i=0; i<nch; ++i) {
93  if(rand <= cum_prob[i]) { ptr = fvect[i]; break; }
94  }
95  return ptr;
96 }
97 
99 {
100  fvect.push_back(ptr);
101  cum_prob.push_back(1.0);
102  ++nch;
103 }
104 
105 inline std::vector<G4double>& G4FermiChannels::GetProbabilities()
106 {
107  return cum_prob;
108 }
109 
111 {
112  return excitation;
113 }
114 
116 {
117  return excitation + ground_mass;
118 }
119 
120 #endif
121 
122 
void AddChannel(const G4FermiPair *)
G4double GetExcitation() const
const G4FermiPair * GetPair(size_t idx) const
G4FermiChannels(size_t nmax, G4double ex, G4double gmass)
const std::vector< const G4FermiPair * > & GetChannels() const
G4double GetMass() const
bool G4bool
Definition: G4Types.hh:79
const G4FermiPair * SamplePair(G4double rand) const
double G4double
Definition: G4Types.hh:76
size_t GetNumberOfChannels() const
std::vector< G4double > & GetProbabilities()