g4tools  5.4.0
sliced
Go to the documentation of this file.
1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
2 // See the file tools.license for terms.
3 
4 #ifndef tools_histo_sliced
5 #define tools_histo_sliced
6 
7 #include "slice"
8 #include "h1d"
9 #include "h2d"
10 
14 
15 namespace tools {
16 namespace histo {
17 
18 inline h1d* slice_x(const h2d& a_from,int aJbeg,int aJend,const std::string& a_title) {
19  h1d* slice_x = new h1d(a_title,
20  a_from.axis_x().bins(),a_from.axis_x().lower_edge(),a_from.axis_x().upper_edge());
21  if(!fill_slice_x(a_from,aJbeg,aJend,*slice_x)) {delete slice_x;return 0;}
22  return slice_x;
23 }
24 
25 inline h1d* projection_x(const h2d& a_from,const std::string& a_title) {
26  return slice_x(a_from,axis_UNDERFLOW_BIN,axis_OVERFLOW_BIN,a_title);
27 }
28 
29 inline h1d* slice_y(const h2d& a_from,int aIbeg,int aIend,const std::string& a_title) {
30  h1d* slice_y = new h1d(a_title,
31  a_from.axis_y().bins(),a_from.axis_y().lower_edge(),a_from.axis_y().upper_edge());
32  if(!fill_slice_y(a_from,aIbeg,aIend,*slice_y)) {delete slice_y;return 0;}
33  return slice_y;
34 }
35 
36 inline h1d* projection_y(const h2d& a_from,const std::string& a_title) {
37  return slice_y(a_from,axis_UNDERFLOW_BIN,axis_OVERFLOW_BIN,a_title);
38 }
39 
40 }}
41 
45 #include "p1d"
46 
47 namespace tools {
48 namespace histo {
49 
50 inline p1d* profile_x(const h2d& a_from,int aJbeg,int aJend,const std::string& a_title) {
51  p1d* slice_x = new p1d(a_title,
52  a_from.axis_x().bins(),a_from.axis_x().lower_edge(),a_from.axis_x().upper_edge());
53  if(!fill_profile_x(a_from,aJbeg,aJend,*slice_x)) {delete slice_x;return 0;}
54  return slice_x;
55 }
56 
57 inline p1d* profile_x(const h2d& a_from,const std::string& a_title) {
58  return profile_x(a_from,axis_UNDERFLOW_BIN,axis_OVERFLOW_BIN,a_title);
59 }
60 
61 inline p1d* profile_y(const h2d& a_from,int aIbeg,int aIend,const std::string& a_title) {
62  p1d* slice_y = new p1d(a_title,
63  a_from.axis_y().bins(),a_from.axis_y().lower_edge(),a_from.axis_y().upper_edge());
64  if(!fill_profile_y(a_from,aIbeg,aIend,*slice_y)) {delete slice_y;return 0;}
65  return slice_y;
66 }
67 
68 inline p1d* profile_y(const h2d& a_from,const std::string& a_title) {
69  return profile_y(a_from,axis_UNDERFLOW_BIN,axis_OVERFLOW_BIN,a_title);
70 }
71 
72 }}
73 
77 
78 #include "h3d"
79 
80 namespace tools {
81 namespace histo {
82 
83 inline h2d* slice_xy(const h3d& a_from,int aKbeg,int aKend,const std::string& a_title) {
84  h2d* slice = new h2d(a_title,
85  a_from.axis_x().bins(),a_from.axis_x().lower_edge(),a_from.axis_x().upper_edge(),
86  a_from.axis_y().bins(),a_from.axis_y().lower_edge(),a_from.axis_y().upper_edge());
87  if(!fill_slice_xy(a_from,aKbeg,aKend,*slice)) {delete slice;return 0;}
88  return slice;
89 }
90 
91 inline h2d* projection_xy(const h3d& a_from,const std::string& a_title) {
92  return slice_xy(a_from,axis_UNDERFLOW_BIN,axis_OVERFLOW_BIN,a_title);
93 }
94 
95 inline h2d* slice_yz(const h3d& a_from,int aIbeg,int aIend,const std::string& a_title) {
96  h2d* slice = new h2d(a_title,
97  a_from.axis_y().bins(),a_from.axis_y().lower_edge(),a_from.axis_y().upper_edge(),
98  a_from.axis_z().bins(),a_from.axis_z().lower_edge(),a_from.axis_z().upper_edge());
99  if(!fill_slice_yz(a_from,aIbeg,aIend,*slice)) {delete slice;return 0;}
100  return slice;
101 }
102 
103 inline h2d* projection_yz(const h3d& a_from,const std::string& a_title) {
104  return slice_yz(a_from,axis_UNDERFLOW_BIN,axis_OVERFLOW_BIN,a_title);
105 }
106 
107 inline h2d* slice_xz(const h3d& a_from,int aJbeg,int aJend,const std::string& a_title) {
108  h2d* slice = new h2d(a_title,
109  a_from.axis_x().bins(),a_from.axis_x().lower_edge(),a_from.axis_x().upper_edge(),
110  a_from.axis_z().bins(),a_from.axis_z().lower_edge(),a_from.axis_z().upper_edge());
111  if(!fill_slice_xz(a_from,aJbeg,aJend,*slice)) {delete slice;return 0;}
112  return slice;
113 }
114 
115 inline h2d* projection_xz(const h3d& a_from,const std::string& a_title) {
116  return slice_xz(a_from,axis_UNDERFLOW_BIN,axis_OVERFLOW_BIN,a_title);
117 }
118 
119 }}
120 
121 #endif
tools::histo::fill_slice_xz
bool fill_slice_xz(const H3 &a_from, int aJbeg, int aJend, H2 &a_to)
Definition: slice:414
h2d
tools::histo::p1d
Definition: p1d:12
tools::histo::h1d
Definition: h1d:14
tools::histo::axis_UNDERFLOW_BIN
@ axis_UNDERFLOW_BIN
Definition: axis:13
p1d
tools::histo::projection_xy
h2d * projection_xy(const h3d &a_from, const std::string &a_title)
Definition: sliced:91
tools::histo::slice_xz
H2 * slice_xz(const H3 &a_from, int aJbeg, int aJend, const std::string &a_title)
Definition: slice:499
tools::histo::fill_profile_y
bool fill_profile_y(const H2 &a_from, int aIbeg, int aIend, P1 &a_to)
Definition: slice:216
tools::histo::fill_slice_yz
bool fill_slice_yz(const H3 &a_from, int aIbeg, int aIend, H2 &a_to)
h3 -> h2 ////////////////////////////////////////////////////////////////////
Definition: slice:279
tools::histo::projection_xz
h2d * projection_xz(const h3d &a_from, const std::string &a_title)
Definition: sliced:115
tools::histo::axis::upper_edge
TC upper_edge() const
Definition: axis:27
tools::histo::fill_slice_x
bool fill_slice_x(const H2 &a_from, int aJbeg, int aJend, H1 &a_to)
h2 -> h1 ////////////////////////////////////////////////////////////////////
Definition: slice:17
tools::histo::h2d
Definition: h2d:12
tools::histo::fill_slice_xy
bool fill_slice_xy(const H3 &a_from, int aKbeg, int aKend, H2 &a_to)
Definition: slice:346
tools::histo::axis_OVERFLOW_BIN
@ axis_OVERFLOW_BIN
Definition: axis:13
tools::histo::b3::axis_z
const axis_t & axis_z() const
Definition: b3:147
tools::histo::projection_y
H1 * projection_y(const H2 &a_from, const std::string &a_title)
Definition: slice:148
h1d
tools::histo::b3::axis_y
const axis_t & axis_y() const
Definition: b3:146
tools::histo::axis::bins
bn_t bins() const
Definition: axis:28
tools::histo::slice_yz
H2 * slice_yz(const H3 &a_from, int aIbeg, int aIend, const std::string &a_title)
Definition: slice:490
slice
tools::histo::fill_slice_y
bool fill_slice_y(const H2 &a_from, int aIbeg, int aIend, H1 &a_to)
Definition: slice:85
tools::histo::slice_xy
H2 * slice_xy(const H3 &a_from, int aKbeg, int aKend, const std::string &a_title)
Definition: slice:481
h3d
tools::histo::b2::axis_y
const axis_t & axis_y() const
Definition: b2:148
tools::histo::slice_y
H1 * slice_y(const H2 &a_from, int aIbeg, int aIend, const std::string &a_title)
Definition: slice:141
tools::histo::profile_x
p1d * profile_x(const h2d &a_from, int aJbeg, int aJend, const std::string &a_title)
Definition: sliced:50
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
tools::histo::profile_y
p1d * profile_y(const h2d &a_from, int aIbeg, int aIend, const std::string &a_title)
Definition: sliced:61
tools::histo::projection_x
H1 * projection_x(const H2 &a_from, const std::string &a_title)
Definition: slice:80
tools::histo::h3d
Definition: h3d:12
tools::histo::b3::axis_x
const axis_t & axis_x() const
Definition: b3:145
tools::histo::slice_x
H1 * slice_x(const H2 &a_from, int aJbeg, int aJend, const std::string &a_title)
Definition: slice:73
tools::histo::axis::lower_edge
TC lower_edge() const
Definition: axis:26
tools::histo::b2::axis_x
const axis_t & axis_x() const
Definition: b2:147
tools::histo::fill_profile_x
bool fill_profile_x(const H2 &a_from, int aJbeg, int aJend, P1 &a_to)
h2 -> p1 ////////////////////////////////////////////////////////////////////
Definition: slice:157
tools::histo::projection_yz
h2d * projection_yz(const h3d &a_from, const std::string &a_title)
Definition: sliced:103