////////////////////////////////////////////////////////////////////////// // Alice ITS class to help keep statistical information // // // // version: 0.0.0 Draft. // // Date: April 18 1999 // // By: Bjorn S. Nilsen // // // ////////////////////////////////////////////////////////////////////////// #include #include #include "TMath.h" #include "AliITSstatistics2.h" #include "Riostream.h" ClassImp(AliITSstatistics2) // AliITSstatistics2::AliITSstatistics2() : TObject(), // Base Class fN(-1), // number of enetries -1 => Uninitilized fOrder(0), // maximum moment of distributions (^n) fX(0), //[fOrder] array of sums of x^n fYx(0), //[fOrder] array of sums of (xy)^n fY(0), //[fOrder] array of sums of y^n fW(0){ //[fOrder] array of sums of w^n (weights) // default constructor // Inputs: // none. // Outputs: // none. // Return: // A default constructed AliITSstatistics class return; } //______________________________________________________________________ AliITSstatistics2::AliITSstatistics2(Int_t order) : TObject(), // Base Class fN(0), // number of enetries -1 => Uninitilized fOrder(order), // maximum moment of distributions (^n) fX(new Double_t[order]), //[fOrder] array of sums of x^n fYx(new Double_t[order]), //[fOrder] array of sums of (xy)^n fY(new Double_t[order]), //[fOrder] array of sums of y^n fW(new Double_t[order]){ //[fOrder] array of sums of w^n (weights) // constructor to maximum moment/order order // Inputs: // Int_t order The maximum moment of distributions {for example x^n} Int_t i; for(i=0;ifX[i] = source.fX[i]; this->fYx[i] = source.fYx[i]; this->fY[i] = source.fY[i]; this->fW[i] = source.fW[i]; } // end for i return *this; } //_______________________________________________________________ AliITSstatistics2::AliITSstatistics2(AliITSstatistics2 &source): TObject(source), // Base Class fN(source.GetN()), // number of enetries -1 => Uninitilized fOrder(source.GetOrder()),// maximum moment of distributions (^n) fX(new Double_t[source.GetOrder()]),//[fOrder] array of sums of x^n fYx(new Double_t[source.GetOrder()]),//[fOrder] array of sums of (xy)^n fY(new Double_t[source.GetOrder()]),//[fOrder] array of sums of y^n fW(new Double_t[source.GetOrder()]){//[fOrder] array of sums of w^n (weights) // Copy constructor // Inputs: // AliITSstatistics2 & source the source of this copy // Outputs: // none. // Return: // A copy of the source. if(this==&source) return; for(Int_t i=0;ifX[i] = source.fX[i]; this->fYx[i] = source.fYx[i]; this->fY[i] = source.fY[i]; this->fW[i] = source.fW[i]; } // end for i } //______________________________________________________________________ void AliITSstatistics2::Reset(Int_t order){ // Reset/zero all statistics variables statistics // Inputs: // none. // Outputs: // none. // Return: // none. Int_t i; for(i=0;ikBig || x>kBig || w>kBig) return; fN++; for(i=0;i 2 ios::fmtflags fmt; #else Int_t fmt; #endif #else #if defined __ICC || defined __ECC || defined __xlC__ ios::fmtflags fmt; #else Int_t fmt; #endif #endif *os << fN <<" "<< fOrder; fmt = os->setf(ios::scientific); // set scientific floating point output for(i=0;iflags(fmt); // reset back to old Formating. return; } //______________________________________________________________________ void AliITSstatistics2::ReadAscii(istream *is){ // Read in class data values in Ascii Form to output stream // Inputs: // istream *is Input stream where Ascii data is to be read in from // Outputs: // none. // Return: // none. Int_t i; *is >> i >> fOrder; Reset(fOrder); fN = i; for(i=0;i> fX[i]; for(i=0;i> fYx[i]; for(i=0;i> fY[i]; for(i=0;i> fW[i]; } //______________________________________________________________________ ostream &operator<<(ostream &os,const AliITSstatistics2 &s){ // Standard output streaming function // Inputs: // ostream &os output steam // AliITSstatistics2 &s class to be streamed. // Output: // none. // Return: // ostream &os The stream pointer s.PrintAscii(&os); return os; } //______________________________________________________________________ istream &operator>>(istream &is,AliITSstatistics2 &s){ // Standard inputput streaming function // Inputs: // istream &is input steam // AliITSstatistics2 &s class to be streamed. // Output: // none. // Return: // ostream &os The stream pointer s.ReadAscii(&is); return is; }