|
inlib
1.2.0
|


Public Member Functions | |
| base_looper (base_ntu &a_ntu, const base_col &a_col) | |
| virtual | ~base_looper () |
| base_looper (const base_looper &a_from) | |
| base_looper & | operator= (const base_looper &a_from) |
| bool | process () |
Static Public Member Functions | |
| static const std::string & | s_class () |
Protected Member Functions | |
| virtual bool | action (const T &a_value)=0 |
| bool | _looper (base_ntu &a_sub, const std::vector< unsigned int > &a_is, unsigned int a_depth, bool &a_stop) |
Static Protected Member Functions | |
| static bool | find_is (const base_ntu &a_ntu, const base_col *a_col, std::vector< unsigned int > &a_is, bool &a_found) |
Protected Attributes | |
| base_ntu & | m_ntu |
| const base_col & | m_col |
Definition at line 985 of file aida_ntuple.
| inlib::aida::base_looper< T >::base_looper | ( | base_ntu & | a_ntu, |
| const base_col & | a_col | ||
| ) | [inline] |
Definition at line 994 of file aida_ntuple.
| virtual inlib::aida::base_looper< T >::~base_looper | ( | ) | [inline, virtual] |
Definition at line 1000 of file aida_ntuple.
{
#ifdef INLIB_MEM
mem::decrement(s_class().c_str());
#endif
}
| inlib::aida::base_looper< T >::base_looper | ( | const base_looper< T > & | a_from | ) | [inline] |
Definition at line 1006 of file aida_ntuple.
| bool inlib::aida::base_looper< T >::_looper | ( | base_ntu & | a_sub, |
| const std::vector< unsigned int > & | a_is, | ||
| unsigned int | a_depth, | ||
| bool & | a_stop | ||
| ) | [inline, protected] |
Definition at line 1087 of file aida_ntuple.
{
if(a_depth>=a_is.size()) return false;
unsigned int coli = a_is[a_depth];
const std::vector<base_col*>& cols = a_sub.cols();
if(coli>=cols.size()) return false;
if(a_depth==(a_is.size()-1)) { //we reach the leaf.
aida_col<T>* col = cast<base_col, aida_col<T> >(*(cols[coli]));
if(!col) return false;
a_sub.start();
while(a_sub.next()) {
T v;
if(!col->get_entry(v)) return false;
if(!action(v)) {a_stop = true;break;}
}
} else {
aida_col_ntu* col = cast<base_col,aida_col_ntu>(*(cols[coli]));
if(!col) return false;
a_sub.start();
while(a_sub.next()) {
base_ntu* ntu = col->get_entry(); //not const.
if(!ntu) return false;
ntu->start();
while(ntu->next()) {
if(!_looper(*ntu,a_is,a_depth+1,a_stop)) return false;
if(a_stop) break;
}
}
}
return true;
}
| virtual bool inlib::aida::base_looper< T >::action | ( | const T & | a_value | ) | [protected, pure virtual] |
Implemented in inlib::aida::stat_looper< T >.
| static bool inlib::aida::base_looper< T >::find_is | ( | const base_ntu & | a_ntu, |
| const base_col * | a_col, | ||
| std::vector< unsigned int > & | a_is, | ||
| bool & | a_found | ||
| ) | [inline, static, protected] |
Definition at line 1052 of file aida_ntuple.
{
// search the indices to reach the sub leaf a_col from the main a_ntu.
// Note : it is assumed that a_is is empty and a_found = false before
// calling with function.
const std::vector<base_col*>& cols = a_ntu.cols();
std::vector<base_col*>::const_iterator it;
// look if a_col is a leaf col of a_ntu :
{unsigned int index = 0;
for(it=cols.begin();it!=cols.end();++it,index++) {
if(*it==a_col) {
a_is.push_back(index); //leaf index is the last one in a_is.
a_found = true;
return true;
}
}}
// go down sub ntu :
{unsigned int index = 0;
for(it=cols.begin();it!=cols.end();++it,index++) {
aida_col_ntu* col = cast<base_col,aida_col_ntu>(*(*it));
if(!col) continue;
base_ntu* sub = col->get_to_fill(); //it holds the "sub" cols schema.
if(!sub) {a_is.clear();return false;}
a_is.push_back(index);
if(!find_is(*sub,a_col,a_is,a_found)) {a_is.clear();return false;}
if(a_found) return true;
a_is.pop_back();
}}
return true;
}
| base_looper& inlib::aida::base_looper< T >::operator= | ( | const base_looper< T > & | a_from | ) | [inline] |
Definition at line 1012 of file aida_ntuple.
{return *this;}
| bool inlib::aida::base_looper< T >::process | ( | ) | [inline] |
Reimplemented in inlib::aida::stat_looper< T >.
Definition at line 1014 of file aida_ntuple.
{
std::vector<unsigned int> is;
bool found = false;
if(!find_is(m_ntu,&m_col,is,found)) {
m_ntu.out() << s_class() << "::process :"
<< " find_is failed."
<< std::endl;
return false;
}
if(!found) {
m_ntu.out() << s_class() << "::process :"
<< " find_is : col not found."
<< std::endl;
return false;
}
if(is.empty()) {
m_ntu.out() << s_class() << "::process :"
<< " is vec empty."
<< std::endl;
return false;
}
//{m_ntu.out() << "debug : sz " << is.size() << std::endl;
// std::vector<unsigned int>::const_iterator it;
// for(it=is.begin();it!=is.end();++it){
// m_ntu.out() << " " << *it << std::endl;
//}}
bool stop = false;
if(!_looper(m_ntu,is,0,stop)) {
m_ntu.out() << s_class() << "::process :"
<< " _looper failed."
<< std::endl;
return false;
}
return true;
}
| static const std::string& inlib::aida::base_looper< T >::s_class | ( | ) | [inline, static] |
Definition at line 987 of file aida_ntuple.
{
static const std::string s_v("inlib::aida::base_looper<"+stype(T())+">");
return s_v;
}
const base_col& inlib::aida::base_looper< T >::m_col [protected] |
Definition at line 1124 of file aida_ntuple.
base_ntu& inlib::aida::base_looper< T >::m_ntu [protected] |
Definition at line 1123 of file aida_ntuple.
1.7.5.1