#include <algorithm>#include <cassert>#include <cmath>#include <iomanip>#include <iostream>#include <string>#include <vector>#include "TH1.h"#include "PhysicsNtuple/Default.h"Go to the source code of this file.
Namespaces | |
| namespace | Anp |
Classes | |
| class | Anp::Bin< T > |
| class | Anp::Hist1d< T > |
Functions | |
| template<typename T> | |
| bool | operator< (const Bin< T > &lhs, const Bin< T > &rhs) |
| template<typename T> | |
| bool | operator< (const Bin< T > &lhs, const T &rhs) |
| template<typename T> | |
| bool | operator< (const T &lhs, const Bin< T > &rhs) |
| template<typename T> | |
| bool | operator< (const Bin< T > &lhs, unsigned int bin) |
| template<typename T> | |
| bool | operator< (unsigned int bin, const Bin< T > &rhs) |
| template<typename T> | |
| bool | operator== (const Bin< T > &lhs, unsigned int bin) |
| template<typename T> | |
| bool | operator== (unsigned int bin, const Bin< T > &rhs) |
| template<typename T> | |
| Bin< T > | Merge (const Bin< T > &lhs, const Bin< T > &rhs) |
| template<typename T> | |
| TH1 * | CreateTH1 (const Hist1d< T > &h, const std::string &name="h") |
| template<typename T> | |
| std::ostream & | operator<< (std::ostream &o, const Bin< T > &self) |
| template<typename T> | |
| T | GetKernelOverlap (const T lpos, const T rpos, const T cpos, const T width) |
| template<typename T> | |
| std::ostream & | operator<< (std::ostream &o, const Hist1d< T > &self) |
|
||||||||||||||||
|
Definition at line 987 of file Hist1d.h. References Anp::Hist1d< T >::GetBins(), Anp::Hist1d< T >::GetIntegral(), and Anp::SetDir(). Referenced by Anp::HistMan::CreateTH1(). 00988 {
00989 const std::vector<Bin<T> > &bvec = h.GetBins();
00990
00991 if(bvec.empty())
00992 {
00993 return 0;
00994 }
00995
00996 double *array = new double[bvec.size() - 1];
00997
00998 for(int ibin = 1; ibin < int(bvec.size()); ++ibin)
00999 {
01000 array[ibin - 1] = bvec[ibin].edge();
01001 }
01002
01003 TH1 *th1 = new TH1D(name.c_str(), name.c_str(), bvec.size() - 2, array);
01004
01005 delete [] array;
01006
01007 for(int ibin = 0; ibin < int(bvec.size()); ++ibin)
01008 {
01009 th1 -> SetBinContent(ibin, bvec[ibin].sum());
01010 }
01011
01012 Anp::SetDir(th1, 0);
01013 th1 -> SetEntries(h.GetIntegral("UO"));
01014
01015 return th1;
01016 }
|
|
||||||||||||||||||||||||
|
Definition at line 297 of file Hist1d.h. 00298 {
00299 // Compute fraction of kernel intergral for kernel centered at x0 = cpos
00300 // and between lpos and rpos boundaries. Kernel function is (1-((x-x0)/w)^2)^2
00301 // for x < 1.0 and 0 otherwise. Kerner integral I(x) = (x - 2*x^3/3 + x^5/5)/C,
00302 // where C = 16/15.
00303
00304 if(!(lpos < rpos) || !(width > 0.0))
00305 {
00306 std::cerr << "GetKernelOverlap - invalid input parameters ("
00307 << lpos << ", " << rpos << ", " << cpos << ", " << width << ")" << std::endl;
00308 return 0;
00309 }
00310
00311 T ledge = cpos - width;
00312 T redge = cpos + width;
00313
00314 if(ledge < lpos) ledge = lpos;
00315 if(redge > rpos) redge = rpos;
00316
00317 const T x1 = (ledge - cpos)/width;
00318 const T x2 = (redge - cpos)/width;
00319
00320 const T I1 = x1 - 2.0*x1*x1*x1/3.0 + x1*x1*x1*x1*x1/5.0;
00321 const T I2 = x2 - 2.0*x2*x2*x2/3.0 + x2*x2*x2*x2*x2/5.0;
00322
00323 const T overlap = 15.0*(I2 - I1)/16.0;
00324
00325 //std::cout << "(lpos, rpos, cpos) = ("
00326 //<< lpos << ", " << rpos << ", " << cpos << ")" << std::endl
00327 //<< "(ledg, redg, width, overlap) = ("
00328 //<< ledge << ", " << redge << ", " << width << ", " << overlap << ")" << std::endl;
00329
00330 return overlap;
00331 }
|
|
||||||||||||||||
|
Definition at line 334 of file Hist1d.h. References Anp::Bin< T >::bin(), Anp::Bin< T >::edge(), Anp::Bin< T >::entries(), Anp::Bin< T >::set_ent(), Anp::Bin< T >::set_sum(), Anp::Bin< T >::sum(), and Anp::Bin< T >::sum2(). 00335 {
00336 Bin<T> bin(std::min<unsigned int>(lhs.bin(), rhs.bin()),
00337 std::min<T>(lhs.edge(), rhs.edge()));
00338
00339 bin.set_sum(lhs.sum() + rhs.sum(), lhs.sum2() + rhs.sum2());
00340 bin.set_ent(lhs.entries() + rhs.entries());
00341
00342 return bin;
00343 }
|
|
||||||||||||||||
|
Definition at line 281 of file Hist1d.h. References Anp::Bin< T >::bin(). 00281 { return lhs < rhs.bin(); }
|
|
||||||||||||||||
|
Definition at line 278 of file Hist1d.h. References Anp::Bin< T >::bin(). 00278 { return lhs.bin() < rhs; }
|
|
||||||||||||||||
|
Definition at line 275 of file Hist1d.h. References Anp::Bin< T >::edge(). 00275 { return lhs < rhs.edge(); }
|
|
||||||||||||||||
|
Definition at line 272 of file Hist1d.h. References Anp::Bin< T >::edge(). 00272 { return lhs.edge() < rhs; }
|
|
||||||||||||||||
|
Definition at line 269 of file Hist1d.h. References Anp::Bin< T >::bin(). 00269 { return lhs.bin() < rhs.bin(); }
|
|
||||||||||||||||
|
Definition at line 1021 of file Hist1d.h. References Anp::Hist1d< T >::Print(). 01022 {
01023 self.Print(o);
01024 return o;
01025 }
|
|
||||||||||||||||
|
Definition at line 290 of file Hist1d.h. References Anp::Bin< T >::print(). 00291 {
00292 self.print(o);
00293 return o;
00294 }
|
|
||||||||||||||||
|
Definition at line 287 of file Hist1d.h. References Anp::Bin< T >::bin(). 00287 { return lhs == rhs.bin(); }
|
|
||||||||||||||||
|
Definition at line 284 of file Hist1d.h. References Anp::Bin< T >::bin(). 00284 { return lhs.bin() == rhs; }
|
1.3.9.1