/************************************************************************** * 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. * **************************************************************************/ //--------------------------------------------------------------------// // // // AliCFVGrid Class // // Just an interface to handle both AliCFGrid and AliCFGridSparse // // implementations // // // // -- Author : S.Arcelli // //--------------------------------------------------------------------// // // #include "AliCFVGrid.h" #include "TMath.h" #include //____________________________________________________________________ ClassImp(AliCFVGrid) //____________________________________________________________________ AliCFVGrid::AliCFVGrid() : AliCFFrame(), fSumW2(kFALSE) { // default constructor } //____________________________________________________________________ AliCFVGrid::AliCFVGrid(const Char_t* name, const Char_t* title) : AliCFFrame(name,title), fSumW2(kFALSE) { // default constructor } //____________________________________________________________________ AliCFVGrid::AliCFVGrid(const Char_t* name, const Char_t* title, const Int_t nVarIn, const Int_t * nBinIn, const Double_t *binLimitsIn) : AliCFFrame(name,title,nVarIn,nBinIn,binLimitsIn), fSumW2(kFALSE) { // // main constructor // } //____________________________________________________________________ AliCFVGrid::AliCFVGrid(const AliCFVGrid& c) : AliCFFrame(c), fSumW2(c.fSumW2) { // // copy constructor // ((AliCFVGrid &)c).Copy(*this); } //____________________________________________________________________ AliCFVGrid::~AliCFVGrid() { // // destructor // } //____________________________________________________________________ AliCFVGrid &AliCFVGrid::operator=(const AliCFVGrid &c) { // // assigment operator // if (this != &c) AliCFFrame::operator=(c); return *this; } //____________________________________________________________________ void AliCFVGrid::Copy(TObject& c) const { // // copy function // AliCFVGrid& target = (AliCFVGrid &) c; target.fSumW2=fSumW2; } //____________________________________________________________________ void AliCFVGrid::Scale(Int_t index, Double_t *fact) { // //scale content of a certain cell by (positive) fact (with error) // if(GetElement(index)==0 || fact[0]==0)return; Double_t in[2], out[2]; in[0]=GetElement(index); in[1]=GetElementError(index); GetScaledValues(fact,in,out); SetElement(index,out[0]); if(fSumW2)SetElementError(index,out[1]); } //____________________________________________________________________ void AliCFVGrid::Scale(Int_t *bin, Double_t *fact) { // //scale content of a certain cell by (positive) fact (with error) // if(GetElement(bin)==0 || fact[0]==0)return; Double_t in[2], out[2]; in[0]=GetElement(bin); in[1]=GetElementError(bin); GetScaledValues(fact,in,out); SetElement(bin,out[0]); if(fSumW2)SetElementError(bin,out[1]); } //____________________________________________________________________ void AliCFVGrid::Scale(Double_t *var, Double_t *fact) { // //scale content of a certain cell by (positive) fact (with error) // if(GetElement(var)==0 || fact[0]==0)return; Double_t in[2], out[2]; in[0]=GetElement(var); in[1]=GetElementError(var); GetScaledValues(fact,in,out); SetElement(var,out[0]); if(fSumW2)SetElementError(var,out[1]); } //____________________________________________________________________ void AliCFVGrid::Scale( Double_t *fact) { // //scale contents of the whole grid by fact // for(Int_t iel=0;iel=indexMin[j] && fIndex[j]<=indexMax[j]))isIn=kFALSE; } if(isIn && GetElement(i)<=0)val++; } AliInfo(Form(" the empty bins = %i ",val)); delete [] indexMin; delete [] indexMax; return val; } //____________________________________________________________________ Int_t AliCFVGrid::CheckStats(Double_t thr) const { // // Count the cells below a certain threshold // Int_t ncellsLow=0; for(Int_t i=0;ifNVarBins[i])binMax[i]=fNVarBins[i]; if((binMin[i]>binMax[i])){ AliInfo(Form(" Bin indeces in variable %i in reverse order, please check!", i)); return val; } } val=GetSum(0,binMin,binMax); return val; } //_____________________________________________________________________ Double_t AliCFVGrid::GetIntegral(Double_t *varMin, Double_t* varMax ) const { // // Get Integral in a range (extremes included) // Int_t *indexMin=new Int_t[fNVar]; Int_t *indexMax=new Int_t[fNVar]; //Find out the min and max bins for(Int_t i=0;iIsEmpty()) return 1; TIterator* iter = list->MakeIterator(); TObject* obj; Int_t count = 0; while ((obj = iter->Next())) { AliCFVGrid* entry = dynamic_cast (obj); if (entry == 0) continue; this->Add(entry); count++; } return count+1; } //____________________________________________________________________ void AliCFVGrid::GetScaledValues(Double_t *fact, Double_t *in, Double_t *out) const{ // // scale input *in and it error by (positive) fact (with error) // and erite it to *out // out[0]=in[0]*fact[0]; out[1]=TMath::Sqrt(in[1]*in[1]/in[0]/in[0] +fact[1]*fact[1]/fact[0]/fact[0])*out[0]; }