FEDRA emulsion software from the OPERA Collaboration
EdbCombGen Class Reference

objects combinations generator More...

#include <EdbCombGen.h>

Inheritance diagram for EdbCombGen:
Collaboration diagram for EdbCombGen:

Public Member Functions

 EdbCombGen ()
 
 EdbCombGen (TObjArray &elements, int nitems=-1)
 
bool NextCombination (TObjArray &selected, TObjArray &regected)
 
 ~EdbCombGen ()
 

Private Attributes

vector< bool > eBits
 bits array More...
 
TObjArray eElements
 objects to be combinated More...
 
Int_t eItems
 number of items to be selected More...
 
Bool_t eNext
 
Int_t eSize
 total number of items More...
 

Detailed Description

objects combinations generator

Constructor & Destructor Documentation

◆ EdbCombGen() [1/2]

EdbCombGen::EdbCombGen ( )
inline
25{}

◆ EdbCombGen() [2/2]

EdbCombGen::EdbCombGen ( TObjArray &  elements,
int  nitems = -1 
)

◆ ~EdbCombGen()

EdbCombGen::~EdbCombGen ( )
inline
29{}

Member Function Documentation

◆ NextCombination()

bool EdbCombGen::NextCombination ( TObjArray &  selected,
TObjArray &  regected 
)
31{
32 selected.Clear();
33 rejected.Clear();
34
35 if ( !eNext ) return false;
36
37 int nfound = 1;
38 for ( int j = 0; j < eSize; j++ )
39 {
40 if (eBits[j] == true )
41 {
42 selected.Add( eElements[j] );
43 nfound++;
44 } else
45 rejected.Add(eElements[j]);
46 }
47 eNext = next_permutation(eBits.begin(), eBits.end());
48 return true;
49}
Bool_t eNext
Definition: EdbCombGen.h:22
Int_t eSize
total number of items
Definition: EdbCombGen.h:20
vector< bool > eBits
bits array
Definition: EdbCombGen.h:19
TObjArray eElements
objects to be combinated
Definition: EdbCombGen.h:18

Member Data Documentation

◆ eBits

vector<bool> EdbCombGen::eBits
private

bits array

◆ eElements

TObjArray EdbCombGen::eElements
private

objects to be combinated

◆ eItems

Int_t EdbCombGen::eItems
private

number of items to be selected

◆ eNext

Bool_t EdbCombGen::eNext
private

◆ eSize

Int_t EdbCombGen::eSize
private

total number of items


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