/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ /////////////////////////////////////////////////////////////////////////// // Class AliMathBase // // Subset of matheamtical functions not included in the TMath // /////////////////////////////////////////////////////////////////////////// #include "TMath.h" #include "AliMathBase.h" #include "Riostream.h" ClassImp(AliMathBase) // Class implementation to enable ROOT I/O AliMathBase::AliMathBase() : TObject() { // Default constructor } /////////////////////////////////////////////////////////////////////////// AliMathBase::~AliMathBase() { // Destructor } //_____________________________________________________________________________ void AliMathBase::EvaluateUni(Int_t nvectors, Double_t *data, Double_t &mean , Double_t &sigma, Int_t hh) { // // Robust estimator in 1D case MI version - (faster than ROOT version) // // For the univariate case // estimates of location and scatter are returned in mean and sigma parameters // the algorithm works on the same principle as in multivariate case - // it finds a subset of size hh with smallest sigma, and then returns mean and // sigma of this subset // if (hh==0) hh=(nvectors+2)/2; Double_t faclts[]={2.6477,2.5092,2.3826,2.2662,2.1587,2.0589,1.9660,1.879,1.7973,1.7203,1.6473}; Int_t *index=new Int_t[nvectors]; TMath::Sort(nvectors, data, index, kFALSE); Int_t nquant = TMath::Min(Int_t(Double_t(((hh*1./nvectors)-0.5)*40))+1, 11); Double_t factor = faclts[nquant-1]; Double_t sumx =0; Double_t sumx2 =0; Int_t bestindex = -1; Double_t bestmean = 0; Double_t bestsigma = data[index[nvectors-1]]-data[index[0]]; // maximal possible sigma for (Int_t i=0; i0){ // fix proper normalization - Anja factor = faclts[nquant-1]; } // // Double_t sumx =0; Double_t sumx2 =0; Int_t bestindex = -1; Double_t bestmean = 0; Double_t bestsigma = -1; for (Int_t i=0; i