Import Geant4 10.6.0 source tree
This commit is contained in:
@@ -28,83 +28,83 @@ public:
|
||||
bn_t bins() const {return m_number_of_bins;}
|
||||
const std::vector<TC>& edges() const {return m_edges;}
|
||||
|
||||
TC bin_width(int aBin) const {
|
||||
if(aBin==UNDERFLOW_BIN) {
|
||||
TC bin_width(int a_bin) const {
|
||||
if(a_bin==UNDERFLOW_BIN) {
|
||||
return 0; //FIXME return DBL_MAX;
|
||||
} else if(aBin==OVERFLOW_BIN) {
|
||||
} else if(a_bin==OVERFLOW_BIN) {
|
||||
return 0; //FIXME return DBL_MAX;
|
||||
} else if((aBin<0) ||(aBin>=(int)m_number_of_bins)) {
|
||||
} else if((a_bin<0) ||(a_bin>=(int)m_number_of_bins)) {
|
||||
return 0;
|
||||
} else {
|
||||
if(m_fixed) {
|
||||
return m_bin_width;
|
||||
} else {
|
||||
return (m_edges[aBin+1]-m_edges[aBin]);
|
||||
return (m_edges[a_bin+1]-m_edges[a_bin]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TC bin_lower_edge(int aBin) const {
|
||||
if(aBin==UNDERFLOW_BIN) {
|
||||
TC bin_lower_edge(int a_bin) const {
|
||||
if(a_bin==UNDERFLOW_BIN) {
|
||||
return 0; //FIXME return -DBL_MAX;
|
||||
} else if(aBin==OVERFLOW_BIN) {
|
||||
} else if(a_bin==OVERFLOW_BIN) {
|
||||
return 0; //FIXME return bin_upper_edge(m_number_of_bins-1);
|
||||
} else if((aBin<0) ||(aBin>=(int)m_number_of_bins)) {
|
||||
} else if((a_bin<0) ||(a_bin>=(int)m_number_of_bins)) {
|
||||
return 0;
|
||||
} else {
|
||||
if(m_fixed) {
|
||||
return (m_minimum_value + aBin * m_bin_width);
|
||||
return (m_minimum_value + a_bin * m_bin_width);
|
||||
} else {
|
||||
return m_edges[aBin];
|
||||
return m_edges[a_bin];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TC bin_upper_edge(int aBin) const {
|
||||
if(aBin==UNDERFLOW_BIN) {
|
||||
TC bin_upper_edge(int a_bin) const {
|
||||
if(a_bin==UNDERFLOW_BIN) {
|
||||
return 0; //FIXME bin_lower_edge(0)
|
||||
} else if(aBin==OVERFLOW_BIN) {
|
||||
} else if(a_bin==OVERFLOW_BIN) {
|
||||
return 0; //FIXME return DBL_MAX;
|
||||
} else if((aBin<0) ||(aBin>=(int)m_number_of_bins)) {
|
||||
} else if((a_bin<0) ||(a_bin>=(int)m_number_of_bins)) {
|
||||
return 0;
|
||||
} else {
|
||||
if(m_fixed) {
|
||||
return (m_minimum_value + (aBin + 1) * m_bin_width);
|
||||
return (m_minimum_value + (a_bin + 1) * m_bin_width);
|
||||
} else {
|
||||
return m_edges[aBin+1];
|
||||
return m_edges[a_bin+1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TC bin_center(int aBin) const {
|
||||
if(aBin==UNDERFLOW_BIN) {
|
||||
TC bin_center(int a_bin) const {
|
||||
if(a_bin==UNDERFLOW_BIN) {
|
||||
return 0; //FIXME : -INF
|
||||
} else if(aBin==OVERFLOW_BIN) {
|
||||
} else if(a_bin==OVERFLOW_BIN) {
|
||||
return 0; //FIXME : +INF
|
||||
} else if(aBin<0) {
|
||||
} else if(a_bin<0) {
|
||||
return 0; //FIXME : -INF
|
||||
} else if(aBin>=(int)m_number_of_bins) {
|
||||
} else if(a_bin>=(int)m_number_of_bins) {
|
||||
return 0; //FIXME : +INF
|
||||
} else {
|
||||
if(m_fixed) {
|
||||
return (m_minimum_value + (aBin + 0.5) * m_bin_width);
|
||||
return (m_minimum_value + (a_bin + 0.5) * m_bin_width);
|
||||
} else {
|
||||
return (m_edges[aBin] + m_edges[aBin+1])/2.;
|
||||
return (m_edges[a_bin] + m_edges[a_bin+1])/2.;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int coord_to_index(TC aValue) const {
|
||||
if( aValue < m_minimum_value) {
|
||||
int coord_to_index(TC a_value) const {
|
||||
if( a_value < m_minimum_value) {
|
||||
return UNDERFLOW_BIN;
|
||||
} else if( aValue >= m_maximum_value) {
|
||||
} else if( a_value >= m_maximum_value) {
|
||||
return OVERFLOW_BIN;
|
||||
} else {
|
||||
if(m_fixed) {
|
||||
return (int)((aValue - m_minimum_value)/m_bin_width);
|
||||
return (int)((a_value - m_minimum_value)/m_bin_width);
|
||||
} else {
|
||||
for(bn_t index=0;index<m_number_of_bins;index++) {
|
||||
if((m_edges[index]<=aValue)&&(aValue<m_edges[index+1])) {
|
||||
if((m_edges[index]<=a_value)&&(a_value<m_edges[index+1])) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
@@ -114,20 +114,20 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool coord_to_absolute_index(TC aValue,bn_t& a_index) const {
|
||||
if( aValue < m_minimum_value) {
|
||||
bool coord_to_absolute_index(TC a_value,bn_t& a_index) const {
|
||||
if( a_value < m_minimum_value) {
|
||||
a_index = 0;
|
||||
return true;
|
||||
} else if( aValue >= m_maximum_value) {
|
||||
} else if( a_value >= m_maximum_value) {
|
||||
a_index = m_number_of_bins+1;
|
||||
return true;
|
||||
} else {
|
||||
if(m_fixed) {
|
||||
a_index = (bn_t)((aValue - m_minimum_value)/m_bin_width)+1;
|
||||
a_index = (bn_t)((a_value - m_minimum_value)/m_bin_width)+1;
|
||||
return true;
|
||||
} else {
|
||||
for(bn_t index=0;index<m_number_of_bins;index++) {
|
||||
if((m_edges[index]<=aValue)&&(aValue<m_edges[index+1])) {
|
||||
if((m_edges[index]<=a_value)&&(a_value<m_edges[index+1])) {
|
||||
a_index = index+1;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -207,6 +207,25 @@ public: //histo_data
|
||||
TW get_in_range_Sw() const {return parent::m_in_range_Sw;} //for CERN-ROOT file writing.
|
||||
TW get_in_range_Sw2() const {return parent::m_in_range_Sw2;} //for CERN-ROOT file writing.
|
||||
|
||||
void get_Sw_Sw2(TW& a_sw,TW& a_sw2) const {
|
||||
a_sw = 0;
|
||||
a_sw2 = 0;
|
||||
for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
|
||||
if(!histo::is_out(parent::m_axes,ibin)) {
|
||||
a_sw += parent::m_bin_Sw[ibin];
|
||||
a_sw2 += parent::m_bin_Sw2[ibin];
|
||||
}
|
||||
}
|
||||
}
|
||||
void get_all_Sw_Sw2(TW& a_sw,TW& a_sw2) const {
|
||||
a_sw = 0;
|
||||
a_sw2 = 0;
|
||||
for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
|
||||
a_sw += parent::m_bin_Sw[ibin];
|
||||
a_sw2 += parent::m_bin_Sw2[ibin];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
TW get_all_Sw() const {
|
||||
TW sw = 0;
|
||||
@@ -377,7 +396,7 @@ public:
|
||||
const std::vector<TC>& in_range_planes_xyw() const {return parent::m_in_range_plane_Sxyw;}
|
||||
|
||||
public:
|
||||
const axis_t& get_axis(int aIndex) const {return parent::m_axes[aIndex];}
|
||||
const axis_t& get_axis(int a_index) const {return parent::m_axes[a_index];}
|
||||
offset_t get_bins() const {return parent::m_bin_number;}
|
||||
const std::string& get_title() const {return parent::m_title;}
|
||||
dim_t get_dimension() const {return parent::m_dimension;}
|
||||
|
||||
@@ -104,8 +104,8 @@ public:
|
||||
double upper_edge() const {
|
||||
return (m_histo ? m_histo->axis().upper_edge() : m_upper_x);
|
||||
}
|
||||
double value(unsigned int aIndex) const {return (m_histo ?0:m_xs[aIndex]);}
|
||||
double weight(unsigned int aIndex) const {return (m_histo ?0:m_ws[aIndex]);}
|
||||
double value(unsigned int a_index) const {return (m_histo ?0:m_xs[a_index]);}
|
||||
double weight(unsigned int a_index) const {return (m_histo ?0:m_ws[a_index]);}
|
||||
double mean() const {
|
||||
return (m_histo ? m_histo->mean() : (m_Sw?m_Sxw/m_Sw:0));
|
||||
}
|
||||
@@ -123,9 +123,9 @@ public:
|
||||
return _rms;
|
||||
}
|
||||
|
||||
bool convert(unsigned int aBins,double aLowerEdge,double aUpperEdge){
|
||||
bool convert(unsigned int a_bins,double a_lower_edge,double a_upper_edge){
|
||||
if(m_histo) return true;
|
||||
m_histo = new histo::h1d(base_cloud::title(),aBins,aLowerEdge,aUpperEdge);
|
||||
m_histo = new histo::h1d(base_cloud::title(),a_bins,a_lower_edge,a_upper_edge);
|
||||
if(!m_histo) return false;
|
||||
bool status = fill_histogram(*m_histo);
|
||||
clear();
|
||||
|
||||
@@ -35,9 +35,9 @@ public:
|
||||
double lower_edge_y() const { return m_histo ? m_histo->axis_y().lower_edge() : m_lower_y;}
|
||||
double upper_edge_x() const { return m_histo ? m_histo->axis_x().upper_edge() : m_upper_x;}
|
||||
double upper_edge_y() const { return m_histo ? m_histo->axis_y().upper_edge() : m_upper_y;}
|
||||
double value_x(unsigned int aIndex) const { return m_histo ? 0 : m_xs[aIndex];}
|
||||
double value_y(unsigned int aIndex) const { return m_histo ? 0 : m_ys[aIndex];}
|
||||
double weight(unsigned int aIndex) const { return m_histo ? 0 : m_ws[aIndex];}
|
||||
double value_x(unsigned int a_index) const { return m_histo ? 0 : m_xs[a_index];}
|
||||
double value_y(unsigned int a_index) const { return m_histo ? 0 : m_ys[a_index];}
|
||||
double weight(unsigned int a_index) const { return m_histo ? 0 : m_ws[a_index];}
|
||||
double mean_x() const {return m_histo ? m_histo->mean_x() : (m_Sw?m_Sxw/m_Sw:0);}
|
||||
double mean_y() const {return m_histo ? m_histo->mean_y() : (m_Sw?m_Syw/m_Sw:0);}
|
||||
double rms_x() const;
|
||||
@@ -211,13 +211,13 @@ void c2d::clear(){
|
||||
|
||||
inline
|
||||
bool c2d::convert(
|
||||
unsigned int aBinsX,double aLowerEdgeX,double aUpperEdgeX
|
||||
,unsigned int aBinsY,double aLowerEdgeY,double aUpperEdgeY
|
||||
unsigned int a_bins_x,double a_lower_edge_x,double a_upper_edge_x
|
||||
,unsigned int a_bins_y,double a_lower_edge_y,double a_upper_edge_y
|
||||
) {
|
||||
if(m_histo) return true; // Done.
|
||||
m_histo = new histo::h2d(base_cloud::title(),
|
||||
aBinsX,aLowerEdgeX,aUpperEdgeX,
|
||||
aBinsY,aLowerEdgeY,aUpperEdgeY);
|
||||
a_bins_x,a_lower_edge_x,a_upper_edge_x,
|
||||
a_bins_y,a_lower_edge_y,a_upper_edge_y);
|
||||
if(!m_histo) return false;
|
||||
bool status = fill_histogram(*m_histo);
|
||||
clear();
|
||||
|
||||
@@ -261,15 +261,15 @@ void c3d::clear(){
|
||||
|
||||
inline
|
||||
bool c3d::convert(
|
||||
unsigned int aBinsX,double aLowerEdgeX,double aUpperEdgeX
|
||||
,unsigned int aBinsY,double aLowerEdgeY,double aUpperEdgeY
|
||||
,unsigned int aBinsZ,double aLowerEdgeZ,double aUpperEdgeZ
|
||||
unsigned int a_bins_x,double a_lower_edge_x,double a_upper_edge_x
|
||||
,unsigned int a_bins_y,double a_lower_edge_y,double a_upper_edge_y
|
||||
,unsigned int a_bins_z,double a_lower_edge_z,double a_upper_edge_z
|
||||
) {
|
||||
if(m_histo) return true; // Done.
|
||||
m_histo = new histo::h3d(base_cloud::title(),
|
||||
aBinsX,aLowerEdgeX,aUpperEdgeX,
|
||||
aBinsY,aLowerEdgeY,aUpperEdgeY,
|
||||
aBinsZ,aLowerEdgeZ,aUpperEdgeZ);
|
||||
a_bins_x,a_lower_edge_x,a_upper_edge_x,
|
||||
a_bins_y,a_lower_edge_y,a_upper_edge_y,
|
||||
a_bins_z,a_lower_edge_z,a_upper_edge_z);
|
||||
if(!m_histo) return false;
|
||||
bool status = fill_histogram(*m_histo);
|
||||
clear();
|
||||
@@ -450,20 +450,20 @@ double c3d::upper_edge_z() const {
|
||||
return m_histo ? m_histo->axis_z().upper_edge() : m_upper_z;
|
||||
}
|
||||
inline
|
||||
double c3d::value_x(unsigned int aIndex) const {
|
||||
return m_histo ? 0 : m_xs[aIndex];
|
||||
double c3d::value_x(unsigned int a_index) const {
|
||||
return m_histo ? 0 : m_xs[a_index];
|
||||
}
|
||||
inline
|
||||
double c3d::value_y(unsigned int aIndex) const {
|
||||
return m_histo ? 0 : m_ys[aIndex];
|
||||
double c3d::value_y(unsigned int a_index) const {
|
||||
return m_histo ? 0 : m_ys[a_index];
|
||||
}
|
||||
inline
|
||||
double c3d::value_z(unsigned int aIndex) const {
|
||||
return m_histo ? 0 : m_zs[aIndex];
|
||||
double c3d::value_z(unsigned int a_index) const {
|
||||
return m_histo ? 0 : m_zs[a_index];
|
||||
}
|
||||
inline
|
||||
double c3d::weight(unsigned int aIndex) const {
|
||||
return m_histo ? 0 : m_ws[aIndex];
|
||||
double c3d::weight(unsigned int a_index) const {
|
||||
return m_histo ? 0 : m_ws[a_index];
|
||||
}
|
||||
inline
|
||||
double c3d::mean_x() const {
|
||||
|
||||
@@ -170,6 +170,75 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool set_bin_content(bn_t a_ibin,TN a_entries,TW a_Sw,TW a_Sw2,TC a_Sxw,TC a_Sx2w,TC a_Svw,TC a_Sv2w) {
|
||||
if(parent::m_dimension!=1) return false;
|
||||
if(a_ibin>(parent::m_axes[0].m_number_of_bins+1)) return false;
|
||||
|
||||
bool inRange = true;
|
||||
if(a_ibin==0) inRange = false;
|
||||
else if(a_ibin==(parent::m_axes[0].m_number_of_bins+1)) inRange = false;
|
||||
|
||||
TO offset = a_ibin;
|
||||
|
||||
parent::m_all_entries -= parent::m_bin_entries[offset];
|
||||
if(inRange) {
|
||||
parent::m_in_range_entries -= parent::m_bin_entries[offset];
|
||||
parent::m_in_range_Sw -= parent::m_bin_Sw[offset];
|
||||
parent::m_in_range_Sw2 -= parent::m_bin_Sw2[offset];
|
||||
parent::m_in_range_Sxw[0] -= parent::m_bin_Sxw[offset][0];
|
||||
parent::m_in_range_Sx2w[0] -= parent::m_bin_Sx2w[offset][0];
|
||||
}
|
||||
|
||||
parent::m_bin_entries[offset] = a_entries;
|
||||
parent::m_bin_Sw[offset] = a_Sw;
|
||||
parent::m_bin_Sw2[offset] = a_Sw2;
|
||||
|
||||
parent::m_bin_Sxw[offset][0] = a_Sxw;
|
||||
parent::m_bin_Sx2w[offset][0] = a_Sx2w;
|
||||
|
||||
parent::m_all_entries += a_entries;
|
||||
if(inRange) {
|
||||
parent::m_in_range_entries += a_entries;
|
||||
parent::m_in_range_Sw += a_Sw;
|
||||
parent::m_in_range_Sw2 += a_Sw2;
|
||||
|
||||
parent::m_in_range_Sxw[0] += a_Sxw;
|
||||
parent::m_in_range_Sx2w[0] += a_Sx2w;
|
||||
}
|
||||
|
||||
// Profile part :
|
||||
m_bin_Svw[offset] = a_Svw;
|
||||
m_bin_Sv2w[offset] = a_Sv2w;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool get_bin_content(bn_t a_ibin,TN& a_entries,TW& a_Sw,TW& a_Sw2,TC& a_Sxw,TC& a_Sx2w,TC& a_Svw,TC& a_Sv2w) {
|
||||
if(parent::m_dimension!=1) {
|
||||
a_entries = 0;a_Sw = 0;a_Sw2 = 0;a_Sxw = 0;a_Sx2w = 0;
|
||||
return false;
|
||||
}
|
||||
if(a_ibin>(parent::m_axes[0].m_number_of_bins+1)) {
|
||||
a_entries = 0;a_Sw = 0;a_Sw2 = 0;a_Sxw = 0;a_Sx2w = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
TO offset = a_ibin;
|
||||
|
||||
a_entries = parent::m_bin_entries[offset];
|
||||
a_Sw = parent::m_bin_Sw[offset];
|
||||
a_Sw2 = parent::m_bin_Sw2[offset];
|
||||
|
||||
a_Sxw = parent::m_bin_Sxw[offset][0];
|
||||
a_Sx2w = parent::m_bin_Sx2w[offset][0];
|
||||
|
||||
// Profile part :
|
||||
a_Svw = m_bin_Svw[offset];
|
||||
a_Sv2w = m_bin_Sv2w[offset];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
TV bin_rms_value(int aI) const {
|
||||
TO offset;
|
||||
if(!parent::_find_offset(aI,offset)) return 0;
|
||||
|
||||
Reference in New Issue
Block a user