Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/externals/g4tools/include/tools/histo/b2

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/g4tools/include/tools/histo/b2 (Version 11.3.0) and /externals/g4tools/include/tools/histo/b2 (Version 11.1.1)


  1 // Copyright (C) 2010, Guy Barrand. All rights      1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
  2 // See the file tools.license for terms.            2 // See the file tools.license for terms.
  3                                                     3 
  4 #ifndef tools_histo_b2                              4 #ifndef tools_histo_b2
  5 #define tools_histo_b2                              5 #define tools_histo_b2
  6                                                     6 
  7 #include "base_histo"                               7 #include "base_histo"
  8                                                     8 
  9 #include <ostream>                                  9 #include <ostream>
 10                                                    10 
 11 namespace tools {                                  11 namespace tools {
 12 namespace histo {                                  12 namespace histo {
 13                                                    13 
 14 template <class TC,class TO,class TN,class TW,     14 template <class TC,class TO,class TN,class TW,class TH>
 15 class b2 : public base_histo<TC,TO,TN,TW,TH> {     15 class b2 : public base_histo<TC,TO,TN,TW,TH> {
 16   typedef base_histo<TC,TO,TN,TW,TH> parent;       16   typedef base_histo<TC,TO,TN,TW,TH> parent;
 17 protected:                                         17 protected:
 18   enum {AxisX=0,AxisY=1};                          18   enum {AxisX=0,AxisY=1};
 19 public:                                            19 public:
 20   typedef base_histo<TC,TO,TN,TW,TH> base_hist     20   typedef base_histo<TC,TO,TN,TW,TH> base_histo_t;
 21   typedef typename parent::axis_t axis_t;          21   typedef typename parent::axis_t axis_t;
 22   typedef typename parent::bn_t bn_t;              22   typedef typename parent::bn_t bn_t;
 23 public:                                            23 public:
 24   virtual TH bin_error(int,int) const = 0; //f     24   virtual TH bin_error(int,int) const = 0; //for print
 25 public:                                            25 public:
 26   // Partition :                                   26   // Partition :
 27   TC mean_x() const {                              27   TC mean_x() const {
 28     if(parent::m_in_range_Sw==0) return 0;         28     if(parent::m_in_range_Sw==0) return 0;
 29     return parent::m_in_range_Sxw[0]/parent::m     29     return parent::m_in_range_Sxw[0]/parent::m_in_range_Sw;
 30   }                                                30   }
 31                                                    31 
 32   TC mean_y() const {                              32   TC mean_y() const {
 33     if(parent::m_in_range_Sw==0) return 0;         33     if(parent::m_in_range_Sw==0) return 0;
 34     return parent::m_in_range_Sxw[1]/parent::m     34     return parent::m_in_range_Sxw[1]/parent::m_in_range_Sw;
 35   }                                                35   }
 36                                                    36 
 37   TC rms_x() const {                               37   TC rms_x() const {
 38     if(parent::m_in_range_Sw==0) return 0;         38     if(parent::m_in_range_Sw==0) return 0;
 39     TC mean = parent::m_in_range_Sxw[0]/parent     39     TC mean = parent::m_in_range_Sxw[0]/parent::m_in_range_Sw;
 40     return ::sqrt(::fabs((parent::m_in_range_S     40     return ::sqrt(::fabs((parent::m_in_range_Sx2w[0] / parent::m_in_range_Sw) - mean * mean));
 41   }                                                41   }
 42                                                    42 
 43   TC rms_y() const {                               43   TC rms_y() const {
 44     if(parent::m_in_range_Sw==0) return 0;         44     if(parent::m_in_range_Sw==0) return 0;
 45     TC mean = parent::m_in_range_Sxw[1]/parent     45     TC mean = parent::m_in_range_Sxw[1]/parent::m_in_range_Sw;
 46     return ::sqrt(::fabs((parent::m_in_range_S     46     return ::sqrt(::fabs((parent::m_in_range_Sx2w[1] / parent::m_in_range_Sw) - mean * mean));
 47   }                                                47   }
 48                                                    48 
 49   int coord_to_index_x(TC aCoord) const {          49   int coord_to_index_x(TC aCoord) const {
 50     return axis_x().coord_to_index(aCoord);        50     return axis_x().coord_to_index(aCoord);
 51   }                                                51   }
 52   int coord_to_index_y(TC aCoord) const {          52   int coord_to_index_y(TC aCoord) const {
 53     return axis_y().coord_to_index(aCoord);        53     return axis_y().coord_to_index(aCoord);
 54   }                                                54   }
 55                                                    55 
 56   // bins :                                        56   // bins :
 57   TN bin_entries(int aI,int aJ) const {            57   TN bin_entries(int aI,int aJ) const {
 58     TO offset;                                     58     TO offset;
 59     if(!_find_offset(aI,aJ,offset)) return 0;      59     if(!_find_offset(aI,aJ,offset)) return 0;
 60     return parent::m_bin_entries[offset];          60     return parent::m_bin_entries[offset];
 61   }                                                61   }
 62                                                    62 
 63   TW bin_Sw(int aI,int aJ) const {                 63   TW bin_Sw(int aI,int aJ) const {
 64     TO offset;                                     64     TO offset;
 65     if(!_find_offset(aI,aJ,offset)) return 0;      65     if(!_find_offset(aI,aJ,offset)) return 0;
 66     return parent::m_bin_Sw[offset];               66     return parent::m_bin_Sw[offset];
 67   }                                                67   }
 68                                                    68 
 69   TW bin_Sw2(int aI,int aJ) const {                69   TW bin_Sw2(int aI,int aJ) const {
 70     TO offset;                                     70     TO offset;
 71     if(!_find_offset(aI,aJ,offset)) return 0;      71     if(!_find_offset(aI,aJ,offset)) return 0;
 72     return parent::m_bin_Sw2[offset];              72     return parent::m_bin_Sw2[offset];
 73   }                                                73   }
 74   TC bin_Sxw(int aI,int aJ) const {                74   TC bin_Sxw(int aI,int aJ) const {
 75     TO offset;                                     75     TO offset;
 76     if(!_find_offset(aI,aJ,offset)) return 0;      76     if(!_find_offset(aI,aJ,offset)) return 0;
 77     return parent::m_bin_Sxw[offset][AxisX];       77     return parent::m_bin_Sxw[offset][AxisX];
 78   }                                                78   }
 79   TC bin_Sx2w(int aI,int aJ) const {               79   TC bin_Sx2w(int aI,int aJ) const {
 80     TO offset;                                     80     TO offset;
 81     if(!_find_offset(aI,aJ,offset)) return 0;      81     if(!_find_offset(aI,aJ,offset)) return 0;
 82     return parent::m_bin_Sx2w[offset][AxisX];      82     return parent::m_bin_Sx2w[offset][AxisX];
 83   }                                                83   }
 84   TC bin_Syw(int aI,int aJ) const {                84   TC bin_Syw(int aI,int aJ) const {
 85     TO offset;                                     85     TO offset;
 86     if(!_find_offset(aI,aJ,offset)) return 0;      86     if(!_find_offset(aI,aJ,offset)) return 0;
 87     return parent::m_bin_Sxw[offset][AxisY];       87     return parent::m_bin_Sxw[offset][AxisY];
 88   }                                                88   }
 89   TC bin_Sy2w(int aI,int aJ) const {               89   TC bin_Sy2w(int aI,int aJ) const {
 90     TO offset;                                     90     TO offset;
 91     if(!_find_offset(aI,aJ,offset)) return 0;      91     if(!_find_offset(aI,aJ,offset)) return 0;
 92     return parent::m_bin_Sx2w[offset][AxisY];      92     return parent::m_bin_Sx2w[offset][AxisY];
 93   }                                                93   }
 94                                                    94 
 95   TH bin_height(int aI,int aJ) const {             95   TH bin_height(int aI,int aJ) const {
 96     TO offset;                                     96     TO offset;
 97     if(!_find_offset(aI,aJ,offset)) return 0;      97     if(!_find_offset(aI,aJ,offset)) return 0;
 98     return this->get_bin_height(offset);           98     return this->get_bin_height(offset);
 99   }                                                99   }
100                                                   100 
101   TC bin_center_x(int aI) const {                 101   TC bin_center_x(int aI) const {
102     return parent::m_axes[0].bin_center(aI);      102     return parent::m_axes[0].bin_center(aI);
103   }                                               103   }
104   TC bin_center_y(int aJ) const {                 104   TC bin_center_y(int aJ) const {
105     return parent::m_axes[1].bin_center(aJ);      105     return parent::m_axes[1].bin_center(aJ);
106   }                                               106   }
107                                                   107 
108   TC bin_mean_x(int aI,int aJ) const {            108   TC bin_mean_x(int aI,int aJ) const {
109     TO offset;                                    109     TO offset;
110     if(!_find_offset(aI,aJ,offset)) return 0;     110     if(!_find_offset(aI,aJ,offset)) return 0;
111     TW sw = parent::m_bin_Sw[offset];             111     TW sw = parent::m_bin_Sw[offset];
112     if(sw==0) return 0;                           112     if(sw==0) return 0;
113     return parent::m_bin_Sxw[offset][AxisX]/sw    113     return parent::m_bin_Sxw[offset][AxisX]/sw;
114   }                                               114   }
115                                                   115 
116   TC bin_mean_y(int aI,int aJ) const {            116   TC bin_mean_y(int aI,int aJ) const {
117     TO offset;                                    117     TO offset;
118     if(!_find_offset(aI,aJ,offset)) return 0;     118     if(!_find_offset(aI,aJ,offset)) return 0;
119     TW sw = parent::m_bin_Sw[offset];             119     TW sw = parent::m_bin_Sw[offset];
120     if(sw==0) return 0;                           120     if(sw==0) return 0;
121     return parent::m_bin_Sxw[offset][AxisY]/sw    121     return parent::m_bin_Sxw[offset][AxisY]/sw;
122   }                                               122   }
123                                                   123 
124   TC bin_rms_x(int aI,int aJ) const {             124   TC bin_rms_x(int aI,int aJ) const {
125     TO offset;                                    125     TO offset;
126     if(!_find_offset(aI,aJ,offset)) return 0;     126     if(!_find_offset(aI,aJ,offset)) return 0;
127     TW sw = parent::m_bin_Sw[offset];             127     TW sw = parent::m_bin_Sw[offset];
128     if(sw==0) return 0;                           128     if(sw==0) return 0;
129     TC sxw = parent::m_bin_Sxw[offset][AxisX];    129     TC sxw = parent::m_bin_Sxw[offset][AxisX];
130     TC sx2w = parent::m_bin_Sx2w[offset][AxisX    130     TC sx2w = parent::m_bin_Sx2w[offset][AxisX];
131     TC mean = sxw/sw;                             131     TC mean = sxw/sw;
132     return ::sqrt(::fabs((sx2w / sw) - mean *     132     return ::sqrt(::fabs((sx2w / sw) - mean * mean));
133   }                                               133   }
134                                                   134 
135   TC bin_rms_y(int aI,int aJ) const {             135   TC bin_rms_y(int aI,int aJ) const {
136     TO offset;                                    136     TO offset;
137     if(!_find_offset(aI,aJ,offset)) return 0;     137     if(!_find_offset(aI,aJ,offset)) return 0;
138     TW sw = parent::m_bin_Sw[offset];             138     TW sw = parent::m_bin_Sw[offset];
139     if(sw==0) return 0;                           139     if(sw==0) return 0;
140     TC sxw = parent::m_bin_Sxw[offset][AxisY];    140     TC sxw = parent::m_bin_Sxw[offset][AxisY];
141     TC sx2w = parent::m_bin_Sx2w[offset][AxisY    141     TC sx2w = parent::m_bin_Sx2w[offset][AxisY];
142     TC mean = sxw/sw;                             142     TC mean = sxw/sw;
143     return ::sqrt(::fabs((sx2w / sw) - mean *     143     return ::sqrt(::fabs((sx2w / sw) - mean * mean));
144   }                                               144   }
145                                                   145 
146   // Axes :                                       146   // Axes :
147   const axis_t& axis_x() const {return parent:    147   const axis_t& axis_x() const {return parent::m_axes[0];}
148   const axis_t& axis_y() const {return parent:    148   const axis_t& axis_y() const {return parent::m_axes[1];}
149   axis_t& axis_x() {return parent::m_axes[0];}    149   axis_t& axis_x() {return parent::m_axes[0];} //touchy
150   axis_t& axis_y() {return parent::m_axes[1];}    150   axis_t& axis_y() {return parent::m_axes[1];} //touchy
151   // Projection :                                 151   // Projection :
152                                                   152 
153   TN bin_entries_x(int aI) const {                153   TN bin_entries_x(int aI) const {
154     if(!parent::m_dimension) return 0;            154     if(!parent::m_dimension) return 0;
155     bn_t ibin;                                    155     bn_t ibin;
156     if(!parent::m_axes[0].in_range_to_absolute    156     if(!parent::m_axes[0].in_range_to_absolute_index(aI,ibin)) return 0;
157     bn_t ybins = parent::m_axes[1].bins()+2;      157     bn_t ybins = parent::m_axes[1].bins()+2;
158     TO offset;                                    158     TO offset;
159     TN _entries = 0;                              159     TN _entries = 0;
160     for(bn_t jbin=0;jbin<ybins;jbin++) {          160     for(bn_t jbin=0;jbin<ybins;jbin++) {
161       offset = ibin + jbin * parent::m_axes[1]    161       offset = ibin + jbin * parent::m_axes[1].m_offset;
162       _entries += parent::m_bin_entries[offset    162       _entries += parent::m_bin_entries[offset];
163     }                                             163     }
164     return _entries;                              164     return _entries;
165   }                                               165   }
166                                                   166 
167   TW bin_height_x(int aI) const {                 167   TW bin_height_x(int aI) const {
168     if(!parent::m_dimension) return 0;            168     if(!parent::m_dimension) return 0;
169     bn_t ibin;                                    169     bn_t ibin;
170     if(!parent::m_axes[0].in_range_to_absolute    170     if(!parent::m_axes[0].in_range_to_absolute_index(aI,ibin)) return 0;
171     bn_t ybins = parent::m_axes[1].bins()+2;      171     bn_t ybins = parent::m_axes[1].bins()+2;
172     TO offset;                                    172     TO offset;
173     TW sw = 0;                                    173     TW sw = 0;
174     for(bn_t jbin=0;jbin<ybins;jbin++) {          174     for(bn_t jbin=0;jbin<ybins;jbin++) {
175       offset = ibin + jbin * parent::m_axes[1]    175       offset = ibin + jbin * parent::m_axes[1].m_offset;
176       sw += this->get_bin_height(offset);         176       sw += this->get_bin_height(offset);
177     }                                             177     }
178     return sw;                                    178     return sw;
179   }                                               179   }
180                                                   180 
181   TN bin_entries_y(int aJ) const {                181   TN bin_entries_y(int aJ) const {
182     if(!parent::m_dimension) return 0;            182     if(!parent::m_dimension) return 0;
183     bn_t jbin;                                    183     bn_t jbin;
184     if(!parent::m_axes[1].in_range_to_absolute    184     if(!parent::m_axes[1].in_range_to_absolute_index(aJ,jbin)) return 0;
185     bn_t xbins = parent::m_axes[0].bins()+2;      185     bn_t xbins = parent::m_axes[0].bins()+2;
186     TO offset;                                    186     TO offset;
187     TN _entries = 0;                              187     TN _entries = 0;
188     for(bn_t ibin=0;ibin<xbins;ibin++) {          188     for(bn_t ibin=0;ibin<xbins;ibin++) {
189       offset = ibin + jbin * parent::m_axes[1]    189       offset = ibin + jbin * parent::m_axes[1].m_offset;
190       _entries += parent::m_bin_entries[offset    190       _entries += parent::m_bin_entries[offset];
191     }                                             191     }
192     return _entries;                              192     return _entries;
193   }                                               193   }
194                                                   194 
195   TW bin_height_y(int aJ) const {                 195   TW bin_height_y(int aJ) const {
196     if(!parent::m_dimension) return 0;            196     if(!parent::m_dimension) return 0;
197     bn_t jbin;                                    197     bn_t jbin;
198     if(!parent::m_axes[1].in_range_to_absolute    198     if(!parent::m_axes[1].in_range_to_absolute_index(aJ,jbin)) return 0;
199     bn_t xbins = parent::m_axes[0].bins()+2;      199     bn_t xbins = parent::m_axes[0].bins()+2;
200     TO offset;                                    200     TO offset;
201     TW sw = 0;                                    201     TW sw = 0;
202     for(bn_t ibin=0;ibin<xbins;ibin++) {          202     for(bn_t ibin=0;ibin<xbins;ibin++) {
203       offset = ibin + jbin * parent::m_axes[1]    203       offset = ibin + jbin * parent::m_axes[1].m_offset;
204       sw += this->get_bin_height(offset);         204       sw += this->get_bin_height(offset);
205     }                                             205     }
206     return sw;                                    206     return sw;
207   }                                               207   }
208                                                   208 
209   TC Sxyw() const {return parent::m_in_range_p    209   TC Sxyw() const {return parent::m_in_range_plane_Sxyw[0];}
210 public:                                           210 public:
211   //NOTE : print is a Python keyword.             211   //NOTE : print is a Python keyword.
212   void hprint(std::ostream& a_out) {              212   void hprint(std::ostream& a_out) {
213     // A la HPRINT.                               213     // A la HPRINT.
214     a_out << parent::dimension() << parent::ti    214     a_out << parent::dimension() << parent::title() << std::endl;
215     a_out                                         215     a_out
216       << " * ENTRIES = " << parent::all_entrie    216       << " * ENTRIES = " << parent::all_entries() << std::endl;
217                                                   217 
218     //   6 | 7 | 8                                218     //   6 | 7 | 8
219     //  -----------                               219     //  -----------
220     //   3 | 4 | 5                                220     //   3 | 4 | 5
221     //  -----------                               221     //  -----------
222     //   0 | 1 | 2                                222     //   0 | 1 | 2
223                                                   223 
224     TW height_0 = bin_height(axis_t::UNDERFLOW    224     TW height_0 = bin_height(axis_t::UNDERFLOW_BIN,
225                                            axi    225                                            axis_t::UNDERFLOW_BIN);
226     TW height_2 = bin_height(axis_t::OVERFLOW_    226     TW height_2 = bin_height(axis_t::OVERFLOW_BIN,
227                                            axi    227                                            axis_t::UNDERFLOW_BIN);
228     TW height_6 = bin_height(axis_t::UNDERFLOW    228     TW height_6 = bin_height(axis_t::UNDERFLOW_BIN,
229                                            axi    229                                            axis_t::OVERFLOW_BIN);
230     TW height_8 = bin_height(axis_t::OVERFLOW_    230     TW height_8 = bin_height(axis_t::OVERFLOW_BIN,
231                                            axi    231                                            axis_t::OVERFLOW_BIN);
232                                                   232 
233     bn_t i,j;                                     233     bn_t i,j;
234                                                   234 
235     TW height_1 = 0;                              235     TW height_1 = 0;
236     TW height_7 = 0;                              236     TW height_7 = 0;
237     for(i=0;i<axis_x().bins();i++){               237     for(i=0;i<axis_x().bins();i++){
238       height_1 += bin_height(i,axis_t::UNDERFL    238       height_1 += bin_height(i,axis_t::UNDERFLOW_BIN);
239       height_7 += bin_height(i,axis_t::OVERFLO    239       height_7 += bin_height(i,axis_t::OVERFLOW_BIN);
240     }                                             240     }
241                                                   241 
242     TW height_3 = 0;                              242     TW height_3 = 0;
243     TW height_5 = 0;                              243     TW height_5 = 0;
244     for(j=0;j<axis_y().bins();j++){               244     for(j=0;j<axis_y().bins();j++){
245       height_3 += bin_height(axis_t::UNDERFLOW    245       height_3 += bin_height(axis_t::UNDERFLOW_BIN,j);
246       height_5 += bin_height(axis_t::OVERFLOW_    246       height_5 += bin_height(axis_t::OVERFLOW_BIN,j);
247     }                                             247     }
248                                                   248 
249     TW height_4 = 0;                              249     TW height_4 = 0;
250     for(i=0;i<axis_x().bins();i++){               250     for(i=0;i<axis_x().bins();i++){
251       for(j=0;j<axis_y().bins();j++){             251       for(j=0;j<axis_y().bins();j++){
252         height_4 += bin_height(i,j);              252         height_4 += bin_height(i,j);
253       }                                           253       }
254     }                                             254     }
255                                                   255 
256     a_out                                         256     a_out
257       << " " << height_6 << " " << height_7 <<    257       << " " << height_6 << " " << height_7 << " " << height_8 << std::endl;
258     a_out                                         258     a_out
259       << " " << height_3 << " " << height_4 <<    259       << " " << height_3 << " " << height_4 << " " << height_5 << std::endl;
260     a_out                                         260     a_out
261       << " " << height_0 << " " << height_1 <<    261       << " " << height_0 << " " << height_1 << " " << height_2 << std::endl;
262                                                   262 
263     // Some bins :                                263     // Some bins :
264     bn_t xbins = axis_x().bins();                 264     bn_t xbins = axis_x().bins();
265     bn_t ybins = axis_y().bins();                 265     bn_t ybins = axis_y().bins();
266     a_out                                         266     a_out
267       << " * ENTRIES[0,0]     = "                 267       << " * ENTRIES[0,0]     = "
268       << bin_entries(0,0)                         268       << bin_entries(0,0)
269       << " * HEIGHT[0,0] = "                      269       << " * HEIGHT[0,0] = "
270       << bin_height(0,0)                          270       << bin_height(0,0)
271       << " * ERROR[0,0] = "                       271       << " * ERROR[0,0] = "
272       << bin_error(0,0)                           272       << bin_error(0,0)
273       << std::endl;                               273       << std::endl;
274     a_out                                         274     a_out
275       << " * ENTRIES[N/2,N/2] = "                 275       << " * ENTRIES[N/2,N/2] = "
276       << bin_entries(xbins/2,ybins/2)             276       << bin_entries(xbins/2,ybins/2)
277       << " * HEIGHT[N/2,N/2] = "                  277       << " * HEIGHT[N/2,N/2] = "
278       << bin_height(xbins/2,ybins/2)              278       << bin_height(xbins/2,ybins/2)
279       << " * ERROR[N/2,N/2] = "                   279       << " * ERROR[N/2,N/2] = "
280       << bin_error(xbins/2,ybins/2)               280       << bin_error(xbins/2,ybins/2)
281       << std::endl;                               281       << std::endl;
282     a_out                                         282     a_out
283       << " * ENTRIES[N-1,N-1] = "                 283       << " * ENTRIES[N-1,N-1] = "
284       << bin_entries(xbins-1,ybins-1)             284       << bin_entries(xbins-1,ybins-1)
285       << " * HEIGHT[N-1,N-1] = "                  285       << " * HEIGHT[N-1,N-1] = "
286       << bin_height(xbins-1,ybins-1)              286       << bin_height(xbins-1,ybins-1)
287       << " * ERROR[N-1,N-1] = "                   287       << " * ERROR[N-1,N-1] = "
288       << bin_error(xbins-1,ybins-1)               288       << bin_error(xbins-1,ybins-1)
289       << std::endl;                               289       << std::endl;
290   }                                               290   }
291 protected:                                        291 protected:
292   b2(const std::string& a_title,bn_t aXnumber,    292   b2(const std::string& a_title,bn_t aXnumber,TC aXmin,TC aXmax,bn_t aYnumber,TC aYmin,TC aYmax) {
293     parent::m_title = a_title;                    293     parent::m_title = a_title;
294     std::vector<bn_t> nbins;                      294     std::vector<bn_t> nbins;
295     nbins.push_back(aXnumber);                    295     nbins.push_back(aXnumber);
296     nbins.push_back(aYnumber);                    296     nbins.push_back(aYnumber);
297     std::vector<TC> mins;                         297     std::vector<TC> mins;
298     mins.push_back(aXmin);                        298     mins.push_back(aXmin);
299     mins.push_back(aYmin);                        299     mins.push_back(aYmin);
300     std::vector<TC> maxs;                         300     std::vector<TC> maxs;
301     maxs.push_back(aXmax);                        301     maxs.push_back(aXmax);
302     maxs.push_back(aYmax);                        302     maxs.push_back(aYmax);
303     parent::configure(2,nbins,mins,maxs);         303     parent::configure(2,nbins,mins,maxs);
304   }                                               304   }
305                                                   305 
306   b2(const std::string& a_title,const std::vec    306   b2(const std::string& a_title,const std::vector<TC>& a_edges_x,const std::vector<TC>& a_edges_y) {
307     parent::m_title = a_title;                    307     parent::m_title = a_title;
308     std::vector< std::vector<TC> > edges(2);      308     std::vector< std::vector<TC> > edges(2);
309     edges[0] = a_edges_x;                         309     edges[0] = a_edges_x;
310     edges[1] = a_edges_y;                         310     edges[1] = a_edges_y;
311     parent::configure(2,edges);                   311     parent::configure(2,edges);
312   }                                               312   }
313                                                   313 
314   virtual ~b2(){}                                 314   virtual ~b2(){}
315 protected:                                        315 protected:
316   b2(const b2& a_from):parent(a_from) {}          316   b2(const b2& a_from):parent(a_from) {}
317   b2& operator=(const b2& a_from) {parent::ope    317   b2& operator=(const b2& a_from) {parent::operator=(a_from);return *this;}
318 public:                                           318 public:
319   bool configure(bn_t aXnumber,TC aXmin,TC aXm    319   bool configure(bn_t aXnumber,TC aXmin,TC aXmax,bn_t aYnumber,TC aYmin,TC aYmax){
320     std::vector<bn_t> nbins;                      320     std::vector<bn_t> nbins;
321     nbins.push_back(aXnumber);                    321     nbins.push_back(aXnumber);
322     nbins.push_back(aYnumber);                    322     nbins.push_back(aYnumber);
323     std::vector<TC> mins;                         323     std::vector<TC> mins;
324     mins.push_back(aXmin);                        324     mins.push_back(aXmin);
325     mins.push_back(aYmin);                        325     mins.push_back(aYmin);
326     std::vector<TC> maxs;                         326     std::vector<TC> maxs;
327     maxs.push_back(aXmax);                        327     maxs.push_back(aXmax);
328     maxs.push_back(aYmax);                        328     maxs.push_back(aYmax);
329     return parent::configure(2,nbins,mins,maxs    329     return parent::configure(2,nbins,mins,maxs);
330   }                                               330   }
331                                                   331 
332   bool configure(const std::vector<TC>& a_edge    332   bool configure(const std::vector<TC>& a_edges_x,const std::vector<TC>& a_edges_y){
333     std::vector< std::vector<TC> > edges(2);      333     std::vector< std::vector<TC> > edges(2);
334     edges[0] = a_edges_x;                         334     edges[0] = a_edges_x;
335     edges[1] = a_edges_y;                         335     edges[1] = a_edges_y;
336     return parent::configure(2,edges);            336     return parent::configure(2,edges);
337   }                                               337   }
338                                                   338 
339 protected:                                        339 protected:
340   bool _find_offset(int aI,int aJ,TO& a_offset    340   bool _find_offset(int aI,int aJ,TO& a_offset) const {
341     if(parent::m_dimension!=2) {a_offset=0;ret    341     if(parent::m_dimension!=2) {a_offset=0;return false;}
342     bn_t ibin,jbin;                               342     bn_t ibin,jbin;
343     if(!parent::m_axes[0].in_range_to_absolute    343     if(!parent::m_axes[0].in_range_to_absolute_index(aI,ibin)) {a_offset=0;return false;}
344     if(!parent::m_axes[1].in_range_to_absolute    344     if(!parent::m_axes[1].in_range_to_absolute_index(aJ,jbin)) {a_offset=0;return false;}
345     a_offset = ibin + jbin * parent::m_axes[1]    345     a_offset = ibin + jbin * parent::m_axes[1].m_offset;
346     return true;                                  346     return true;
347   }                                               347   }
348 };                                                348 };
349                                                   349 
350 }}                                                350 }}
351                                                   351 
352 #endif                                            352 #endif
353                                                   353 
354                                                   354 
355                                                   355 
356                                                   356