/* $Id$ */ //--------------------------------------------------------------------// // // // AliCFFrame Class // // Class to accumulate data on an N-dimensional grid, to be used // // as input to get corrections for Reconstruction & Trigger efficiency// // // // -- Author : S.Arcelli // // Still to be done: // // --Implement methods to merge cells // // --Interpolate among bins in a range // //--------------------------------------------------------------------// // // #include "TSystem.h" #include #include #include "AliCFFrame.h" //____________________________________________________________________ ClassImp(AliCFFrame) //____________________________________________________________________ AliCFFrame::AliCFFrame() : TNamed(), fNVar(0), fNDim(0), fNVarBinLimits(0), fNVarBins(0x0), fIndex(0x0), fProduct(0x0), fOffset(0x0), fVarBinLimits(0x0) { // default constructor } //____________________________________________________________________ AliCFFrame::AliCFFrame(const Char_t* name, const Char_t* title) : TNamed(name,title), fNVar(0), fNDim(0), fNVarBinLimits(0), fNVarBins(0x0), fIndex(0x0), fProduct(0x0), fOffset(0x0), fVarBinLimits(0x0) { // named constructor } //____________________________________________________________________ AliCFFrame::AliCFFrame(const Char_t* name, const Char_t* title, const Int_t nVarIn, const Int_t * nBinIn, const Float_t *binLimitsIn) : TNamed(name,title), fNVar(0), fNDim(0), fNVarBinLimits(0), fNVarBins(0x0), fIndex(0x0), fProduct(0x0), fOffset(0x0), fVarBinLimits(0x0) { // // main constructor // //the number of variables on the grid fNVar=nVarIn; // the binning in each variable fNVarBins= new Int_t[fNVar]; fIndex= new Int_t[fNVar]; Int_t ndimTot=1; Int_t nbinTot=0; //Calculate total number of elements and bins... for(Int_t i=0;i0;i--){ ind=ibin[i-1]+ind*fNVarBins[i-1]; } return ind; } //____________________________________________________________________ Int_t AliCFFrame::GetBinIndex(Int_t ivar, Int_t ind) const { // // getting the bin index on a given dim. ivar for a given element ind on the grid // Int_t index=-1; for(Int_t i=fNVar-1;i>=0;i--){ index=ind/fProduct[i]; fIndex[i]=index; ind-=index*fProduct[i]; } index=fIndex[ivar]; return index; } //____________________________________________________________________ void AliCFFrame::GetBinIndex(Int_t ind, Int_t *bins ) const { // // getting the set of bin indeces for a given element ind on the grid // Int_t index=-1; for(Int_t i=fNVar-1;i>=0;i--){ index=ind/fProduct[i]; bins[i]=index; ind-=index*fProduct[i]; } return; } //____________________________________________________________________ Float_t AliCFFrame::GetBinCenter(Int_t ivar, Int_t ibin) const { // // getting the bin center of a given bin ibin on the dim. (axis) ivar // Float_t binMin=fVarBinLimits[fOffset[ivar]+ibin]; Float_t binMax=fVarBinLimits[fOffset[ivar]+ibin+1]; Float_t val=0.5*(binMin+binMax); return val; } //____________________________________________________________________ void AliCFFrame::GetBinCenter(Int_t *ibin, Float_t *binCenter) const { // // gives the centers of the N-dim bin identified by a set of bin indeces // invar // for(Int_t i=0;iFindFile(dirname,filename))!=NULL){ file = new TFile( outfile,"UPDATE"); } else{ file = new TFile( outfile,"RECREATE"); } file->cd(); //write the object to a file this->Write(GetName(),TObject::kSingleKey); file->Close(); delete file; }