yoda is hosted by Hepforge, IPPP Durham
YODA - Yet more Objects for Data Analysis  1.7.2
YODA::Profile1D Class Reference

A one-dimensional profile histogram. More...

#include <Profile1D.h>

Inheritance diagram for YODA::Profile1D:
YODA::AnalysisObject

Public Types

typedef Profile1DAxis Axis
 Convenience typedefs. More...
 
typedef Axis::Bins Bins
 
typedef ProfileBin1D Bin
 
typedef std::tuple< double, double > FillType
 
typedef double BinType
 
typedef std::shared_ptr< Profile1DPtr
 
- Public Types inherited from YODA::AnalysisObject
typedef std::map< std::string, std::string > Annotations
 Collection type for annotations, as a string-string map. More...
 

Public Member Functions

size_t dim () const
 Fill dimension of this data object. More...
 
Constructors
 Profile1D (const std::string &path="", const std::string &title="")
 Default constructor. More...
 
 Profile1D (size_t nxbins, double xlower, double xupper, const std::string &path="", const std::string &title="")
 Constructor giving range and number of bins. More...
 
 Profile1D (const std::vector< double > &xbinedges, const std::string &path="", const std::string &title="")
 
 Profile1D (const Profile1D &p, const std::string &path="")
 Copy constructor with optional new path. More...
 
 Profile1D (const Scatter2D &s, const std::string &path="")
 Constructor from a Scatter2D's binning, with optional new path. More...
 
 Profile1D (const Histo1D &h, const std::string &path="")
 Constructor from a Histo1D's binning, with optional new path. More...
 
 Profile1D (const std::vector< ProfileBin1D > &bins, const Dbn2D &dbn_tot, const Dbn2D &dbn_uflow, const Dbn2D &dbn_oflow, const std::string &path="", const std::string &title="")
 State-setting constructor. More...
 
Profile1Doperator= (const Profile1D &p1)
 Assignment operator. More...
 
Profile1D clone () const
 Make a copy on the stack. More...
 
Profile1Dnewclone () const
 Make a copy on the heap, via 'new'. More...
 
Modifiers
virtual void fill (double x, double y, double weight=1.0, double fraction=1.0)
 Fill histo by value and weight. More...
 
void fill (const FillType &xs, double weight=1.0, double fraction=1.0)
 
virtual void fillBin (size_t i, double y, double weight=1.0, double fraction=1.0)
 Fill histo x bin i with the given y value and weight. More...
 
void reset ()
 Reset the histogram. More...
 
void scaleW (double scalefactor)
 Rescale as if all fill weights had been different by factor scalefactor. More...
 
void scaleY (double scalefactor)
 Rescale as if all y values had been different by factor scalefactor. More...
 
void mergeBins (size_t from, size_t to)
 Merge together the bin range with indices from from to to, inclusive. More...
 
void rebinBy (unsigned int n, size_t begin=0, size_t end=UINT_MAX)
 Merge every group of n bins, starting from the LHS. More...
 
void rebin (unsigned int n, size_t begin=0, size_t end=UINT_MAX)
 Overloaded alias for rebinBy. More...
 
void rebinTo (const std::vector< double > &newedges)
 Rebin to the given list of bin edges. More...
 
void rebin (const std::vector< double > &newedges)
 Overloaded alias for rebinTo. More...
 
void addBin (double xlow, double xhigh)
 Bin addition operator. More...
 
void addBins (const std::vector< double > binedges)
 Bin addition operator. More...
 
void addBin (const ProfileBin1D &b)
 Add a new bin, perhaps already populated: CAREFUL! More...
 
void addBins (const Bins &bins)
 Bins addition operator. More...
 
Bin accessors
size_t numBins () const
 Number of bins on this axis (not counting under/overflow) More...
 
double xMin () const
 Low edge of this histo's axis. More...
 
double xMax () const
 High edge of this histo's axis. More...
 
const std::vector< double > xEdges () const
 
std::vector< YODA::ProfileBin1D > & bins ()
 Access the bin vector. More...
 
const std::vector< YODA::ProfileBin1D > & bins () const
 Access the bin vector. More...
 
ProfileBin1Dbin (size_t index)
 Access a bin by index (non-const version) More...
 
const ProfileBin1Dbin (size_t index) const
 Access a bin by index (const version) More...
 
int binIndexAt (double x)
 Access a bin index by x-coordinate. More...
 
const ProfileBin1DbinAt (double x) const
 Access a bin by x-coordinate (const version) More...
 
Dbn2DtotalDbn ()
 Access summary distribution, including gaps and overflows (non-const version) More...
 
const Dbn2DtotalDbn () const
 Access summary distribution, including gaps and overflows (const version) More...
 
void setTotalDbn (const Dbn2D &dbn)
 Set summary distribution, mainly for persistency: CAREFUL! More...
 
Dbn2Dunderflow ()
 Access underflow (non-const version) More...
 
const Dbn2Dunderflow () const
 Access underflow (const version) More...
 
void setUnderflow (const Dbn2D &dbn)
 Set underflow distribution, mainly for persistency: CAREFUL! More...
 
Dbn2Doverflow ()
 Access overflow (non-const version) More...
 
const Dbn2Doverflow () const
 Access overflow (const version) More...
 
void setOverflow (const Dbn2D &dbn)
 Set overflow distribution, mainly for persistency: CAREFUL! More...
 
Whole histo data
double numEntries (bool includeoverflows=true) const
 Get the number of fills (fractional fills are possible) More...
 
double effNumEntries (bool includeoverflows=true) const
 Get the effective number of fills. More...
 
double sumW (bool includeoverflows=true) const
 Get sum of weights in histo. More...
 
double sumW2 (bool includeoverflows=true) const
 Get sum of squared weights in histo. More...
 
double xMean (bool includeoverflows=true) const
 Get the mean x. More...
 
double xVariance (bool includeoverflows=true) const
 Get the variance in x. More...
 
double xStdDev (bool includeoverflows=true) const
 Get the standard deviation in x. More...
 
double xStdErr (bool includeoverflows=true) const
 Get the standard error on <x> More...
 
double xRMS (bool includeoverflows=true) const
 Get the RMS in x. More...
 
Adding and subtracting histograms
Profile1Doperator+= (const Profile1D &toAdd)
 Add another profile to this one. More...
 
Profile1Doperator-= (const Profile1D &toSubtract)
 Subtract another profile from this one. More...
 
bool operator== (const Profile1D &other)
 
bool operator!= (const Profile1D &other)
 
- Public Member Functions inherited from YODA::AnalysisObject
 AnalysisObject ()
 Default constructor. More...
 
 AnalysisObject (const std::string &type, const std::string &path, const std::string &title="")
 Constructor giving a type, a path and an optional title. More...
 
 AnalysisObject (const std::string &type, const std::string &path, const AnalysisObject &ao, const std::string &title="")
 Constructor giving a type, a path, another AO to copy annotation from, and an optional title. More...
 
virtual ~AnalysisObject ()
 Default destructor. More...
 
virtual AnalysisObjectoperator= (const AnalysisObject &ao)
 Default copy assignment operator. More...
 
std::vector< std::string > annotations () const
 
bool hasAnnotation (const std::string &name) const
 Check if an annotation is defined. More...
 
const std::string & annotation (const std::string &name) const
 Get an annotation by name (as a string) More...
 
const std::string & annotation (const std::string &name, const std::string &defaultreturn) const
 Get an annotation by name (as a string) with a default in case the annotation is not found. More...
 
template<typename T >
const T annotation (const std::string &name) const
 Get an annotation by name (copied to another type) More...
 
template<typename T >
const T annotation (const std::string &name, const T &defaultreturn) const
 Get an annotation by name (copied to another type) with a default in case the annotation is not found. More...
 
void setAnnotation (const std::string &name, const std::string &value)
 Add or set a string-valued annotation by name. More...
 
void setAnnotation (const std::string &name, double value)
 Add or set a double-valued annotation by name. More...
 
void setAnnotation (const std::string &name, float value)
 Add or set a float-valued annotation by name. More...
 
void setAnnotation (const std::string &name, long double value)
 Add or set a long-double-valued annotation by name. More...
 
template<typename T >
void setAnnotation (const std::string &name, const T &value)
 Add or set an annotation by name (templated for remaining types) More...
 
void setAnnotations (const Annotations &anns)
 Set all annotations at once. More...
 
template<typename T >
void addAnnotation (const std::string &name, const T &value)
 Add or set an annotation by name. More...
 
void rmAnnotation (const std::string &name)
 Delete an annotation by name. More...
 
void clearAnnotations ()
 Delete an annotation by name. More...
 
const std::string title () const
 Get the AO title. More...
 
void setTitle (const std::string &title)
 Set the AO title. More...
 
const std::string path () const
 Get the AO path. More...
 
void setPath (const std::string &path)
 
const std::string name () const
 
virtual std::string type () const
 Get name of the analysis object type. More...
 

Detailed Description

A one-dimensional profile histogram.

Definition at line 33 of file Profile1D.h.

Member Typedef Documentation

◆ Axis

Convenience typedefs.

Definition at line 37 of file Profile1D.h.

◆ Bin

Definition at line 39 of file Profile1D.h.

◆ Bins

Definition at line 38 of file Profile1D.h.

◆ BinType

typedef double YODA::Profile1D::BinType

Definition at line 42 of file Profile1D.h.

◆ FillType

typedef std::tuple<double, double> YODA::Profile1D::FillType

Definition at line 41 of file Profile1D.h.

◆ Ptr

typedef std::shared_ptr<Profile1D> YODA::Profile1D::Ptr

Definition at line 43 of file Profile1D.h.

Constructor & Destructor Documentation

◆ Profile1D() [1/7]

YODA::Profile1D::Profile1D ( const std::string &  path = "",
const std::string &  title = "" 
)
inline

Default constructor.

Definition at line 50 of file Profile1D.h.

Referenced by clone(), newclone(), and Profile1D().

51  : AnalysisObject("Profile1D", path, title),
52  _axis()
53  { }
AnalysisObject()
Default constructor.
const std::string path() const
Get the AO path.
const std::string title() const
Get the AO title.

◆ Profile1D() [2/7]

YODA::Profile1D::Profile1D ( size_t  nxbins,
double  xlower,
double  xupper,
const std::string &  path = "",
const std::string &  title = "" 
)
inline

Constructor giving range and number of bins.

Definition at line 57 of file Profile1D.h.

59  : AnalysisObject("Profile1D", path, title),
60  _axis(nxbins, xlower, xupper)
61  { }
AnalysisObject()
Default constructor.
const std::string path() const
Get the AO path.
const std::string title() const
Get the AO title.

◆ Profile1D() [3/7]

YODA::Profile1D::Profile1D ( const std::vector< double > &  xbinedges,
const std::string &  path = "",
const std::string &  title = "" 
)
inline

Constructor giving explicit bin edges

For n bins, binedges.size() == n+1, the last one being the upper bound of the last bin

Definition at line 68 of file Profile1D.h.

References YODA::AnalysisObject::path(), and Profile1D().

70  : AnalysisObject("Profile1D", path, title),
71  _axis(xbinedges)
72  { }
AnalysisObject()
Default constructor.
const std::string path() const
Get the AO path.
const std::string title() const
Get the AO title.

◆ Profile1D() [4/7]

YODA::Profile1D::Profile1D ( const Profile1D p,
const std::string &  path = "" 
)

Copy constructor with optional new path.

Copy constructor with optional new path

Todo:
Also allow title setting from the constructor?

Definition at line 119 of file Profile1D.cc.

120  : AnalysisObject("Profile1D", (path.size() == 0) ? p.path() : path, p, p.title())
121  {
122  _axis = p._axis;
123  }
AnalysisObject()
Default constructor.
const std::string path() const
Get the AO path.

◆ Profile1D() [5/7]

YODA::Profile1D::Profile1D ( const Scatter2D s,
const std::string &  path = "" 
)

Constructor from a Scatter2D's binning, with optional new path.

Constructor from a Scatter2D's binning, with optional new path

Todo:
Also allow title setting from the constructor?

Definition at line 127 of file Profile1D.cc.

References bins(), and YODA::Scatter2D::points().

128  : AnalysisObject("Profile1D", (path.size() == 0) ? s.path() : path, s, s.title())
129  {
130  std::vector<ProfileBin1D> bins;
131  for (const Scatter2D::Point& p : s.points()) {
132  bins.push_back(ProfileBin1D(p.xMin(), p.xMax()));
133  }
134  _axis = Profile1DAxis(bins);
135  }
Axis1D< ProfileBin1D, Dbn2D > Profile1DAxis
Convenience typedef.
Definition: Profile1D.h:25
AnalysisObject()
Default constructor.
const std::string path() const
Get the AO path.
Point2D Point
Type of the native Point2D collection.
Definition: Scatter2D.h:28
std::vector< YODA::ProfileBin1D > & bins()
Access the bin vector.
Definition: Profile1D.h:235

◆ Profile1D() [6/7]

YODA::Profile1D::Profile1D ( const Histo1D h,
const std::string &  path = "" 
)

Constructor from a Histo1D's binning, with optional new path.

Constructor from a Histo1D's binning, with optional new path

Todo:
Also allow title setting from the constructor?

Definition at line 139 of file Profile1D.cc.

References YODA::Histo1D::bins(), and bins().

140  : AnalysisObject("Profile1D", (path.size() == 0) ? h.path() : path, h, h.title())
141  {
142  Bins bins;
143  for (const Histo1D::Bin& b : h.bins()) {
144  bins.push_back(ProfileBin1D(b.xMin(), b.xMax()));
145  }
146  _axis = Profile1DAxis(bins);
147 
148  }
Axis1D< ProfileBin1D, Dbn2D > Profile1DAxis
Convenience typedef.
Definition: Profile1D.h:25
AnalysisObject()
Default constructor.
const std::string path() const
Get the AO path.
std::vector< YODA::ProfileBin1D > & bins()
Access the bin vector.
Definition: Profile1D.h:235
HistoBin1D Bin
Definition: Histo1D.h:32
Axis::Bins Bins
Definition: Profile1D.h:38

◆ Profile1D() [7/7]

YODA::Profile1D::Profile1D ( const std::vector< ProfileBin1D > &  bins,
const Dbn2D dbn_tot,
const Dbn2D dbn_uflow,
const Dbn2D dbn_oflow,
const std::string &  path = "",
const std::string &  title = "" 
)
inline

State-setting constructor.

Intended principally for internal persistency use.

Definition at line 93 of file Profile1D.h.

96  : AnalysisObject("Profile1D", path, title),
97  _axis(bins, dbn_tot, dbn_uflow, dbn_oflow)
98  { }
AnalysisObject()
Default constructor.
const std::string path() const
Get the AO path.
const std::string title() const
Get the AO title.

Member Function Documentation

◆ addBin() [1/2]

void YODA::Profile1D::addBin ( double  xlow,
double  xhigh 
)
inline

Bin addition operator.

Definition at line 188 of file Profile1D.h.

188  {
189  _axis.addBin(xlow, xhigh);
190  }

◆ addBin() [2/2]

void YODA::Profile1D::addBin ( const ProfileBin1D b)
inline

Add a new bin, perhaps already populated: CAREFUL!

Definition at line 203 of file Profile1D.h.

203 { _axis.addBin(b); }

◆ addBins() [1/2]

void YODA::Profile1D::addBins ( const std::vector< double >  binedges)
inline

Bin addition operator.

Definition at line 193 of file Profile1D.h.

193  {
194  _axis.addBins(binedges);
195  }

◆ addBins() [2/2]

void YODA::Profile1D::addBins ( const Bins bins)
inline

Bins addition operator.

Add multiple bins without resetting

Definition at line 208 of file Profile1D.h.

208  {
209  _axis.addBins(bins);
210  }
std::vector< YODA::ProfileBin1D > & bins()
Access the bin vector.
Definition: Profile1D.h:235

◆ bin() [1/2]

ProfileBin1D& YODA::Profile1D::bin ( size_t  index)
inline

Access a bin by index (non-const version)

Definition at line 242 of file Profile1D.h.

Referenced by YODA::chi2(), YODA::divide(), scaleY(), YODA::toTH1D(), and YODA::toTProfile().

242 { return _axis.bins()[index]; }

◆ bin() [2/2]

const ProfileBin1D& YODA::Profile1D::bin ( size_t  index) const
inline

Access a bin by index (const version)

Definition at line 244 of file Profile1D.h.

244 { return _axis.bins()[index]; }

◆ binAt()

const ProfileBin1D& YODA::Profile1D::binAt ( double  x) const
inline

Access a bin by x-coordinate (const version)

Definition at line 250 of file Profile1D.h.

Referenced by YODA::toTH1D(), and YODA::toTProfile().

250 { return _axis.binAt(x); }

◆ binIndexAt()

int YODA::Profile1D::binIndexAt ( double  x)
inline

Access a bin index by x-coordinate.

Definition at line 247 of file Profile1D.h.

247 { return _axis.binIndexAt(x); }

◆ bins() [1/2]

std::vector<YODA::ProfileBin1D>& YODA::Profile1D::bins ( )
inline

Access the bin vector.

Definition at line 235 of file Profile1D.h.

Referenced by YODA::Histo1D::Histo1D(), YODA::mkScatter(), numBins(), Profile1D(), and scaleY().

235 { return _axis.bins(); }

◆ bins() [2/2]

const std::vector<YODA::ProfileBin1D>& YODA::Profile1D::bins ( ) const
inline

Access the bin vector.

Definition at line 238 of file Profile1D.h.

238 { return _axis.bins(); }

◆ clone()

Profile1D YODA::Profile1D::clone ( ) const
inline

Make a copy on the stack.

Definition at line 109 of file Profile1D.h.

References Profile1D().

109  {
110  return Profile1D(*this);
111  }
Profile1D(const std::string &path="", const std::string &title="")
Default constructor.
Definition: Profile1D.h:50

◆ dim()

size_t YODA::Profile1D::dim ( ) const
inlinevirtual

Fill dimension of this data object.

Implements YODA::AnalysisObject.

Definition at line 122 of file Profile1D.h.

References fill().

122 { return 1; }

◆ effNumEntries()

double YODA::Profile1D::effNumEntries ( bool  includeoverflows = true) const

Get the effective number of fills.

Definition at line 57 of file Profile1D.cc.

Referenced by setOverflow().

57  {
58  if (includeoverflows) return totalDbn().effNumEntries();
59  double n = 0;
60  for (const Bin& b : bins()) n += b.effNumEntries();
61  return n;
62  }
ProfileBin1D Bin
Definition: Profile1D.h:39
double effNumEntries() const
Effective number of entries .
Definition: Dbn2D.h:171
Dbn2D & totalDbn()
Access summary distribution, including gaps and overflows (non-const version)
Definition: Profile1D.h:254
std::vector< YODA::ProfileBin1D > & bins()
Access the bin vector.
Definition: Profile1D.h:235

◆ fill() [1/2]

void YODA::Profile1D::fill ( double  x,
double  y,
double  weight = 1.0,
double  fraction = 1.0 
)
virtual

Fill histo by value and weight.

Unify this with Histo1D's version, when binning and inheritance are reworked

Todo:
Replace try block with a check that there is a bin at x

Definition at line 16 of file Profile1D.cc.

References YODA::inRange().

Referenced by dim(), and fill().

16  {
17  if ( std::isnan(x) ) throw RangeError("X is NaN");
18  if ( std::isnan(y) ) throw RangeError("Y is NaN");
19 
20  // Fill the overall distribution
21  _axis.totalDbn().fill(x, y, weight, fraction);
22 
23  // Fill the bins and overflows
25  if (inRange(x, _axis.xMin(), _axis.xMax())) {
26  try {
28  _binAt(x).fill(x, y, weight, fraction);
29  } catch (const RangeError& re) { }
30  } else if (x < _axis.xMin()) {
31  _axis.underflow().fill(x, y, weight, fraction);
32  } else if (x >= _axis.xMax()) {
33  _axis.overflow().fill(x, y, weight, fraction);
34  }
35 
36  // Lock the axis now that a fill has happened
37  _axis._setLock(true);
38  }
bool inRange(NUM value, NUM low, NUM high, RangeBoundary lowbound=CLOSED, RangeBoundary highbound=OPEN)
Determine if value is in the range low to high, for floating point numbers.
Definition: MathUtils.h:155

◆ fill() [2/2]

void YODA::Profile1D::fill ( const FillType xs,
double  weight = 1.0,
double  fraction = 1.0 
)
inline

Definition at line 130 of file Profile1D.h.

References fill(), and fillBin().

130  {
131  fill(std::get<0>(xs), std::get<1>(xs), weight, fraction);
132  }
virtual void fill(double x, double y, double weight=1.0, double fraction=1.0)
Fill histo by value and weight.
Definition: Profile1D.cc:16

◆ fillBin()

void YODA::Profile1D::fillBin ( size_t  i,
double  y,
double  weight = 1.0,
double  fraction = 1.0 
)
virtual

Fill histo x bin i with the given y value and weight.

Definition at line 41 of file Profile1D.cc.

Referenced by fill().

41  {
42  fill(bin(i).xMid(), y, weight, fraction);
43  }
virtual void fill(double x, double y, double weight=1.0, double fraction=1.0)
Fill histo by value and weight.
Definition: Profile1D.cc:16
ProfileBin1D & bin(size_t index)
Access a bin by index (non-const version)
Definition: Profile1D.h:242

◆ mergeBins()

void YODA::Profile1D::mergeBins ( size_t  from,
size_t  to 
)
inline

Merge together the bin range with indices from from to to, inclusive.

Definition at line 163 of file Profile1D.h.

163  {
164  _axis.mergeBins(from, to);
165  }

◆ newclone()

Profile1D* YODA::Profile1D::newclone ( ) const
inlinevirtual

Make a copy on the heap, via 'new'.

Implements YODA::AnalysisObject.

Definition at line 114 of file Profile1D.h.

References Profile1D().

114  {
115  return new Profile1D(*this);
116  }
Profile1D(const std::string &path="", const std::string &title="")
Default constructor.
Definition: Profile1D.h:50

◆ numBins()

size_t YODA::Profile1D::numBins ( ) const
inline

Number of bins on this axis (not counting under/overflow)

Definition at line 219 of file Profile1D.h.

