Changeset 9253


Ignore:
Timestamp:
01/24/09 10:57:48 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r9252 r9253  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20
     21 2009/01/24 Thomas Bretz
     22
     23   * mbase/MMath.cc:
     24     - added two explicit conversion to make it compile on my Ubuntu
     25     - Replaced some Form by MString::Format
     26     - included MString
     27
     28
    2029
    2130 2009/01/23 Daniela Dorner
  • trunk/MagicSoft/Mars/mbase/MMath.cc

    r9234 r9253  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.45 2009-01-21 14:22:39 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.46 2009-01-24 10:57:46 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    5656#endif
    5757
     58#include "MString.h"
     59
    5860//NamespaceImp(MMath);
    5961
     
    243245    Double_t arr[n];
    244246    for (int i=0; i<n; i++)
    245         arr[i] = TMath::Abs(a[i]-med);
     247        arr[i] = (Double_t)TMath::Abs(Double_t(a[i])-med);
    246248
    247249    //return TMath::Median(n, arr)/0.67449896936; //MMath::GaussProb(x)=0.5
    248250
    249251    // Define where to divide (floor because the highest possible is n-1)
    250     const Size div = TMath::FloorNint(n*prob);
     252    const Size div = TMath::FloorNint(Double_t(n)*prob);
    251253
    252254    // Calculate result
     
    336338{
    337339    Element *cpy = new Element[n];
    338     Int_t   *pos = new Int_t[n];
     340    Size    *pos = new Size[n];
    339341
    340342    memcpy(cpy, a, n*sizeof(Element));
     
    342344    TMath::Sort(n, a, pos, down);
    343345
    344     Int_t *idx = pos;
     346    Size *idx = pos;
    345347
    346348    for (Element *ptr=a; ptr<a+n; ptr++)
     
    867869    // Check if error starts with 1 or 2. In this case use one
    868870    // more valid digit
    869     TString error = Form("%.0e", e);
     871    TString error = MString::Format("%.0e", e);
    870872    if (error[0]=='1' || error[0]=='2')
    871873    {
    872874        i++;
    873         error = Form("%.1e", e);
    874     }
    875 
    876     const char *fmt = Form("%%.%de", i);
    877 
    878     v = atof(Form(fmt, v));
     875        error = MString::Format("%.1e", e);
     876    }
     877
     878    const char *fmt = MString::Format("%%.%de", i);
     879
     880    v = MString::Format(fmt, v).Atof();
    879881    e = error.Atof();
    880882}
Note: See TracChangeset for help on using the changeset viewer.