Changeset 1053 in Sophya for trunk/SophyaLib/HiStats/histos.cc


Ignore:
Timestamp:
Jun 30, 2000, 3:21:53 PM (25 years ago)
Author:
ansari
Message:

les friend operator ne marche plus ? passage en inline cmv 30/06/00

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/HiStats/histos.cc

    r958 r1053  
    11//
    2 // $Id: histos.cc,v 1.5 2000-04-18 13:38:16 ansari Exp $
     2// $Id: histos.cc,v 1.6 2000-06-30 13:21:52 ansari Exp $
    33//
    44
     
    192192/********* Methode *********/
    193193/*!
    194   Operateur H2 = H1 * b
    195 */
    196 Histo operator * (const Histo& a, double b)
    197 {
    198   Histo result(a);
    199   return (result *= b);
    200 }
    201 
    202 /*!
    203   Operateur H2 = b * H1
    204 */
    205 Histo operator * (double b, const Histo& a)
    206 {
    207   Histo result(a);
    208   return (result *= b);
    209 }
    210 
    211 /*!
    212   Operateur H2 = H1 / b
    213 */
    214 Histo operator / (const Histo& a, double b)
    215 {
    216   Histo result(a);
    217   return (result /= b);
    218 }
    219 
    220 /*!
    221   Operateur H2 = H1 + b
    222 */
    223 Histo operator + (const Histo& a, double b)
    224 {
    225   Histo result(a);
    226   return (result += b);
    227 }
    228 
    229 /*!
    230   Operateur H2 = b + H1
    231 */
    232 Histo operator + (double b, const Histo& a)
    233 {
    234   Histo result(a);
    235   return (result += b);
    236 }
    237 
    238 /*!
    239   Operateur H2 = H1 - b
    240 */
    241 Histo operator - (const Histo& a, double b)
    242 {
    243   Histo result(a);
    244   return (result -= b);
    245 }
    246 
    247 /*!
    248   Operateur H2 = b - H1
    249 */
    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 /*!
    259194  Operateur H += H1
    260195*/
     
    265200  data[i] += a(i);
    266201  if(err2 && a.err2) err2[i] += a.Error2(i);
    267     else err2[i] = 0.;
    268202}
    269203under += a.under;
     
    284218  data[i] -= a(i);
    285219  if(err2 && a.err2) err2[i] += a.Error2(i);
    286     else err2[i] = 0.;
    287220}
    288221under -= a.under;
     
    304237  if(err2 && a.err2)
    305238      err2[i] = a(i)*a(i)*err2[i] + data[i]*data[i]*a.Error2(i);
    306     else err2[i] = 0.;
    307239  data[i] *= a(i);
    308240  nHist += data[i];
     
    331263      err2[i] = (err2[i] + data[i]/a(i)*data[i]/a(i)*a.Error2(i))
    332264                /(a(i)*a(i));
    333     else err2[i] = 0.;
    334265  data[i] /= a(i);
    335266  nHist += data[i];
     
    340271
    341272return *this;
    342 }
    343 
    344 /********* Methode *********/
    345 /*!
    346   Operateur H = H1 + H2
    347 */
    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 - H2
    357 */
    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 * H2
    367 */
    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 / H2
    377 */
    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);
    383273}
    384274
     
    448338for(int i=0;i<bins;i++) {
    449339  data[i] += v(i);
    450   if(err2&&ierr) err2[i] += fabs(v(i));
     340  if(err2 && ierr) err2[i] += fabs(v(i));
    451341}
    452342return;
Note: See TracChangeset for help on using the changeset viewer.