inlib  1.2.0
Public Member Functions | Protected Member Functions | Protected Attributes
inlib::histo::c3d Class Reference
Inheritance diagram for inlib::histo::c3d:
Inheritance graph
[legend]
Collaboration diagram for inlib::histo::c3d:
Collaboration graph
[legend]

List of all members.

Public Member Functions

bool set_title (const std::string &)
unsigned int dimension () const
bool reset ()
unsigned int entries () const
double sum_of_weights () const
bool convert_to_histogram ()
bool is_converted () const
bool scale (double)
bool fill (double, double, double, double=1)
double lower_edge_x () const
double upper_edge_x () const
double lower_edge_y () const
double upper_edge_y () const
double lower_edge_z () const
double upper_edge_z () const
double value_x (unsigned int) const
double value_y (unsigned int) const
double value_z (unsigned int) const
double weight (unsigned int) const
double mean_x () const
double mean_y () const
double mean_z () const
double rms_x () const
double rms_y () const
double rms_z () const
bool convert (unsigned int, double, double, unsigned int, double, double, unsigned int, double, double)
bool convert (const std::vector< double > &, const std::vector< double > &, const std::vector< double > &)
const histo::h3dhistogram () const
bool fill_histogram (histo::h3d &a_histo) const
bool set_conversion_parameters (unsigned int, double, double, unsigned int, double, double, unsigned int, double, double)
 c3d ()
 c3d (const std::string &, int=-1)
virtual ~c3d ()
 c3d (const c3d &a_from)
c3doperator= (const c3d &a_from)

Protected Member Functions

void clear ()

Protected Attributes

std::vector< double > m_xs
std::vector< double > m_ys
std::vector< double > m_zs
double m_lower_x
double m_upper_x
double m_lower_y
double m_upper_y
double m_lower_z
double m_upper_z
double m_Sxw
double m_Sx2w
double m_Syw
double m_Sy2w
double m_Szw
double m_Sz2w
unsigned int m_cnv_x_num
double m_cnv_x_min
double m_cnv_x_max
unsigned int m_cnv_y_num
double m_cnv_y_min
double m_cnv_y_max
unsigned int m_cnv_z_num
double m_cnv_z_min
double m_cnv_z_max
histo::h3dm_histo

Detailed Description

Definition at line 16 of file c3d.


Constructor & Destructor Documentation

inlib::histo::c3d::c3d ( ) [inline]

Definition at line 172 of file c3d.

inlib::histo::c3d::c3d ( const std::string &  a_title,
int  aLimit = -1 
) [inline]

Definition at line 199 of file c3d.

virtual inlib::histo::c3d::~c3d ( ) [inline, virtual]

Definition at line 66 of file c3d.

{delete m_histo;}
inlib::histo::c3d::c3d ( const c3d a_from) [inline]

Definition at line 68 of file c3d.

  :base_cloud(a_from)
  ,m_xs(a_from.m_xs)
  ,m_ys(a_from.m_ys)
  ,m_zs(a_from.m_zs)
  ,m_lower_x(a_from.m_lower_x)
  ,m_upper_x(a_from.m_upper_x)
  ,m_lower_y(a_from.m_lower_y)
  ,m_upper_y(a_from.m_upper_y)
  ,m_lower_z(a_from.m_lower_z)
  ,m_upper_z(a_from.m_upper_z)
  ,m_Sxw(a_from.m_Sxw)
  ,m_Sx2w(a_from.m_Sx2w)
  ,m_Syw(a_from.m_Syw)
  ,m_Sy2w(a_from.m_Sy2w)
  ,m_Szw(a_from.m_Szw)
  ,m_Sz2w(a_from.m_Sz2w)
  ,m_cnv_x_num(a_from.m_cnv_x_num)
  ,m_cnv_x_min(a_from.m_cnv_x_min)
  ,m_cnv_x_max(a_from.m_cnv_x_max)
  ,m_cnv_y_num(a_from.m_cnv_y_num)
  ,m_cnv_y_min(a_from.m_cnv_y_min)
  ,m_cnv_y_max(a_from.m_cnv_y_max)
  ,m_cnv_z_num(a_from.m_cnv_z_num)
  ,m_cnv_z_min(a_from.m_cnv_z_min)
  ,m_cnv_z_max(a_from.m_cnv_z_max)
  ,m_histo(0)
  {
    if(a_from.m_histo) {
      m_histo = new histo::h3d(*a_from.m_histo);
    }
  }

Member Function Documentation

void inlib::histo::c3d::clear ( ) [inline, protected]

Definition at line 231 of file c3d.

               {
  m_lower_x = 0;
  m_upper_x = 0;
  m_lower_y = 0;
  m_upper_y = 0;
  m_lower_z = 0;
  m_upper_z = 0;
  m_Sw = 0;
  m_Sxw = 0;
  m_Sx2w = 0;
  m_Syw = 0;
  m_Sy2w = 0;
  m_Szw = 0;
  m_Sz2w = 0;
  m_xs.clear();
  m_ys.clear();
  m_zs.clear();
  m_ws.clear();
}
bool inlib::histo::c3d::convert ( unsigned int  aBinsX,
double  aLowerEdgeX,
double  aUpperEdgeX,
unsigned int  aBinsY,
double  aLowerEdgeY,
double  aUpperEdgeY,
unsigned int  aBinsZ,
double  aLowerEdgeZ,
double  aUpperEdgeZ 
) [inline]

Definition at line 252 of file c3d.

  { 
  if(m_histo) return true; // Done.
  m_histo = new histo::h3d(this->title(),
                              aBinsX,aLowerEdgeX,aUpperEdgeX,
                              aBinsY,aLowerEdgeY,aUpperEdgeY,
                              aBinsZ,aLowerEdgeZ,aUpperEdgeZ);
  if(!m_histo) return false;
  bool status = fill_histogram(*m_histo);
  clear();
  return status;
}
bool inlib::histo::c3d::convert ( const std::vector< double > &  aEdgesX,
const std::vector< double > &  aEdgesY,
const std::vector< double > &  aEdgesZ 
) [inline]

Definition at line 393 of file c3d.

  { 
  if(m_histo) return true;
  m_histo = new histo::h3d(this->title(),
                           aEdgesX,aEdgesY,aEdgesZ);
  if(!m_histo) return false;
  bool status = fill_histogram(*m_histo);
  clear();
  return status;
}
bool inlib::histo::c3d::convert_to_histogram ( ) [inline]

Definition at line 269 of file c3d.

unsigned int inlib::histo::c3d::dimension ( ) const [inline]

Definition at line 19 of file c3d.

{return 3;}
unsigned int inlib::histo::c3d::entries ( ) const [inline]

Definition at line 413 of file c3d.

                                { 
  return m_histo ? m_histo->all_entries() : m_ws.size();
}
bool inlib::histo::c3d::fill ( double  aX,
double  aY,
double  aZ,
double  aW = 1 
) [inline]

Definition at line 345 of file c3d.

                                                     {
  if(!m_histo && (m_limit!=UNLIMITED()) && ((int)m_xs.size()>=m_limit)){
    convert_to_histogram();
  }

  if(m_histo) {
    return m_histo->fill(aX,aY,aZ,aW);
  } else {
    if(m_xs.size()) {
      m_lower_x = inlib::mn<double>(aX,m_lower_x);
      m_upper_x = inlib::mx<double>(aX,m_upper_x);
    } else {
      m_lower_x = aX;
      m_upper_x = aX;
    }
    if(m_ys.size()) { 
      m_lower_y = inlib::mn<double>(aY,m_lower_y);
      m_upper_y = inlib::mx<double>(aY,m_upper_y);
    } else {
      m_lower_y = aY;
      m_upper_y = aY;
    }
    if(m_zs.size()) { 
      m_lower_z = inlib::mn<double>(aZ,m_lower_z);
      m_upper_z = inlib::mx<double>(aZ,m_upper_z);
    } else {
      m_lower_z = aZ;
      m_upper_z = aZ;
    }
    m_xs.push_back(aX);
    m_ys.push_back(aY);
    m_zs.push_back(aZ);
    m_ws.push_back(aW);
    m_Sw += aW;
    double xw = aX * aW;
    m_Sxw += xw;
    m_Sx2w += aX * xw;
    double yw = aY * aW; 
    m_Syw += yw;
    m_Sy2w += aY * yw;
    double zw = aZ * aW;
    m_Szw += zw;
    m_Sz2w += aZ * zw;
    return true;
  }
}
bool inlib::histo::c3d::fill_histogram ( histo::h3d a_histo) const [inline]

