Changeset 1053 in Sophya


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

Location:
trunk/SophyaLib/HiStats
Files:
6 edited

Legend:

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

    r926 r1053  
    230230}
    231231
    232 /********* Methode *********/
    233 /*!
    234   Operateur H = H1 + H2
    235   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 
    244232///////////////////////////////////////////////////////////
    245233// --------------------------------------------------------
  • trunk/SophyaLib/HiStats/hisprof.h

    r958 r1053  
    5252  HProf& operator = (const HProf& h);
    5353  HProf& operator += (const HProf& a);
    54   friend HProf operator + (const HProf& a, const HProf& b);
    5554
    5655  // Fit
     
    9493// ObjFileIO<HProf>
    9594
     95/*! \ingroup HiStats \fn operator+(const HProf&, const HProf&)
     96  \brief Operateur H = H1 + H2
     97  \warning Meme commentaire que pour l'operateur +=
     98*/
     99inline HProf operator + (const HProf& a, const HProf& b)
     100{
     101if (b.NBins()!=a.NBins()) THROW(sizeMismatchErr);
     102HProf c(a);
     103return (c += b);
     104}
    96105
    97106} // Fin du namespace
  • 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;
  • trunk/SophyaLib/HiStats/histos.h

    r958 r1053  
    11// This may look like C code, but it is really -*- C++ -*-
    22//
    3 // $Id: histos.h,v 1.6 2000-04-18 13:38:17 ansari Exp $
     3// $Id: histos.h,v 1.7 2000-06-30 13:21:53 ansari Exp $
    44//
    55
     
    5050  Histo& operator += (double b);
    5151  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);
    5952  Histo& operator += (const Histo& a);
    6053  Histo& operator -= (const Histo& a);
    6154  Histo& operator *= (const Histo& a);
    6255  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);
    6756
    6857  // get/put dans/depuis un vector
     
    191180// ObjFileIO<Histo>
    192181
     182/*! \ingroup HiStats \fn operator*(const Histo&,double)
     183  \brief Operateur H2 = H1 * b */
     184inline 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 */
     192inline 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 */
     200inline 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 */
     208inline 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 */
     216inline 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 */
     224inline 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 */
     232inline 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 */
     241inline Histo operator + (const Histo& a, const Histo& b)
     242{
     243if (b.NBins()!=a.NBins()) THROW(sizeMismatchErr);
     244Histo c(a);
     245return (c += b);
     246}
     247
     248/*! \ingroup HiStats \fn operator-(const Histo&,const Histo&)
     249  \brief Operateur H = H1 - H2 */
     250inline Histo operator - (const Histo& a, const Histo& b)
     251{
     252if (b.NBins()!=a.NBins()) THROW(sizeMismatchErr);
     253Histo c(a);
     254return (c -= b);
     255}
     256
     257/*! \ingroup HiStats \fn operator*(const Histo&,const Histo&)
     258  \brief Operateur H = H1 * H2 */
     259inline Histo operator * (const Histo& a, const Histo& b)
     260{
     261if (b.NBins()!=a.NBins()) THROW(sizeMismatchErr);
     262Histo c(a);
     263return (c *= b);
     264}
     265
     266/*! \ingroup HiStats \fn operator/(const Histo&,const Histo&)
     267  \brief Operateur H = H1 / H2 */
     268inline Histo operator / (const Histo& a, const Histo& b)
     269{
     270if (b.NBins()!=a.NBins()) THROW(sizeMismatchErr);
     271Histo c(a);
     272return (c /= b);
     273}
    193274
    194275} // Fin du namespace
  • trunk/SophyaLib/HiStats/histos2.cc

    r958 r1053  
    390390///////////////////////////////////////////////////////////////////
    391391/*!
    392   Operateur H2 = H1 * b
    393 */
    394 Histo2D operator * (const Histo2D& a, double b)
    395 {
    396   Histo2D result(a);
    397   return (result *= b);
    398 }
    399 
    400 /*!
    401   Operateur H2 = b * H1
    402 */
    403 Histo2D operator * (double b, const Histo2D& a)
    404 {
    405   Histo2D result(a);
    406   return (result *= b);
    407 }
    408 
    409 /*!
    410   Operateur H2 = H1 / b
    411 */
    412 Histo2D operator / (const Histo2D& a, double b)
    413 {
    414   Histo2D result(a);
    415   return (result /= b);
    416 }
    417 
    418 /*!
    419   Operateur H2 = H1 + b
    420 */
    421 Histo2D operator + (const Histo2D& a, double b)
    422 {
    423   Histo2D result(a);
    424   return (result += b);
    425 }
    426 
    427 /*!
    428   Operateur H2 = b + H1
    429 */
    430 Histo2D operator + (double b, const Histo2D& a)
    431 {
    432   Histo2D result(a);
    433   return (result += b);
    434 }
    435 
    436 /*!
    437   Operateur H2 = H1 - b
    438 */
    439 Histo2D operator - (const Histo2D& a, double b)
    440 {
    441   Histo2D result(a);
    442   return (result -= b);
    443 }
    444 
    445 /*!
    446   Operateur H2 = b - H1
    447 */
    448 Histo2D operator - (double b, const Histo2D& a)
    449 {
    450   Histo2D result(a);
    451   result *= -1.;
    452   return (result += b);
    453 }
    454 
    455 ///////////////////////////////////////////////////////////////////
    456 /*!
    457392  Operateur H += H1
    458393*/
     
    555490
    556491return *this;
    557 }
    558 
    559 ///////////////////////////////////////////////////////////////////
    560 /*!
    561   Operateur H = H1 + H2
    562 */
    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 - H2
    573 */
    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 * H2
    583 */
    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 / H2
    593 */
    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);
    599492}
    600493
  • trunk/SophyaLib/HiStats/histos2.h

    r958 r1053  
    4747  Histo2D& operator += (double b);
    4848  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);
    5649  Histo2D& operator += (const Histo2D& a);
    5750  Histo2D& operator -= (const Histo2D& a);
    5851  Histo2D& operator *= (const Histo2D& a);
    5952  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);
    6453
    6554  // get/put dans/depuis une matrice / vector
     
    261250// ObjFileIO<Histo2D>
    262251
     252/*! \ingroup HiStats \fn operator*(const Histo2D&,double)
     253  \brief Operateur H2 = H1 * b */
     254inline 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 */
     262inline 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 */
     270inline 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 */
     278inline 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 */
     286inline 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 */
     294inline 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 */
     302inline 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
     312inline Histo2D operator + (const Histo2D& a, const Histo2D& b)
     313{
     314if (b.NBinX()!=a.NBinX() || b.NBinY()!=a.NBinY()) THROW(sizeMismatchErr);
     315Histo2D c(a);
     316return (c += b);
     317}
     318
     319/*! \ingroup HiStats \fn operator-(const Histo2D&,const Histo2D&)
     320  \brief Operateur H = H1 - H2 */
     321inline Histo2D operator - (const Histo2D& a, const Histo2D& b)
     322{
     323if (b.NBinX()!=a.NBinX() || b.NBinY()!=a.NBinY()) THROW(sizeMismatchErr);
     324Histo2D c(a);
     325return (c -= b);
     326}
     327
     328/*! \ingroup HiStats \fn operator*(const Histo2D&,const Histo2D&)
     329  \brief Operateur H = H1 * H2 */
     330inline Histo2D operator * (const Histo2D& a, const Histo2D& b)
     331{
     332if (b.NBinX()!=a.NBinX() || b.NBinY()!=a.NBinY()) THROW(sizeMismatchErr);
     333Histo2D c(a);
     334return (c *= b);
     335}
     336
     337/*! \ingroup HiStats \fn operator/(const Histo2D&,const Histo2D&)
     338  \brief Operateur H = H1 / H2 */
     339inline Histo2D operator / (const Histo2D& a, const Histo2D& b)
     340{
     341if (b.NBinX()!=a.NBinX() || b.NBinY()!=a.NBinY()) THROW(sizeMismatchErr);
     342Histo2D c(a);
     343return (c /= b);
     344}
     345
    263346} // Fin du namespace
    264347
Note: See TracChangeset for help on using the changeset viewer.