Import Geant4 10.7.0 source tree
This commit is contained in:
@@ -17,7 +17,7 @@ inline bool is_out(const std::vector< axis<TC,TO> >& a_axes,TO a_offset) {
|
||||
TO offset = a_offset;
|
||||
int index;
|
||||
typename std::vector< axis<TC,TO> >::size_type dimension = a_axes.size();
|
||||
for(int iaxis=int(dimension)-1;iaxis>=0;iaxis--) {
|
||||
for(int iaxis=int(dimension)-1;iaxis>=0;iaxis--) {
|
||||
index = int(offset/a_axes[iaxis].m_offset);
|
||||
if(index==0) return true;
|
||||
if(index==(int(a_axes[iaxis].m_number_of_bins)+1)) return true;
|
||||
@@ -30,7 +30,7 @@ template <class TC,class TO>
|
||||
inline void get_indices(const std::vector< axis<TC,TO> >& a_axes,TO a_offset,std::vector<int>& a_is) {
|
||||
TO offset = a_offset;
|
||||
typename std::vector< axis<TC,TO> >::size_type dimension = a_axes.size();
|
||||
{for(int iaxis=int(dimension)-1;iaxis>=0;iaxis--) {
|
||||
{for(int iaxis=int(dimension)-1;iaxis>=0;iaxis--) {
|
||||
a_is[iaxis] = int(offset/a_axes[iaxis].m_offset);
|
||||
offset -= a_is[iaxis] * a_axes[iaxis].m_offset;
|
||||
}}
|
||||
@@ -57,7 +57,7 @@ inline bool get_offset(const std::vector< axis<TC,TO> >& a_axes,const std::vecto
|
||||
typename std::vector< axis<TC,TO> >::size_type dimension = a_axes.size();
|
||||
typename axis<TC,TO>::bn_t ibin;
|
||||
typedef unsigned int dim_t;
|
||||
for(dim_t iaxis=0;iaxis<dimension;iaxis++) {
|
||||
for(dim_t iaxis=0;iaxis<dimension;iaxis++) {
|
||||
if(!a_axes[iaxis].in_range_to_absolute_index(a_is[iaxis],ibin)) {
|
||||
a_offset = 0;
|
||||
return false;
|
||||
|
||||
@@ -120,7 +120,7 @@ public:
|
||||
return true;
|
||||
} else if( a_value >= m_maximum_value) {
|
||||
a_index = m_number_of_bins+1;
|
||||
return true;
|
||||
return true;
|
||||
} else {
|
||||
if(m_fixed) {
|
||||
a_index = (bn_t)((a_value - m_minimum_value)/m_bin_width)+1;
|
||||
@@ -203,14 +203,14 @@ public:
|
||||
m_fixed = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool is_compatible(const axis& a_axis) const {
|
||||
if(m_number_of_bins!=a_axis.m_number_of_bins) return false;
|
||||
if(m_minimum_value!=a_axis.m_minimum_value) return false;
|
||||
if(m_maximum_value!=a_axis.m_maximum_value) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
axis()
|
||||
:m_offset(0)
|
||||
@@ -256,7 +256,7 @@ public:
|
||||
if(m_edges!=a_from.m_edges) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool operator==(const axis& a_from) const {return equals(a_from);}
|
||||
bool operator!=(const axis& a_from) const {return !equals(a_from);}
|
||||
|
||||
|
||||
@@ -107,42 +107,42 @@ public:
|
||||
void hprint(std::ostream& a_out) {
|
||||
// A la HPRINT.
|
||||
a_out << parent::dimension() << parent::title() << std::endl;
|
||||
a_out
|
||||
a_out
|
||||
<< " * ENTRIES = " << parent::all_entries()
|
||||
<< " * ALL CHANNELS = " << parent::sum_bin_heights()
|
||||
<< " * UNDERFLOW = " << bin_height(axis_t::UNDERFLOW_BIN)
|
||||
<< " * OVERFLOW = " << bin_height(axis_t::OVERFLOW_BIN)
|
||||
<< std::endl;
|
||||
a_out
|
||||
a_out
|
||||
<< " * BIN WID = " << axis().bin_width(0)
|
||||
<< " * MEAN VALUE = " << mean()
|
||||
<< " * R . M . S = " << rms()
|
||||
<< std::endl;
|
||||
|
||||
|
||||
// Some bins :
|
||||
bn_t bins = axis().bins();
|
||||
a_out
|
||||
<< " * ENTRIES[0] = "
|
||||
<< bin_entries(0)
|
||||
<< " * HEIGHT[0] = "
|
||||
<< bin_height(0)
|
||||
<< " * ERROR[0] = "
|
||||
<< bin_error(0)
|
||||
a_out
|
||||
<< " * ENTRIES[0] = "
|
||||
<< bin_entries(0)
|
||||
<< " * HEIGHT[0] = "
|
||||
<< bin_height(0)
|
||||
<< " * ERROR[0] = "
|
||||
<< bin_error(0)
|
||||
<< std::endl;
|
||||
a_out
|
||||
<< " * ENTRIES[N/2] = "
|
||||
<< bin_entries(bins/2)
|
||||
<< " * HEIGHT[N/2] = "
|
||||
a_out
|
||||
<< " * ENTRIES[N/2] = "
|
||||
<< bin_entries(bins/2)
|
||||
<< " * HEIGHT[N/2] = "
|
||||
<< bin_height(bins/2)
|
||||
<< " * ERROR[N/2] = "
|
||||
<< " * ERROR[N/2] = "
|
||||
<< bin_error(bins/2)
|
||||
<< std::endl;
|
||||
a_out
|
||||
<< " * ENTRIES[N-1] = "
|
||||
<< bin_entries(bins-1)
|
||||
<< " * HEIGHT[N-1] = "
|
||||
a_out
|
||||
<< " * ENTRIES[N-1] = "
|
||||
<< bin_entries(bins-1)
|
||||
<< " * HEIGHT[N-1] = "
|
||||
<< bin_height(bins-1)
|
||||
<< " * ERROR[N-1] = "
|
||||
<< " * ERROR[N-1] = "
|
||||
<< bin_error(bins-1)
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
@@ -212,15 +212,15 @@ public:
|
||||
void hprint(std::ostream& a_out) {
|
||||
// A la HPRINT.
|
||||
a_out << parent::dimension() << parent::title() << std::endl;
|
||||
a_out
|
||||
a_out
|
||||
<< " * ENTRIES = " << parent::all_entries() << std::endl;
|
||||
|
||||
|
||||
// 6 | 7 | 8
|
||||
// -----------
|
||||
// 3 | 4 | 5
|
||||
// -----------
|
||||
// 0 | 1 | 2
|
||||
|
||||
|
||||
TW height_0 = bin_height(axis_t::UNDERFLOW_BIN,
|
||||
axis_t::UNDERFLOW_BIN);
|
||||
TW height_2 = bin_height(axis_t::OVERFLOW_BIN,
|
||||
@@ -229,62 +229,62 @@ public:
|
||||
axis_t::OVERFLOW_BIN);
|
||||
TW height_8 = bin_height(axis_t::OVERFLOW_BIN,
|
||||
axis_t::OVERFLOW_BIN);
|
||||
|
||||
|
||||
bn_t i,j;
|
||||
|
||||
|
||||
TW height_1 = 0;
|
||||
TW height_7 = 0;
|
||||
for(i=0;i<axis_x().bins();i++){
|
||||
height_1 += bin_height(i,axis_t::UNDERFLOW_BIN);
|
||||
height_7 += bin_height(i,axis_t::OVERFLOW_BIN);
|
||||
}
|
||||
|
||||
|
||||
TW height_3 = 0;
|
||||
TW height_5 = 0;
|
||||
for(j=0;j<axis_y().bins();j++){
|
||||
height_3 += bin_height(axis_t::UNDERFLOW_BIN,j);
|
||||
height_5 += bin_height(axis_t::OVERFLOW_BIN,j);
|
||||
}
|
||||
|
||||
|
||||
TW height_4 = 0;
|
||||
for(i=0;i<axis_x().bins();i++){
|
||||
for(j=0;j<axis_y().bins();j++){
|
||||
height_4 += bin_height(i,j);
|
||||
}
|
||||
}
|
||||
|
||||
a_out
|
||||
|
||||
a_out
|
||||
<< " " << height_6 << " " << height_7 << " " << height_8 << std::endl;
|
||||
a_out
|
||||
a_out
|
||||
<< " " << height_3 << " " << height_4 << " " << height_5 << std::endl;
|
||||
a_out
|
||||
a_out
|
||||
<< " " << height_0 << " " << height_1 << " " << height_2 << std::endl;
|
||||
|
||||
|
||||
// Some bins :
|
||||
bn_t xbins = axis_x().bins();
|
||||
bn_t ybins = axis_y().bins();
|
||||
a_out
|
||||
<< " * ENTRIES[0,0] = "
|
||||
<< bin_entries(0,0)
|
||||
<< " * HEIGHT[0,0] = "
|
||||
<< bin_height(0,0)
|
||||
<< " * ERROR[0,0] = "
|
||||
<< bin_error(0,0)
|
||||
a_out
|
||||
<< " * ENTRIES[0,0] = "
|
||||
<< bin_entries(0,0)
|
||||
<< " * HEIGHT[0,0] = "
|
||||
<< bin_height(0,0)
|
||||
<< " * ERROR[0,0] = "
|
||||
<< bin_error(0,0)
|
||||
<< std::endl;
|
||||
a_out
|
||||
<< " * ENTRIES[N/2,N/2] = "
|
||||
<< bin_entries(xbins/2,ybins/2)
|
||||
<< " * HEIGHT[N/2,N/2] = "
|
||||
a_out
|
||||
<< " * ENTRIES[N/2,N/2] = "
|
||||
<< bin_entries(xbins/2,ybins/2)
|
||||
<< " * HEIGHT[N/2,N/2] = "
|
||||
<< bin_height(xbins/2,ybins/2)
|
||||
<< " * ERROR[N/2,N/2] = "
|
||||
<< " * ERROR[N/2,N/2] = "
|
||||
<< bin_error(xbins/2,ybins/2)
|
||||
<< std::endl;
|
||||
a_out
|
||||
<< " * ENTRIES[N-1,N-1] = "
|
||||
<< bin_entries(xbins-1,ybins-1)
|
||||
<< " * HEIGHT[N-1,N-1] = "
|
||||
a_out
|
||||
<< " * ENTRIES[N-1,N-1] = "
|
||||
<< bin_entries(xbins-1,ybins-1)
|
||||
<< " * HEIGHT[N-1,N-1] = "
|
||||
<< bin_height(xbins-1,ybins-1)
|
||||
<< " * ERROR[N-1,N-1] = "
|
||||
<< " * ERROR[N-1,N-1] = "
|
||||
<< bin_error(xbins-1,ybins-1)
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ public:
|
||||
if(!parent::m_dimension) return 0;
|
||||
bn_t ibin;
|
||||
if(!parent::m_axes[0].in_range_to_absolute_index(aI,ibin)) return 0;
|
||||
bn_t jbin,kbin,offset;
|
||||
bn_t jbin,kbin,offset;
|
||||
bn_t ybins = parent::m_axes[1].bins()+2;
|
||||
bn_t zbins = parent::m_axes[2].bins()+2;
|
||||
TO yoffset = parent::m_axes[1].m_offset;
|
||||
@@ -302,9 +302,9 @@ public:
|
||||
void hprint(std::ostream& a_out) {
|
||||
// A la HPRINT.
|
||||
a_out << parent::dimension() << parent::title() << std::endl;
|
||||
a_out
|
||||
a_out
|
||||
<< " * ENTRIES = " << parent::all_entries() << std::endl;
|
||||
|
||||
|
||||
}
|
||||
public:
|
||||
b3(const std::string& a_title,
|
||||
|
||||
@@ -154,7 +154,7 @@ public:
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
TH max_bin_height() const {
|
||||
TH value = 0;
|
||||
bool first = true;
|
||||
@@ -189,7 +189,7 @@ public:
|
||||
a_value = value;
|
||||
return first?false:true; //return true if at least one bin with entries processed.
|
||||
}
|
||||
|
||||
|
||||
bool max_bin_height_with_entries(TH& a_value) const {
|
||||
TH value = 0;
|
||||
bool first = true;
|
||||
@@ -261,7 +261,7 @@ public: //histo_data
|
||||
a_sw2 += parent::m_bin_Sw2[ibin];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
TW get_all_Sw() const {
|
||||
TW sw = 0;
|
||||
@@ -314,12 +314,12 @@ protected:
|
||||
parent::m_in_range_Sw2 = 0;
|
||||
parent::m_in_range_Sxw.resize(a_dim,0);
|
||||
parent::m_in_range_Sx2w.resize(a_dim,0);
|
||||
|
||||
|
||||
// Some checks :
|
||||
if(!a_dim) return false;
|
||||
parent::m_axes.resize(a_dim);
|
||||
// Setup axes :
|
||||
for(dim_t iaxis=0;iaxis<a_dim;iaxis++) {
|
||||
for(dim_t iaxis=0;iaxis<a_dim;iaxis++) {
|
||||
if(!parent::m_axes[iaxis].configure(aNumbers[iaxis],aMins[iaxis],aMaxs[iaxis])) {
|
||||
// do not do :
|
||||
// m_axes.clear()
|
||||
@@ -330,7 +330,7 @@ protected:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
parent::m_dimension = a_dim;
|
||||
|
||||
base_allocate(); //set m_bin_number.
|
||||
@@ -364,13 +364,13 @@ protected:
|
||||
if(!a_dim) return false;
|
||||
parent::m_axes.resize(a_dim);
|
||||
// Setup axes :
|
||||
for(dim_t iaxis=0;iaxis<a_dim;iaxis++) {
|
||||
for(dim_t iaxis=0;iaxis<a_dim;iaxis++) {
|
||||
if(!parent::m_axes[iaxis].configure(a_edges[iaxis])) {
|
||||
//m_axes.clear();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
parent::m_dimension = a_dim;
|
||||
|
||||
base_allocate(); //set m_bin_number.
|
||||
@@ -411,14 +411,14 @@ protected:
|
||||
empty.resize(parent::m_dimension,0);
|
||||
parent::m_bin_Sxw.resize(n_bin,empty);
|
||||
parent::m_bin_Sx2w.resize(n_bin,empty);
|
||||
|
||||
|
||||
parent::m_bin_number = n_bin; // All bins : [in-range, underflow, outflow] bins.
|
||||
|
||||
|
||||
parent::m_axes[0].m_offset = 1;
|
||||
for(iaxis=1;iaxis<parent::m_dimension;iaxis++) {
|
||||
parent::m_axes[iaxis].m_offset = parent::m_axes[iaxis-1].m_offset * (parent::m_axes[iaxis-1].bins()+2);
|
||||
}
|
||||
|
||||
|
||||
parent::m_in_range_plane_Sxyw.resize(dim_planes(parent::m_dimension),0);
|
||||
}
|
||||
|
||||
@@ -459,7 +459,7 @@ public: //annotations :
|
||||
a_out << " * ANNOTATIONS :" << std::endl;
|
||||
annotations_t::const_iterator it;
|
||||
for(it=parent::m_annotations.begin();it!=parent::m_annotations.end();++it) {
|
||||
//out << " * (" << index << ") "
|
||||
//out << " * (" << index << ") "
|
||||
a_out << " * " << (*it).first << " = " << (*it).second << std::endl;
|
||||
}
|
||||
}
|
||||
@@ -510,14 +510,14 @@ protected:
|
||||
parent::update_fast_getters();
|
||||
}
|
||||
|
||||
bool base_multiply(const base_histo& a_histo) {
|
||||
bool base_multiply(const base_histo& a_histo) {
|
||||
//ill-defined operation. We keep that because of the "ill-defined past".
|
||||
|
||||
// We build a new histo with one entry in each bin of weight :
|
||||
// We build a new histo with one entry in each bin of weight :
|
||||
// this.w * a_histo.w
|
||||
// The current histo is overriden with this new histo.
|
||||
// The m_bin_Sw2 computation is consistent with FreeHEP and CERN-ROOT.
|
||||
|
||||
|
||||
if(!is_compatible(a_histo)) return false;
|
||||
|
||||
std::vector<int> is(parent::m_dimension);
|
||||
@@ -546,12 +546,12 @@ protected:
|
||||
|
||||
bool base_divide(const base_histo& a_histo) {
|
||||
//ill-defined operation. We keep that because of the "ill-defined past".
|
||||
|
||||
// We build a new histo with one entry in each bin of weight :
|
||||
|
||||
// We build a new histo with one entry in each bin of weight :
|
||||
// this.w / a_histo.w
|
||||
// The current histo is overriden with this new histo.
|
||||
// The m_bin_Sw2 computation is consistent with FreeHEP and ROOT.
|
||||
|
||||
|
||||
if(!is_compatible(a_histo)) return false;
|
||||
|
||||
std::vector<int> is(parent::m_dimension);
|
||||
|
||||
@@ -27,17 +27,17 @@ public:
|
||||
}
|
||||
|
||||
unsigned int dimension() const {return 1;}
|
||||
bool reset() {
|
||||
bool reset() {
|
||||
clear();
|
||||
delete m_histo;
|
||||
m_histo = 0;
|
||||
return true;
|
||||
}
|
||||
unsigned int entries() const {
|
||||
unsigned int entries() const {
|
||||
return m_histo ? m_histo->all_entries() : (unsigned int)m_ws.size();
|
||||
}
|
||||
public:
|
||||
double sum_of_weights() const {
|
||||
double sum_of_weights() const {
|
||||
return (m_histo ? m_histo->sum_bin_heights() : m_Sw);
|
||||
}
|
||||
|
||||
@@ -73,11 +73,11 @@ public:
|
||||
|
||||
public:
|
||||
bool fill(double aX,double aW = 1){
|
||||
if(!m_histo && (m_limit!=UNLIMITED()) &&
|
||||
if(!m_histo && (m_limit!=UNLIMITED()) &&
|
||||
((int)m_xs.size()>=m_limit)){
|
||||
convert_to_histogram();
|
||||
}
|
||||
|
||||
|
||||
if(m_histo) {
|
||||
return m_histo->fill(aX,aW);
|
||||
} else {
|
||||
@@ -98,10 +98,10 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
double lower_edge() const {
|
||||
double lower_edge() const {
|
||||
return (m_histo ? m_histo->axis().lower_edge() : m_lower_x);
|
||||
}
|
||||
double upper_edge() const {
|
||||
double upper_edge() const {
|
||||
return (m_histo ? m_histo->axis().upper_edge() : m_upper_x);
|
||||
}
|
||||
double value(unsigned int a_index) const {return (m_histo ?0:m_xs[a_index]);}
|
||||
@@ -168,7 +168,7 @@ public:
|
||||
,m_Sxw(0),m_Sx2w(0)
|
||||
,m_cnv_x_num(0),m_cnv_x_min(0),m_cnv_x_max(0),m_histo(0)
|
||||
{}
|
||||
|
||||
|
||||
c1d(const std::string& a_title,int aLimit = base_cloud::UNLIMITED())
|
||||
:base_cloud(aLimit)
|
||||
,m_lower_x(0),m_upper_x(0)
|
||||
|
||||
@@ -210,10 +210,10 @@ void c2d::clear(){
|
||||
}
|
||||
|
||||
inline
|
||||
bool c2d::convert(
|
||||
bool c2d::convert(
|
||||
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_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(),
|
||||
a_bins_x,a_lower_edge_x,a_upper_edge_x,
|
||||
@@ -263,7 +263,7 @@ bool c2d::scale(double a_scale) {
|
||||
}
|
||||
|
||||
inline
|
||||
bool c2d::reset() {
|
||||
bool c2d::reset() {
|
||||
clear();
|
||||
delete m_histo;
|
||||
m_histo = 0;
|
||||
@@ -286,7 +286,7 @@ bool c2d::fill(double aX,double aY,double aW){
|
||||
m_lower_x = aX;
|
||||
m_upper_x = aX;
|
||||
}
|
||||
if(m_ys.size()) {
|
||||
if(m_ys.size()) {
|
||||
m_lower_y = mn<double>(aY,m_lower_y);
|
||||
m_upper_y = mx<double>(aY,m_upper_y);
|
||||
} else {
|
||||
@@ -300,7 +300,7 @@ bool c2d::fill(double aX,double aY,double aW){
|
||||
double xw = aX * aW;
|
||||
m_Sxw += xw;
|
||||
m_Sx2w += aX * xw;
|
||||
double yw = aY * aW;
|
||||
double yw = aY * aW;
|
||||
m_Syw += yw;
|
||||
m_Sy2w += aY * yw;
|
||||
return true;
|
||||
@@ -308,7 +308,7 @@ bool c2d::fill(double aX,double aY,double aW){
|
||||
}
|
||||
|
||||
inline
|
||||
bool c2d::convert(const std::vector<double>& a_edges_x,const std::vector<double>& a_edges_y) {
|
||||
bool c2d::convert(const std::vector<double>& a_edges_x,const std::vector<double>& a_edges_y) {
|
||||
if(m_histo) return true;
|
||||
m_histo = new histo::h2d(base_cloud::title(),
|
||||
a_edges_x,a_edges_y);
|
||||
@@ -333,7 +333,7 @@ bool c2d::set_conversion_parameters(
|
||||
}
|
||||
|
||||
inline
|
||||
const h2d& c2d::histogram() const {
|
||||
const h2d& c2d::histogram() const {
|
||||
if(!m_histo) const_cast<c2d&>(*this).convert_to_histogram();
|
||||
return *m_histo;
|
||||
}
|
||||
|
||||
@@ -260,11 +260,11 @@ void c3d::clear(){
|
||||
}
|
||||
|
||||
inline
|
||||
bool c3d::convert(
|
||||
bool c3d::convert(
|
||||
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
|
||||
) {
|
||||
,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(),
|
||||
a_bins_x,a_lower_edge_x,a_upper_edge_x,
|
||||
@@ -339,13 +339,13 @@ bool c3d::set_conversion_parameters(
|
||||
|
||||
|
||||
inline
|
||||
const h3d& c3d::histogram() const {
|
||||
const h3d& c3d::histogram() const {
|
||||
if(!m_histo) const_cast<c3d&>(*this).convert_to_histogram();
|
||||
return *m_histo;
|
||||
}
|
||||
|
||||
inline
|
||||
bool c3d::reset() {
|
||||
bool c3d::reset() {
|
||||
clear();
|
||||
delete m_histo;
|
||||
m_histo = 0;
|
||||
@@ -368,14 +368,14 @@ bool c3d::fill(double aX,double aY,double aZ,double aW){
|
||||
m_lower_x = aX;
|
||||
m_upper_x = aX;
|
||||
}
|
||||
if(m_ys.size()) {
|
||||
if(m_ys.size()) {
|
||||
m_lower_y = mn<double>(aY,m_lower_y);
|
||||
m_upper_y = mx<double>(aY,m_upper_y);
|
||||
} else {
|
||||
m_lower_y = aY;
|
||||
m_upper_y = aY;
|
||||
}
|
||||
if(m_zs.size()) {
|
||||
if(m_zs.size()) {
|
||||
m_lower_z = mn<double>(aZ,m_lower_z);
|
||||
m_upper_z = mx<double>(aZ,m_upper_z);
|
||||
} else {
|
||||
@@ -390,7 +390,7 @@ bool c3d::fill(double aX,double aY,double aZ,double aW){
|
||||
double xw = aX * aW;
|
||||
m_Sxw += xw;
|
||||
m_Sx2w += aX * xw;
|
||||
double yw = aY * aW;
|
||||
double yw = aY * aW;
|
||||
m_Syw += yw;
|
||||
m_Sy2w += aY * yw;
|
||||
double zw = aZ * aW;
|
||||
@@ -401,11 +401,11 @@ bool c3d::fill(double aX,double aY,double aZ,double aW){
|
||||
}
|
||||
|
||||
inline
|
||||
bool c3d::convert(
|
||||
bool c3d::convert(
|
||||
const std::vector<double>& a_edges_x
|
||||
,const std::vector<double>& a_edges_y
|
||||
,const std::vector<double>& a_edges_z
|
||||
) {
|
||||
) {
|
||||
if(m_histo) return true;
|
||||
m_histo = new histo::h3d(base_cloud::title(),
|
||||
a_edges_x,a_edges_y,a_edges_z);
|
||||
@@ -416,53 +416,53 @@ bool c3d::convert(
|
||||
}
|
||||
|
||||
inline
|
||||
double c3d::sum_of_weights() const {
|
||||
double c3d::sum_of_weights() const {
|
||||
return (m_histo ? m_histo->sum_bin_heights() : m_Sw);
|
||||
}
|
||||
|
||||
inline
|
||||
unsigned int c3d::entries() const {
|
||||
unsigned int c3d::entries() const {
|
||||
return m_histo ? m_histo->all_entries() : (unsigned int)m_ws.size();
|
||||
}
|
||||
|
||||
inline
|
||||
double c3d::lower_edge_x() const {
|
||||
double c3d::lower_edge_x() const {
|
||||
return m_histo ? m_histo->axis_x().lower_edge() : m_lower_x;
|
||||
}
|
||||
inline
|
||||
double c3d::lower_edge_y() const {
|
||||
double c3d::lower_edge_y() const {
|
||||
return m_histo ? m_histo->axis_y().lower_edge() : m_lower_y;
|
||||
}
|
||||
inline
|
||||
double c3d::lower_edge_z() const {
|
||||
double c3d::lower_edge_z() const {
|
||||
return m_histo ? m_histo->axis_z().lower_edge() : m_lower_z;
|
||||
}
|
||||
inline
|
||||
double c3d::upper_edge_x() const {
|
||||
double c3d::upper_edge_x() const {
|
||||
return m_histo ? m_histo->axis_x().upper_edge() : m_upper_x;
|
||||
}
|
||||
inline
|
||||
double c3d::upper_edge_y() const {
|
||||
double c3d::upper_edge_y() const {
|
||||
return m_histo ? m_histo->axis_y().upper_edge() : m_upper_y;
|
||||
}
|
||||
inline
|
||||
double c3d::upper_edge_z() const {
|
||||
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 a_index) const {
|
||||
double c3d::value_x(unsigned int a_index) const {
|
||||
return m_histo ? 0 : m_xs[a_index];
|
||||
}
|
||||
inline
|
||||
double c3d::value_y(unsigned int a_index) const {
|
||||
double c3d::value_y(unsigned int a_index) const {
|
||||
return m_histo ? 0 : m_ys[a_index];
|
||||
}
|
||||
inline
|
||||
double c3d::value_z(unsigned int a_index) const {
|
||||
double c3d::value_z(unsigned int a_index) const {
|
||||
return m_histo ? 0 : m_zs[a_index];
|
||||
}
|
||||
inline
|
||||
double c3d::weight(unsigned int a_index) const {
|
||||
double c3d::weight(unsigned int a_index) const {
|
||||
return m_histo ? 0 : m_ws[a_index];
|
||||
}
|
||||
inline
|
||||
|
||||
@@ -152,21 +152,21 @@ public:
|
||||
void clear() {m_points.clear();}
|
||||
size_t size() const {return m_points.size();}
|
||||
|
||||
const data_point& point(size_t a_index) const {
|
||||
const data_point& point(size_t a_index) const {
|
||||
//WARNING : no check done on a_index.
|
||||
return m_points[a_index];
|
||||
}
|
||||
data_point& point(size_t a_index) {
|
||||
data_point& point(size_t a_index) {
|
||||
//WARNING : no check done on a_index.
|
||||
return m_points[a_index];
|
||||
}
|
||||
|
||||
data_point& add_point() {
|
||||
data_point& add_point() {
|
||||
m_points.push_back(data_point(m_dim));
|
||||
return m_points.back();
|
||||
}
|
||||
|
||||
bool remove_point(size_t a_index) {
|
||||
bool remove_point(size_t a_index) {
|
||||
bool done = false;
|
||||
if(a_index<m_points.size()){
|
||||
std::vector<data_point>::iterator it = m_points.begin();
|
||||
@@ -177,7 +177,7 @@ public:
|
||||
return done;
|
||||
}
|
||||
|
||||
bool lower_extent(unsigned int a_coord,double& a_value) const {
|
||||
bool lower_extent(unsigned int a_coord,double& a_value) const {
|
||||
if(m_points.empty()||(a_coord>=m_dim)){
|
||||
a_value = 0;
|
||||
return false;
|
||||
@@ -190,8 +190,8 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool upper_extent(unsigned int a_coord,double& a_value) const {
|
||||
|
||||
bool upper_extent(unsigned int a_coord,double& a_value) const {
|
||||
if(m_points.empty()||(a_coord>=m_dim)){
|
||||
a_value = 0;
|
||||
return false;
|
||||
@@ -204,8 +204,8 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void scale(double a_scale) {
|
||||
|
||||
void scale(double a_scale) {
|
||||
std::vector<data_point>::iterator it;
|
||||
for(it=m_points.begin();it!=m_points.end();++it) {
|
||||
for(unsigned int coord=0;coord<m_dim;coord++) {
|
||||
@@ -217,7 +217,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void scale_value(double a_scale) {
|
||||
void scale_value(double a_scale) {
|
||||
std::vector<data_point>::iterator it;
|
||||
for(it=m_points.begin();it!=m_points.end();++it) {
|
||||
for(unsigned int coord=0;coord<m_dim;coord++) {
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void scale_errors(double a_scale) {
|
||||
void scale_errors(double a_scale) {
|
||||
std::vector<data_point>::iterator it;
|
||||
for(it=m_points.begin();it!=m_points.end();++it) {
|
||||
for(unsigned int coord=0;coord<m_dim;coord++) {
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
parent::m_bin_entries[offset]++;
|
||||
parent::m_bin_Sw[offset] += aWeight;
|
||||
parent::m_bin_Sw2[offset] += aWeight * aWeight;
|
||||
|
||||
|
||||
TC xw = aX * aWeight;
|
||||
TC x2w = aX * xw;
|
||||
parent::m_bin_Sxw[offset][0] += xw;
|
||||
@@ -150,10 +150,10 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool multiply(const h1& a_histo) {
|
||||
bool multiply(const h1& a_histo) {
|
||||
return parent::base_multiply(a_histo);
|
||||
}
|
||||
|
||||
|
||||
bool divide(const h1& a_histo) {
|
||||
return parent::base_divide(a_histo);
|
||||
}
|
||||
@@ -162,7 +162,7 @@ public:
|
||||
if(!a_factor) return false;
|
||||
|
||||
// actual bin number must be a multiple of a_factor.
|
||||
|
||||
|
||||
const axis_t& _axis = parent::axis();
|
||||
|
||||
bn_t n = _axis.bins();
|
||||
@@ -220,14 +220,14 @@ public:
|
||||
*this = *new_h;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool equals_TH(const h1& a_from,const TW& a_prec,TW(*a_fabs)(TW)) const {
|
||||
if(!parent::equals_TH(a_from,a_prec,a_fabs,true)) return false;
|
||||
if(!parent::equals_TH(a_from,a_prec,a_fabs,true)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void not_a_profile() const {}
|
||||
|
||||
|
||||
public: //CERN-ROOT API (for MEMPHYS sim).
|
||||
bool Fill(TC aX,TW aWeight = 1) {return fill(aX,aWeight);}
|
||||
|
||||
|
||||
@@ -41,33 +41,33 @@ public:
|
||||
|
||||
bool fill(TC aX,TC aY,TW aWeight = 1) {
|
||||
if(parent::m_dimension!=2) return false;
|
||||
|
||||
|
||||
bn_t ibin,jbin;
|
||||
if(!parent::m_axes[0].coord_to_absolute_index(aX,ibin)) return false;
|
||||
if(!parent::m_axes[1].coord_to_absolute_index(aY,jbin)) return false;
|
||||
TO offset = ibin + jbin * parent::m_axes[1].m_offset;
|
||||
|
||||
|
||||
parent::m_bin_entries[offset]++;
|
||||
parent::m_bin_Sw[offset] += aWeight;
|
||||
parent::m_bin_Sw2[offset] += aWeight * aWeight;
|
||||
|
||||
|
||||
TC xw = aX * aWeight;
|
||||
TC x2w = aX * xw;
|
||||
parent::m_bin_Sxw[offset][0] += xw;
|
||||
parent::m_bin_Sx2w[offset][0] += x2w;
|
||||
|
||||
|
||||
TC yw = aY * aWeight;
|
||||
TC y2w = aY * yw;
|
||||
parent::m_bin_Sxw[offset][1] += yw;
|
||||
parent::m_bin_Sx2w[offset][1] += y2w;
|
||||
|
||||
|
||||
bool inRange = true;
|
||||
if(ibin==0) inRange = false;
|
||||
else if(ibin==(parent::m_axes[0].m_number_of_bins+1)) inRange = false;
|
||||
|
||||
|
||||
if(jbin==0) inRange = false;
|
||||
else if(jbin==(parent::m_axes[1].m_number_of_bins+1)) inRange = false;
|
||||
|
||||
|
||||
parent::m_all_entries++;
|
||||
if(inRange) {
|
||||
parent::m_in_range_plane_Sxyw[0] += aX * aY * aWeight;
|
||||
@@ -76,17 +76,17 @@ public:
|
||||
parent::m_in_range_entries++;
|
||||
parent::m_in_range_Sw += aWeight;
|
||||
parent::m_in_range_Sw2 += aWeight*aWeight;
|
||||
|
||||
|
||||
parent::m_in_range_Sxw[0] += xw;
|
||||
parent::m_in_range_Sx2w[0] += x2w;
|
||||
|
||||
parent::m_in_range_Sxw[1] += yw;
|
||||
parent::m_in_range_Sx2w[1] += y2w;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool set_bin_content(bn_t a_ibin,bn_t a_jbin,
|
||||
TN a_entries,TW a_Sw,TW a_Sw2,
|
||||
TC a_Sxw,TC a_Sx2w,TC a_Syw,TC a_Sy2w) {
|
||||
@@ -171,7 +171,7 @@ public:
|
||||
a_Sx2w = parent::m_bin_Sx2w[offset][0];
|
||||
a_Syw = parent::m_bin_Sxw[offset][1];
|
||||
a_Sy2w = parent::m_bin_Sx2w[offset][1];
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -184,24 +184,24 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool multiply(const h2& a_histo) {
|
||||
bool multiply(const h2& a_histo) {
|
||||
return parent::base_multiply(a_histo);
|
||||
}
|
||||
|
||||
|
||||
bool divide(const h2& a_histo) {
|
||||
return parent::base_divide(a_histo);
|
||||
}
|
||||
|
||||
bool equals_TH(const h2& a_from,const TW& a_prec,TW(*a_fabs)(TW)) const {
|
||||
if(!parent::equals_TH(a_from,a_prec,a_fabs,true)) return false;
|
||||
if(!parent::equals_TH(a_from,a_prec,a_fabs,true)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void not_a_profile() const {}
|
||||
|
||||
|
||||
public: //CERN-ROOT API
|
||||
bool Fill(TC aX,TC aY,TW aWeight = 1) {return fill(aX,aY,aWeight);}
|
||||
|
||||
|
||||
public:
|
||||
h2(const std::string& a_title,bn_t aXnumber,TC aXmin,TC aXmax,bn_t aYnumber,TC aYmin,TC aYmax)
|
||||
:parent(a_title,aXnumber,aXmin,aXmax,aYnumber,aYmin,aYmax)
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
const std::string& s_cls() const {return s_class();}
|
||||
public:
|
||||
h2d():parent("",10,0,1,10,0,1){} //for I/O when reading.
|
||||
|
||||
|
||||
h2d(const std::string& a_title,
|
||||
unsigned int aXnumber,double aXmin,double aXmax,
|
||||
unsigned int aYnumber,double aYmin,double aYmax)
|
||||
|
||||
@@ -41,42 +41,42 @@ public:
|
||||
|
||||
bool fill(TC aX,TC aY,TC aZ,TW aWeight = 1) {
|
||||
if(parent::m_dimension!=3) return false;
|
||||
|
||||
|
||||
bn_t ibin,jbin,kbin;
|
||||
if(!parent::m_axes[0].coord_to_absolute_index(aX,ibin)) return false;
|
||||
if(!parent::m_axes[1].coord_to_absolute_index(aY,jbin)) return false;
|
||||
if(!parent::m_axes[2].coord_to_absolute_index(aZ,kbin)) return false;
|
||||
TO offset = ibin + jbin * parent::m_axes[1].m_offset + kbin * parent::m_axes[2].m_offset;
|
||||
|
||||
|
||||
parent::m_bin_entries[offset]++;
|
||||
parent::m_bin_Sw[offset] += aWeight;
|
||||
parent::m_bin_Sw2[offset] += aWeight * aWeight;
|
||||
|
||||
|
||||
TC xw = aX * aWeight;
|
||||
TC x2w = aX * xw;
|
||||
parent::m_bin_Sxw[offset][0] += xw;
|
||||
parent::m_bin_Sx2w[offset][0] += x2w;
|
||||
|
||||
|
||||
TC yw = aY * aWeight;
|
||||
TC y2w = aY * yw;
|
||||
parent::m_bin_Sxw[offset][1] += yw;
|
||||
parent::m_bin_Sx2w[offset][1] += y2w;
|
||||
|
||||
|
||||
TC zw = aZ * aWeight;
|
||||
TC z2w = aZ * zw;
|
||||
parent::m_bin_Sxw[offset][2] += zw;
|
||||
parent::m_bin_Sx2w[offset][2] += z2w;
|
||||
|
||||
|
||||
bool inRange = true;
|
||||
if(ibin==0) inRange = false;
|
||||
else if(ibin==(parent::m_axes[0].m_number_of_bins+1)) inRange = false;
|
||||
|
||||
|
||||
if(jbin==0) inRange = false;
|
||||
else if(jbin==(parent::m_axes[1].m_number_of_bins+1)) inRange = false;
|
||||
|
||||
|
||||
if(kbin==0) inRange = false;
|
||||
else if(kbin==(parent::m_axes[2].m_number_of_bins+1)) inRange = false;
|
||||
|
||||
|
||||
parent::m_all_entries++;
|
||||
if(inRange) {
|
||||
parent::m_in_range_plane_Sxyw[0] += aX * aY * aWeight;
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
parent::m_in_range_entries++;
|
||||
parent::m_in_range_Sw += aWeight;
|
||||
parent::m_in_range_Sw2 += aWeight*aWeight;
|
||||
|
||||
|
||||
parent::m_in_range_Sxw[0] += xw;
|
||||
parent::m_in_range_Sx2w[0] += x2w;
|
||||
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
parent::m_in_range_Sxw[2] += zw;
|
||||
parent::m_in_range_Sx2w[2] += z2w;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -219,24 +219,24 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool multiply(const h3& a_histo) {
|
||||
bool multiply(const h3& a_histo) {
|
||||
return parent::base_multiply(a_histo);
|
||||
}
|
||||
|
||||
|
||||
bool divide(const h3& a_histo) {
|
||||
return parent::base_divide(a_histo);
|
||||
}
|
||||
|
||||
bool equals_TH(const h3& a_from,const TW& a_prec,TW(*a_fabs)(TW)) const {
|
||||
if(!parent::equals_TH(a_from,a_prec,a_fabs,true)) return false;
|
||||
if(!parent::equals_TH(a_from,a_prec,a_fabs,true)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void not_a_profile() const {}
|
||||
|
||||
public: //CERN-ROOT API
|
||||
bool Fill(TC aX,TC aY,TC aZ,TW aWeight = 1) {return fill(aX,aY,aZ,aWeight);}
|
||||
|
||||
|
||||
public:
|
||||
/*
|
||||
// Slices :
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
const std::string& s_cls() const {return s_class();}
|
||||
public:
|
||||
h3d():parent("",10,0,1,10,0,1,10,0,1){} //for I/O when reading.
|
||||
|
||||
|
||||
h3d(const std::string& a_title,
|
||||
unsigned int aXnumber,double aXmin,double aXmax,
|
||||
unsigned int aYnumber,double aYmin,double aYmax,
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
const std::string& s_cls() const {return s_class();}
|
||||
public:
|
||||
h3df():parent("",10,0,1,10,0,1,10,0,1){} //for I/O when reading.
|
||||
|
||||
|
||||
h3df(const std::string& a_title,
|
||||
unsigned int aXnumber,float aXmin,float aXmax,
|
||||
unsigned int aYnumber,float aYmin,float aYmax,
|
||||
|
||||
@@ -130,15 +130,15 @@ public:
|
||||
if(m_axes!=a_from.m_axes) return false;
|
||||
if(!vectors_are_equal(m_in_range_plane_Sxyw,a_from.m_in_range_plane_Sxyw,a_prec,a_fabs)) return false;
|
||||
if(m_annotations!=a_from.m_annotations) return false;
|
||||
|
||||
|
||||
if(m_all_entries!=a_from.m_all_entries) return false;
|
||||
if(m_in_range_entries!=a_from.m_in_range_entries) return false;
|
||||
|
||||
|
||||
if(!numbers_are_equal(m_in_range_Sw,a_from.m_in_range_Sw,a_prec,a_fabs)) return false;
|
||||
if(!numbers_are_equal(m_in_range_Sw2,a_from.m_in_range_Sw2,a_prec,a_fabs)) return false;
|
||||
if(!vectors_are_equal(m_in_range_Sxw,a_from.m_in_range_Sxw,a_prec,a_fabs)) return false;
|
||||
if(!vectors_are_equal(m_in_range_Sx2w,a_from.m_in_range_Sx2w,a_prec,a_fabs)) return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
bool equals_TH(const histo_data& a_from,const TW& a_prec,TW(*a_fabs)(TW),bool a_cmp_bin_Sw2) const {
|
||||
@@ -155,10 +155,10 @@ public:
|
||||
if(m_axes!=a_from.m_axes) return false;
|
||||
if(!vectors_are_equal(m_in_range_plane_Sxyw,a_from.m_in_range_plane_Sxyw,a_prec,a_fabs)) return false;
|
||||
//if(m_annotations!=a_from.m_annotations) return false;
|
||||
|
||||
|
||||
if(m_all_entries!=a_from.m_all_entries) return false;
|
||||
//if(m_in_range_entries!=a_from.m_in_range_entries) return false;
|
||||
|
||||
|
||||
if(!numbers_are_equal(m_in_range_Sw,a_from.m_in_range_Sw,a_prec,a_fabs)) return false;
|
||||
if(!numbers_are_equal(m_in_range_Sw2,a_from.m_in_range_Sw2,a_prec,a_fabs)) return false;
|
||||
//if(!vectors_are_equal(m_in_range_Sxw,a_from.m_in_range_Sxw,a_prec,a_fabs)) return false;
|
||||
|
||||
@@ -255,7 +255,7 @@ inline void histo_data_duiuid_assign(histo_data<double,unsigned int,unsigned int
|
||||
{a_hd.m_annotations.clear();
|
||||
for(unsigned int i=0;i<a_c.m_number_of_annotations;i++) {
|
||||
a_hd.m_annotations[a_c.m_annotations[2*i+0]] = a_c.m_annotations[2*i+1];
|
||||
}}
|
||||
}}
|
||||
|
||||
a_hd.m_all_entries = a_c.m_all_entries;
|
||||
a_hd.m_in_range_entries = a_c.m_in_range_entries;
|
||||
|
||||
@@ -31,19 +31,19 @@ protected:
|
||||
}
|
||||
public:
|
||||
bool equals(const p1& a_from,const TW& a_prec,TW(*a_fabs)(TW)) const {
|
||||
if(!parent::equals(a_from,a_prec,a_fabs)) return false;
|
||||
if(!parent::equals(a_from,a_prec,a_fabs)) return false;
|
||||
if(m_cut_v!=a_from.m_cut_v) return false;
|
||||
if(!numbers_are_equal(m_min_v,a_from.m_min_v,a_prec,a_fabs)) return false;
|
||||
if(!numbers_are_equal(m_max_v,a_from.m_max_v,a_prec,a_fabs)) return false;
|
||||
if(!numbers_are_equal(m_max_v,a_from.m_max_v,a_prec,a_fabs)) return false;
|
||||
if(!vectors_are_equal(m_bin_Svw,a_from.m_bin_Svw,a_prec,a_fabs)) return false;
|
||||
if(!vectors_are_equal(m_bin_Sv2w,a_from.m_bin_Sv2w,a_prec,a_fabs)) return false;
|
||||
return true;
|
||||
}
|
||||
bool equals_TH(const p1& a_from,const TW& a_prec,TW(*a_fabs)(TW)) const {
|
||||
if(!parent::equals_TH(a_from,a_prec,a_fabs,false)) return false;
|
||||
if(!parent::equals_TH(a_from,a_prec,a_fabs,false)) return false;
|
||||
if(m_cut_v!=a_from.m_cut_v) return false;
|
||||
if(!numbers_are_equal(m_min_v,a_from.m_min_v,a_prec,a_fabs)) return false;
|
||||
if(!numbers_are_equal(m_max_v,a_from.m_max_v,a_prec,a_fabs)) return false;
|
||||
if(!numbers_are_equal(m_max_v,a_from.m_max_v,a_prec,a_fabs)) return false;
|
||||
if(!vectors_are_equal(m_bin_Svw,a_from.m_bin_Svw,a_prec,a_fabs)) return false;
|
||||
if(!vectors_are_equal(m_bin_Sv2w,a_from.m_bin_Sv2w,a_prec,a_fabs)) return false;
|
||||
return true;
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
// Stat_t contsum = cont/sum;
|
||||
// Stat_t eprim2 = TMath::Abs(err2/sum - contsum*contsum);
|
||||
// eprim = TMath::Sqrt(eprim2);
|
||||
// ... ???
|
||||
// ... ???
|
||||
// if (fErrorMode == kERRORMEAN) return eprim/TMath::Sqrt(sum);
|
||||
|
||||
TW sw = parent::m_bin_Sw[offset]; //ROOT sum
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
parent::m_bin_entries[offset]++;
|
||||
parent::m_bin_Sw[offset] += aWeight;
|
||||
parent::m_bin_Sw2[offset] += aWeight * aWeight;
|
||||
|
||||
|
||||
TC xw = aX * aWeight;
|
||||
TC x2w = aX * xw;
|
||||
parent::m_bin_Sxw[offset][0] += xw;
|
||||
@@ -209,7 +209,7 @@ public:
|
||||
// Profile part :
|
||||
m_bin_Svw[offset] = a_Svw;
|
||||
m_bin_Sv2w[offset] = a_Sv2w;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ public:
|
||||
// Profile part :
|
||||
a_Svw = m_bin_Svw[offset];
|
||||
a_Sv2w = m_bin_Sv2w[offset];
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -253,16 +253,16 @@ public:
|
||||
bool add(const p1& a_histo){
|
||||
parent::base_add(a_histo);
|
||||
for(bn_t ibin=0;ibin<parent::m_bin_number;ibin++) {
|
||||
m_bin_Svw[ibin] += a_histo.m_bin_Svw[ibin];
|
||||
m_bin_Sv2w[ibin] += a_histo.m_bin_Sv2w[ibin];
|
||||
m_bin_Svw[ibin] += a_histo.m_bin_Svw[ibin];
|
||||
m_bin_Sv2w[ibin] += a_histo.m_bin_Sv2w[ibin];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool subtract(const p1& a_histo){
|
||||
parent::base_subtract(a_histo);
|
||||
for(bn_t ibin=0;ibin<parent::m_bin_number;ibin++) {
|
||||
m_bin_Svw[ibin] -= a_histo.m_bin_Svw[ibin];
|
||||
m_bin_Sv2w[ibin] -= a_histo.m_bin_Sv2w[ibin];
|
||||
m_bin_Svw[ibin] -= a_histo.m_bin_Svw[ibin];
|
||||
m_bin_Sv2w[ibin] -= a_histo.m_bin_Sv2w[ibin];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -271,7 +271,7 @@ public:
|
||||
if(!a_factor) return false;
|
||||
|
||||
// actual bin number must be a multiple of a_factor.
|
||||
|
||||
|
||||
const axis_t& _axis = parent::axis();
|
||||
|
||||
bn_t n = _axis.bins();
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
{}
|
||||
|
||||
p1d(const std::string& a_title,const std::vector<double>& a_edges,double aVmin,double aVmax)
|
||||
:parent(a_title,a_edges,aVmin,aVmax)
|
||||
:parent(a_title,a_edges,aVmin,aVmax)
|
||||
{}
|
||||
|
||||
virtual ~p1d(){}
|
||||
|
||||
@@ -23,19 +23,19 @@ protected:
|
||||
}
|
||||
public:
|
||||
bool equals(const p2& a_from,const TW& a_prec,TW(*a_fabs)(TW)) const {
|
||||
if(!parent::equals(a_from,a_prec,a_fabs)) return false;
|
||||
if(!parent::equals(a_from,a_prec,a_fabs)) return false;
|
||||
if(m_cut_v!=a_from.m_cut_v) return false;
|
||||
if(!numbers_are_equal(m_min_v,a_from.m_min_v,a_prec,a_fabs)) return false;
|
||||
if(!numbers_are_equal(m_max_v,a_from.m_max_v,a_prec,a_fabs)) return false;
|
||||
if(!numbers_are_equal(m_max_v,a_from.m_max_v,a_prec,a_fabs)) return false;
|
||||
if(!vectors_are_equal(m_bin_Svw,a_from.m_bin_Svw,a_prec,a_fabs)) return false;
|
||||
if(!vectors_are_equal(m_bin_Sv2w,a_from.m_bin_Sv2w,a_prec,a_fabs)) return false;
|
||||
return true;
|
||||
}
|
||||
bool equals_TH(const p2& a_from,const TW& a_prec,TW(*a_fabs)(TW)) const {
|
||||
if(!parent::equals_TH(a_from,a_prec,a_fabs,false)) return false;
|
||||
if(!parent::equals_TH(a_from,a_prec,a_fabs,false)) return false;
|
||||
if(m_cut_v!=a_from.m_cut_v) return false;
|
||||
if(!numbers_are_equal(m_min_v,a_from.m_min_v,a_prec,a_fabs)) return false;
|
||||
if(!numbers_are_equal(m_max_v,a_from.m_max_v,a_prec,a_fabs)) return false;
|
||||
if(!numbers_are_equal(m_max_v,a_from.m_max_v,a_prec,a_fabs)) return false;
|
||||
if(!vectors_are_equal(m_bin_Svw,a_from.m_bin_Svw,a_prec,a_fabs)) return false;
|
||||
if(!vectors_are_equal(m_bin_Sv2w,a_from.m_bin_Sv2w,a_prec,a_fabs)) return false;
|
||||
return true;
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
virtual TH bin_error(int aI,int aJ) const { //TH should be the same as TV
|
||||
TO offset;
|
||||
if(!parent::_find_offset(aI,aJ,offset)) return 0;
|
||||
|
||||
|
||||
//FIXME Is it correct ?
|
||||
// TProfile::GetBinError with kERRORMEAN mode does :
|
||||
// Stat_t cont = fArray[bin]; //Svw (see TProfile::Fill)
|
||||
@@ -55,9 +55,9 @@ public:
|
||||
// Stat_t contsum = cont/sum;
|
||||
// Stat_t eprim2 = TMath::Abs(err2/sum - contsum*contsum);
|
||||
// eprim = TMath::Sqrt(eprim2);
|
||||
// ... ???
|
||||
// ... ???
|
||||
// if (fErrorMode == kERRORMEAN) return eprim/TMath::Sqrt(sum);
|
||||
|
||||
|
||||
TW sw = parent::m_bin_Sw[offset]; //ROOT sum
|
||||
if(sw==0) return 0;
|
||||
TV svw = m_bin_Svw[offset]; //ROOT cont
|
||||
@@ -125,33 +125,33 @@ public:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bn_t ibin,jbin;
|
||||
if(!parent::m_axes[0].coord_to_absolute_index(aX,ibin)) return false;
|
||||
if(!parent::m_axes[1].coord_to_absolute_index(aY,jbin)) return false;
|
||||
bn_t offset = ibin + jbin * parent::m_axes[1].m_offset;
|
||||
|
||||
|
||||
parent::m_bin_entries[offset]++;
|
||||
parent::m_bin_Sw[offset] += aWeight;
|
||||
parent::m_bin_Sw2[offset] += aWeight * aWeight;
|
||||
|
||||
|
||||
TC xw = aX * aWeight;
|
||||
TC x2w = aX * xw;
|
||||
parent::m_bin_Sxw[offset][0] += xw;
|
||||
parent::m_bin_Sx2w[offset][0] += x2w;
|
||||
|
||||
|
||||
TC yw = aY * aWeight;
|
||||
TC y2w = aY * yw;
|
||||
parent::m_bin_Sxw[offset][1] += yw;
|
||||
parent::m_bin_Sx2w[offset][1] += y2w;
|
||||
|
||||
|
||||
bool inRange = true;
|
||||
if(ibin==0) inRange = false;
|
||||
else if(ibin==(parent::m_axes[0].m_number_of_bins+1)) inRange = false;
|
||||
|
||||
|
||||
if(jbin==0) inRange = false;
|
||||
else if(jbin==(parent::m_axes[1].m_number_of_bins+1)) inRange = false;
|
||||
|
||||
|
||||
parent::m_all_entries++;
|
||||
if(inRange) {
|
||||
parent::m_in_range_plane_Sxyw[0] += aX * aY * aWeight;
|
||||
@@ -160,26 +160,26 @@ public:
|
||||
parent::m_in_range_entries++;
|
||||
parent::m_in_range_Sw += aWeight;
|
||||
parent::m_in_range_Sw2 += aWeight*aWeight;
|
||||
|
||||
|
||||
parent::m_in_range_Sxw[0] += xw;
|
||||
parent::m_in_range_Sx2w[0] += x2w;
|
||||
|
||||
parent::m_in_range_Sxw[1] += yw;
|
||||
parent::m_in_range_Sx2w[1] += y2w;
|
||||
}
|
||||
|
||||
|
||||
// Profile part :
|
||||
TV vw = aV * aWeight;
|
||||
m_bin_Svw[offset] += vw;
|
||||
m_bin_Sv2w[offset] += aV * vw;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
TV bin_rms_value(int aI,int aJ) const {
|
||||
TO offset;
|
||||
if(!parent::_find_offset(aI,aJ,offset)) return 0;
|
||||
|
||||
|
||||
TW sw = parent::m_bin_Sw[offset];
|
||||
if(sw==0) return 0;
|
||||
TV svw = m_bin_Svw[offset];
|
||||
@@ -191,16 +191,16 @@ public:
|
||||
bool add(const p2& a_histo){
|
||||
parent::base_add(a_histo);
|
||||
for(bn_t ibin=0;ibin<parent::m_bin_number;ibin++) {
|
||||
m_bin_Svw[ibin] += a_histo.m_bin_Svw[ibin];
|
||||
m_bin_Sv2w[ibin] += a_histo.m_bin_Sv2w[ibin];
|
||||
m_bin_Svw[ibin] += a_histo.m_bin_Svw[ibin];
|
||||
m_bin_Sv2w[ibin] += a_histo.m_bin_Sv2w[ibin];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool subtract(const p2& a_histo){
|
||||
parent::base_subtract(a_histo);
|
||||
for(bn_t ibin=0;ibin<parent::m_bin_number;ibin++) {
|
||||
m_bin_Svw[ibin] -= a_histo.m_bin_Svw[ibin];
|
||||
m_bin_Sv2w[ibin] -= a_histo.m_bin_Sv2w[ibin];
|
||||
m_bin_Svw[ibin] -= a_histo.m_bin_Svw[ibin];
|
||||
m_bin_Sv2w[ibin] -= a_histo.m_bin_Sv2w[ibin];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -254,7 +254,7 @@ public:
|
||||
,m_cut_v(true)
|
||||
,m_min_v(aVmin)
|
||||
,m_max_v(aVmax)
|
||||
{
|
||||
{
|
||||
m_bin_Svw.resize(parent::m_bin_number,0);
|
||||
m_bin_Sv2w.resize(parent::m_bin_number,0);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ template <class H2,class H1>
|
||||
inline bool fill_slice_x(const H2& a_from,int aJbeg,int aJend,H1& a_to) {
|
||||
|
||||
if(!a_from.dimension()) return false;
|
||||
|
||||
|
||||
typedef typename H2::bn_t bn_t;
|
||||
|
||||
bn_t jbeg;
|
||||
@@ -31,9 +31,9 @@ inline bool fill_slice_x(const H2& a_from,int aJbeg,int aJend,H1& a_to) {
|
||||
typedef typename H1::hd_t hd_t;
|
||||
hd_t hdata = a_to.dac();
|
||||
|
||||
bn_t aoffset,offset,jbin;
|
||||
bn_t aoffset,offset,jbin;
|
||||
bn_t yoffset = a_from.axis_y().m_offset;
|
||||
|
||||
|
||||
typedef typename H2::num_entries_t TN;
|
||||
typedef typename H2::weight_t TW;
|
||||
typedef typename H2::coordinate_t TC;
|
||||
@@ -99,7 +99,7 @@ inline bool fill_slice_y(const H2& a_from,int aIbeg,int aIend,H1& a_to) {
|
||||
typedef typename H1::hd_t hd_t;
|
||||
hd_t hdata = a_to.dac();
|
||||
|
||||
bn_t aibin,aoffset,offset,ibin;
|
||||
bn_t aibin,aoffset,offset,ibin;
|
||||
bn_t yoffset = a_from.axis_y().m_offset;
|
||||
|
||||
typedef typename H2::num_entries_t TN;
|
||||
@@ -156,7 +156,7 @@ inline H1* projection_y(const H2& a_from,const std::string& a_title) {
|
||||
template <class H2,class P1>
|
||||
inline bool fill_profile_x(const H2& a_from,int aJbeg,int aJend,P1& a_to) {
|
||||
if(!a_from.dimension()) return false;
|
||||
|
||||
|
||||
typedef typename H2::bn_t bn_t;
|
||||
|
||||
bn_t jbeg;
|
||||
@@ -170,9 +170,9 @@ inline bool fill_profile_x(const H2& a_from,int aJbeg,int aJend,P1& a_to) {
|
||||
typedef typename P1::pd_t pd_t;
|
||||
pd_t hdata = a_to.get_histo_data();
|
||||
|
||||
bn_t aoffset,offset,jbin;
|
||||
bn_t aoffset,offset,jbin;
|
||||
bn_t yoffset = a_from.axis_y().m_offset;
|
||||
|
||||
|
||||
typedef typename H2::num_entries_t TN;
|
||||
typedef typename H2::weight_t TW;
|
||||
typedef typename H2::coordinate_t TC;
|
||||
@@ -230,7 +230,7 @@ inline bool fill_profile_y(const H2& a_from,int aIbeg,int aIend,P1& a_to) {
|
||||
typedef typename P1::pd_t pd_t;
|
||||
pd_t hdata = a_to.get_histo_data();
|
||||
|
||||
bn_t aibin,aoffset,offset,ibin;
|
||||
bn_t aibin,aoffset,offset,ibin;
|
||||
bn_t yoffset = a_from.axis_y().m_offset;
|
||||
|
||||
typedef typename H2::num_entries_t TN;
|
||||
@@ -293,13 +293,13 @@ inline bool fill_slice_yz(const H3& a_from,int aIbeg,int aIend,H2& a_to) {
|
||||
|
||||
typedef typename H2::hd_t hd_t;
|
||||
hd_t hdata = a_to.dac();
|
||||
|
||||
bn_t aibin,ajbin,aoffset,offset,ibin;
|
||||
|
||||
|
||||
bn_t aibin,ajbin,aoffset,offset,ibin;
|
||||
|
||||
bn_t ayoffset = hdata.m_axes[1].m_offset;
|
||||
bn_t yoffset = a_from.axis_y().m_offset;
|
||||
bn_t zoffset = a_from.axis_z().m_offset;
|
||||
|
||||
|
||||
bn_t axbins = hdata.m_axes[0].bins()+2;
|
||||
bn_t aybins = hdata.m_axes[1].bins()+2;
|
||||
|
||||
@@ -344,7 +344,7 @@ inline bool fill_slice_yz(const H3& a_from,int aIbeg,int aIend,H2& a_to) {
|
||||
|
||||
template <class H3,class H2>
|
||||
inline bool fill_slice_xy(const H3& a_from,int aKbeg,int aKend,H2& a_to) {
|
||||
|
||||
|
||||
if(!a_from.dimension()) return false;
|
||||
|
||||
typedef typename H3::bn_t bn_t;
|
||||
@@ -354,20 +354,20 @@ inline bool fill_slice_xy(const H3& a_from,int aKbeg,int aKend,H2& a_to) {
|
||||
bn_t kend;
|
||||
if(!a_from.axis_z().in_range_to_absolute_index(aKend,kend)) return false;
|
||||
if(kbeg>kend) return false;
|
||||
|
||||
|
||||
if(a_from.axis_x().bins()!=a_to.axis_x().bins()) return false;
|
||||
if(a_from.axis_y().bins()!=a_to.axis_y().bins()) return false;
|
||||
|
||||
typedef typename H2::hd_t hd_t;
|
||||
hd_t hdata = a_to.dac();
|
||||
|
||||
|
||||
bn_t kbin;
|
||||
bn_t aibin,ajbin,aoffset,offset;
|
||||
|
||||
bn_t aibin,ajbin,aoffset,offset;
|
||||
|
||||
bn_t ayoffset = hdata.m_axes[1].m_offset;
|
||||
bn_t yoffset = a_from.axis_y().m_offset;
|
||||
bn_t zoffset = a_from.axis_z().m_offset;
|
||||
|
||||
|
||||
bn_t axbins = hdata.m_axes[0].bins()+2;
|
||||
bn_t aybins = hdata.m_axes[1].bins()+2;
|
||||
|
||||
@@ -412,7 +412,7 @@ inline bool fill_slice_xy(const H3& a_from,int aKbeg,int aKend,H2& a_to) {
|
||||
|
||||
template <class H3,class H2>
|
||||
inline bool fill_slice_xz(const H3& a_from,int aJbeg,int aJend,H2& a_to) {
|
||||
|
||||
|
||||
if(!a_from.dimension()) return false;
|
||||
|
||||
typedef typename H3::bn_t bn_t;
|
||||
@@ -425,16 +425,16 @@ inline bool fill_slice_xz(const H3& a_from,int aJbeg,int aJend,H2& a_to) {
|
||||
|
||||
if(a_from.axis_x().bins()!=a_to.axis_x().bins()) return false;
|
||||
if(a_from.axis_z().bins()!=a_to.axis_y().bins()) return false;
|
||||
|
||||
|
||||
typedef typename H2::hd_t hd_t;
|
||||
hd_t hdata = a_to.dac();
|
||||
|
||||
bn_t aibin,ajbin,aoffset,offset,jbin;
|
||||
|
||||
bn_t aibin,ajbin,aoffset,offset,jbin;
|
||||
|
||||
bn_t ayoffset = hdata.m_axes[1].m_offset;
|
||||
bn_t yoffset = a_from.axis_y().m_offset;
|
||||
bn_t zoffset = a_from.axis_z().m_offset;
|
||||
|
||||
|
||||
bn_t axbins = hdata.m_axes[0].bins()+2;
|
||||
bn_t aybins = hdata.m_axes[1].bins()+2;
|
||||
|
||||
@@ -457,7 +457,7 @@ inline bool fill_slice_xz(const H3& a_from,int aJbeg,int aJend,H2& a_to) {
|
||||
//offset3D = ibin + jbin * m_axes[1].m_offset + kbin*m_axes[2].m_offset;
|
||||
// hdata booked with x-z then :
|
||||
offset = aibin + jbin * yoffset + ajbin * zoffset;
|
||||
|
||||
|
||||
// Bin :
|
||||
hdata.m_bin_entries[aoffset] += af_bin_entries[offset];
|
||||
hdata.m_bin_Sw[aoffset] += af_bin_Sw[offset];
|
||||
@@ -469,7 +469,7 @@ inline bool fill_slice_xz(const H3& a_from,int aJbeg,int aJend,H2& a_to) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
hdata.m_in_range_plane_Sxyw.assign(a_to.number_of_planes(),0); //ill-defined.
|
||||
|
||||
hdata.update_fast_getters();
|
||||
|
||||
Reference in New Issue
Block a user