Definition at line 52 of file c3d.

                                               {
    unsigned int number = m_xs.size();
    for(unsigned int index=0;index<number;index++) {
      if(!a_histo.fill(m_xs[index],m_ys[index],m_zs[index],m_ws[index]))
        return false;
    }
    return true;
  }
const h3d & inlib::histo::c3d::histogram ( ) const [inline]

Definition at line 331 of file c3d.

                                { 
  if(!m_histo) const_cast<c3d&>(*this).convert_to_histogram();
  return *m_histo;
}
bool inlib::histo::c3d::is_converted ( ) const [inline]

Definition at line 228 of file c3d.

{return m_histo ? true : false;}
double inlib::histo::c3d::lower_edge_x ( ) const [inline]

Definition at line 418 of file c3d.

                               { 
  return m_histo ? m_histo->axis_x().lower_edge() : m_lower_x;
}
double inlib::histo::c3d::lower_edge_y ( ) const [inline]

Definition at line 422 of file c3d.

                               { 
  return m_histo ? m_histo->axis_y().lower_edge() : m_lower_y;
}
double inlib::histo::c3d::lower_edge_z ( ) const [inline]

Definition at line 426 of file c3d.

                               { 
  return m_histo ? m_histo->axis_z().lower_edge() : m_lower_z;
}
double inlib::histo::c3d::mean_x ( ) const [inline]

Definition at line 458 of file c3d.

                         {
  return m_histo ? m_histo->mean_x() : (m_Sw?m_Sxw/m_Sw:0);
}
double inlib::histo::c3d::mean_y ( ) const [inline]

Definition at line 462 of file c3d.

                         {
  return m_histo ? m_histo->mean_y() : (m_Sw?m_Syw/m_Sw:0);
}
double inlib::histo::c3d::mean_z ( ) const [inline]

Definition at line 466 of file c3d.

                         {
  return m_histo ? m_histo->mean_z() : (m_Sw?m_Szw/m_Sw:0);
}
c3d& inlib::histo::c3d::operator= ( const c3d a_from) [inline]

Definition at line 101 of file c3d.

                                    {
    base_cloud::operator=(a_from);
    m_xs = a_from.m_xs;
    m_ys = a_from.m_ys;
    m_zs = a_from.m_zs;
    m_lower_x = a_from.m_lower_x;
    m_upper_x = a_from.m_upper_x;
    m_lower_y = a_from.m_lower_y;
    m_upper_y = a_from.m_upper_y;
    m_lower_z = a_from.m_lower_z;
    m_upper_z = a_from.m_upper_z;
    m_Sxw = a_from.m_Sxw;
    m_Sx2w = a_from.m_Sx2w;
    m_Syw = a_from.m_Syw;
    m_Sy2w = a_from.m_Sy2w;
    m_Szw = a_from.m_Szw;
    m_Sz2w = a_from.m_Sz2w;
    m_cnv_x_num = a_from.m_cnv_x_num;
    m_cnv_x_min = a_from.m_cnv_x_min;
    m_cnv_x_max = a_from.m_cnv_x_max;
    m_cnv_y_num = a_from.m_cnv_y_num;
    m_cnv_y_min = a_from.m_cnv_y_min;
    m_cnv_y_max = a_from.m_cnv_y_max;
    m_cnv_z_num = a_from.m_cnv_z_num;
    m_cnv_z_min = a_from.m_cnv_z_min;
    m_cnv_z_max = a_from.m_cnv_z_max;
    delete m_histo;
    m_histo = 0;
    if(a_from.m_histo) {
      m_histo = new histo::h3d(*a_from.m_histo);
    }
    return *this;
  }
bool inlib::histo::c3d::reset ( ) [inline]

Definition at line 337 of file c3d.

                { 
  clear();
  delete m_histo;
  m_histo = 0;
  return true;
}
double inlib::histo::c3d::rms_x ( ) const [inline]

Definition at line 470 of file c3d.

                        {
  double rms = 0; //FIXME nan.
  if(m_histo) {
    rms = m_histo->rms_x();
  } else {
    if(m_Sw==0) {
    } else {
      double mean = m_Sxw / m_Sw;
      rms = ::sqrt(::fabs( (m_Sx2w / m_Sw) - mean * mean));
    }
  }
  return rms;
}
double inlib::histo::c3d::rms_y ( ) const [inline]

Definition at line 484 of file c3d.

                        {
  double rms = 0; //FIXME nan.
  if(m_histo) {
    rms = m_histo->rms_y();
  } else {
    if(m_Sw==0) {
    } else {
      double mean = m_Syw / m_Sw;
      rms = ::sqrt(::fabs( (m_Sy2w / m_Sw) - mean * mean));
    }
  }
  return rms;
}
double inlib::histo::c3d::rms_z ( ) const [inline]

Definition at line 498 of file c3d.

                        {
  double rms = 0; //FIXME nan.
  if(m_histo) {
    rms = m_histo->rms_z();
  } else {
    if(m_Sw==0) {
    } else {
      double mean = m_Szw / m_Sw;
      rms = ::sqrt(::fabs( (m_Sz2w / m_Sw) - mean * mean));
    }
  }
  return rms;
}
bool inlib::histo::c3d::scale ( double  a_scale) [inline]

Definition at line 294 of file c3d.

                              {
  if(m_histo) {
    return m_histo->scale(a_scale);
  } else {
    unsigned int number = m_ws.size();
    for(unsigned int index=0;index<number;index++) m_ws[index] *= a_scale;
    m_Sw *= a_scale;
    m_Sxw *= a_scale;
    m_Sx2w *= a_scale;
    m_Syw *= a_scale;
    m_Sy2w *= a_scale;
    m_Szw *= a_scale;
    m_Sz2w *= a_scale;
    return true;
  }
}
bool inlib::histo::c3d::set_conversion_parameters ( unsigned int  aCnvXnumber,
double  aCnvXmin,
double  aCnvXmax,
unsigned int  aCnvYnumber,
double  aCnvYmin,
double  aCnvYmax,
unsigned int  aCnvZnumber,
double  aCnvZmin,
double  aCnvZmax 
) [inline]

Definition at line 312 of file c3d.

 {
  m_cnv_x_num = aCnvXnumber;
  m_cnv_x_min = aCnvXmin;
  m_cnv_x_max = aCnvXmax;
  m_cnv_y_num = aCnvYnumber;
  m_cnv_y_min = aCnvYmin;
  m_cnv_y_max = aCnvYmax;
  m_cnv_z_num = aCnvZnumber;
  m_cnv_z_min = aCnvZmin;
  m_cnv_z_max = aCnvZmax;
  return true;
}
bool inlib::histo::c3d::set_title ( const std::string &  a_title) [inline]

Definition at line 287 of file c3d.

                                           {
  m_title = a_title;
  if(m_histo) m_histo->set_title(a_title);
  return true;
}
double inlib::histo::c3d::sum_of_weights ( ) const [inline]

Definition at line 408 of file c3d.

                                 { 
  return (m_histo ? m_histo->sum_bin_heights() : m_Sw);
}
double inlib::histo::c3d::upper_edge_x ( ) const [inline]

Definition at line 430 of file c3d.

                               { 
  return m_histo ? m_histo->axis_x().upper_edge() : m_upper_x;
}
double inlib::histo::c3d::upper_edge_y ( ) const [inline]

Definition at line 434 of file c3d.

                               { 
  return m_histo ? m_histo->axis_y().upper_edge() : m_upper_y;
}
double inlib::histo::c3d::upper_edge_z ( ) const [inline]

Definition at line 438 of file c3d.

                               { 
  return m_histo ? m_histo->axis_z().upper_edge() : m_upper_z;
}
double inlib::histo::c3d::value_x ( unsigned int  aIndex) const [inline]

Definition at line 442 of file c3d.

                                             { 
  return m_histo ? 0 : m_xs[aIndex];
}
double inlib::histo::c3d::value_y ( unsigned int  aIndex) const [inline]

Definition at line 446 of file c3d.

                                             { 
  return m_histo ? 0 : m_ys[aIndex];
}
double inlib::histo::c3d::value_z ( unsigned int  aIndex) const [inline]

Definition at line 450 of file c3d.

                                             { 
  return m_histo ? 0 : m_zs[aIndex];
}
double inlib::histo::c3d::weight ( unsigned int  aIndex) const [inline]

Definition at line 454 of file c3d.

                                            { 
  return m_histo ? 0 : m_ws[aIndex];
}

Member Data Documentation

double inlib::histo::c3d::m_cnv_x_max [protected]

Definition at line 156 of file c3d.

double inlib::histo::c3d::m_cnv_x_min [protected]

Definition at line 155 of file c3d.

unsigned int inlib::histo::c3d::m_cnv_x_num [protected]

Definition at line 154 of file c3d.

double inlib::histo::c3d::m_cnv_y_max [protected]

Definition at line 159 of file c3d.

double inlib::histo::c3d::m_cnv_y_min [protected]

Definition at line 158 of file c3d.

unsigned int inlib::histo::c3d::m_cnv_y_num [protected]

Definition at line 157 of file c3d.

double inlib::histo::c3d::m_cnv_z_max [protected]

Definition at line 162 of file c3d.

double inlib::histo::c3d::m_cnv_z_min [protected]

Definition at line 161 of file c3d.

unsigned int inlib::histo::c3d::m_cnv_z_num [protected]

Definition at line 160 of file c3d.

Definition at line 163 of file c3d.

double inlib::histo::c3d::m_lower_x [protected]

Definition at line 141 of file c3d.

double inlib::histo::c3d::m_lower_y [protected]

Definition at line 143 of file c3d.

double inlib::histo::c3d::m_lower_z [protected]

Definition at line 145 of file c3d.

double inlib::histo::c3d::m_Sx2w [protected]

Definition at line 148 of file c3d.

double inlib::histo::c3d::m_Sxw [protected]

Definition at line 147 of file c3d.

double inlib::histo::c3d::m_Sy2w [protected]

Definition at line 150 of file c3d.

double inlib::histo::c3d::m_Syw [protected]

Definition at line 149 of file c3d.

double inlib::histo::c3d::m_Sz2w [protected]

Definition at line 152 of file c3d.

double inlib::histo::c3d::m_Szw [protected]

Definition at line 151 of file c3d.

double inlib::histo::c3d::m_upper_x [protected]

Definition at line 142 of file c3d.

double inlib::histo::c3d::m_upper_y [protected]

Definition at line 144 of file c3d.

double inlib::histo::c3d::m_upper_z [protected]

Definition at line 146 of file c3d.

std::vector<double> inlib::histo::c3d::m_xs [protected]

Definition at line 138 of file c3d.

std::vector<double> inlib::histo::c3d::m_ys [protected]

Definition at line 139 of file c3d.

std::vector<double> inlib::histo::c3d::m_zs [protected]

Definition at line 140 of file c3d.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines