9 #ifndef LWH_HistogramFactory_H 10 #define LWH_HistogramFactory_H 15 #include "AIHistogramFactory.h" 16 #include "Histogram1D.h" 17 #include "Histogram2D.h" 53 IManagedObject * mo =
dynamic_cast<IManagedObject *
>(hist);
54 if ( !mo )
return false;
55 return tree->rm(tree->findPath(*mo));
62 int = -1,
const std::string & =
"") {
63 return error<ICloud1D>(
"ICloud1D");
70 return error<ICloud1D>(
"ICloud1D");
76 ICloud1D *
createCopy(
const std::string &,
const ICloud1D &) {
77 return error<ICloud1D>(
"ICloud1D");
83 ICloud2D *
createCloud2D(
const std::string &,
const std::string &,
int = -1,
84 const std::string & =
"") {
85 return error<ICloud2D>(
"ICloud2D");
93 return error<ICloud2D>(
"ICloud2D");
99 ICloud2D *
createCopy(
const std::string &,
const ICloud2D &) {
100 return error<ICloud2D>(
"ICloud2D");
106 ICloud3D *
createCloud3D(
const std::string &,
const std::string &,
int = -1,
107 const std::string & =
"") {
108 return error<ICloud3D>(
"ICloud3D");
115 return error<ICloud3D>(
"ICloud3D");
121 ICloud3D *
createCopy(
const std::string &,
const ICloud3D &) {
122 return error<ICloud3D>(
"ICloud3D");
143 int nBins,
double lowerEdge,
double upperEdge,
144 const std::string & =
"") {
147 if ( !tree->insert(path, hist) ) {
150 throw std::runtime_error(
"LWH could not create histogram '" 170 int nBins,
double lowerEdge,
double upperEdge) {
171 std::string title = pathAndTitle.substr(pathAndTitle.rfind(
'/') + 1);
172 return createHistogram1D(pathAndTitle, title, nBins, lowerEdge, upperEdge);
190 const std::vector<double> & binEdges,
191 const std::string & =
"") {
194 if ( !tree->insert(path, hist) ) {
197 throw std::runtime_error(
"LWH could not create histogram '" 214 createCopy(
const std::string & path,
const IHistogram1D & hist) {
216 h->
setTitle(path.substr(path.rfind(
'/') + 1));
217 if ( !tree->insert(path, h) ) {
220 throw std::runtime_error(
"LWH could not create a copy of histogram '" 221 + hist.title() +
"'." );
231 int nx,
double xlo,
double xup,
232 int ny,
double ylo,
double yup,
233 const std::string & =
"") {
236 if ( !tree->insert(path, hist) ) {
239 throw std::runtime_error(
"LWH could not create histogram '" 249 int nx,
double xlo,
double xup,
250 int ny,
double ylo,
double yup) {
251 std::string title = pathAndTitle.substr(pathAndTitle.rfind(
'/') + 1);
252 return createHistogram2D(pathAndTitle, title, nx, xlo, xup, ny, ylo, yup);
260 const std::vector<double> & xedges,
261 const std::vector<double> & yedges,
262 const std::string & =
"") {
265 if ( !tree->insert(path, hist) ) {
268 throw std::runtime_error(
"LWH could not create histogram '" 278 createCopy(
const std::string & path,
const IHistogram2D & hist) {
280 h->
setTitle(path.substr(path.rfind(
'/') + 1));
281 if ( !tree->insert(path, h) ) {
284 throw std::runtime_error(
"LWH could not create a copy of histogram '" 285 + hist.title() +
"'." );
294 int,
double,
double,
int,
double,
double,
296 const std::string & =
"") {
297 return error<IHistogram3D>(
"IHistogram3D");
304 int,
double,
double,
int,
double,
double) {
305 return error<IHistogram3D>(
"IHistogram3D");
312 const std::vector<double> &,
313 const std::vector<double> &,
314 const std::vector<double> &,
315 const std::string & =
"") {
316 return error<IHistogram3D>(
"IHistogram3D");
322 IHistogram3D *
createCopy(
const std::string &,
const IHistogram3D &) {
323 return error<IHistogram3D>(
"IHistogram3D");
330 int,
double,
double,
const std::string & =
"") {
331 return error<IProfile1D>(
"IProfile1D");
338 int,
double,
double,
double,
double,
339 const std::string & =
"") {
340 return error<IProfile1D>(
"IProfile1D");
347 const std::vector<double> &,
348 const std::string & =
"") {
349 return error<IProfile1D>(
"IProfile1D");
356 const std::vector<double> &,
double,
double,
357 const std::string & =
"") {
358 return error<IProfile1D>(
"IProfile1D");
365 return error<IProfile1D>(
"IProfile1D");
372 int,
double,
double,
double,
double) {
373 return error<IProfile1D>(
"IProfile1D");
379 IProfile1D *
createCopy(
const std::string &,
const IProfile1D &) {
380 return error<IProfile1D>(
"IProfile1D");
387 int,
double,
double,
int,
double,
double,
388 const std::string & =
"") {
389 return error<IProfile2D>(
"IProfile2D");
396 int,
double,
double,
int,
397 double,
double,
double,
double,
398 const std::string & =
"") {
399 return error<IProfile2D>(
"IProfile2D");
406 const std::vector<double> &,
407 const std::vector<double> &,
408 const std::string & =
"") {
409 return error<IProfile2D>(
"IProfile2D");
416 const std::vector<double> &,
417 const std::vector<double> &,
418 double,
double,
const std::string & =
"") {
419 return error<IProfile2D>(
"IProfile2D");
426 int,
double,
double) {
427 return error<IProfile2D>(
"IProfile2D");
434 int,
double,
double,
double,
double) {
435 return error<IProfile2D>(
"IProfile2D");
441 IProfile2D *
createCopy(
const std::string &,
const IProfile2D &) {
442 return error<IProfile2D>(
"IProfile2D");
458 if ( !checkBins(hist1, hist2) )
return 0;
460 h->
setTitle(path.substr(path.rfind(
'/') + 1));
462 if ( !tree->insert(path, h) )
return 0;
477 IHistogram1D *
add(
const std::string & path,
478 const IHistogram1D & hist1,
const IHistogram1D & hist2) {
479 return add(path, dynamic_cast<const Histogram1D &>(hist1),
480 dynamic_cast<const Histogram1D &>(hist2));
496 if ( !checkBins(h1, h2) )
return 0;
498 h->
setTitle(path.substr(path.rfind(
'/') + 1));
499 for (
int i = 0; i < h->
ax->bins() + 2; ++i ) {
504 if ( !tree->insert(path, h) )
return 0;
519 IHistogram1D *
subtract(
const std::string & path,
const IHistogram1D & hist1,
520 const IHistogram1D & hist2) {
521 return subtract(path, dynamic_cast<const Histogram1D &>(hist1),
522 dynamic_cast<const Histogram1D &>(hist2));
538 if ( !checkBins(h1, h2) )
return 0;
540 h->
setTitle(path.substr(path.rfind(
'/') + 1));
541 for (
int i = 0; i < h->
ax->bins() + 2; ++i ) {
546 if ( !tree->insert(path, h) )
return 0;
561 IHistogram1D *
multiply(
const std::string & path,
const IHistogram1D & hist1,
562 const IHistogram1D & hist2) {
563 return multiply(path, dynamic_cast<const Histogram1D &>(hist1),
564 dynamic_cast<const Histogram1D &>(hist2));
580 if ( !checkBins(h1, h2) )
return 0;
582 h->
setTitle(path.substr(path.rfind(
'/') + 1));
583 for (
int i = 0; i < h->
ax->bins() + 2; ++i ) {
584 if ( h2.
sum[i] == 0 || h2.
sumw[i] == 0.0 ) {
594 if ( !tree->insert(path, h) )
return 0;
609 IHistogram1D *
divide(
const std::string & path,
const IHistogram1D & hist1,
610 const IHistogram1D & hist2) {
611 return divide(path, dynamic_cast<const Histogram1D &>(hist1),
612 dynamic_cast<const Histogram1D &>(hist2));
615 inline bool _neq(
double a,
double b,
double eps = 1e-5)
const {
616 if ( a == 0 && b == 0 )
return false;
617 if ( abs(a-b) < eps*(abs(a) + abs(b)) )
return false;
625 if ( _neq(h1.
ax->upperEdge(), h2.
ax->upperEdge()) ||
626 _neq(h1.
ax->lowerEdge(), h2.
ax->lowerEdge()) ||
627 _neq(h1.
ax->bins(), h2.
ax->bins()) )
return false;
628 if ( h1.
fax && h2.
fax )
return true;
629 for (
int i = 0; i < h1.
ax->bins(); ++i ) {
630 if ( _neq(h1.
ax->binUpperEdge(i), h2.
ax->binUpperEdge(i)) ||
631 _neq(h1.
ax->binLowerEdge(i), h2.
ax->binLowerEdge(i)) )
return false;
640 if (_neq( h1.
xax->upperEdge(), h2.
xax->upperEdge()) ||
641 _neq( h1.
xax->lowerEdge(), h2.
xax->lowerEdge()) ||
642 h1.
xax->bins() != h2.
xax->bins() )
return false;
643 if (_neq( h1.
yax->upperEdge(), h2.
yax->upperEdge()) ||
644 _neq( h1.
yax->lowerEdge(), h2.
yax->lowerEdge()) ||
645 h1.
yax->bins() != h2.
yax->bins() )
return false;
647 for (
int i = 0; i < h1.
xax->bins(); ++i ) {
648 if ( _neq(h1.
xax->binUpperEdge(i), h2.
xax->binUpperEdge(i)) ||
649 _neq(h1.
xax->binLowerEdge(i), h2.
xax->binLowerEdge(i)) )
652 for (
int i = 0; i < h1.
yax->bins(); ++i ) {
653 if ( _neq(h1.
yax->binUpperEdge(i), h2.
yax->binUpperEdge(i)) ||
654 _neq(h1.
yax->binLowerEdge(i), h2.
yax->binLowerEdge(i)) )
663 IHistogram2D *
add(
const std::string & path,
664 const IHistogram2D & hist1,
const IHistogram2D & hist2) {
665 return add(path, dynamic_cast<const Histogram2D &>(hist1),
666 dynamic_cast<const Histogram2D &>(hist2));
674 if ( !checkBins(h1, h2) )
return 0;
676 h->
setTitle(path.substr(path.rfind(
'/') + 1));
678 if ( !tree->insert(path, h) ) {
690 if ( !checkBins(h1, h2) ) {
695 h->
setTitle(path.substr(path.rfind(
'/') + 1));
696 for (
int ix = 0; ix < h->
xax->bins() + 2; ++ix )
697 for (
int iy = 0; iy < h->
yax->bins() + 2; ++iy ) {
698 h->
sum[ix][iy] += h2.
sum[ix][iy];
706 if ( !tree->insert(path, h) ) {
718 const IHistogram2D & h1,
const IHistogram2D & h2) {
719 return subtract(path, dynamic_cast<const Histogram2D &>(h1),
720 dynamic_cast<const Histogram2D &>(h2));
727 const IHistogram2D & h1,
const IHistogram2D & h2) {
728 return multiply(path, dynamic_cast<const Histogram2D &>(h1),
729 dynamic_cast<const Histogram2D &>(h2));
737 if ( !checkBins(h1, h2) )
return 0;
739 h->
setTitle(path.substr(path.rfind(
'/') + 1));
740 for (
int ix = 0; ix < h->
xax->bins() + 2; ++ix )
741 for (
int iy = 0; iy < h->
yax->bins() + 2; ++iy ) {
742 h->
sum[ix][iy] *= h2.
sum[ix][iy];
747 if ( !tree->insert(path, h) ) {
759 if ( !checkBins(h1,h2) )
return 0;
761 h->
setTitle(path.substr(path.rfind(
'/') + 1));
762 for (
int ix = 0; ix < h->
xax->bins() + 2; ++ix )
763 for (
int iy = 0; iy < h->
yax->bins() + 2; ++iy ) {
764 if ( h2.
sum[ix][iy] == 0 || h2.
sumw[ix][iy] == 0.0 ) {
766 h->
sumw[ix][iy] = h->
sumw2[ix][iy] = 0.0;
774 if ( !tree->insert(path, h) ) {
785 IHistogram2D *
divide(
const std::string & path,
786 const IHistogram2D & h1,
const IHistogram2D & h2) {
787 return divide(path, dynamic_cast<const Histogram2D &>(h1),
788 dynamic_cast<const Histogram2D &>(h2));
794 IHistogram3D *
add(
const std::string &,
795 const IHistogram3D &,
const IHistogram3D &) {
796 return error<IHistogram3D>(
"3D histograms");
803 const IHistogram3D &,
const IHistogram3D &) {
804 return error<IHistogram3D>(
"3D histograms");
811 const IHistogram3D &,
const IHistogram3D &) {
812 return error<IHistogram3D>(
"3D histograms");
818 IHistogram3D *
divide(
const std::string &,
819 const IHistogram3D &,
const IHistogram3D &) {
820 return error<IHistogram3D>(
"3D histograms");
827 IHistogram1D *
projectionX(
const std::string & path,
const IHistogram2D & h) {
828 return projectionX(path, dynamic_cast<const Histogram2D &>(h));
836 return sliceX(path, h, 0, h.
yax->bins() - 1);
843 IHistogram1D *
projectionY(
const std::string & path,
const IHistogram2D & h) {
844 return projectionY(path, dynamic_cast<const Histogram2D &>(h));
852 return sliceY(path, h, 0, h.
xax->bins() - 1);
860 sliceX(
const std::string & path,
const IHistogram2D & h,
int i) {
861 return sliceX(path, dynamic_cast<const Histogram2D &>(h), i, i);
870 return sliceX(path, h, i, i);
878 sliceY(
const std::string & path,
const IHistogram2D & h,
int i) {
879 return sliceY(path, dynamic_cast<const Histogram2D &>(h), i, i);
887 return sliceY(path, h, i, i);
895 sliceX(
const std::string & path,
const IHistogram2D & h,
int il,
int iu) {
896 return sliceX(path, dynamic_cast<const Histogram2D &>(h), il, iu);
910 std::vector<double> edges(h2.
xax->bins() + 1);
911 edges.push_back(h2.
xax->lowerEdge());
912 for (
int i = 0; i < h2.
xax->bins(); ++i )
913 edges.push_back(h2.
xax->binLowerEdge(i));
916 for (
int ix = 0; ix < h2.
xax->bins() + 2; ++ix )
917 for (
int iy = il + 2; iy <= iu + 2; ++iy ) {
918 h1->
sum[ix] += h2.
sum[ix][iy];
924 if ( !tree->insert(path, h1) ) {
936 sliceY(
const std::string & path,
const IHistogram2D & h,
int il,
int iu) {
937 return sliceY(path, dynamic_cast<const Histogram2D &>(h), il, iu);
941 sliceY(
const std::string & path,
const Histogram2D & h2,
int il,
int iu) {
947 std::vector<double> edges(h2.
yax->bins() + 1);
948 edges.push_back(h2.
yax->lowerEdge());
949 for (
int i = 0; i < h2.
yax->bins(); ++i )
950 edges.push_back(h2.
yax->binLowerEdge(i));
953 for (
int iy = 0; iy < h2.
yax->bins() + 2; ++iy )
954 for (
int ix = il + 2; ix <= iu + 2; ++ix ) {
955 h1->
sum[iy] += h2.
sum[ix][iy];
961 if ( !tree->insert(path, h1) ) {
972 IHistogram2D *
projectionXY(
const std::string &,
const IHistogram3D &) {
973 return error<IHistogram2D>(
"2D histograms");
980 IHistogram2D *
projectionXZ(
const std::string &,
const IHistogram3D &) {
981 return error<IHistogram2D>(
"2D histograms");
988 IHistogram2D *
projectionYZ(
const std::string &,
const IHistogram3D &) {
989 return error<IHistogram2D>(
"2D histograms");
997 IHistogram2D *
sliceXY(
const std::string &,
const IHistogram3D &,
int,
int) {
998 return error<IHistogram2D>(
"2D histograms");
1006 IHistogram2D *
sliceXZ(
const std::string &,
const IHistogram3D &,
int,
int) {
1007 return error<IHistogram2D>(
"2D histograms");
1015 IHistogram2D *
sliceYZ(
const std::string &,
const IHistogram3D &,
int,
int) {
1016 return error<IHistogram2D>(
"2D histograms");
1023 template <
typename T>
1025 throw std::runtime_error(
"LWH cannot handle " + feature +
".");
std::vector< double > sumx2w
The weighted x-square-values.
ICloud2D * createCloud2D(const std::string &)
LWH cannot create a ICloud2D, an unbinned 2-dimensional histogram.
ICloud3D * createCopy(const std::string &, const ICloud3D &)
LWH cannot create a copy of an ICloud3D.
IHistogram1D * add(const std::string &path, const IHistogram1D &hist1, const IHistogram1D &hist2)
Create an IHistogram1D by adding two IHistogram1D.
IHistogram3D * createHistogram3D(const std::string &, const std::string &, int, double, double, int, double, double, int, double, double, const std::string &="")
LWH cannot create a IHistogram3D.
IHistogram2D * createHistogram2D(const std::string &pathAndTitle, int nx, double xlo, double xup, int ny, double ylo, double yup)
Create a IHistogram2D.
virtual ~HistogramFactory()
Destructor.
Histogram1D * sliceY(const std::string &path, const Histogram2D &h, int i)
LWH cannot create an IHistogram1D by slicing an IHistogram2D parallel to the x axis at a given bin...
IProfile2D * createProfile2D(const std::string &, int, double, double, int, double, double, double, double)
LWH cannot create a IProfile2D.
Histogram1D * projectionX(const std::string &path, const Histogram2D &h)
LWH cannot create an IHistogram1D by projecting an IHistogram2D along its x axis. ...
bool setTitle(const std::string &title)
Set the histogram title.
IHistogram1D * subtract(const std::string &path, const IHistogram1D &hist1, const IHistogram1D &hist2)
Create an IHistogram1D by subtracting two IHistogram1D.
bool destroy(IBaseHistogram *hist)
Destroy an IBaseHistogram object.
IHistogram3D * subtract(const std::string &, const IHistogram3D &, const IHistogram3D &)
LWH cannot create an IHistogram3D by subtracting two IHistogram3D.
IHistogram3D * createHistogram3D(const std::string &, const std::string &, const std::vector< double > &, const std::vector< double > &, const std::vector< double > &, const std::string &="")
LWH cannot create a IHistogram3D.
Histogram2D * add(const std::string &path, const Histogram2D &h1, const Histogram2D &h2)
LWH cannot create an IHistogram2D by adding two IHistogram2D.
IHistogram2D * sliceXZ(const std::string &, const IHistogram3D &, int, int)
LWH cannot create an IHistogram2D by slicing an IHistogram3D perpendicular to the Y axis...
IProfile1D * createProfile1D(const std::string &, const std::string &, int, double, double, const std::string &="")
LWH cannot create a IProfile1D.
ICloud1D * createCloud1D(const std::string &)
LWH cannot create a ICloud1D, an unbinned 1-dimensional histogram.
IHistogram3D * multiply(const std::string &, const IHistogram3D &, const IHistogram3D &)
LWH cannot create an IHistogram3D by multiplying two IHistogram3D.
std::vector< std::vector< double > > sumyw
The weighted y-values.
HistogramFactory(Tree &t)
Standard constructor.
User level interface to 1D Histogram.
IProfile2D * createCopy(const std::string &, const IProfile2D &)
LWH cannot create a copy of an IProfile2D.
ICloud3D * createCloud3D(const std::string &)
LWH cannot create a ICloud3D, an unbinned 3-dimensional histogram.
Tree * tree
The tree where the actual histograms are stored.
IProfile1D * createProfile1D(const std::string &, const std::string &, int, double, double, double, double, const std::string &="")
LWH cannot create a IProfile1D.
Histogram2D * multiply(const std::string &path, const Histogram2D &h1, const Histogram2D &h2)
LWH cannot create an IHistogram2D by multiplying two IHistogram2D.
IHistogram2D * createCopy(const std::string &path, const IHistogram2D &hist)
Create a copy of an IHistogram2D.
ICloud2D * createCloud2D(const std::string &, const std::string &, int=-1, const std::string &="")
LWH cannot create a ICloud2D, an unbinned 2-dimensional histogram.
Histogram1D * sliceX(const std::string &path, const Histogram2D &h, int i)
LWH cannot create an IHistogram1D by slicing an IHistogram2D parallel to the y axis at a given bin...
std::vector< double > sumw
The weights.
IHistogram1D * projectionY(const std::string &path, const IHistogram2D &h)
LWH cannot create an IHistogram1D by projecting an IHistogram2D along its y axis. ...
bool add(const Histogram2D &h)
Add to this Histogram2D the contents of another IHistogram2D.
Histogram1D * divide(const std::string &path, const Histogram1D &h1, const Histogram1D &h2)
Create n Histogram1D by dividing two Histogram1D.
IHistogram2D * subtract(const std::string &path, const IHistogram2D &h1, const IHistogram2D &h2)
LWH cannot create an IHistogram2D by subtracting two IHistogram2D.
IHistogram3D * add(const std::string &, const IHistogram3D &, const IHistogram3D &)
LWH cannot create an IHistogram3D by adding two IHistogram3D.
IHistogram2D * divide(const std::string &path, const IHistogram2D &h1, const IHistogram2D &h2)
LWH cannot create an IHistogram2D by dividing two IHistogram2D.
bool checkBins(const Histogram2D &h1, const Histogram2D &h2) const
Check if two histograms have the same bins.
IHistogram1D * createCopy(const std::string &path, const IHistogram1D &hist)
Create a copy of an IHistogram1D.
IHistogram1D * sliceY(const std::string &path, const IHistogram2D &h, int i)
LWH cannot create an IHistogram1D by slicing an IHistogram2D parallel to the x axis at a given bin...
IProfile1D * createCopy(const std::string &, const IProfile1D &)
LWH cannot create a copy of an IProfile1D.
IProfile1D * createProfile1D(const std::string &, int, double, double)
LWH cannot create a IProfile1D.
double upperEdge() const
Get the upper edge of the IAxis.
IHistogram2D * add(const std::string &path, const IHistogram2D &hist1, const IHistogram2D &hist2)
LWH cannot create an IHistogram2D by adding two IHistogram2D.
IHistogram1D * sliceY(const std::string &path, const IHistogram2D &h, int il, int iu)
LWH cannot create an IHistogram1D by slicing an IHistogram2D parallel to the x axis between two bins ...
IHistogram2D * projectionYZ(const std::string &, const IHistogram3D &)
LWH cannot create an IHistogram2D by projecting an IHistogram3D on the y-z plane. ...
IHistogram2D * multiply(const std::string &path, const IHistogram2D &h1, const IHistogram2D &h2)
LWH cannot create an IHistogram2D by multiplying two IHistogram2D.
IProfile2D * createProfile2D(const std::string &, const std::string &, const std::vector< double > &, const std::vector< double > &, double, double, const std::string &="")
LWH cannot create a IProfile2D.
std::vector< int > sum
The counts.
IHistogram2D * projectionXZ(const std::string &, const IHistogram3D &)
LWH cannot create an IHistogram2D by projecting an IHistogram3D on the x-z plane. ...
IHistogram1D * projectionX(const std::string &path, const IHistogram2D &h)
LWH cannot create an IHistogram1D by projecting an IHistogram2D along its x axis. ...
ICloud1D * createCopy(const std::string &, const ICloud1D &)
LWH cannot create a copy of an ICloud1D.
Histogram1D * subtract(const std::string &path, const Histogram1D &h1, const Histogram1D &h2)
Create a Histogram1D by subtracting two Histogram1D.
IHistogram2D * createHistogram2D(const std::string &path, const std::string &title, const std::vector< double > &xedges, const std::vector< double > &yedges, const std::string &="")
Create a IHistogram2D.
IProfile1D * createProfile1D(const std::string &, const std::string &, const std::vector< double > &, double, double, const std::string &="")
LWH cannot create a IProfile1D.
std::vector< std::vector< double > > sumw2
The squared weights.
IHistogram1D * multiply(const std::string &path, const IHistogram1D &hist1, const IHistogram1D &hist2)
Create an IHistogram1D by multiplying two IHistogram1D.
std::vector< std::vector< double > > sumw
The weights.
IHistogram3D * createHistogram3D(const std::string &, int, double, double, int, double, double, int, double, double)
LWH cannot create a IHistogram3D.
IHistogram1D * createHistogram1D(const std::string &path, const std::string &title, const std::vector< double > &binEdges, const std::string &="")
Create a IHistogram1D.
IHistogram1D * divide(const std::string &path, const IHistogram1D &hist1, const IHistogram1D &hist2)
Create an IHistogram1D by dividing two IHistogram1D.
ICloud3D * createCloud3D(const std::string &, const std::string &, int=-1, const std::string &="")
LWH cannot create a ICloud3D, an unbinned 3-dimensional histogram.
Histogram2D * subtract(const std::string &path, const Histogram2D &h1, const Histogram2D &h2)
LWH cannot create an IHistogram2D by subtracting two IHistogram2D.
ICloud1D * createCloud1D(const std::string &, const std::string &, int=-1, const std::string &="")
LWH cannot create a ICloud1D, an unbinned 1-dimensional histogram.
IHistogram1D * sliceX(const std::string &path, const IHistogram2D &h, int i)
LWH cannot create an IHistogram1D by slicing an IHistogram2D parallel to the y axis at a given bin...
Axis * yfax
Pointer (possibly null) to a axis with fixed bin width.
Histogram1D * projectionY(const std::string &path, const Histogram2D &h)
LWH cannot create an IHistogram1D by projecting an IHistogram2D along its y axis. ...
User level interface for factory classes of Histograms (binned, unbinned, and profile).
User level interface to 1D Histogram.
IProfile2D * createProfile2D(const std::string &, const std::string &, int, double, double, int, double, double, const std::string &="")
LWH cannot create a IProfile2D.
IHistogram2D * projectionXY(const std::string &, const IHistogram3D &)
LWH cannot create an IHistogram2D by projecting an IHistogram3D on the x-y plane. ...
IProfile1D * createProfile1D(const std::string &, const std::string &, const std::vector< double > &, const std::string &="")
LWH cannot create a IProfile1D.
IProfile2D * createProfile2D(const std::string &, int, double, double, int, double, double)
LWH cannot create a IProfile2D.
static T * error(std::string feature)
Throw a suitable error.
bool setTitle(const std::string &title)
Set the histogram title.
std::vector< std::vector< double > > sumx2w
The weighted x-square-values.
Histogram2D * divide(const std::string &path, const Histogram2D &h1, const Histogram2D &h2)
LWH cannot create an IHistogram2D by dividing two IHistogram2D.
double lowerEdge() const
Get the lower edge of the IAxis.
IProfile2D * createProfile2D(const std::string &, const std::string &, int, double, double, int, double, double, double, double, const std::string &="")
LWH cannot create a IProfile2D.
IHistogram2D * sliceXY(const std::string &, const IHistogram3D &, int, int)
LWH cannot create an IHistogram2D by slicing an IHistogram3D perpendicular to the Z axis...
std::vector< std::vector< int > > sum
The counts.
IProfile2D * createProfile2D(const std::string &, const std::string &, const std::vector< double > &, const std::vector< double > &, const std::string &="")
LWH cannot create a IProfile2D.
int bins() const
The number of bins (excluding underflow and overflow) on the IAxis.
std::vector< std::vector< double > > sumy2w
The weighted y-square-values.
Axis * fax
Pointer (possibly null) to a axis with fixed bin width.
The LWH namespace contains a Light-Weight Histogram package which implements the most rudimentary his...
bool checkBins(const Histogram1D &h1, const Histogram1D &h2) const
Check if two histograms have the same bins.
IHistogram1D * createHistogram1D(const std::string &pathAndTitle, int nBins, double lowerEdge, double upperEdge)
Create a IHistogram1D.
Histogram1D * add(const std::string &path, const Histogram1D &hist1, const Histogram1D &hist2)
Create a Histogram1D by adding two Histogram1D.
The Tree class is a simple implementation of the AIDA::ITree interface.
IProfile1D * createProfile1D(const std::string &, int, double, double, double, double)
LWH cannot create a IProfile1D.
IHistogram3D * divide(const std::string &, const IHistogram3D &, const IHistogram3D &)
LWH cannot create an IHistogram3D by dividing two IHistogram3D.
bool add(const Histogram1D &h)
Add to this Histogram1D the contents of another IHistogram1D.
IHistogram2D * createHistogram2D(const std::string &path, const std::string &title, int nx, double xlo, double xup, int ny, double ylo, double yup, const std::string &="")
Create a IHistogram2D.
std::vector< double > sumxw
The weighted x-values.
ICloud2D * createCopy(const std::string &, const ICloud2D &)
LWH cannot create a copy of an ICloud2D.
IHistogram2D * sliceYZ(const std::string &, const IHistogram3D &, int, int)
LWH cannot create an IHistogram2D by slicing an IHistogram3D perpendicular to the X axis...
Histogram1D * sliceX(const std::string &path, const Histogram2D &h2, int il, int iu)
LWH cannot create an IHistogram1D by slicing an IHistogram2D parallel to the y axis between two bins ...
IHistogram1D * sliceX(const std::string &path, const IHistogram2D &h, int il, int iu)
LWH cannot create an IHistogram1D by slicing an IHistogram2D parallel to the y axis between two bins ...
Histogram1D * multiply(const std::string &path, const Histogram1D &h1, const Histogram1D &h2)
Create a Histogram1D by multiplying two Histogram1D.
IHistogram3D * createCopy(const std::string &, const IHistogram3D &)
LWH cannot create a copy of an IHistogram3D.
IHistogram1D * createHistogram1D(const std::string &path, const std::string &title, int nBins, double lowerEdge, double upperEdge, const std::string &="")
Create a IHistogram1D.
std::vector< double > sumw2
The squared weights.
std::vector< std::vector< double > > sumxw
The weighted x-values.
Axis * xfax
Pointer (possibly null) to a axis with fixed bin width.