inlib
1.2.0
|
00001 // Copyright (C) 2010, Guy Barrand. All rights reserved. 00002 // See the file inlib.license for terms. 00003 00004 #ifndef inlib_histo_sliced 00005 #define inlib_histo_sliced 00006 00007 #include "slice" 00008 #include "h1d" 00009 #include "h2d" 00010 #include "h3d" 00011 00012 namespace inlib { 00013 namespace histo { 00014 00015 inline h1d* slice_x(const h2d& a_from, 00016 int aJbeg,int aJend, 00017 const std::string& a_title) { 00018 h1d* slice_x = new h1d(a_title, 00019 a_from.axis_x().bins(), 00020 a_from.axis_x().lower_edge(), 00021 a_from.axis_x().upper_edge()); 00022 if(!fill_slice_x(a_from,aJbeg,aJend,*slice_x)) {delete slice_x;return 0;} 00023 return slice_x; 00024 } 00025 00026 inline h1d* projection_x(const h2d& a_from,const std::string& a_title) { 00027 return slice_x(a_from,axis<double>::UNDERFLOW_BIN,axis<double>::OVERFLOW_BIN,a_title); 00028 } 00029 00030 inline h1d* slice_y(const h2d& a_from, 00031 int aIbeg,int aIend, 00032 const std::string& a_title) { 00033 h1d* slice_y = new h1d(a_title, 00034 a_from.axis_y().bins(), 00035 a_from.axis_y().lower_edge(), 00036 a_from.axis_y().upper_edge()); 00037 if(!fill_slice_y(a_from,aIbeg,aIend,*slice_y)) {delete slice_y;return 0;} 00038 return slice_y; 00039 } 00040 00041 inline h1d* projection_y(const h2d& a_from,const std::string& a_title) { 00042 return slice_y(a_from,axis<double>::UNDERFLOW_BIN,axis<double>::OVERFLOW_BIN,a_title); 00043 } 00044 00045 inline h2d* slice_xy(const h3d& a_from, 00046 int aKbeg,int aKend, 00047 const std::string& a_title) { 00048 h2d* slice = new h2d(a_title, 00049 a_from.axis_x().bins(), 00050 a_from.axis_x().lower_edge(), 00051 a_from.axis_x().upper_edge(), 00052 a_from.axis_y().bins(), 00053 a_from.axis_y().lower_edge(), 00054 a_from.axis_y().upper_edge()); 00055 if(!fill_slice_xy(a_from,aKbeg,aKend,*slice)) {delete slice;return 0;} 00056 return slice; 00057 } 00058 00059 inline h2d* slice_yz(const h3d& a_from, 00060 int aIbeg,int aIend, 00061 const std::string& a_title) { 00062 h2d* slice = new h2d(a_title, 00063 a_from.axis_y().bins(), 00064 a_from.axis_y().lower_edge(), 00065 a_from.axis_y().upper_edge(), 00066 a_from.axis_z().bins(), 00067 a_from.axis_z().lower_edge(), 00068 a_from.axis_z().upper_edge()); 00069 if(!fill_slice_yz(a_from,aIbeg,aIend,*slice)) {delete slice;return 0;} 00070 return slice; 00071 } 00072 00073 inline h2d* slice_xz(const h3d& a_from, 00074 int aJbeg,int aJend, 00075 const std::string& a_title) { 00076 h2d* slice = new h2d(a_title, 00077 a_from.axis_x().bins(), 00078 a_from.axis_x().lower_edge(), 00079 a_from.axis_x().upper_edge(), 00080 a_from.axis_z().bins(), 00081 a_from.axis_z().lower_edge(), 00082 a_from.axis_z().upper_edge()); 00083 if(!fill_slice_xz(a_from,aJbeg,aJend,*slice)) {delete slice;return 0;} 00084 return slice; 00085 } 00086 00087 }} 00088 00089 #endif