FEDRA emulsion software from the OPERA Collaboration
TIndexCellIter Class Reference

#include <TIndexCell.h>

Inheritance diagram for TIndexCellIter:
Collaboration diagram for TIndexCellIter:

Public Member Functions

const TIndexCellGetCell () const
 
int LevelDown ()
 
TIndexCell const * Next ()
 
void Reset ()
 
void Test ()
 
 TIndexCellIter (const TIndexCell *cell, int level, Bool_t dir=kIterForward)
 
 ~TIndexCellIter ()
 

Private Member Functions

 TIndexCellIter ()
 

Private Attributes

const TIndexCellfCell
 
Bool_t fDirection
 
Int_t fLevel
 
Int_t fLevel0
 
Int_t fPass
 
Int_t * fVind
 

Constructor & Destructor Documentation

◆ TIndexCellIter() [1/2]

TIndexCellIter::TIndexCellIter ( )
inlineprivate
121 : fCell(0) { }
const TIndexCell * fCell
Definition: TIndexCell.h:114

◆ TIndexCellIter() [2/2]

TIndexCellIter::TIndexCellIter ( const TIndexCell cell,
int  level,
Bool_t  dir = kIterForward 
)
640 {
641  // Create cell iterator. By default the iteration direction
642  // is kIterForward. To go backward use kIterBackward.
643 
644  fPass = 0;
645  fCell = cell;
646  fDirection = dir;
647  if( level > fCell->Nlevels() ) level=0;
648  if( level < 1 ) level=0;
649  fLevel = fLevel0 = level-1;
650  if(fLevel0 >= 0) {
651  fVind = new int[ fLevel0+1 ];
652  Reset();
653  }
654 }
Int_t fPass
Definition: TIndexCell.h:118
Int_t * fVind
Definition: TIndexCell.h:115
Int_t fLevel
Definition: TIndexCell.h:117
Int_t fLevel0
Definition: TIndexCell.h:116
void Reset()
Definition: TIndexCell.cpp:705
Bool_t fDirection
Definition: TIndexCell.h:119
Int_t Nlevels() const
Definition: TIndexCell.cpp:328

◆ ~TIndexCellIter()

TIndexCellIter::~TIndexCellIter ( )
658 {
659  if(fVind) delete [] fVind;
660  fVind=0;
661 }

Member Function Documentation

◆ GetCell()

const TIndexCell* TIndexCellIter::GetCell ( ) const
inline
132 { return fCell; }

◆ LevelDown()

int TIndexCellIter::LevelDown ( )
689 {
690  if(fLevel<1) return 0;
691  fVind[fLevel] = 0;
692  fLevel--;
693  int nent = fCell->At(fLevel,fVind)->GetEntriesFast();
694  //printf("LevelDown: level = %d, nent= %d fVind= %d\n",fLevel, nent,fVind[fLevel]);
695  if( fVind[fLevel] < nent-1 ) {
696  fVind[fLevel]++;
697  fLevel=fLevel0;
698  fVind[fLevel0]=-1;
699  return 1;
700  } else return LevelDown();
701  return 0;
702 }
int LevelDown()
Definition: TIndexCell.cpp:688
Int_t GetEntriesFast() const
Definition: TIndexCell.h:82
TIndexCell const * At(Int_t narg, Int_t vind[]) const
Definition: TIndexCell.cpp:519

◆ Next()

TIndexCell const * TIndexCellIter::Next ( )
665 {
666  // Return next object in cell. Returns 0 when no more objects in cell.
667 
668  if( fLevel0 <0 ) return 0;
669 
670  START:
671 
672  if( fLevel != fLevel0 ) return 0;
673 
674  int nent = fCell->At(fLevel,fVind)->GetEntriesFast();
675  //printf("Next: nent= %d fPass= %d\n",nent,fPass);
676 
677  if( fVind[fLevel] < nent-1 ) {
678  fVind[fLevel]++;
679  fPass++;
680  return fCell->At(fLevel+1,fVind);
681  } else {
682  if( LevelDown() ) goto START;
683  }
684  return 0;
685 }

◆ Reset()

void TIndexCellIter::Reset ( )
706 {
707  // Reset array iterator.
708 
709  if (fDirection == kIterForward) {
710  fLevel = fLevel0;
711  for(int i=0; i<fLevel0; i++ ) fVind[i]=0;
712  fVind[fLevel0]=-1;
713  }
714  else {}
715 }

◆ Test()

void TIndexCellIter::Test ( )
719 {
720  int count=0;
721  while( Next() ) count++;
722  printf("count = %d\n",count);
723 }
TIndexCell const * Next()
Definition: TIndexCell.cpp:664

Member Data Documentation

◆ fCell

const TIndexCell* TIndexCellIter::fCell
private

◆ fDirection

Bool_t TIndexCellIter::fDirection
private

◆ fLevel

Int_t TIndexCellIter::fLevel
private

◆ fLevel0

Int_t TIndexCellIter::fLevel0
private

◆ fPass

Int_t TIndexCellIter::fPass
private

◆ fVind

Int_t* TIndexCellIter::fVind
private

The documentation for this class was generated from the following files: