|
[yoda-svn] r246 - in trunk: . include/YODA srcblackhole at projects.hepforge.org blackhole at projects.hepforge.orgMon Aug 15 19:15:06 BST 2011
Author: buckley Date: Mon Aug 15 19:15:05 2011 New Revision: 246 Log: Inlining all functions in ProfileBin2D. Deleted: trunk/src/ProfileBin1D.cc Modified: trunk/ChangeLog trunk/TODO trunk/include/YODA/ProfileBin1D.h trunk/src/Makefile.am Modified: trunk/ChangeLog ============================================================================== --- trunk/ChangeLog Mon Aug 15 19:09:28 2011 (r245) +++ trunk/ChangeLog Mon Aug 15 19:15:05 2011 (r246) @@ -1,6 +1,7 @@ 2011-08-15 Andy Buckley <andy at insectnation.org> - * Inlining all functions in HistoBin1D and HistoBin2D. + * Inlining all functions in HistoBin1D, ProfileBin1D, and + HistoBin2D. * Converting Dbn2D to be composed of two Dbn1Ds and a cross-term. Also tidying the interfaces of the 2D classes and the Modified: trunk/TODO ============================================================================== --- trunk/TODO Mon Aug 15 19:09:28 2011 (r245) +++ trunk/TODO Mon Aug 15 19:15:05 2011 (r246) @@ -25,7 +25,7 @@ * Implement hierarchy-cascading state-setting constructor for Histo2D. (MICHAL) -* Move micro-functions to be inline in the headers for HistoBin2D.cc, Bin1D.cc, +* Move micro-functions to be inline in the header: still needed for Bin1D.cc, and probably some others. (AB) * Use state-setting constructors for Histo and Profile persistency via the Modified: trunk/include/YODA/ProfileBin1D.h ============================================================================== --- trunk/include/YODA/ProfileBin1D.h Mon Aug 15 19:09:28 2011 (r245) +++ trunk/include/YODA/ProfileBin1D.h Mon Aug 15 19:15:05 2011 (r246) @@ -31,15 +31,22 @@ //@{ /// Constructor giving bin low and high edges. - ProfileBin1D(double lowedge, double highedge); + ProfileBin1D(double lowedge, double highedge) + : Bin1D(lowedge, highedge) + { } /// Constructor giving bin low and high edges as a pair. - ProfileBin1D(const std::pair<double,double>& edges); + ProfileBin1D(const std::pair<double,double>& edges) + : Bin1D(edges) + { } /// @brief Init a profile bin with all the components of a fill history. /// Mainly intended for internal persistency use. ProfileBin1D(double lowedge, double highedge, - const Dbn1D& dbnx, const Dbn1D& dbny); + const Dbn1D& dbnx, const Dbn1D& dbny) + : Bin1D(lowedge, highedge, dbnx), + _ydbn(dbny) + { } //@} @@ -47,14 +54,24 @@ /// @name Modifiers //@{ - /// Fill histo by value and weight. - void fill(double x, double d, double weight=1.0); + /// Fill histo by x and y values and weight. + void fill(double x, double d, double weight=1.0) { + assert( _edges.first < _edges.second ); + assert( x >= _edges.first && x < _edges.second ); + _xdbn.fill(x, weight); + _ydbn.fill(d, weight); + } - /// Fill histo with @a weight at bin midpoint. - void fillBin(double d, double weight=1.0); + /// Fill histo with @a weight and y-value @c d at x = bin midpoint. + void fillBin(double d, double weight=1.0) { + fill(midpoint(), d, weight); + } /// Reset the bin. - void reset(); + void reset() { + Bin1D::reset(); + _ydbn.reset(); + } /// Rescale as if all fill weights had been different by factor @a scalefactor. void scaleW(double scalefactor) { @@ -105,10 +122,18 @@ protected: /// Add two bins (internal, explicitly named version) - ProfileBin1D& add(const ProfileBin1D&); + ProfileBin1D& add(const ProfileBin1D& pb) { + Bin1D::add(pb); + _ydbn += pb._ydbn; + return *this; + } /// Subtract one bin from another (internal, explicitly named version) - ProfileBin1D& subtract(const ProfileBin1D&); + ProfileBin1D& subtract(const ProfileBin1D& pb) { + Bin1D::subtract(pb); + _ydbn -= pb._ydbn; + return *this; + } public: @@ -133,9 +158,18 @@ }; - ProfileBin1D operator + (const ProfileBin1D& a, const ProfileBin1D& b); + inline ProfileBin1D operator + (const ProfileBin1D& a, const ProfileBin1D& b) { + ProfileBin1D rtn(a); + rtn += a; + return rtn; + } + + inline ProfileBin1D operator - (const ProfileBin1D& a, const ProfileBin1D& b) { + ProfileBin1D rtn(a); + rtn -= a; + return rtn; + } - ProfileBin1D operator - (const ProfileBin1D& a, const ProfileBin1D& b); } Modified: trunk/src/Makefile.am ============================================================================== --- trunk/src/Makefile.am Mon Aug 15 19:09:28 2011 (r245) +++ trunk/src/Makefile.am Mon Aug 15 19:15:05 2011 (r246) @@ -5,7 +5,6 @@ libYODA_la_SOURCES = \ Dbn1D.cc \ Bin1D.cc \ - ProfileBin1D.cc \ Bin2D.cc \ Histo1D.cc \ Histo2D.cc \
More information about the yoda-svn mailing list |