inlib  1.2.0
Public Member Functions | Protected Member Functions | Protected Attributes
inlib::histo::p2< TC, TN, TW, TH, TV > Class Template Reference
Inheritance diagram for inlib::histo::p2< TC, TN, TW, TH, TV >:
Inheritance graph
[legend]
Collaboration diagram for inlib::histo::p2< TC, TN, TW, TH, TV >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual TH bin_error (int aI, int aJ) const
bool multiply (TW aFactor)
bool scale (TW aFactor)
TV bin_Svw (int aI, int aJ) const
TV bin_Sv2w (int aI, int aJ) const
bool reset ()
void copy_from_data (const profile_data< TC, TN, TW, TV > &a_from)
profile_data< TC, TN, TW, TV > get_histo_data () const
bool fill (TC aX, TC aY, TV aV, TW aWeight=1)
TV bin_rms_value (int aI, int aJ) const
bool add (const p2 &a_histo)
bool subtract (const p2 &a_histo)
bool cut_v () const
TV min_v () const
TV max_v () const
 p2 (const std::string &a_title, bn_t aXnumber, TC aXmin, TC aXmax, bn_t aYnumber, TC aYmin, TC aYmax)
 p2 (const std::string &a_title, bn_t aXnumber, TC aXmin, TC aXmax, bn_t aYnumber, TC aYmin, TC aYmax, TV aVmin, TV aVmax)
 p2 (const std::string &a_title, const std::vector< TC > &aEdgesX, const std::vector< TC > &aEdgesY)
 p2 (const std::string &a_title, const std::vector< TC > &aEdgesX, const std::vector< TC > &aEdgesY, TV aVmin, TV aVmax)
virtual ~p2 ()
 p2 (const p2 &a_from)
p2operator= (const p2 &a_from)
const std::vector< TV > & bins_sum_vw () const
const std::vector< TV > & bins_sum_v2w () const

Protected Member Functions

virtual TH get_bin_height (int a_offset) const

Protected Attributes

bool m_cut_v
TV m_min_v
TV m_max_v
std::vector< TV > m_bin_Svw
std::vector< TV > m_bin_Sv2w

Detailed Description

template<class TC, class TN, class TW, class TH, class TV>
class inlib::histo::p2< TC, TN, TW, TH, TV >

Definition at line 14 of file p2.


Constructor & Destructor Documentation

template<class TC, class TN, class TW, class TH, class TV>
inlib::histo::p2< TC, TN, TW, TH, TV >::p2 ( const std::string &  a_title,
bn_t  aXnumber,
TC  aXmin,
TC  aXmax,
bn_t  aYnumber,
TC  aYmin,
TC  aYmax 
) [inline]

Definition at line 210 of file p2.

  : parent(a_title,aXnumber,aXmin,aXmax,aYnumber,aYmin,aYmax)
  ,m_cut_v(false)
  ,m_min_v(0)
  ,m_max_v(0)
  {
    m_bin_Svw.resize(parent::m_bin_number,0);
    m_bin_Sv2w.resize(parent::m_bin_number,0);
  }
template<class TC, class TN, class TW, class TH, class TV>
inlib::histo::p2< TC, TN, TW, TH, TV >::p2 ( const std::string &  a_title,
bn_t  aXnumber,
TC  aXmin,
TC  aXmax,
bn_t  aYnumber,
TC  aYmin,
TC  aYmax,
TV  aVmin,
TV  aVmax 
) [inline]

Definition at line 222 of file p2.

  : parent(a_title,aXnumber,aXmin,aXmax,aYnumber,aYmin,aYmax)
  ,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);
  }
template<class TC, class TN, class TW, class TH, class TV>
inlib::histo::p2< TC, TN, TW, TH, TV >::p2 ( const std::string &  a_title,
const std::vector< TC > &  aEdgesX,
const std::vector< TC > &  aEdgesY 
) [inline]

Definition at line 235 of file p2.

  : parent(a_title,aEdgesX,aEdgesY)
  ,m_cut_v(false)
  ,m_min_v(0)
  ,m_max_v(0)
  {
    m_bin_Svw.resize(parent::m_bin_number,0);
    m_bin_Sv2w.resize(parent::m_bin_number,0);
  }
template<class TC, class TN, class TW, class TH, class TV>
inlib::histo::p2< TC, TN, TW, TH, TV >::p2 ( const std::string &  a_title,
const std::vector< TC > &  aEdgesX,
const std::vector< TC > &  aEdgesY,
TV  aVmin,
TV  aVmax 
) [inline]

Definition at line 247 of file p2.

  : parent(a_title,aEdgesX,aEdgesY)
  ,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);
  }
template<class TC, class TN, class TW, class TH, class TV>
virtual inlib::histo::p2< TC, TN, TW, TH, TV >::~p2 ( ) [inline, virtual]

Definition at line 260 of file p2.

{}
template<class TC, class TN, class TW, class TH, class TV>
inlib::histo::p2< TC, TN, TW, TH, TV >::p2 ( const p2< TC, TN, TW, TH, TV > &  a_from) [inline]

Definition at line 262 of file p2.

  : parent(a_from)
  ,m_cut_v(a_from.m_cut_v)
  ,m_min_v(a_from.m_min_v)
  ,m_max_v(a_from.m_max_v)
  ,m_bin_Svw(a_from.m_bin_Svw)
  ,m_bin_Sv2w(a_from.m_bin_Sv2w)
  {}

Member Function Documentation

template<class TC, class TN, class TW, class TH, class TV>
bool inlib::histo::p2< TC, TN, TW, TH, TV >::add ( const p2< TC, TN, TW, TH, TV > &  a_histo) [inline]

Definition at line 187 of file p2.

                             {
    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];      
    }
    this->update_fast_getters();
    return true;
  }
template<class TC, class TN, class TW, class TH, class TV>
virtual TH inlib::histo::p2< TC, TN, TW, TH, TV >::bin_error ( int  aI,
int  aJ 
) const [inline, virtual]

Implements inlib::histo::b2< TC, TN, TW, TH >.

Definition at line 23 of file p2.

                                            { //TH should be the same as TV
    if(parent::m_bin_number==0) return 0;
    bn_t ibin;
    if(!parent::m_axes[0].in_range_to_absolute_index(aI,ibin)) return 0;
    bn_t jbin;
    if(!parent::m_axes[1].in_range_to_absolute_index(aJ,jbin)) return 0;
    bn_t offset = ibin + jbin * parent::m_axes[1].m_offset;
  
    //FIXME Is it correct ?
    // TProfile::GetBinError with kERRORMEAN mode does :
    //  Stat_t cont = fArray[bin];              //Svw (see TProfile::Fill)
    //  Stat_t sum  = parent::m_bin_entries.fArray[bin];  //Sw
    //  Stat_t err2 = fSumw2.fArray[bin];       //Sv2w
    //  if (sum == 0) return 0;
    //  Stat_t eprim;
    //  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
    TV sv2w = m_bin_Sv2w[offset];  //ROOT err2
    TV mean = (svw / sw);        //ROOT contsum
    TV rms = ::sqrt(::fabs((sv2w/sw) - mean * mean)); //ROOT eprim
    // rms = get_bin_rms_value.
    return rms/::sqrt(sw); //ROOT kERRORMEAN mode returned value
  }
template<class TC, class TN, class TW, class TH, class TV>
TV inlib::histo::p2< TC, TN, TW, TH, TV >::bin_rms_value ( int  aI,
int  aJ 
) const [inline]

Definition at line 171 of file p2.

                                        {
    if(parent::m_bin_number==0) return 0;
    bn_t ibin;
    if(!parent::m_axes[0].in_range_to_absolute_index(aI,ibin)) return 0;
    bn_t jbin;
    if(!parent::m_axes[1].in_range_to_absolute_index(aJ,jbin)) return 0;
    bn_t offset = ibin + jbin * parent::m_axes[1].m_offset;
  
    TW sw = parent::m_bin_Sw[offset];
    if(sw==0) return 0;
    TV svw = m_bin_Svw[offset];
    TV sv2w = m_bin_Sv2w[offset];
    TV mean = (svw / sw);
    return ::sqrt(::fabs((sv2w / sw) - mean * mean));
  }
template<class TC, class TN, class TW, class TH, class TV>
TV inlib::histo::p2< TC, TN, TW, TH, TV >::bin_Sv2w ( int  aI,
int  aJ 
) const [inline]

Definition at line 74 of file p2.

                                   {
    if(parent::m_bin_number==0) return 0;
    bn_t ibin;
    if(!parent::m_axes[0].in_range_to_absolute_index(aI,ibin)) return 0;
    bn_t jbin;
    if(!parent::m_axes[1].in_range_to_absolute_index(aJ,jbin)) return 0;
    bn_t offset = ibin + jbin * parent::m_axes[1].m_offset;
    return m_bin_Sv2w[offset];
  }
template<class TC, class TN, class TW, class TH, class TV>
TV inlib::histo::p2< TC, TN, TW, TH, TV >::bin_Svw ( int  aI,
int  aJ 
) const [inline]

Definition at line 65 of file p2.

                                  {
    if(parent::m_bin_number==0) return 0;
    bn_t ibin;
    if(!parent::m_axes[0].in_range_to_absolute_index(aI,ibin)) return 0;
    bn_t jbin;
    if(!parent::m_axes[1].in_range_to_absolute_index(aJ,jbin)) return 0;
    bn_t offset = ibin + jbin * parent::m_axes[1].m_offset;
    return m_bin_Svw[offset];
  }
template<class TC, class TN, class TW, class TH, class TV>
const std::vector<TV>& inlib::histo::p2< TC, TN, TW, TH, TV >::bins_sum_v2w ( ) const [inline]

Definition at line 281 of file p2.

{return m_bin_Sv2w;}
template<class TC, class TN, class TW, class TH, class TV>
const std::vector<TV>& inlib::histo::p2< TC, TN, TW, TH, TV >::bins_sum_vw ( ) const [inline]

Definition at line 280 of file p2.

{return m_bin_Svw;}
template<class TC, class TN, class TW, class TH, class TV>
void inlib::histo::p2< TC, TN, TW, TH, TV >::copy_from_data ( const profile_data< TC, TN, TW, TV > &  a_from) [inline]

Definition at line 94 of file p2.

                                                               {
    parent::base_from_data(a_from);
    m_bin_Svw = a_from.m_bin_Svw;
    m_bin_Sv2w = a_from.m_bin_Sv2w;
    m_cut_v = a_from.m_cut_v;
    m_min_v = a_from.m_min_v;
    m_max_v = a_from.m_max_v;
  }
template<class TC, class TN, class TW, class TH, class TV>
bool inlib::histo::p2< TC, TN, TW, TH, TV >::cut_v ( ) const [inline]

Definition at line 206 of file p2.

{return m_cut_v;}
template<class TC, class TN, class TW, class TH, class TV>
bool inlib::histo::p2< TC, TN, TW, TH, TV >::fill ( TC  aX,
TC  aY,
TV  aV,
TW  aWeight = 1 
) [inline]

Definition at line 113 of file p2.

                                              {
    //m_coords[0] = aX;
    //m_coords[1] = aY;
    //return fill_bin(m_coords,aV,aWeight);
  
    if(m_cut_v) {
      if( (aV<m_min_v) || (aV>=m_max_v) ) {
        return true;
      }
    }
  
    if(parent::m_dimension<=0) 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;
    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;
  
    if(inRange) {
      parent::m_in_range_entries++;
      parent::m_in_range_Sw += aWeight;
  
      parent::m_in_range_Sxw += xw;
      parent::m_in_range_Sx2w += x2w;
  
      parent::m_in_range_Syw += yw;
      parent::m_in_range_Sy2w += y2w;
    }
   
    // Profile part :
    TV vw = aV * aWeight;
    m_bin_Svw[offset] += vw;
    m_bin_Sv2w[offset] += aV * vw;
  
    return true;
  }
template<class TC, class TN, class TW, class TH, class TV>
virtual TH inlib::histo::p2< TC, TN, TW, TH, TV >::get_bin_height ( int  a_offset) const [inline, protected, virtual]

Implements inlib::histo::base_histo< TC, TN, TW, TH >.

Definition at line 18 of file p2.

                                                {
    return (parent::m_bin_Sw[a_offset] ? (m_bin_Svw[a_offset]/parent::m_bin_Sw[a_offset]):0);
  }
template<class TC, class TN, class TW, class TH, class TV>
profile_data<TC,TN,TW,TV> inlib::histo::p2< TC, TN, TW, TH, TV >::get_histo_data ( ) const [inline]

Definition at line 102 of file p2.

                                                   {
    profile_data<TC,TN,TW,TV> hd(parent::base_get_data());
    hd.m_is_profile = true;
    hd.m_bin_Svw = m_bin_Svw;
    hd.m_bin_Sv2w = m_bin_Sv2w;
    hd.m_cut_v = m_cut_v;
    hd.m_min_v = m_min_v;
    hd.m_max_v = m_max_v;
    return hd;
  }
template<class TC, class TN, class TW, class TH, class TV>
TV inlib::histo::p2< TC, TN, TW, TH, TV >::max_v ( ) const [inline]

Definition at line 208 of file p2.

{return m_max_v;}
template<class TC, class TN, class TW, class TH, class TV>
TV inlib::histo::p2< TC, TN, TW, TH, TV >::min_v ( ) const [inline]

Definition at line 207 of file p2.

{return m_min_v;}
template<class TC, class TN, class TW, class TH, class TV>
bool inlib::histo::p2< TC, TN, TW, TH, TV >::multiply ( TW  aFactor) [inline]

Definition at line 55 of file p2.

                           {
    if(!parent::base_multiply(aFactor)) return false;
    for(bn_t ibin=0;ibin<parent::m_bin_number;ibin++) {
      m_bin_Svw[ibin] *= aFactor;
    }
    this->update_fast_getters();
    return true;
  }
template<class TC, class TN, class TW, class TH, class TV>
p2& inlib::histo::p2< TC, TN, TW, TH, TV >::operator= ( const p2< TC, TN, TW, TH, TV > &  a_from) [inline]

Definition at line 270 of file p2.

                                 {
    parent::operator=(a_from);
    m_cut_v = a_from.m_cut_v;
    m_min_v = a_from.m_min_v;
    m_max_v = a_from.m_max_v;
    m_bin_Svw = a_from.m_bin_Svw;
    m_bin_Sv2w = a_from.m_bin_Sv2w;
    return *this;
  }
template<class TC, class TN, class TW, class TH, class TV>
bool inlib::histo::p2< TC, TN, TW, TH, TV >::reset ( ) [inline]

Definition at line 84 of file p2.

               {
    parent::base_reset();
    for(bn_t ibin=0;ibin<parent::m_bin_number;ibin++) {
      m_bin_Svw[ibin] = 0;
      m_bin_Sv2w[ibin] = 0;
    }
    this->update_fast_getters();
    return true;
  }
template<class TC, class TN, class TW, class TH, class TV>
bool inlib::histo::p2< TC, TN, TW, TH, TV >::scale ( TW  aFactor) [inline]

Definition at line 63 of file p2.

{return multiply(aFactor);}
template<class TC, class TN, class TW, class TH, class TV>
bool inlib::histo::p2< TC, TN, TW, TH, TV >::subtract ( const p2< TC, TN, TW, TH, TV > &  a_histo) [inline]

Definition at line 196 of file p2.

                                  {
    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];      
    }
    this->update_fast_getters();
    return true;
  }

Member Data Documentation

template<class TC, class TN, class TW, class TH, class TV>
std::vector<TV> inlib::histo::p2< TC, TN, TW, TH, TV >::m_bin_Sv2w [protected]

Definition at line 287 of file p2.

template<class TC, class TN, class TW, class TH, class TV>
std::vector<TV> inlib::histo::p2< TC, TN, TW, TH, TV >::m_bin_Svw [protected]

Definition at line 286 of file p2.

template<class TC, class TN, class TW, class TH, class TV>
bool inlib::histo::p2< TC, TN, TW, TH, TV >::m_cut_v [protected]

Definition at line 283 of file p2.

template<class TC, class TN, class TW, class TH, class TV>
TV inlib::histo::p2< TC, TN, TW, TH, TV >::m_max_v [protected]

Definition at line 285 of file p2.

template<class TC, class TN, class TW, class TH, class TV>
TV inlib::histo::p2< TC, TN, TW, TH, TV >::m_min_v [protected]

Definition at line 284 of file p2.


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