#include "RooFit.h"
#include "RooDataHist.h"
#include "RooArgSet.h"
#include "RooAbsLValue.h"
#include "RooDataHistSliceIter.h"
ClassImp(RooDataHistSliceIter)
;
RooDataHistSliceIter::RooDataHistSliceIter(RooDataHist& hist, RooAbsArg& sliceArg) : _hist(&hist), _sliceArg(&sliceArg)
{
  
  dynamic_cast<RooAbsLValue&>(sliceArg).setBin(0) ;
  _baseIndex = hist.calcTreeIndex() ;
  _nStep = dynamic_cast<RooAbsLValue&>(sliceArg).numBins() ;
  hist._iterator->Reset() ;
  RooAbsArg* arg ;
  Int_t i=0 ;
  while((arg=(RooAbsArg*)hist._iterator->Next())) {
    if (arg==&sliceArg) break ;
    i++ ;
  }
  _stepSize = hist._idxMult[i] ;
  
  _curStep = 0 ;  
}
RooDataHistSliceIter::RooDataHistSliceIter(const RooDataHistSliceIter& other) : 
  TIterator(other), 
  _hist(other._hist), 
  _sliceArg(other._sliceArg), 
  _nStep(other._nStep), 
  _curStep(other._curStep)
{
  
}
RooDataHistSliceIter::~RooDataHistSliceIter() 
{
  
}
const TCollection* RooDataHistSliceIter::GetCollection() const 
{
  
  return 0 ;
}
TObject* RooDataHistSliceIter::Next() 
{
  
  if (_curStep==_nStep) return 0 ;
  
  
  _hist->get(_baseIndex + _curStep*_stepSize) ;
  
  _curStep++ ;
  return _sliceArg ;
}
void RooDataHistSliceIter::Reset() 
{
  _curStep=0 ;
}
Last update: Thu Jan 17 08:44:25 2008
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.