Anaphe Home Page Reference Documentation

Main Page     Namespaces     Classes     Source Code    

T_Histograms_2D.h

Go to the documentation of this file.
00001 #ifndef _H_T__HISTOGRAMS_2D_H_
00002 
00003 #if 0
00004         #define _H_P__HISTOGRAMS_2D_H_ 1
00005 
00006         // Instantiations have already been done:
00007         #define T_HISTOS_INSTANTIATED
00008 
00009         #include "HTL/P_Histograms.h"
00010 #else
00011         #define _H_T__HISTOGRAMS_2D_H_ 1
00012 
00013         // Instantiations have already been done:
00014         #define T_HISTOS_INSTANTIATED
00015 
00016         #include "HTL/T_Histograms.h"
00017 #endif
00018 
00019 #include "HTL/H_Statistics.h"
00020 #include "HTL/HTLlimits.h"
00021 
00022 #ifndef T__POINTS_VECTOR_H_
00023 #define T__POINTS_VECTOR_H_
00024 
00025 typedef T_Uneven_Partition::Points_Set T_Points_Vector;
00026 
00027 #endif //_POINTS_VECTOR_H_
00028 
00033 class T_Histo2D: public T_Histo_2D_WED
00034 {
00035 public:
00037   H_IID_IMPLEMENT( T_Histo2D );
00039   typedef T_Histo2D     Like_Current;
00041  typedef H_T_REF( Like_Current )        Ref_Like_Current;
00042 public:
00052   T_Histo2D( const char *a_title , Size n1, double x1 , double x2
00053                          , Size n2, double y1 , double y2
00054                          , End_Point_Convention epc1 = RIGHT_OPEN
00055                          , End_Point_Convention epc2 = RIGHT_OPEN )
00056     :H_H2D_E_EP(T_Histo_2D_WED,a_title,n1,x1,x2,epc1,n2,y1,y2,epc2)
00057     {}
00058 
00062   T_Histo2D( I_Histo &a_histo, int copy_data = 1 )
00063     : T_Histo_2D_WED( a_histo, copy_data )
00064     {}
00068   T_Histo2D(const I_Histo &a_histo, int copy_data = 1 )
00069     : T_Histo_2D_WED( a_histo, copy_data )
00070     {}
00072   virtual ~T_Histo2D() {}
00073 public:
00075   void fill( double x, double y, double w = 1.0 ) {
00076     // Avoid checking the weight if it is one
00077     if ((w == 1.0) && (HTLlimits::isFinite(x))&&(HTLlimits::isFinite(y)))
00078       mapped_bin(x,y).put(w); 
00079     else {
00080       // Otherwise check all 
00081       if (HTLlimits::isFinite(w)&&HTLlimits::isFinite(x)&&
00082           HTLlimits::isFinite(y))
00083         mapped_bin(x,y).put(w);               
00084       else
00085         {HTLlimits::classify(x);HTLlimits::classify(y);HTLlimits::classify(w);}
00086     }
00087   }     
00088 
00090   double bin_center( Index i, Index j, Index p = 0 ) 
00091     { I_Histo::I_Bin_Location l(2);
00092     l[0]=i; l[1]=j; return H_Bin_Helper::bin_center( *this, p, l ); }
00094   double mean( Index p=0 ) { return H_Statistics::mean( *this, p ); }
00096   double rms(Index p=0) { return H_Statistics::rms(*this, mean(p), p); }
00097 public:
00101   Ref_Like_Current clone( int copy_data = 1 ) {
00102     Ref_Like_Current h =
00103       H_T_NEW_CLUSTER0 Like_Current( *this, copy_data );
00104     return h;
00105   }
00110   Ref_Like_Current clone( H_T_CLUSTER1(a_place), int copy_data = 1 )
00111     { return H_T_NEW_CLUSTER1(a_place) Like_Current(*this, copy_data); }
00112 
00113 protected:
00114   virtual T_REF_I_Histo clone_( int copy_data = 1 )
00115     { return (T_REF_I_Histo) clone( copy_data ); }
00116   virtual T_REF_I_Histo clone_( H_T_CLUSTER1(a_place),
00117                                             int copy_data = 1 )
00118     { return (T_REF_I_Histo) clone( a_place, copy_data ); }
00119 public:
00121   Ref_Like_Current add( const Ref_Like_Current &other )
00122     {
00123       Ref_Like_Current h = (Ref_Like_Current &) other;
00124       if( partition_X().is_compatible_with( h->partition_X() )
00125           && partition_Y().is_compatible_with( h->partition_Y())) {
00126         H_BIN_UPDATE
00127           for( Index i = 0; i<bin_count()+extra_bin_count(); i++ )
00128             bins_[i].add( h->_bin(i) );
00129       } else {
00130         HTL_ERR("Incompatible partitions in add(..)" );
00131       }
00132       return H_T_THIS;
00133     }
00135   void add( const I_Histo &other ) { add_( other ); }
00137   Ref_Like_Current sub( const Ref_Like_Current &other )
00138     {
00139       Ref_Like_Current h = (Ref_Like_Current &) other;
00140       if( partition_X().is_compatible_with( h->partition_X() )
00141           && partition_Y().is_compatible_with( h->partition_Y())) {
00142         H_BIN_UPDATE
00143           for( Index i=0; i<bin_count()+extra_bin_count(); i++ )
00144             bins_[i].sub( h->_bin(i) );
00145       } else {
00146         HTL_ERR("Incompatible partitions in sub(..)" );
00147       }
00148       return H_T_THIS;
00149     }
00152   void sub( const I_Histo &other ) { sub_( other ); }
00154   Ref_Like_Current mul( const Ref_Like_Current &other )
00155     {
00156       Ref_Like_Current h = (Ref_Like_Current &) other;
00157       if( partition_X().is_compatible_with( h->partition_X() )
00158           && partition_Y().is_compatible_with( h->partition_Y())) {
00159         H_BIN_UPDATE
00160           for( Index i=0; i<bin_count()+extra_bin_count(); i++ )
00161             bins_[i].mul( h->_bin(i) );
00162       } else {
00163         HTL_ERR("Incompatible partitions in mul(..)" );
00164       }
00165       return H_T_THIS;
00166     }
00169   void mul( const I_Histo &other ) { mul_( other ); }
00171   Ref_Like_Current div( const Ref_Like_Current &other )
00172     {
00173       Ref_Like_Current h = (Ref_Like_Current &) other;
00174       if( partition_X().is_compatible_with( h->partition_X() )
00175           && partition_Y().is_compatible_with( h->partition_Y())) {
00176         H_BIN_UPDATE
00177           for( Index i=0; i<bin_count()+extra_bin_count(); i++ )
00178             bins_[i].div( h->_bin(i) );
00179       } else {
00180         HTL_ERR("Incompatible partitions in div(..)" );
00181       }
00182       return H_T_THIS;
00183     }
00186   void div( const I_Histo &other ) { div_( other ); }
00188   void add( double x ) { add_( x ); }
00190   void sub( double x ) { sub_( x ); }
00192   void mul( double x ) { mul_( x ); }
00194   void div( double x ) { div_( x ); }
00195 };
00196 
00197 
00203 class T_Histo2DF: public T_Histo_2D_FWED
00204 {
00205 public:
00207   H_IID_IMPLEMENT( T_Histo2DF );
00209   typedef T_Histo2DF    Like_Current;
00211   typedef H_T_REF( Like_Current )       Ref_Like_Current;
00212 public:
00222   T_Histo2DF( const char *a_title
00223                           , Size n1, double x1 , double x2
00224                           , Size n2, double y1 , double y2
00225                           , End_Point_Convention epc1 = RIGHT_OPEN
00226                           , End_Point_Convention epc2 = RIGHT_OPEN )
00227     : H_H2D_E_EP( T_Histo_2D_FWED, a_title , n1, x1, x2, epc1, 
00228                   n2, y1, y2, epc2 )
00229     {}
00230 
00234   T_Histo2DF( I_Histo &a_histo, int copy_data = 1 )
00235     : T_Histo_2D_FWED( a_histo, copy_data )
00236     {}
00240   T_Histo2DF(const I_Histo &a_histo, int copy_data = 1 )
00241     : T_Histo_2D_FWED( a_histo, copy_data )
00242     {}
00244   virtual ~T_Histo2DF() {}
00245 public:
00247   void fill( double x, double y, double w = 1.0 ) {
00248     // Avoid checking the weight if it is one
00249     if ((w == 1.0) && (HTLlimits::isFinite(x))&&(HTLlimits::isFinite(y)))
00250       mapped_bin(x,y).put(w); 
00251     else {
00252       // Otherwise check all 
00253       if (HTLlimits::isFinite(w)&&HTLlimits::isFinite(x)
00254           &&HTLlimits::isFinite(y))
00255         mapped_bin(x,y).put(w);               
00256       else
00257         {HTLlimits::classify(x);HTLlimits::classify(y);HTLlimits::classify(w);}
00258     }
00259   }     
00261   double bin_center( Index i, Index j, Index p = 0 ) 
00262     { I_Histo::I_Bin_Location l(2);
00263     l[0]=i; l[1]=j; return H_Bin_Helper::bin_center( *this, p, l ); }
00265   double mean( Index p=0 ) { return H_Statistics::mean( *this, p ); }
00267   double rms(Index p=0) { return H_Statistics::rms(*this, mean(p), p); }
00268 public:
00272   Ref_Like_Current clone( int copy_data = 1 ) {
00273       Ref_Like_Current h =
00274         H_T_NEW_CLUSTER0 Like_Current( *this, copy_data );
00275       return h;
00276     }
00281   Ref_Like_Current clone( H_T_CLUSTER1(a_place), int copy_data = 1 )
00282     { return H_T_NEW_CLUSTER1(a_place) Like_Current(*this, copy_data); }
00283 protected:
00284   virtual T_REF_I_Histo clone_( int copy_data = 1 )
00285     { return (T_REF_I_Histo) clone( copy_data ); }
00286   virtual T_REF_I_Histo clone_( H_T_CLUSTER1(a_place),
00287                                             int copy_data = 1 )
00288     { return (T_REF_I_Histo) clone( a_place, copy_data ); }
00289 public:
00291   Ref_Like_Current add( const Ref_Like_Current &other )
00292     {
00293       Ref_Like_Current h = (Ref_Like_Current &) other;
00294       if( partition_X().is_compatible_with( h->partition_X() )
00295           && partition_Y().is_compatible_with( h->partition_Y())) {
00296         H_BIN_UPDATE
00297           for( Index i = 0; i<bin_count()+extra_bin_count(); i++ )
00298             bins_[i].add( h->_bin(i) );
00299       } else {
00300         HTL_ERR("Incompatible partitions in add(..)" );
00301       }
00302       return H_T_THIS;
00303     }
00305   void add( const I_Histo &other ) { add_( other ); }
00307   Ref_Like_Current sub( const Ref_Like_Current &other )
00308     {
00309       Ref_Like_Current h = (Ref_Like_Current &) other;
00310       if( partition_X().is_compatible_with( h->partition_X() )
00311           && partition_Y().is_compatible_with( h->partition_Y())) {
00312         H_BIN_UPDATE
00313           for( Index i=0; i<bin_count()+extra_bin_count(); i++ )
00314             bins_[i].sub( h->_bin(i) );
00315       } else {
00316         HTL_ERR("Incompatible partitions in sub(..)" );
00317       }
00318       return H_T_THIS;
00319     }
00322   void sub( const I_Histo &other ) { sub_( other ); }
00324   Ref_Like_Current mul( const Ref_Like_Current &other )
00325     {
00326       Ref_Like_Current h = (Ref_Like_Current &) other;
00327       if( partition_X().is_compatible_with( h->partition_X() )
00328           && partition_Y().is_compatible_with( h->partition_Y())) {
00329         H_BIN_UPDATE
00330           for( Index i=0; i<bin_count()+extra_bin_count(); i++ )
00331             bins_[i].mul( h->_bin(i) );
00332       } else {
00333         HTL_ERR("Incompatible partitions in mul(..)" );
00334       }
00335       return H_T_THIS;
00336     }
00339   void mul( const I_Histo &other ) { mul_( other ); }
00341   Ref_Like_Current div( const Ref_Like_Current &other )
00342     {
00343       Ref_Like_Current h = (Ref_Like_Current &) other;
00344       if( partition_X().is_compatible_with( h->partition_X() )
00345           && partition_Y().is_compatible_with( h->partition_Y())) {
00346         H_BIN_UPDATE
00347           for( Index i=0; i<bin_count()+extra_bin_count(); i++ )
00348             bins_[i].div( h->_bin(i) );
00349       } else {
00350         HTL_ERR("Incompatible partitions in div(..)" );
00351       }
00352       return H_T_THIS;
00353     }
00356   void div( const I_Histo &other ) { div_( other ); }
00358   void add( double x ) { add_( x ); }
00360   void sub( double x ) { sub_( x ); }
00362   void mul( double x ) { mul_( x ); }
00364   void div( double x ) { div_( x ); }
00365 };
00366 
00367 
00373 class T_Histo2DVar: public T_Histo_2D_WUD
00374 {
00375 public:
00377   H_IID_IMPLEMENT( T_Histo2DVar );
00379   typedef T_Histo2DVar  Like_Current;
00381   typedef H_T_REF( Like_Current )       Ref_Like_Current;
00382 public:
00395   T_Histo2DVar( const char *a_title
00396                             , HTL_STD::vector<float> &some_points1
00397                             , HTL_STD::vector<float> &some_points2
00398                             , End_Point_Convention epc1 = RIGHT_OPEN
00399                             , End_Point_Convention epc2 = RIGHT_OPEN )
00400     : H_H2D_U_EP( T_Histo_2D_WUD, a_title
00401                   , some_points1, epc1, some_points2, epc2 )
00402     {}
00403 
00417   T_Histo2DVar( const char *a_title
00418                             , HTL_STD::vector<double> &some_points1
00419                             , HTL_STD::vector<double> &some_points2
00420                             , End_Point_Convention epc1 = RIGHT_OPEN
00421                             , End_Point_Convention epc2 = RIGHT_OPEN )
00422     : H_H2D_U_EP( T_Histo_2D_WUD, a_title
00423                   , some_points1, epc1, some_points2, epc2 )
00424     {}
00425 
00429   T_Histo2DVar( I_Histo &a_histo, int copy_data=1 )
00430     : T_Histo_2D_WUD( a_histo, copy_data )
00431     {}
00435   T_Histo2DVar(const I_Histo &a_histo, int copy_data=1 )
00436     : T_Histo_2D_WUD( a_histo, copy_data )
00437     {}
00439   virtual ~T_Histo2DVar() {}
00440 
00441 public:
00443   void fill( double x, double y, double w = 1.0 ) {
00444     // Avoid checking the weight if it is one
00445     if ((w == 1.0) && (HTLlimits::isFinite(x))&&(HTLlimits::isFinite(y)))
00446       mapped_bin(x,y).put(w); 
00447     else {
00448       // Otherwise check all 
00449       if (HTLlimits::isFinite(w)&&HTLlimits::isFinite(x)
00450           &&HTLlimits::isFinite(y))
00451         mapped_bin(x,y).put(w);               
00452       else
00453         {HTLlimits::classify(x);HTLlimits::classify(y);HTLlimits::classify(w);}
00454     }
00455   }     
00456 
00458   double bin_center( Index i, Index j, Index p = 0 ) 
00459     { I_Histo::I_Bin_Location l(2);
00460     l[0]=i; l[1]=j; return H_Bin_Helper::bin_center( *this, p, l ); }
00462   double mean( Index p=0 ) { return H_Statistics::mean( *this, p ); }
00464   double rms(Index p=0) { return H_Statistics::rms(*this, mean(p), p); }
00465 public:
00469   Ref_Like_Current clone( int copy_data = 1 ) {
00470     Ref_Like_Current h =
00471       H_T_NEW_CLUSTER0 Like_Current( *this, copy_data );
00472     return h;
00473   }
00478   Ref_Like_Current clone( H_T_CLUSTER1(a_place), int copy_data = 1 )
00479     { return H_T_NEW_CLUSTER1(a_place) Like_Current(*this, copy_data); }
00480 protected:
00481   virtual T_REF_I_Histo clone_( int copy_data = 1 )
00482     { return (T_REF_I_Histo) clone( copy_data ); }
00483   virtual T_REF_I_Histo clone_( H_T_CLUSTER1(a_place),
00484                                             int copy_data = 1 )
00485     { return (T_REF_I_Histo) clone( a_place, copy_data ); }
00486 public:
00488   Ref_Like_Current add( const Ref_Like_Current &other )
00489     {
00490       Ref_Like_Current h = (Ref_Like_Current &) other;
00491       if( partition_X().is_compatible_with( h->partition_X() )
00492           && partition_Y().is_compatible_with( h->partition_Y())) {
00493         H_BIN_UPDATE
00494           for( Index i = 0; i<bin_count()+extra_bin_count(); i++ )
00495             bins_[i].add( h->_bin(i) );
00496       } else {
00497         HTL_ERR("Incompatible partitions in add(..)" );
00498       }
00499       return H_T_THIS;
00500     }
00502   void add( const I_Histo &other ) { add_( other ); }
00504   Ref_Like_Current sub( const Ref_Like_Current &other )
00505     {
00506       Ref_Like_Current h = (Ref_Like_Current &) other;
00507       if( partition_X().is_compatible_with( h->partition_X() )
00508           && partition_Y().is_compatible_with( h->partition_Y())) {
00509         H_BIN_UPDATE
00510           for( Index i=0; i<bin_count()+extra_bin_count(); i++ )
00511             bins_[i].sub( h->_bin(i) );
00512       } else {
00513         HTL_ERR("Incompatible partitions in sub(..)" );
00514       }
00515       return H_T_THIS;
00516     }
00519   void sub( const I_Histo &other ) { sub_( other ); }
00521   Ref_Like_Current mul( const Ref_Like_Current &other )
00522     {
00523       Ref_Like_Current h = (Ref_Like_Current &) other;
00524       if( partition_X().is_compatible_with( h->partition_X() )
00525           && partition_Y().is_compatible_with( h->partition_Y())) {
00526         H_BIN_UPDATE
00527           for( Index i=0; i<bin_count()+extra_bin_count(); i++ )
00528             bins_[i].mul( h->_bin(i) );
00529       } else {
00530         HTL_ERR("Incompatible partitions in mul(..)" );
00531       }
00532       return H_T_THIS;
00533     }
00536   void mul( const I_Histo &other ) { mul_( other ); }
00538   Ref_Like_Current div( const Ref_Like_Current &other )
00539     {
00540       Ref_Like_Current h = (Ref_Like_Current &) other;
00541       if( partition_X().is_compatible_with( h->partition_X() )
00542           && partition_Y().is_compatible_with( h->partition_Y())) {
00543         H_BIN_UPDATE
00544           for( Index i=0; i<bin_count()+extra_bin_count(); i++ )
00545             bins_[i].div( h->_bin(i) );
00546       } else {
00547         HTL_ERR("Incompatible partitions in div(..)" );
00548       }
00549       return H_T_THIS;
00550     }
00553   void div( const I_Histo &other ) { div_( other ); }
00555   void add( double x ) { add_( x ); }
00557   void sub( double x ) { sub_( x ); }
00559   void mul( double x ) { mul_( x ); }
00561   void div( double x ) { div_( x ); }
00562 };
00563 
00564 
00568 class T_ProfileHisto2D: public T_Histo_2D_PED
00569 {
00570 public:
00572   H_IID_IMPLEMENT( T_ProfileHisto2D );
00574   typedef T_ProfileHisto2D      Like_Current;
00576   typedef H_T_REF( Like_Current )       Ref_Like_Current;
00577 public:
00587   T_ProfileHisto2D( const char *a_title
00588                                 , Size n1, double x1 , double x2
00589                                 , Size n2, double y1 , double y2
00590                                 , End_Point_Convention epc1 = RIGHT_OPEN
00591                                 , End_Point_Convention epc2 = RIGHT_OPEN )
00592     : H_H2D_E_EP( T_Histo_2D_PED, a_title
00593                   , n1, x1, x2, epc1, n2, y1, y2, epc2 )
00594     {}
00595 
00599   T_ProfileHisto2D( I_Histo &a_histo, int copy_data = 1 )
00600     : T_Histo_2D_PED( a_histo, copy_data )
00601     {}
00605   T_ProfileHisto2D(const  I_Histo &a_histo, int copy_data = 1 )
00606     : T_Histo_2D_PED( a_histo, copy_data )
00607     {}
00609   virtual ~T_ProfileHisto2D() {}
00610 
00611 public:
00614   void fill( double x, double y, double k  , double w = 1.0) {
00615     // Avoid checking the weight if it is one
00616     if ((w == 1.0) && (HTLlimits::isFinite(x))&&(HTLlimits::isFinite(y))
00617         &&(HTLlimits::isFinite(k)))
00618       mapped_bin(x,y).put(w,k); 
00619     else {
00620       // Otherwise check all 
00621       if (HTLlimits::isFinite(w)&&HTLlimits::isFinite(x)&&
00622           HTLlimits::isFinite(y)&&(HTLlimits::isFinite(k)))
00623         mapped_bin(x,y).put(w,k);             
00624       else
00625         {HTLlimits::classify(x);HTLlimits::classify(y);
00626         HTLlimits::classify(w);HTLlimits::classify(k);}
00627     }
00628   }
00629 
00631   double bin_center( Index i, Index j, Index p = 0 ) 
00632     { I_Histo::I_Bin_Location l(2);
00633     l[0]=i; l[1]=j; return H_Bin_Helper::bin_center( *this, p, l ); }
00635   double mean( Index p=0 ) { return H_Statistics::mean( *this, p ); }
00637   double rms(Index p=0) { return H_Statistics::rms(*this, mean(p), p); }
00638 public:
00642   Ref_Like_Current clone( int copy_data = 1 )
00643     {
00644       Ref_Like_Current h =
00645         H_T_NEW_CLUSTER0 Like_Current( *this, copy_data );
00646       return h;
00647     }
00652   Ref_Like_Current clone( H_T_CLUSTER1(a_place), int copy_data = 1 )
00653     { return H_T_NEW_CLUSTER1(a_place) Like_Current(*this, copy_data); }
00654 
00655 protected:
00656   virtual T_REF_I_Histo clone_( int copy_data = 1 )
00657     { return (T_REF_I_Histo) clone( copy_data ); }
00658   virtual T_REF_I_Histo clone_( H_T_CLUSTER1(a_place),
00659                                             int copy_data = 1 )
00660     { return (T_REF_I_Histo) clone( a_place, copy_data ); }
00661 public:
00663   Ref_Like_Current add( const Ref_Like_Current &other )
00664     {
00665       Ref_Like_Current h = (Ref_Like_Current &) other;
00666       if( partition_X().is_compatible_with( h->partition_X() )
00667           && partition_Y().is_compatible_with( h->partition_Y())) {
00668         H_BIN_UPDATE
00669           for( Index i = 0; i<bin_count()+extra_bin_count(); i++ )
00670             bins_[i].add( h->_bin(i) );
00671       } else {
00672         HTL_ERR("Incompatible partitions in add(..)" );
00673       }
00674       return H_T_THIS;
00675     }
00677   void add( const I_Histo &other ) { add_( other ); }
00679   Ref_Like_Current sub( const Ref_Like_Current &other )
00680     {
00681       Ref_Like_Current h = (Ref_Like_Current &) other;
00682       if( partition_X().is_compatible_with( h->partition_X() )
00683           && partition_Y().is_compatible_with( h->partition_Y())) {
00684         H_BIN_UPDATE
00685           for( Index i=0; i<bin_count()+extra_bin_count(); i++ )
00686             bins_[i].sub( h->_bin(i) );
00687       } else {
00688         HTL_ERR("Incompatible partitions in sub(..)" );
00689       }
00690       return H_T_THIS;
00691     }
00694   void sub( const I_Histo &other ) { sub_( other ); }
00696   Ref_Like_Current mul( const Ref_Like_Current &other )
00697     {
00698       Ref_Like_Current h = (Ref_Like_Current &) other;
00699       if( partition_X().is_compatible_with( h->partition_X() )
00700           && partition_Y().is_compatible_with( h->partition_Y())) {
00701         H_BIN_UPDATE
00702           for( Index i=0; i<bin_count()+extra_bin_count(); i++ )
00703             bins_[i].mul( h->_bin(i) );
00704       } else {
00705         HTL_ERR("Incompatible partitions in mul(..)" );
00706       }
00707       return H_T_THIS;
00708     }
00711   void mul( const I_Histo &other ) { mul_( other ); }
00713   Ref_Like_Current div( const Ref_Like_Current &other )
00714     {
00715       Ref_Like_Current h = (Ref_Like_Current &) other;
00716       if( partition_X().is_compatible_with( h->partition_X() )
00717           && partition_Y().is_compatible_with( h->partition_Y())) {
00718         H_BIN_UPDATE
00719           for( Index i=0; i<bin_count()+extra_bin_count(); i++ )
00720             bins_[i].div( h->_bin(i) );
00721       } else {
00722         HTL_ERR("Incompatible partitions in div(..)" );
00723       }
00724       return H_T_THIS;
00725     }
00728   void div( const I_Histo &other ) { div_( other ); }
00730   void add( double x ) { add_( x ); }
00732   void sub( double x ) { sub_( x ); }
00734   void mul( double x ) { mul_( x ); }
00736   void div( double x ) { div_( x ); }
00737 };
00738 
00743 class T_ProfileHisto2DVar: public T_Histo_2D_PUD
00744 {
00745 public:
00747   H_IID_IMPLEMENT( T_ProfileHisto2DVar );
00749   typedef T_ProfileHisto2DVar Like_Current;
00751   typedef H_T_REF( Like_Current )       Ref_Like_Current;
00752 public:
00770   T_ProfileHisto2DVar( const char *a_title
00771                                    , HTL_STD::vector<float> &some_points1
00772                                    , HTL_STD::vector<float> &some_points2
00773                                    , End_Point_Convention epc1 = RIGHT_OPEN
00774                                    , End_Point_Convention epc2 = RIGHT_OPEN )
00775     : H_H2D_U_EP( T_Histo_2D_PUD, a_title
00776                   , some_points1, epc1, some_points2, epc2 )
00777     {}
00778 
00780   T_ProfileHisto2DVar( const char *a_title
00781                                    , HTL_STD::vector<double> &some_points1
00782                                    , HTL_STD::vector<double> &some_points2
00783                                    , End_Point_Convention epc1 = RIGHT_OPEN
00784                                    , End_Point_Convention epc2 = RIGHT_OPEN )
00785     : H_H2D_U_EP( T_Histo_2D_PUD, a_title
00786                   , some_points1, epc1, some_points2, epc2 )
00787     {}
00788 
00790   T_ProfileHisto2DVar( I_Histo &a_histo, int copy_data = 1 )
00791     : T_Histo_2D_PUD( a_histo, copy_data )
00792     {}
00796   T_ProfileHisto2DVar(const I_Histo &a_histo, int copy_data = 1 )
00797     : T_Histo_2D_PUD( a_histo, copy_data )
00798     {}
00800   virtual ~T_ProfileHisto2DVar() {}
00801 
00802 public:
00805   void fill( double x, double y, double k  , double w = 1.0) {
00806     // Avoid checking the weight if it is one
00807     if ((w == 1.0) && (HTLlimits::isFinite(x))&&(HTLlimits::isFinite(y))
00808         &&(HTLlimits::isFinite(k)))
00809       mapped_bin(x,y).put(w,k); 
00810     else {
00811       // Otherwise check all 
00812       if (HTLlimits::isFinite(w)&&HTLlimits::isFinite(x)&&
00813           HTLlimits::isFinite(y)&&(HTLlimits::isFinite(k)))
00814         mapped_bin(x,y).put(w,k);             
00815       else
00816         {HTLlimits::classify(x);HTLlimits::classify(y);
00817         HTLlimits::classify(w);HTLlimits::classify(k);}
00818     }
00819   }
00820 
00822   double bin_center( Index i, Index j, Index p = 0 ) 
00823     { I_Histo::I_Bin_Location l(2);
00824     l[0]=i; l[1]=j; return H_Bin_Helper::bin_center( *this, p, l ); }
00826   double mean( Index p=0 ) { return H_Statistics::mean( *this, p ); }
00828   double rms(Index p=0) { return H_Statistics::rms(*this, mean(p), p); }
00829 public:
00833   Ref_Like_Current clone( int copy_data = 1 )
00834     {
00835       Ref_Like_Current h =
00836         H_T_NEW_CLUSTER0 Like_Current( *this, copy_data );
00837       return h;
00838     }
00843   Ref_Like_Current clone( H_T_CLUSTER1(a_place), int copy_data = 1 )
00844     { return H_T_NEW_CLUSTER1(a_place) Like_Current(*this, copy_data); }
00845 
00846 protected:
00847   virtual T_REF_I_Histo clone_( int copy_data = 1 )
00848     { return (T_REF_I_Histo) clone( copy_data ); }
00849   virtual T_REF_I_Histo clone_( H_T_CLUSTER1(a_place),
00850                                             int copy_data = 1 )
00851     { return (T_REF_I_Histo) clone( a_place, copy_data ); }
00852 public:
00854   Ref_Like_Current add( const Ref_Like_Current &other )
00855     {
00856       Ref_Like_Current h = (Ref_Like_Current &) other;
00857       if( partition_X().is_compatible_with( h->partition_X() )
00858           && partition_Y().is_compatible_with( h->partition_Y())) {
00859         H_BIN_UPDATE
00860           for( Index i = 0; i<bin_count()+extra_bin_count(); i++ )
00861             bins_[i].add( h->_bin(i) );
00862       } else {
00863         HTL_ERR("Incompatible partitions in add(..)" );
00864       }
00865       return H_T_THIS;
00866     }
00868   void add( const I_Histo &other ) { add_( other ); }
00870   Ref_Like_Current sub( const Ref_Like_Current &other )
00871     {
00872       Ref_Like_Current h = (Ref_Like_Current &) other;
00873       if( partition_X().is_compatible_with( h->partition_X() )
00874           && partition_Y().is_compatible_with( h->partition_Y())) {
00875         H_BIN_UPDATE
00876           for( Index i=0; i<bin_count()+extra_bin_count(); i++ )
00877             bins_[i].sub( h->_bin(i) );
00878       } else {
00879         HTL_ERR("Incompatible partitions in sub(..)" );
00880       }
00881       return H_T_THIS;
00882     }
00885   void sub( const I_Histo &other ) { sub_( other ); }
00887   Ref_Like_Current mul( const Ref_Like_Current &other )
00888     {
00889       Ref_Like_Current h = (Ref_Like_Current &) other;
00890       if( partition_X().is_compatible_with( h->partition_X() )
00891           && partition_Y().is_compatible_with( h->partition_Y())) {
00892         H_BIN_UPDATE
00893           for( Index i=0; i<bin_count()+extra_bin_count(); i++ )
00894             bins_[i].mul( h->_bin(i) );
00895       } else {
00896         HTL_ERR("Incompatible partitions in mul(..)" );
00897       }
00898       return H_T_THIS;
00899     }
00902   void mul( const I_Histo &other ) { mul_( other ); }
00904   Ref_Like_Current div( const Ref_Like_Current &other )
00905     {
00906       Ref_Like_Current h = (Ref_Like_Current &) other;
00907       if( partition_X().is_compatible_with( h->partition_X() )
00908           && partition_Y().is_compatible_with( h->partition_Y())) {
00909         H_BIN_UPDATE
00910           for( Index i=0; i<bin_count()+extra_bin_count(); i++ )
00911             bins_[i].div( h->_bin(i) );
00912       } else {
00913         HTL_ERR("Incompatible partitions in div(..)" );
00914       }
00915       return H_T_THIS;
00916     }
00919   void div( const I_Histo &other ) { div_( other ); }
00921   void add( double x ) { add_( x ); }
00923   void sub( double x ) { sub_( x ); }
00925   void mul( double x ) { mul_( x ); }
00927   void div( double x ) { div_( x ); }
00928 };
00929 
00930 #endif
00931 


Anaphe documentation generated by Doxygen (www.doxygen.org)