Import Geant4 11.0.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2021-06-25 16:12:29 +02:00
parent c968e26a39
commit 6399a014b6
4200 changed files with 207479 additions and 237366 deletions
@@ -53,167 +53,124 @@
class G4ConvergenceTester
{
public:
G4ConvergenceTester(G4String theName = "NONAME");
~G4ConvergenceTester();
G4ConvergenceTester(G4double);
public:
void AddScore(G4double);
G4ConvergenceTester(const G4String& theName = "NONAME");
~G4ConvergenceTester();
G4ConvergenceTester(G4double);
inline G4ConvergenceTester& operator+=(G4double val)
{
this->AddScore(val);
return *this;
}
void AddScore(G4double);
// default to G4cout but can redirected to another ostream
void ShowHistory(std::ostream& out = G4cout);
void ShowResult(std::ostream& out = G4cout);
inline G4double GetValueOfMinimizingFunction(std::vector<G4double> x)
{
return slope_fitting_function(x);
}
public:
void ComputeStatistics() { calStat(); }
// Public function to explicitly calculate statistics
// All accessors check to make sure value is current before returning
inline G4double GetMean()
{
CheckIsUpdated();
return mean;
}
inline G4double GetStandardDeviation()
{
CheckIsUpdated();
return sd;
}
inline G4double GetVariance()
{
CheckIsUpdated();
return var;
}
inline G4double GetR()
{
CheckIsUpdated();
return r;
}
inline G4double GetEfficiency()
{
CheckIsUpdated();
return efficiency;
}
inline G4double GetR2eff()
{
CheckIsUpdated();
return r2eff;
}
inline G4double GetR2int()
{
CheckIsUpdated();
return r2int;
}
inline G4double GetShift()
{
CheckIsUpdated();
return shift;
}
inline G4double GetVOV()
{
CheckIsUpdated();
return vov;
}
inline G4double GetFOM()
{
CheckIsUpdated();
return fom;
}
private:
void calStat();
// Boolean value of 'statsAreUpdated' is set to TRUE at end of calStat
// and set to FALSE at end of AddScore
// NOTE : A thread lock for Geant4-MT needs to be put in AddScore so calStat
// is not executed in one thread while AddScore is modifying/adding data
inline void CheckIsUpdated()
{
if(!statsAreUpdated)
inline G4ConvergenceTester& operator+=(G4double val)
{
calStat();
this->AddScore(val);
return *this;
}
}
void calc_grid_point_of_history();
void calc_stat_history();
void check_stat_history(std::ostream& out = G4cout);
G4double calc_Pearson_r(G4int, std::vector<G4double>, std::vector<G4double>);
G4bool is_monotonically_decrease(std::vector<G4double>);
void calc_slope_fit(std::vector<G4double>);
G4double slope_fitting_function(std::vector<G4double>);
void ShowHistory(std::ostream& out = G4cout);
void ShowResult(std::ostream& out = G4cout);
// Default to G4cout but can be redirected to another ostream
private:
G4String name;
std::map<G4int, G4double> nonzero_histories;
// (ith-history , score value)
G4int n = 0;
// number of history
G4double sum = 0.0; // sum of scores;
inline G4double GetValueOfMinimizingFunction(std::vector<G4double> x)
{
return slope_fitting_function(x);
}
G4Timer* timer = nullptr;
std::vector<G4double> cpu_time;
void ComputeStatistics() { calStat(); }
// Explicitly calculate statistics
G4double mean = 0.0;
G4double var = 0.0;
G4double sd = 0.0;
G4double r = 0.0; // relative err sd/mean/sqrt(n)
G4double efficiency = 0.0; // rate of non zero score
G4double r2eff = 0.0;
G4double r2int = 0.0;
G4double shift = 0.0;
G4double vov = 0.0;
G4double fom = 0.0;
// All accessors check to make sure value is current before returning
G4double largest = 0.0;
G4int largest_score_happened = 0;
inline G4double GetMean() { CheckIsUpdated(); return mean; }
inline G4double GetStandardDeviation() { CheckIsUpdated(); return sd; }
inline G4double GetVariance() { CheckIsUpdated(); return var; }
inline G4double GetR() { CheckIsUpdated(); return r; }
inline G4double GetEfficiency() { CheckIsUpdated(); return efficiency; }
inline G4double GetR2eff() { CheckIsUpdated(); return r2eff; }
inline G4double GetR2int() { CheckIsUpdated(); return r2int; }
inline G4double GetShift() { CheckIsUpdated(); return shift; }
inline G4double GetVOV() { CheckIsUpdated(); return vov; }
inline G4double GetFOM() { CheckIsUpdated(); return fom; }
G4double mean_1 = 0.0;
G4double var_1 = 0.0;
G4double sd_1 = 0.0;
G4double r_1 = 0.0; // relative err sd/mean/sqrt(n)
G4double shift_1 = 0.0;
G4double vov_1 = 0.0;
G4double fom_1 = 0.0;
private:
G4int noBinOfHistory = 16;
std::vector<G4int> history_grid;
std::vector<G4double> mean_history;
std::vector<G4double> var_history;
std::vector<G4double> sd_history;
std::vector<G4double> r_history;
std::vector<G4double> vov_history;
std::vector<G4double> fom_history;
std::vector<G4double> shift_history;
std::vector<G4double> e_history;
std::vector<G4double> r2eff_history;
std::vector<G4double> r2int_history;
void calStat();
// Boolean value of 'statsAreUpdated' is set to TRUE at end of calStat
// and set to FALSE at end of AddScore().
// NOTE: A thread lock needs to be put in AddScore() so calStat()
// is not executed in one thread while AddScore() is adding data
G4double slope = 0.0;
std::vector<G4double> largest_scores;
std::vector<G4double> f_xi;
std::vector<G4double> f_yi;
G4int noBinOfPDF = 10;
G4SimplexDownhill<G4ConvergenceTester>* minimizer = nullptr;
inline void CheckIsUpdated()
{
if(!statsAreUpdated) { calStat(); }
}
G4int noPass = 0;
G4int noTotal = 8; // Total number of tests
void calc_grid_point_of_history();
void calc_stat_history();
void check_stat_history(std::ostream& out = G4cout);
G4double calc_Pearson_r(G4int,std::vector<G4double>,std::vector<G4double>);
G4bool is_monotonically_decrease(std::vector<G4double>);
void calc_slope_fit(std::vector<G4double>);
G4double slope_fitting_function(std::vector<G4double>);
G4bool statsAreUpdated = true;
G4bool showHistory = true;
G4bool calcSLOPE = true;
private:
G4String name;
std::map<G4int, G4double> nonzero_histories; // (ith-history, score value)
G4int n = 0; // number of history
G4double sum = 0.0; // sum of scores;
G4Timer* timer = nullptr;
std::vector<G4double> cpu_time;
G4double mean = 0.0;
G4double var = 0.0;
G4double sd = 0.0;
G4double r = 0.0; // relative err sd/mean/sqrt(n)
G4double efficiency = 0.0; // rate of non zero score
G4double r2eff = 0.0;
G4double r2int = 0.0;
G4double shift = 0.0;
G4double vov = 0.0;
G4double fom = 0.0;
G4double largest = 0.0;
G4int largest_score_happened = 0;
G4double mean_1 = 0.0;
G4double var_1 = 0.0;
G4double sd_1 = 0.0;
G4double r_1 = 0.0; // relative err sd/mean/sqrt(n)
G4double shift_1 = 0.0;
G4double vov_1 = 0.0;
G4double fom_1 = 0.0;
G4int noBinOfHistory = 16;
std::vector<G4int> history_grid;
std::vector<G4double> mean_history;
std::vector<G4double> var_history;
std::vector<G4double> sd_history;
std::vector<G4double> r_history;
std::vector<G4double> vov_history;
std::vector<G4double> fom_history;
std::vector<G4double> shift_history;
std::vector<G4double> e_history;
std::vector<G4double> r2eff_history;
std::vector<G4double> r2int_history;
G4double slope = 0.0;
std::vector<G4double> largest_scores;
std::vector<G4double> f_xi;
std::vector<G4double> f_yi;
G4int noBinOfPDF = 10;
G4SimplexDownhill<G4ConvergenceTester>* minimizer = nullptr;
G4int noPass = 0;
G4int noTotal = 8; // Total number of tests
G4bool statsAreUpdated = true;
G4bool showHistory = true;
G4bool calcSLOPE = true;
};
#endif