References bins().

Referenced by YODA::chi2(), YODA::divide(), YODA::mkScatter(), YODA::toTH1D(), and YODA::toTProfile().

219 { return bins().size(); }
std::vector< YODA::ProfileBin1D > & bins()
Access the bin vector.
Definition: Profile1D.h:235

◆ numEntries()

double YODA::Profile1D::numEntries ( bool  includeoverflows = true) const

Get the number of fills (fractional fills are possible)

Todo:
Add integrals? Or are they too ambiguous to make a core function?

Definition at line 49 of file Profile1D.cc.

Referenced by setOverflow().

49  {
50  if (includeoverflows) return totalDbn().numEntries();
51  unsigned long n = 0;
52  for (const Bin& b : bins()) n += b.numEntries();
53  return n;
54  }
ProfileBin1D Bin
Definition: Profile1D.h:39
Dbn2D & totalDbn()
Access summary distribution, including gaps and overflows (non-const version)
Definition: Profile1D.h:254
std::vector< YODA::ProfileBin1D > & bins()
Access the bin vector.
Definition: Profile1D.h:235
double numEntries() const
Number of entries (number of times fill was called, ignoring weights)
Definition: Dbn2D.h:166

◆ operator!=()

bool YODA::Profile1D::operator!= ( const Profile1D other)
inline

Definition at line 337 of file Profile1D.h.

References operator==().

337  {
338  return ! operator == (other);
339  }
bool operator==(const Profile1D &other)
Definition: Profile1D.h:333

◆ operator+=()

Profile1D& YODA::Profile1D::operator+= ( const Profile1D toAdd)
inline

Add another profile to this one.

Definition at line 320 of file Profile1D.h.

References YODA::AnalysisObject::hasAnnotation(), and YODA::AnalysisObject::rmAnnotation().

320  {
321  if (hasAnnotation("ScaledBy")) rmAnnotation("ScaledBy");
322  _axis += toAdd._axis;
323  return *this;
324  }
void rmAnnotation(const std::string &name)
Delete an annotation by name.
bool hasAnnotation(const std::string &name) const
Check if an annotation is defined.

◆ operator-=()

Profile1D& YODA::Profile1D::operator-= ( const Profile1D toSubtract)
inline

Subtract another profile from this one.

Definition at line 327 of file Profile1D.h.

References YODA::AnalysisObject::hasAnnotation(), and YODA::AnalysisObject::rmAnnotation().

327  {
328  if (hasAnnotation("ScaledBy")) rmAnnotation("ScaledBy");
329  _axis -= toSubtract._axis;
330  return *this;
331  }
void rmAnnotation(const std::string &name)
Delete an annotation by name.
bool hasAnnotation(const std::string &name) const
Check if an annotation is defined.

◆ operator=()

Profile1D& YODA::Profile1D::operator= ( const Profile1D p1)
inline

Assignment operator.

Definition at line 102 of file Profile1D.h.

References YODA::AnalysisObject::operator=().

102  {
103  AnalysisObject::operator = (p1); //< AO treatment of paths etc.
104  _axis = p1._axis;
105  return *this;
106  }
virtual AnalysisObject & operator=(const AnalysisObject &ao)
Default copy assignment operator.

◆ operator==()

bool YODA::Profile1D::operator== ( const Profile1D other)
inline

Definition at line 333 of file Profile1D.h.

Referenced by operator!=().

333  {
334  return _axis == other._axis;
335  }

◆ overflow() [1/2]

Dbn2D& YODA::Profile1D::overflow ( )
inline

Access overflow (non-const version)

Definition at line 270 of file Profile1D.h.

Referenced by YODA::toTH1D(), and YODA::toTProfile().

270 { return _axis.overflow(); }

◆ overflow() [2/2]

const Dbn2D& YODA::Profile1D::overflow ( ) const
inline

Access overflow (const version)

Definition at line 272 of file Profile1D.h.

272 { return _axis.overflow(); }

◆ rebin() [1/2]

void YODA::Profile1D::rebin ( unsigned int  n,
size_t  begin = 0,
size_t  end = UINT_MAX 
)
inline

Overloaded alias for rebinBy.

Definition at line 173 of file Profile1D.h.

References rebinBy().

173  {
174  rebinBy(n, begin, end);
175  }
void rebinBy(unsigned int n, size_t begin=0, size_t end=UINT_MAX)
Merge every group of n bins, starting from the LHS.
Definition: Profile1D.h:169

◆ rebin() [2/2]

void YODA::Profile1D::rebin ( const std::vector< double > &  newedges)
inline

Overloaded alias for rebinTo.

Definition at line 182 of file Profile1D.h.

References rebinTo().

182  {
183  rebinTo(newedges);
184  }
void rebinTo(const std::vector< double > &newedges)
Rebin to the given list of bin edges.
Definition: Profile1D.h:178

◆ rebinBy()

void YODA::Profile1D::rebinBy ( unsigned int  n,
size_t  begin = 0,
size_t  end = UINT_MAX 
)
inline

Merge every group of n bins, starting from the LHS.

Definition at line 169 of file Profile1D.h.

Referenced by rebin().

169  {
170  _axis.rebinBy(n, begin, end);
171  }

◆ rebinTo()

void YODA::Profile1D::rebinTo ( const std::vector< double > &  newedges)
inline

Rebin to the given list of bin edges.

Definition at line 178 of file Profile1D.h.

Referenced by rebin().

178  {
179  _axis.rebinTo(newedges);
180  }

◆ reset()

void YODA::Profile1D::reset ( )
inlinevirtual

Reset the histogram.

Keep the binning but set all bin contents and related quantities to zero

Implements YODA::AnalysisObject.

Definition at line 141 of file Profile1D.h.

141  {
142  _axis.reset();
143  }

◆ scaleW()

void YODA::Profile1D::scaleW ( double  scalefactor)
inline

Rescale as if all fill weights had been different by factor scalefactor.

Definition at line 147 of file Profile1D.h.

147  {
148  _axis.scaleW(scalefactor);
149  }

◆ scaleY()

void YODA::Profile1D::scaleY ( double  scalefactor)
inline

Rescale as if all y values had been different by factor scalefactor.

Definition at line 153 of file Profile1D.h.

References bin(), bins(), and YODA::ProfileBin1D::scaleY().

153  {
154  _axis.totalDbn().scaleY(scalefactor);
155  _axis.overflow().scaleY(scalefactor);
156  _axis.underflow().scaleY(scalefactor);
157  for (size_t i = 0; i < bins().size(); ++i)
158  bin(i).scaleY(scalefactor);
159  }
std::vector< YODA::ProfileBin1D > & bins()
Access the bin vector.
Definition: Profile1D.h:235
void scaleY(double ay)
Definition: ProfileBin1D.h:90
ProfileBin1D & bin(size_t index)
Access a bin by index (non-const version)
Definition: Profile1D.h:242

◆ setOverflow()

void YODA::Profile1D::setOverflow ( const Dbn2D dbn)
inline

Set overflow distribution, mainly for persistency: CAREFUL!

Definition at line 274 of file Profile1D.h.

References effNumEntries(), numEntries(), sumW(), sumW2(), xMean(), and xVariance().

274 { _axis.setOverflow(dbn); }

◆ setTotalDbn()

void YODA::Profile1D::setTotalDbn ( const Dbn2D dbn)
inline

Set summary distribution, mainly for persistency: CAREFUL!

Definition at line 258 of file Profile1D.h.

258 { _axis.setTotalDbn(dbn); }

◆ setUnderflow()

void YODA::Profile1D::setUnderflow ( const Dbn2D dbn)
inline

Set underflow distribution, mainly for persistency: CAREFUL!

Definition at line 266 of file Profile1D.h.

266 { _axis.setUnderflow(dbn); }

◆ sumW()

double YODA::Profile1D::sumW ( bool  includeoverflows = true) const

Get sum of weights in histo.

Definition at line 65 of file Profile1D.cc.

Referenced by setOverflow().

65  {
66  if (includeoverflows) return _axis.totalDbn().sumW();
67  double sumw = 0;
68  for (const Bin& b : bins()) sumw += b.sumW();
69  return sumw;
70  }
ProfileBin1D Bin
Definition: Profile1D.h:39
std::vector< YODA::ProfileBin1D > & bins()
Access the bin vector.
Definition: Profile1D.h:235

◆ sumW2()

double YODA::Profile1D::sumW2 ( bool  includeoverflows = true) const

Get sum of squared weights in histo.

Definition at line 73 of file Profile1D.cc.

Referenced by setOverflow().

73  {
74  if (includeoverflows) return _axis.totalDbn().sumW2();
75  double sumw2 = 0;
76  for (const Bin& b : bins()) sumw2 += b.sumW2();
77  return sumw2;
78  }
ProfileBin1D Bin
Definition: Profile1D.h:39
std::vector< YODA::ProfileBin1D > & bins()
Access the bin vector.
Definition: Profile1D.h:235

◆ totalDbn() [1/2]

Dbn2D& YODA::Profile1D::totalDbn ( )
inline

