Geant4-11
Public Member Functions | Private Attributes
G4NuclWatcher Class Reference

#include <G4NuclWatcher.hh>

Public Member Functions

 G4NuclWatcher (G4int z, const std::vector< G4double > &expa, const std::vector< G4double > &expcs, const std::vector< G4double > &experr, G4bool check, G4bool nucl)
 
std::pair< G4double, G4doublegetAverageRatio () const
 
G4double getChsq () const
 
std::pair< G4double, G4doublegetExpCs () const
 
std::pair< G4double, G4doublegetInuclCs () const
 
G4double getLhood () const
 
G4double getNmatched () const
 
G4bool look_forNuclei () const
 
void print ()
 
void setInuclCs (G4double csec, G4int nev)
 
G4bool to_check () const
 
void watch (G4int a, G4int z)
 
 ~G4NuclWatcher ()
 

Private Attributes

G4double aver_lhood
 
G4double aver_matched
 
G4double aver_rat_err
 
G4double average_ratio
 
G4bool checkable
 
std::vector< G4doubleexper_as
 
std::vector< G4doubleexper_cs
 
std::vector< G4doubleexper_err
 
G4double izotop_chsq
 
G4bool nucleable
 
G4int nuclz
 
std::vector< G4doublesimulated_as
 
std::vector< G4doublesimulated_cs
 
std::vector< G4doublesimulated_errors
 
std::vector< G4doublesimulated_prob
 

Detailed Description

Definition at line 40 of file G4NuclWatcher.hh.

Constructor & Destructor Documentation

◆ G4NuclWatcher()

G4NuclWatcher::G4NuclWatcher ( G4int  z,
const std::vector< G4double > &  expa,
const std::vector< G4double > &  expcs,
const std::vector< G4double > &  experr,
G4bool  check,
G4bool  nucl 
)

Definition at line 39 of file G4NuclWatcher.cc.

45 : nuclz(z), izotop_chsq(0.), average_ratio(0.), aver_rat_err(0.),
46 aver_lhood(0.), aver_matched(0.), exper_as(expa), exper_cs(expcs),
47 exper_err(experr), checkable(check), nucleable(nucl) {}
G4double aver_rat_err
G4double aver_lhood
G4double aver_matched
G4double izotop_chsq
std::vector< G4double > exper_cs
std::vector< G4double > exper_as
std::vector< G4double > exper_err
G4double average_ratio

◆ ~G4NuclWatcher()

G4NuclWatcher::~G4NuclWatcher ( )
inline

Definition at line 49 of file G4NuclWatcher.hh.

49{}

Member Function Documentation

◆ getAverageRatio()

std::pair< G4double, G4double > G4NuclWatcher::getAverageRatio ( ) const
inline

Definition at line 63 of file G4NuclWatcher.hh.

63 {
64 return std::pair<G4double, G4double>(average_ratio, aver_rat_err);
65 }

References aver_rat_err, and average_ratio.

◆ getChsq()

G4double G4NuclWatcher::getChsq ( ) const
inline

Definition at line 54 of file G4NuclWatcher.hh.

54{ return izotop_chsq; }

References izotop_chsq.

◆ getExpCs()

std::pair< G4double, G4double > G4NuclWatcher::getExpCs ( ) const

Definition at line 80 of file G4NuclWatcher.cc.

80 {
81 G4double cs = 0.0;
82 G4double err = 0.0;
83
84 G4int experAsSize = exper_as.size();
85 for(G4int iz = 0; iz < experAsSize; iz++) {
86 cs += exper_cs[iz];
87 err += exper_err[iz];
88 }
89
90 return std::pair<G4double, G4double>(cs, err);
91}
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85

References exper_as, exper_cs, and exper_err.

◆ getInuclCs()

std::pair< G4double, G4double > G4NuclWatcher::getInuclCs ( ) const

Definition at line 93 of file G4NuclWatcher.cc.

93 {
94 G4double cs = 0.0;
95 G4double err = 0.0;
96 G4int simulatedAsSize = simulated_as.size();
97 for(G4int iz = 0; iz < simulatedAsSize; iz++) {
98 cs += simulated_cs[iz];
99 err += simulated_errors[iz];
100 }
101
102 return std::pair<G4double, G4double>(cs, err);
103}
std::vector< G4double > simulated_as
std::vector< G4double > simulated_errors
std::vector< G4double > simulated_cs

References simulated_as, simulated_cs, and simulated_errors.

◆ getLhood()

G4double G4NuclWatcher::getLhood ( ) const
inline

Definition at line 57 of file G4NuclWatcher.hh.

57{ return aver_lhood; }

References aver_lhood.

◆ getNmatched()

G4double G4NuclWatcher::getNmatched ( ) const
inline

Definition at line 58 of file G4NuclWatcher.hh.

58{ return aver_matched; }

References aver_matched.

◆ look_forNuclei()

G4bool G4NuclWatcher::look_forNuclei ( ) const
inline

Definition at line 56 of file G4NuclWatcher.hh.

56{ return nucleable; }

References nucleable.

◆ print()

void G4NuclWatcher::print ( )

Definition at line 105 of file G4NuclWatcher.cc.

105 {
106 const G4double small = 0.001;
107
108 G4cout << "\n ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "
109 << "\n **** izotop Z **** " << nuclz << G4endl;
110
111 izotop_chsq = 0.0;
112 average_ratio = 0.0;
113 aver_rat_err = 0.0;
114 G4double exp_cs = 0.0;
115 G4double exp_cs_err = 0.0;
116 G4double inucl_cs = 0.0;
117 G4double inucl_cs_err = 0.0;
118 std::vector<G4bool> not_used(simulated_cs.size(), true);
119 G4int nmatched = exper_as.size();
120 G4int nused = simulated_cs.size();
121 G4double lhood = 0.0;
122 G4int experAsSize = exper_as.size();
123
124 for (G4int iz = 0; iz < experAsSize; iz++) {
125 G4double a = exper_as[iz];
126
127 exp_cs += exper_cs[iz];
128 exp_cs_err += exper_err[iz];
129
130 G4bool found = false;
131 G4int simulatedAsSize = simulated_as.size();
132 for (G4int i = 0; i<simulatedAsSize && !found; i++) {
133 if (std::fabs(simulated_as[i] - a) < small) {
134 G4double rat = simulated_cs[i] / exper_cs[iz];
135
136 lhood += std::log10(rat) * std::log10(rat);
137
138 G4double rat_err
139 = std::sqrt(simulated_errors[i]*simulated_errors[i] +
140 exper_err[iz]*exper_err[iz] * rat*rat) / exper_cs[iz];
141 average_ratio += rat;
142 aver_rat_err += rat_err;
143
144 G4cout << " A " << a << " exp.cs " << exper_cs[iz] << " err "
145 << exper_err[iz] << G4endl << " sim. cs " << simulated_cs[i]
146 << " err " << simulated_errors[i] << G4endl
147 << " ratio " << rat << " err " << rat_err << G4endl
148 << " simulated production rate " << simulated_prob[i] << G4endl;
149
150 not_used[i] = false;
151 izotop_chsq += (rat - 1.0) * (rat - 1.0) / rat_err / rat_err;
152 found = true;
153 nused--;
154 }
155 }
156
157 if (found) nmatched--;
158 else
159 G4cout << " not found exper.: A " << a << " exp.cs " << exper_cs[iz]
160 << " err " << exper_err[iz] << G4endl;
161 }
162
163 G4cout << " not found in simulations " << nmatched << G4endl
164 << " not found in exper: " << nused << G4endl;
165
166 G4int simulatedAsSize = simulated_as.size();
167 for(G4int i = 0; i < simulatedAsSize; i++) {
168 inucl_cs += simulated_cs[i];
169 inucl_cs_err += simulated_errors[i];
170
171 if(not_used[i])
172 G4cout << " extra simul.: A " << simulated_as[i] << " sim. cs "
173 << simulated_cs[i] << " err " << simulated_errors[i] << G4endl;
174
175 G4cout << " simulated production rate " << simulated_prob[i] << G4endl;
176 }
177
178 G4int matched = exper_as.size() - nmatched;
179
180 if (matched > 0) {
181 aver_lhood = lhood;
182 aver_matched = matched;
183 lhood = std::pow(10.0, std::sqrt(lhood/matched));
184
185 G4cout << " matched " << matched << " CHSQ " << std::sqrt(izotop_chsq) / matched
186 << G4endl
187 << " raw chsq " << izotop_chsq << G4endl
188 << " average ratio " << average_ratio / matched
189 << " err " << aver_rat_err / matched << G4endl
190 << " lhood " << lhood << G4endl;
191 }
192 else {
193 izotop_chsq = 0.0;
194 aver_lhood = 0.0;
195 }
196
197 G4cout << " exper. cs " << exp_cs << " err " << exp_cs_err << G4endl
198 << " inucl. cs " << inucl_cs << " err " << inucl_cs_err << G4endl
199 << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "
200 << G4endl;
201}
bool G4bool
Definition: G4Types.hh:86
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
std::vector< G4double > simulated_prob

References aver_lhood, aver_matched, aver_rat_err, average_ratio, exper_as, exper_cs, exper_err, G4cout, G4endl, izotop_chsq, nuclz, simulated_as, simulated_cs, simulated_errors, and simulated_prob.

◆ setInuclCs()

void G4NuclWatcher::setInuclCs ( G4double  csec,
G4int  nev 
)

Definition at line 69 of file G4NuclWatcher.cc.

69 {
70 G4int simulatedAsSize = simulated_as.size();
71 for(G4int i = 0; i < simulatedAsSize ; i++) {
72 double err = std::sqrt(simulated_cs[i]) / simulated_cs[i];
73
74 simulated_prob.push_back(simulated_cs[i] / nev);
75 simulated_cs[i] *= csec / nev;
76 simulated_errors.push_back(simulated_cs[i] * err);
77 }
78}

References simulated_as, simulated_cs, simulated_errors, and simulated_prob.

◆ to_check()

G4bool G4NuclWatcher::to_check ( ) const
inline

Definition at line 55 of file G4NuclWatcher.hh.

55{ return checkable; }

References checkable.

◆ watch()

void G4NuclWatcher::watch ( G4int  a,
G4int  z 
)

Definition at line 49 of file G4NuclWatcher.cc.

49 {
50 const G4double small = 0.001;
51
52 if (std::abs(z-nuclz) >= small) return;
53
54 G4bool here = false; // Increment specified nucleus count
55 G4int simulatedAsSize = simulated_as.size();
56 for (G4int i = 0; i<simulatedAsSize && !here; i++) {
57 if (std::abs(simulated_as[i] - a) < small) {
58 simulated_cs[i] += 1.0;
59 here = true; // Terminates loop
60 }
61 }
62
63 if (!here) { // Nothing found, so add new entry
64 simulated_as.push_back(a);
65 simulated_cs.push_back(1.0);
66 }
67}

References nuclz, simulated_as, and simulated_cs.

Field Documentation

◆ aver_lhood

G4double G4NuclWatcher::aver_lhood
private

Definition at line 74 of file G4NuclWatcher.hh.

Referenced by getLhood(), and print().

◆ aver_matched

G4double G4NuclWatcher::aver_matched
private

Definition at line 75 of file G4NuclWatcher.hh.

Referenced by getNmatched(), and print().

◆ aver_rat_err

G4double G4NuclWatcher::aver_rat_err
private

Definition at line 73 of file G4NuclWatcher.hh.

Referenced by getAverageRatio(), and print().

◆ average_ratio

G4double G4NuclWatcher::average_ratio
private

Definition at line 72 of file G4NuclWatcher.hh.

Referenced by getAverageRatio(), and print().

◆ checkable

G4bool G4NuclWatcher::checkable
private

Definition at line 83 of file G4NuclWatcher.hh.

Referenced by to_check().

◆ exper_as

std::vector<G4double> G4NuclWatcher::exper_as
private

Definition at line 76 of file G4NuclWatcher.hh.

Referenced by getExpCs(), and print().

◆ exper_cs

std::vector<G4double> G4NuclWatcher::exper_cs
private

Definition at line 77 of file G4NuclWatcher.hh.

Referenced by getExpCs(), and print().

◆ exper_err

std::vector<G4double> G4NuclWatcher::exper_err
private

Definition at line 78 of file G4NuclWatcher.hh.

Referenced by getExpCs(), and print().

◆ izotop_chsq

G4double G4NuclWatcher::izotop_chsq
private

Definition at line 71 of file G4NuclWatcher.hh.

Referenced by getChsq(), and print().

◆ nucleable

G4bool G4NuclWatcher::nucleable
private

Definition at line 84 of file G4NuclWatcher.hh.

Referenced by look_forNuclei().

◆ nuclz

G4int G4NuclWatcher::nuclz
private

Definition at line 70 of file G4NuclWatcher.hh.

Referenced by print(), and watch().

◆ simulated_as

std::vector<G4double> G4NuclWatcher::simulated_as
private

Definition at line 79 of file G4NuclWatcher.hh.

Referenced by getInuclCs(), print(), setInuclCs(), and watch().

◆ simulated_cs

std::vector<G4double> G4NuclWatcher::simulated_cs
private

Definition at line 80 of file G4NuclWatcher.hh.

Referenced by getInuclCs(), print(), setInuclCs(), and watch().

◆ simulated_errors

std::vector<G4double> G4NuclWatcher::simulated_errors
private

Definition at line 81 of file G4NuclWatcher.hh.

Referenced by getInuclCs(), print(), and setInuclCs().

◆ simulated_prob

std::vector<G4double> G4NuclWatcher::simulated_prob
private

Definition at line 82 of file G4NuclWatcher.hh.

Referenced by print(), and setInuclCs().


The documentation for this class was generated from the following files: