1#ifndef __JROOT__JTOOLSSUPPORTKIT__
2#define __JROOT__JTOOLSSUPPORTKIT__
21namespace JPP {
using namespace JROOT; }
54 template<
class JAbscissa_t,
56 template<
class,
class>
class JContainer_t,
62 const Int_t NbinsX = from.GetXaxis()->GetNbins();
64 to.underflow = from.GetBinContent(0);
65 to.overflow = from.GetBinContent(NbinsX+1);
66 to.integral = from.Integral(0, NbinsX+1);
68 for (Int_t i = 1; i <= NbinsX; ++i) {
70 const double x0 = from.GetXaxis()->GetBinLowEdge(i);
71 const double xc = from.GetXaxis()->GetBinCenter (i);
73 const double y = from.GetBinContent(i);
74 const double ye = from.GetBinError (i);
89 template<
class JAbscissa_t,
91 template<
class,
class>
class JContainer_t,
98 const Int_t NbinsX = from.GetXaxis()->GetNbins();
99 const Int_t NbinsY = from.GetYaxis()->GetNbins();
101 for (Int_t i = 0; i <= NbinsX+1; ++i) {
103 JHistogram1D_t histogram;
105 const double xc = from.GetXaxis()->GetBinCenter(i);
107 for (Int_t j = 0; j <= NbinsY+1; ++j) {
109 const Int_t N = from.GetBin(i,j);
111 const double y0 = from.GetYaxis()->GetBinLowEdge(j);
112 const double yc = from.GetYaxis()->GetBinCenter (j);
114 const double z = from.GetBinContent(N);
115 const double ze = from.GetBinError (N);
117 histogram.integral += z;
119 if (from.IsBinUnderflow(N)) {
120 histogram.underflow += z;
121 }
else if (from.IsBinOverflow(N)) {
122 histogram.overflow += z;
125 histogram.insert(bin);
129 if (histogram.getSize() > 0) {
142 template<
class JAbscissa_t,
144 template<
class,
class>
class JContainer_t,
152 const Int_t NbinsX = from.GetXaxis()->GetNbins();
153 const Int_t NbinsY = from.GetYaxis()->GetNbins();
154 const Int_t NbinsZ = from.GetZaxis()->GetNbins();
156 for (Int_t i = 0; i <= NbinsX+1; ++i) {
158 const double xc = from.GetXaxis()->GetBinCenter(i);
160 for (Int_t j = 0; j <= NbinsY+1; ++j) {
162 JHistogram1D_t histogram;
164 const double yc = from.GetYaxis()->GetBinCenter(j);
166 for (Int_t k = 0; k <= NbinsZ+1; ++k) {
168 const Int_t N = from.GetBin(i,j,k);
170 const double z0 = from.GetYaxis()->GetBinLowEdge(j);
171 const double zc = from.GetYaxis()->GetBinCenter (j);
173 const double w = from.GetBinContent(N);
174 const double we = from.GetBinError (N);
176 histogram.integral += w;
178 if (from.IsBinUnderflow(N)) {
179 histogram.underflow += w;
180 }
else if (from.IsBinOverflow(N)) {
181 histogram.overflow += w;
184 histogram.insert(bin);
188 if (histogram.getSize() > 0) {
189 to[xc][yc] = histogram;
202 template<
class JAbscissa_t,
204 template<
class,
class>
class JContainer_t,
208 return copy(from, to);
218 template<
class JAbscissa_t,
220 template<
class,
class>
class JContainer_t,
225 return copy(from, to);
235 template<
class JAbscissa_t,
237 template<
class,
class>
class JContainer_t,
243 return copy(from, to);
The elements in a collection are sorted according to their abscissa values and a given distance opera...
Auxiliary class for copying ROOT histograms to Jpp histograms.
static void copy(const TH1 &from, JHistogram1D< JBin1D< JAbscissa_t, JOrdinate_t >, JContainer_t, JDistance_t > &to)
Copy histogram from from to to.
void operator()(const TH1 &from, JHistogram1D< JBin1D< JAbscissa_t, JOrdinate_t >, JContainer_t, JDistance_t > &to) const
Copy histogram from from to to.
JHistogramHelper()
Default constructor.
void operator()(const TH2 &from, JMultiHistogram< JHistogram1D< JBin1D< JAbscissa_t, JOrdinate_t >, JContainer_t, JDistance_t >, JMapList< JMap_t >, JDistance_t > &to) const
Copy histogram from from to to.
static void copy(const TH2 &from, JMultiHistogram< JHistogram1D< JBin1D< JAbscissa_t, JOrdinate_t >, JContainer_t, JDistance_t >, JMapList< JMap_t >, JDistance_t > &to)
Copy histogram from from to to.
static void copy(const TH3 &from, JMultiHistogram< JHistogram1D< JBin1D< JAbscissa_t, JOrdinate_t >, JContainer_t, JDistance_t >, typename JMAPLIST< JMap_t1, JMap_t2 >::maplist, JDistance_t > &to)
Copy histogram from from to to.
void operator()(const TH3 &from, JMultiHistogram< JHistogram1D< JBin1D< JAbscissa_t, JOrdinate_t >, JContainer_t, JDistance_t >, typename JMAPLIST< JMap_t1, JMap_t2 >::maplist, JDistance_t > &to) const
Copy histogram from from to to.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for ROOT I/O.
static const JHistogramHelper copyHistogram
Function object for copying histograms.