1 #ifndef __JSUPPORT__JTREESCANNER__
2 #define __JSUPPORT__JTREESCANNER__
51 template<
class JClass_t>
53 public JPointer< JChainReader<JClass_t> >
76 gErrorIgnoreLevel = kError;
90 template<
class JClass_t = JNullType,
class JEvaluator_t = JNullType>
112 template<
class JDerived_t,
class JBase_t>
174 if (counter < this->getLowerLimit()) {
175 skip(this->getLowerLimit() - counter);
178 return (counter < this->getEntries() &&
179 counter < this->getUpperLimit());
190 if (this->hasNext()) {
192 this->
get()->GetEvent(counter++);
194 ps.reset(this->
get()->getAddress());
225 using namespace JROOT;
227 this->setLimit(limit);
231 this->
get()->Reset();
235 TFile* file = TFile::Open(i->c_str());
237 if (file != NULL && file->GetListOfKeys()->Contains(this->
get()->getTreeName())) {
238 this->
get()->Add(i->c_str());
246 actionAtFileOpen<JDerived_t>(this->
get()->GetCurrentFile());
247 actionAtFileOpen<JBase_t> (this->
get()->GetCurrentFile());
258 return this->
get()->GetEntries();
270 if (index >= 0 && index < this->getEntries()) {
272 this->
get()->GetEvent(index);
274 return this->
get()->getAddress();
299 return JDerived_t::Class_Name();
314 template<
class JClass_t>
316 public JTreeScanner<JAssertConversion<JClass_t, JClass_t>, JNullType>
359 template<
class JDerived_t,
class JBase_t,
class JEvaluator_t>
362 public JTreeScanner<JAssertConversion<JDerived_t, JBase_t>, JNullType>
384 const double __value) :
397 friend inline bool operator<(
const JEntry_t& first,
const JEntry_t& second)
399 return first.value < second.value;
410 friend inline bool operator<(
const JEntry_t& entry,
const double value)
412 return entry.value < value;
453 const JEvaluator_t& evaluator = JEvaluator_t()) :
469 const JEvaluator_t& evaluator = JEvaluator_t()) :
483 if (this->hasNext()) {
485 this->
get()->GetEvent(queue[this->counter++].index);
487 ps.reset(this->
get()->getAddress());
512 queue.resize(this->getEntries());
514 typename queue_type::iterator out = queue.begin();
516 for (Long64_t i = 0; i != this->getEntries(); ++i, ++out) {
518 STATUS(left << setw(24) << this->
get()->GetName() << right <<
' ' << setw(3) << (100 * (i + 1)) / this->getEntries() <<
"%\r");
DEBUG(endl);
520 this->
get()->GetEvent(i);
528 this->
get()->SetBranchStatus(
"*", 1);
530 sort(queue.begin(), queue.end());
545 if (index >= 0 && index < (Long64_t) queue.size()) {
547 this->
get()->GetEvent(queue[index].index);
549 return this->
get()->getAddress();
564 virtual Long64_t
find(
const double value)
const
568 if (!queue.empty()) {
570 typename queue_type::const_iterator p = lower_bound(queue.begin(), queue.end(), value);
572 if (p == queue.end()) {
574 return queue.size() - 1;
576 }
else if (p == queue.begin()) {
582 typename queue_type::const_iterator q = p--;
584 if (value - p->value < q->value - value)
608 if (branch != NULL) {
610 TObjArray* array = branch->GetListOfBranches();
612 for (Int_t i = 0; i != array->GetEntries(); ++i) {
614 TBranch* p = (TBranch*) array->At(i);
616 if (p != NULL &&
string(p->GetName()).find(pattern) != string::npos) {
618 if (p->GetSplitLevel() == 0) {
620 NOTICE(
"Set status of branch " << p->GetName() <<
" to " << status << endl);
622 p->SetStatus(status);
626 setBranchStatus(p, pattern, status);
643 template<
class JClass_t,
class JEvaluator_t>
645 public JTreeScanner<JAssertConversion<JClass_t, JClass_t>, JEvaluator_t>
661 const JEvaluator_t& evaluator = JEvaluator_t()) :
675 const JEvaluator_t& evaluator = JEvaluator_t()) :