48 std::vector<G4VStatMFMacroCluster*> * ClusterVector) :
52 _FreeInternalE0(FreeE0),
54 _MeanMultiplicity(0.0),
55 _MeanTemperature(0.0),
56 _ChemPotentialMu(0.0),
57 _ChemPotentialNu(0.0),
59 _theClusters(ClusterVector)
85 while (fTa < 0.0 && ++iterations < 10) {
92 while (fTa*fTb > 0.0 && iterations++ < 10) {
93 Tb += 2.*std::fabs(Tb-Ta);
98 G4cerr <<
"G4StatMFMacroTemperature:"<<
" Ta="<<Ta<<
" Tb="<<Tb<<
G4endl;
99 G4cerr <<
"G4StatMFMacroTemperature:"<<
" fTa="<<fTa<<
" fTb="<<fTb<<
G4endl;
100 throw G4HadronicException(__FILE__, __LINE__,
"G4StatMFMacroTemperature::CalcTemperature: I couldn't bracket the solution.");
107 G4cout <<
"G4StatMFMacroTemperature, Crenshaw method failed:"<<
" Ta="
108 <<Ta<<
" Tb="<<Tb<<
G4endl;
109 G4cout <<
"G4StatMFMacroTemperature, Crenshaw method failed:"<<
" fTa="
110 <<fTa<<
" fTb="<<fTb<<
G4endl;
118 if (std::fabs(FunctionValureAtRoot) > 5.
e-2) {
119 if (_MeanTemperature < 1. || _MeanTemperature > 50.) {
120 G4cout <<
"Crenshaw method failed; function = " << FunctionValureAtRoot
125 if (!theSolverBrent->
Brent(*
this)){
126 G4cout <<
"G4StatMFMacroTemperature, Brent method failed:"
127 <<
" Ta="<<Ta<<
" Tb="<<Tb<<
G4endl;
128 G4cout <<
"G4StatMFMacroTemperature, Brent method failed:"
129 <<
" fTa="<<fTa<<
" fTb="<<fTb<<
G4endl;
130 throw G4HadronicException(__FILE__, __LINE__,
"G4StatMFMacroTemperature::CalcTemperature: I couldn't find the root with any method.");
135 delete theSolverBrent;
137 if (
std::abs(FunctionValureAtRoot) > 5.
e-2) {
138 G4cout <<
"Brent method failed; function = " << FunctionValureAtRoot
140 throw G4HadronicException(__FILE__, __LINE__,
"G4StatMFMacroTemperature::CalcTemperature: I couldn't find the root with any method.");
165 std::vector<G4VStatMFMacroCluster*>::iterator i;
168 AverageEnergy += (*i)->GetMeanMultiplicity() * (*i)->CalcEnergy(T);