Changeset 1053 in Sophya
- Timestamp:
- Jun 30, 2000, 3:21:53 PM (25 years ago)
- Location:
- trunk/SophyaLib/HiStats
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/HiStats/hisprof.cc
r926 r1053 230 230 } 231 231 232 /********* Methode *********/233 /*!234 Operateur H = H1 + H2235 Meme commentaire que pour l'operateur +=236 */237 HProf operator + (const HProf& a, const HProf& b)238 {239 if (b.NBins()!=a.NBins()) THROW(sizeMismatchErr);240 HProf c(a);241 return (c += b);242 }243 244 232 /////////////////////////////////////////////////////////// 245 233 // -------------------------------------------------------- -
trunk/SophyaLib/HiStats/hisprof.h
r958 r1053 52 52 HProf& operator = (const HProf& h); 53 53 HProf& operator += (const HProf& a); 54 friend HProf operator + (const HProf& a, const HProf& b);55 54 56 55 // Fit … … 94 93 // ObjFileIO<HProf> 95 94 95 /*! \ingroup HiStats \fn operator+(const HProf&, const HProf&) 96 \brief Operateur H = H1 + H2 97 \warning Meme commentaire que pour l'operateur += 98 */ 99 inline HProf operator + (const HProf& a, const HProf& b) 100 { 101 if (b.NBins()!=a.NBins()) THROW(sizeMismatchErr); 102 HProf c(a); 103 return (c += b); 104 } 96 105 97 106 } // Fin du namespace -
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; -
trunk/SophyaLib/HiStats/histos.h
r958 r1053 1 1 // This may look like C code, but it is really -*- C++ -*- 2 2 // 3 // $Id: histos.h,v 1. 6 2000-04-18 13:38:17ansari Exp $3 // $Id: histos.h,v 1.7 2000-06-30 13:21:53 ansari Exp $ 4 4 // 5 5 … … 50 50 Histo& operator += (double b); 51 51 Histo& operator -= (double b); 52 friend Histo operator * (const Histo& a, double b);53 friend Histo operator * (double b, const Histo& a);54 friend Histo operator / (const Histo& a, double b);55 friend Histo operator + (const Histo& a, double b);56 friend Histo operator + (double b, const Histo& a);57 friend Histo operator - (const Histo& a, double b);58 friend Histo operator - (double b, const Histo& a);59 52 Histo& operator += (const Histo& a); 60 53 Histo& operator -= (const Histo& a); 61 54 Histo& operator *= (const Histo& a); 62 55 Histo& operator /= (const Histo& a); 63 friend Histo operator + (const Histo& a, const Histo& b);64 friend Histo operator - (const Histo& a, const Histo& b);65 friend Histo operator * (const Histo& a, const Histo& b);66 friend Histo operator / (const Histo& a, const Histo& b);67 56 68 57 // get/put dans/depuis un vector … … 191 180 // ObjFileIO<Histo> 192 181 182 /*! \ingroup HiStats \fn operator*(const Histo&,double) 183 \brief Operateur H2 = H1 * b */ 184 inline Histo operator * (const Histo& a, double b) 185 { 186 Histo result(a); 187 return (result *= b); 188 } 189 190 /*! \ingroup HiStats \fn operator*(double,const Histo&) 191 \brief Operateur H2 = b * H1 */ 192 inline Histo operator * (double b, const Histo& a) 193 { 194 Histo result(a); 195 return (result *= b); 196 } 197 198 /*! \ingroup HiStats \fn operator/(const Histo&,double) 199 \brief Operateur H2 = H1 / b */ 200 inline Histo operator / (const Histo& a, double b) 201 { 202 Histo result(a); 203 return (result /= b); 204 } 205 206 /*! \ingroup HiStats \fn operator+(const Histo&,double) 207 \brief Operateur H2 = H1 + b */ 208 inline Histo operator + (const Histo& a, double b) 209 { 210 Histo result(a); 211 return (result += b); 212 } 213 214 /*! \ingroup HiStats \fn operator+(double,const Histo&) 215 \brief Operateur H2 = b + H1 */ 216 inline Histo operator + (double b, const Histo& a) 217 { 218 Histo result(a); 219 return (result += b); 220 } 221 222 /*! \ingroup HiStats \fn operator-(const Histo&,double) 223 \brief Operateur H2 = H1 - b */ 224 inline Histo operator - (const Histo& a, double b) 225 { 226 Histo result(a); 227 return (result -= b); 228 } 229 230 /*! \ingroup HiStats \fn operator-(double,const Histo&) 231 \brief Operateur H2 = b - H1 */ 232 inline Histo operator - (double b, const Histo& a) 233 { 234 Histo result(a); 235 result *= -1.; 236 return (result += b); 237 } 238 239 /*! \ingroup HiStats \fn operator+(const Histo&,const Histo&) 240 \brief Operateur H = H1 + H2 */ 241 inline Histo operator + (const Histo& a, const Histo& b) 242 { 243 if (b.NBins()!=a.NBins()) THROW(sizeMismatchErr); 244 Histo c(a); 245 return (c += b); 246 } 247 248 /*! \ingroup HiStats \fn operator-(const Histo&,const Histo&) 249 \brief Operateur H = H1 - H2 */ 250 inline Histo operator - (const Histo& a, const Histo& b) 251 { 252 if (b.NBins()!=a.NBins()) THROW(sizeMismatchErr); 253 Histo c(a); 254 return (c -= b); 255 } 256 257 /*! \ingroup HiStats \fn operator*(const Histo&,const Histo&) 258 \brief Operateur H = H1 * H2 */ 259 inline Histo operator * (const Histo& a, const Histo& b) 260 { 261 if (b.NBins()!=a.NBins()) THROW(sizeMismatchErr); 262 Histo c(a); 263 return (c *= b); 264 } 265 266 /*! \ingroup HiStats \fn operator/(const Histo&,const Histo&) 267 \brief Operateur H = H1 / H2 */ 268 inline Histo operator / (const Histo& a, const Histo& b) 269 { 270 if (b.NBins()!=a.NBins()) THROW(sizeMismatchErr); 271 Histo c(a); 272 return (c /= b); 273 } 193 274 194 275 } // Fin du namespace -
trunk/SophyaLib/HiStats/histos2.cc
r958 r1053 390 390 /////////////////////////////////////////////////////////////////// 391 391 /*! 392 Operateur H2 = H1 * b393 */394 Histo2D operator * (const Histo2D& a, double b)395 {396 Histo2D result(a);397 return (result *= b);398 }399 400 /*!401 Operateur H2 = b * H1402 */403 Histo2D operator * (double b, const Histo2D& a)404 {405 Histo2D result(a);406 return (result *= b);407 }408 409 /*!410 Operateur H2 = H1 / b411 */412 Histo2D operator / (const Histo2D& a, double b)413 {414 Histo2D result(a);415 return (result /= b);416 }417 418 /*!419 Operateur H2 = H1 + b420 */421 Histo2D operator + (const Histo2D& a, double b)422 {423 Histo2D result(a);424 return (result += b);425 }426 427 /*!428 Operateur H2 = b + H1429 */430 Histo2D operator + (double b, const Histo2D& a)431 {432 Histo2D result(a);433 return (result += b);434 }435 436 /*!437 Operateur H2 = H1 - b438 */439 Histo2D operator - (const Histo2D& a, double b)440 {441 Histo2D result(a);442 return (result -= b);443 }444 445 /*!446 Operateur H2 = b - H1447 */448 Histo2D operator - (double b, const Histo2D& a)449 {450 Histo2D result(a);451 result *= -1.;452 return (result += b);453 }454 455 ///////////////////////////////////////////////////////////////////456 /*!457 392 Operateur H += H1 458 393 */ … … 555 490 556 491 return *this; 557 }558 559 ///////////////////////////////////////////////////////////////////560 /*!561 Operateur H = H1 + H2562 */563 564 Histo2D operator + (const Histo2D& a, const Histo2D& b)565 {566 if (b.NBinX()!=a.NBinX() || b.NBinY()!=a.NBinY()) THROW(sizeMismatchErr);567 Histo2D c(a);568 return (c += b);569 }570 571 /*!572 Operateur H = H1 - H2573 */574 Histo2D operator - (const Histo2D& a, const Histo2D& b)575 {576 if (b.NBinX()!=a.NBinX() || b.NBinY()!=a.NBinY()) THROW(sizeMismatchErr);577 Histo2D c(a);578 return (c -= b);579 }580 581 /*!582 Operateur H = H1 * H2583 */584 Histo2D operator * (const Histo2D& a, const Histo2D& b)585 {586 if (b.NBinX()!=a.NBinX() || b.NBinY()!=a.NBinY()) THROW(sizeMismatchErr);587 Histo2D c(a);588 return (c *= b);589 }590 591 /*!592 Operateur H = H1 / H2593 */594 Histo2D operator / (const Histo2D& a, const Histo2D& b)595 {596 if (b.NBinX()!=a.NBinX() || b.NBinY()!=a.NBinY()) THROW(sizeMismatchErr);597 Histo2D c(a);598 return (c /= b);599 492 } 600 493 -
trunk/SophyaLib/HiStats/histos2.h
r958 r1053 47 47 Histo2D& operator += (double b); 48 48 Histo2D& operator -= (double b); 49 friend Histo2D operator * (const Histo2D& a, double b);50 friend Histo2D operator * (double b, const Histo2D& a);51 friend Histo2D operator / (const Histo2D& a, double b);52 friend Histo2D operator + (const Histo2D& a, double b);53 friend Histo2D operator + (double b, const Histo2D& a);54 friend Histo2D operator - (const Histo2D& a, double b);55 friend Histo2D operator - (double b, const Histo2D& a);56 49 Histo2D& operator += (const Histo2D& a); 57 50 Histo2D& operator -= (const Histo2D& a); 58 51 Histo2D& operator *= (const Histo2D& a); 59 52 Histo2D& operator /= (const Histo2D& a); 60 friend Histo2D operator + (const Histo2D& a, const Histo2D& b);61 friend Histo2D operator - (const Histo2D& a, const Histo2D& b);62 friend Histo2D operator * (const Histo2D& a, const Histo2D& b);63 friend Histo2D operator / (const Histo2D& a, const Histo2D& b);64 53 65 54 // get/put dans/depuis une matrice / vector … … 261 250 // ObjFileIO<Histo2D> 262 251 252 /*! \ingroup HiStats \fn operator*(const Histo2D&,double) 253 \brief Operateur H2 = H1 * b */ 254 inline Histo2D operator * (const Histo2D& a, double b) 255 { 256 Histo2D result(a); 257 return (result *= b); 258 } 259 260 /*! \ingroup HiStats \fn operator*(double,const Histo2D&) 261 \brief Operateur H2 = b * H1 */ 262 inline Histo2D operator * (double b, const Histo2D& a) 263 { 264 Histo2D result(a); 265 return (result *= b); 266 } 267 268 /*! \ingroup HiStats \fn operator/(const Histo2D&,double) 269 \brief Operateur H2 = H1 / b */ 270 inline Histo2D operator / (const Histo2D& a, double b) 271 { 272 Histo2D result(a); 273 return (result /= b); 274 } 275 276 /*! \ingroup HiStats \fn operator+(const Histo2D&,double) 277 \brief Operateur H2 = H1 + b */ 278 inline Histo2D operator + (const Histo2D& a, double b) 279 { 280 Histo2D result(a); 281 return (result += b); 282 } 283 284 /*! \ingroup HiStats \fn operator+(double,const Histo2D&) 285 \brief Operateur H2 = b + H1 */ 286 inline Histo2D operator + (double b, const Histo2D& a) 287 { 288 Histo2D result(a); 289 return (result += b); 290 } 291 292 /*! \ingroup HiStats \fn operator-(const Histo2D&,double) 293 \brief Operateur H2 = H1 - b */ 294 inline Histo2D operator - (const Histo2D& a, double b) 295 { 296 Histo2D result(a); 297 return (result -= b); 298 } 299 300 /*! \ingroup HiStats \fn operator-(double,const Histo2D&) 301 \brief Operateur H2 = b - H1 */ 302 inline Histo2D operator - (double b, const Histo2D& a) 303 { 304 Histo2D result(a); 305 result *= -1.; 306 return (result += b); 307 } 308 309 /*! \ingroup HiStats \fn operator+(const Histo2D&,const Histo2D&) 310 \brief Operateur H = H1 + H2 */ 311 312 inline Histo2D operator + (const Histo2D& a, const Histo2D& b) 313 { 314 if (b.NBinX()!=a.NBinX() || b.NBinY()!=a.NBinY()) THROW(sizeMismatchErr); 315 Histo2D c(a); 316 return (c += b); 317 } 318 319 /*! \ingroup HiStats \fn operator-(const Histo2D&,const Histo2D&) 320 \brief Operateur H = H1 - H2 */ 321 inline Histo2D operator - (const Histo2D& a, const Histo2D& b) 322 { 323 if (b.NBinX()!=a.NBinX() || b.NBinY()!=a.NBinY()) THROW(sizeMismatchErr); 324 Histo2D c(a); 325 return (c -= b); 326 } 327 328 /*! \ingroup HiStats \fn operator*(const Histo2D&,const Histo2D&) 329 \brief Operateur H = H1 * H2 */ 330 inline Histo2D operator * (const Histo2D& a, const Histo2D& b) 331 { 332 if (b.NBinX()!=a.NBinX() || b.NBinY()!=a.NBinY()) THROW(sizeMismatchErr); 333 Histo2D c(a); 334 return (c *= b); 335 } 336 337 /*! \ingroup HiStats \fn operator/(const Histo2D&,const Histo2D&) 338 \brief Operateur H = H1 / H2 */ 339 inline Histo2D operator / (const Histo2D& a, const Histo2D& b) 340 { 341 if (b.NBinX()!=a.NBinX() || b.NBinY()!=a.NBinY()) THROW(sizeMismatchErr); 342 Histo2D c(a); 343 return (c /= b); 344 } 345 263 346 } // Fin du namespace 264 347
Note:
See TracChangeset
for help on using the changeset viewer.