Changeset 1053 in Sophya for trunk/SophyaLib/HiStats/histos.cc
- Timestamp:
- Jun 30, 2000, 3:21:53 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/HiStats/histos.cc
r958 r1053 1 1 // 2 // $Id: histos.cc,v 1. 5 2000-04-18 13:38:16ansari Exp $2 // $Id: histos.cc,v 1.6 2000-06-30 13:21:52 ansari Exp $ 3 3 // 4 4 … … 192 192 /********* Methode *********/ 193 193 /*! 194 Operateur H2 = H1 * b195 */196 Histo operator * (const Histo& a, double b)197 {198 Histo result(a);199 return (result *= b);200 }201 202 /*!203 Operateur H2 = b * H1204 */205 Histo operator * (double b, const Histo& a)206 {207 Histo result(a);208 return (result *= b);209 }210 211 /*!212 Operateur H2 = H1 / b213 */214 Histo operator / (const Histo& a, double b)215 {216 Histo result(a);217 return (result /= b);218 }219 220 /*!221 Operateur H2 = H1 + b222 */223 Histo operator + (const Histo& a, double b)224 {225 Histo result(a);226 return (result += b);227 }228 229 /*!230 Operateur H2 = b + H1231 */232 Histo operator + (double b, const Histo& a)233 {234 Histo result(a);235 return (result += b);236 }237 238 /*!239 Operateur H2 = H1 - b240 */241 Histo operator - (const Histo& a, double b)242 {243 Histo result(a);244 return (result -= b);245 }246 247 /*!248 Operateur H2 = b - H1249 */250 Histo operator - (double b, const Histo& a)251 {252 Histo result(a);253 result *= -1.;254 return (result += b);255 }256 257 /********* Methode *********/258 /*!259 194 Operateur H += H1 260 195 */ … … 265 200 data[i] += a(i); 266 201 if(err2 && a.err2) err2[i] += a.Error2(i); 267 else err2[i] = 0.;268 202 } 269 203 under += a.under; … … 284 218 data[i] -= a(i); 285 219 if(err2 && a.err2) err2[i] += a.Error2(i); 286 else err2[i] = 0.;287 220 } 288 221 under -= a.under; … … 304 237 if(err2 && a.err2) 305 238 err2[i] = a(i)*a(i)*err2[i] + data[i]*data[i]*a.Error2(i); 306 else err2[i] = 0.;307 239 data[i] *= a(i); 308 240 nHist += data[i]; … … 331 263 err2[i] = (err2[i] + data[i]/a(i)*data[i]/a(i)*a.Error2(i)) 332 264 /(a(i)*a(i)); 333 else err2[i] = 0.;334 265 data[i] /= a(i); 335 266 nHist += data[i]; … … 340 271 341 272 return *this; 342 }343 344 /********* Methode *********/345 /*!346 Operateur H = H1 + H2347 */348 Histo operator + (const Histo& a, const Histo& b)349 {350 if (b.NBins()!=a.NBins()) THROW(sizeMismatchErr);351 Histo c(a);352 return (c += b);353 }354 355 /*!356 Operateur H = H1 - H2357 */358 Histo operator - (const Histo& a, const Histo& b)359 {360 if (b.NBins()!=a.NBins()) THROW(sizeMismatchErr);361 Histo c(a);362 return (c -= b);363 }364 365 /*!366 Operateur H = H1 * H2367 */368 Histo operator * (const Histo& a, const Histo& b)369 {370 if (b.NBins()!=a.NBins()) THROW(sizeMismatchErr);371 Histo c(a);372 return (c *= b);373 }374 375 /*!376 Operateur H = H1 / H2377 */378 Histo operator / (const Histo& a, const Histo& b)379 {380 if (b.NBins()!=a.NBins()) THROW(sizeMismatchErr);381 Histo c(a);382 return (c /= b);383 273 } 384 274 … … 448 338 for(int i=0;i<bins;i++) { 449 339 data[i] += v(i); 450 if(err2 &&ierr) err2[i] += fabs(v(i));340 if(err2 && ierr) err2[i] += fabs(v(i)); 451 341 } 452 342 return;
Note:
See TracChangeset
for help on using the changeset viewer.