Access summary distribution, including gaps and overflows (non-const version)

Definition at line 254 of file Profile1D.h.

254 { return _axis.totalDbn(); }

◆ totalDbn() [2/2]

const Dbn2D& YODA::Profile1D::totalDbn ( ) const
inline

Access summary distribution, including gaps and overflows (const version)

Definition at line 256 of file Profile1D.h.

256 { return _axis.totalDbn(); }

◆ underflow() [1/2]

Dbn2D& YODA::Profile1D::underflow ( )
inline

Access underflow (non-const version)

Definition at line 262 of file Profile1D.h.

Referenced by YODA::toTH1D(), and YODA::toTProfile().

262 { return _axis.underflow(); }

◆ underflow() [2/2]

const Dbn2D& YODA::Profile1D::underflow ( ) const
inline

Access underflow (const version)

Definition at line 264 of file Profile1D.h.

264 { return _axis.underflow(); }

◆ xEdges()

const std::vector<double> YODA::Profile1D::xEdges ( ) const
inline

All bin edges on this histo's axis

Note
This only returns the finite edges, i.e. -inf and +inf are removed
Todo:
Make the +-inf stripping controllable by a default-valued bool arg

Definition at line 231 of file Profile1D.h.

231 { return _axis.xEdges(); }

◆ xMax()

double YODA::Profile1D::xMax ( ) const
inline

High edge of this histo's axis.

Definition at line 225 of file Profile1D.h.

225 { return _axis.xMax(); }

◆ xMean()

double YODA::Profile1D::xMean ( bool  includeoverflows = true) const

Get the mean x.

Definition at line 83 of file Profile1D.cc.

References YODA::Dbn2D::xMean().

Referenced by setOverflow().

83  {
84  if (includeoverflows) return _axis.totalDbn().xMean();
85  Dbn2D dbn;
86  for (const ProfileBin1D& b : bins()) dbn += b.dbn();
87  return dbn.xMean();
88  }
std::vector< YODA::ProfileBin1D > & bins()
Access the bin vector.
Definition: Profile1D.h:235

◆ xMin()

double YODA::Profile1D::xMin ( ) const
inline

Low edge of this histo's axis.

Definition at line 222 of file Profile1D.h.

222 { return _axis.xMin(); }

◆ xRMS()

double YODA::Profile1D::xRMS ( bool  includeoverflows = true) const

Get the RMS in x.

Definition at line 107 of file Profile1D.cc.

References YODA::Dbn2D::xRMS().

Referenced by xStdDev().

107  {
108  if (includeoverflows) return _axis.totalDbn().xRMS();
109  Dbn2D dbn;
110  for (const ProfileBin1D& b : bins()) dbn += b.dbn();
111  return dbn.xRMS();
112  }
std::vector< YODA::ProfileBin1D > & bins()
Access the bin vector.
Definition: Profile1D.h:235

◆ xStdDev()

double YODA::Profile1D::xStdDev ( bool  includeoverflows = true) const
inline

Get the standard deviation in x.

Definition at line 303 of file Profile1D.h.

References xRMS(), xStdErr(), and xVariance().

303  {
304  return std::sqrt(xVariance(includeoverflows));
305  }
double xVariance(bool includeoverflows=true) const
Get the variance in x.
Definition: Profile1D.cc:91

◆ xStdErr()

double YODA::Profile1D::xStdErr ( bool  includeoverflows = true) const

Get the standard error on <x>

Definition at line 99 of file Profile1D.cc.

References YODA::Dbn2D::xStdErr().

Referenced by xStdDev().

99  {
100  if (includeoverflows) return _axis.totalDbn().xStdErr();
101  Dbn2D dbn;
102  for (const ProfileBin1D& b : bins()) dbn += b.dbn();
103  return dbn.xStdErr();
104  }
std::vector< YODA::ProfileBin1D > & bins()
Access the bin vector.
Definition: Profile1D.h:235

◆ xVariance()

double YODA::Profile1D::xVariance ( bool  includeoverflows = true) const

Get the variance in x.

Definition at line 91 of file Profile1D.cc.

References YODA::Dbn2D::xVariance().

Referenced by setOverflow(), and xStdDev().

91  {
92  if (includeoverflows) return _axis.totalDbn().xVariance();
93  Dbn2D dbn;
94  for (const ProfileBin1D& b : bins()) dbn += b.dbn();
95  return dbn.xVariance();
96  }
std::vector< YODA::ProfileBin1D > & bins()
Access the bin vector.
Definition: Profile1D.h:235

The documentation for this class was generated from the following files: