ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4FermiChannels.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4FermiChannels.hh
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 //
27 // FermiBreakUp de-excitation model
28 // by V. Ivanchenko (July 2016)
29 //
30 
31 #ifndef G4FermiChannels_h
32 #define G4FermiChannels_h 1
33 
34 #include "globals.hh"
35 #include "G4FermiFragment.hh"
36 #include "G4FermiPair.hh"
37 #include <vector>
38 
40 {
41 public:
42 
43  explicit G4FermiChannels(size_t nmax, G4double ex, G4double gmass)
44  : nch(0), excitation(ex), ground_mass(gmass)
45  { fvect.reserve(nmax); cum_prob.reserve(nmax); };
46 
47  inline size_t GetNumberOfChannels() const;
48  inline const std::vector<const G4FermiPair*>& GetChannels() const;
49  inline const G4FermiPair* GetPair(size_t idx) const;
50  inline const G4FermiPair* SamplePair(G4double rand) const;
51 
52  inline void AddChannel(const G4FermiPair*);
53  inline std::vector<G4double>& GetProbabilities();
54 
55  inline G4double GetExcitation() const;
56  inline G4double GetMass() const;
57 
58 private:
59 
60  inline const G4FermiChannels& operator=(const G4FermiChannels&);
61  inline G4FermiChannels(const G4FermiChannels &);
62  inline G4bool operator==(const G4FermiChannels &);
63  inline G4bool operator!=(const G4FermiChannels &);
64 
65  size_t nch;
68  std::vector<const G4FermiPair*> fvect;
69  std::vector<G4double> cum_prob;
70 
71 };
72 
74 {
75  return nch;
76 }
77 
78 inline const std::vector<const G4FermiPair*>& G4FermiChannels::GetChannels() const
79 {
80  return fvect;
81 }
82 
83 inline const G4FermiPair* G4FermiChannels::GetPair(size_t idx) const
84 {
85  return (idx < nch) ? fvect[idx] : nullptr;
86 }
87 
89 {
90  const G4FermiPair* ptr = nullptr;
91  for(size_t i=0; i<nch; ++i) {
92  if(rand <= cum_prob[i]) { ptr = fvect[i]; break; }
93  }
94  return ptr;
95 }
96 
98 {
99  fvect.push_back(ptr);
100  cum_prob.push_back(1.0);
101  ++nch;
102 }
103 
104 inline std::vector<G4double>& G4FermiChannels::GetProbabilities()
105 {
106  return cum_prob;
107 }
108 
110 {
111  return excitation;
112 }
113 
115 {
116  return excitation + ground_mass;
117 }
118 
119 #endif
120 
121