1 #ifndef __JSUPPORT__JTREESCANNER__
2 #define __JSUPPORT__JTREESCANNER__
28 namespace JPP {
using namespace JSUPPORT; }
53 template<
class JClass_t>
55 public JPointer< JChainReader<JClass_t> >
101 gErrorIgnoreLevel = kError;
115 template<
class JClass_t = JNullType,
class JEvaluator_t = JNullType>
138 template<
class JDerived_t,
class JBase_t>
143 public JEquals< JTreeScanner<JAssertConversion<JDerived_t, JBase_t>, JNullType> >
193 return (this->getLimit() ==
object.getLimit() &&
194 this->getFilelist() ==
object.getFilelist());
214 if (counter < this->getLowerLimit()) {
215 skip(this->getLowerLimit() - counter);
218 return (counter < this->getEntries() &&
219 counter < this->getUpperLimit());
230 if (this->hasNext()) {
232 this->
get()->GetEvent(counter++);
234 ps.reset(this->
get()->getAddress());
265 using namespace JROOT;
267 this->setLimit(limit);
271 this->
get()->Reset();
275 TFile*
file = TFile::Open(
i->c_str());
279 if (file->GetListOfKeys()->Contains(this->
get()->getTreeName())) {
280 this->
get()->Add(
i->c_str());
289 actionAtFileOpen<JDerived_t>(this->
get()->GetCurrentFile());
290 actionAtFileOpen<JBase_t> (this->
get()->GetCurrentFile());
301 return this->
get()->GetEntries();
313 if (index >= 0 && index < this->getEntries()) {
315 this->
get()->GetEvent(index);
317 return this->
get()->getAddress();
342 return JDerived_t::Class_Name();
358 template<
class JClass_t>
360 public JTreeScanner<JAssertConversion<JClass_t, JClass_t>, JNullType>
404 template<
class JDerived_t,
class JBase_t,
class JEvaluator_t>
407 public JTreeScanner<JAssertConversion<JDerived_t, JBase_t>, JNullType>
429 const double __value) :
444 return first.value < second.value;
455 friend inline bool operator<(
const JEntry_t& entry,
const double value)
457 return entry.value < value;
498 const JEvaluator_t& evaluator = JEvaluator_t()) :
514 const JEvaluator_t& evaluator = JEvaluator_t()) :
528 if (this->hasNext()) {
530 this->
get()->GetEvent(
queue[this->counter++].index);
532 ps.reset(this->
get()->getAddress());
555 setBranchStatus(this->
get()->GetBranch(this->
get()->getBranchName()),
BRANCH_PATTERN,
false);
557 queue.resize(this->getEntries());
559 typename queue_type::iterator out =
queue.begin();
561 for (Long64_t
i = 0, n0 = 0;
i != this->getEntries(); ++
i, ++out) {
563 const Long64_t n1 = (100 * (
i + 1)) / this->getEntries();
567 STATUS(left << setw(24) << this->
get()->GetName() << right <<
' ' << setw(3) << n1 <<
"%\r");
DEBUG(endl);
572 this->
get()->GetEvent(
i);
574 const data_type* p = this->
get()->getAddress();
578 STATUS(left << setw(24) << this->
get()->GetName() << right << endl);
580 this->
get()->SetBranchStatus(
"*", 1);
594 if (index >= 0 && index < (Long64_t)
queue.size()) {
596 this->
get()->GetEvent(
queue[index].index);
598 return this->
get()->getAddress();
613 virtual Long64_t
find(
const double value)
const override
617 if (!
queue.empty()) {
619 typename queue_type::const_iterator p = lower_bound(
queue.begin(),
queue.end(), value);
621 if (p ==
queue.end()) {
623 return queue.size() - 1;
625 }
else if (p ==
queue.begin()) {
631 typename queue_type::const_iterator q = p--;
633 if (value - p->value < q->value - value)
657 if (branch != NULL) {
659 TObjArray*
array = branch->GetListOfBranches();
661 for (Int_t
i = 0;
i != array->GetEntries(); ++
i) {
663 TBranch* p = (TBranch*) array->At(
i);
665 if (p != NULL &&
string(p->GetName()).find(pattern) != string::npos) {
667 if (p->GetSplitLevel() == 0) {
669 NOTICE(
"Set status of branch " << p->GetName() <<
" to " << status << endl);
671 p->SetStatus(status);
675 setBranchStatus(p, pattern, status);
692 template<
class JClass_t,
class JEvaluator_t>
694 public JTreeScanner<JAssertConversion<JClass_t, JClass_t>, JEvaluator_t>
711 const JEvaluator_t& evaluator = JEvaluator_t()) :
725 const JEvaluator_t& evaluator = JEvaluator_t()) :
virtual const pointer_type & next() override
Get next element.
virtual void configure(const JMultipleFileScanner_t &file_list, const JLimit &limit) override
Configure.
virtual Long64_t find(const double value) const override
Find index of element that is closest in value to given value.
then usage $script[< detector identifier >< run range >]< QA/QCfile > nExample script to produce data quality plots nWhen a detector identifier and run range are data are downloaded from the database nand subsequently stored in the given QA QC file
JTreeScanner(const JMultipleFileScanner_t &file_list, const JLimit &limit, const JEvaluator_t &evaluator=JEvaluator_t())
Constructor.
JEntry_t(const Long64_t __index, const double __value)
Constructor.
virtual bool hasNext() override
Check availability of next element.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
unsigned int skip_type
Type definition for number of objects to skip.
JTreeScanner(const JMultipleFileScanner_t &file_list, const JEvaluator_t &evaluator=JEvaluator_t())
Constructor.
static void setBranchStatus(TBranch *branch, const char *pattern, const bool status)
Set status of branch.
Auxiliary interface for direct access of elements in ROOT TChain.
JTreeScannerInterface< JBase_t >::pointer_type pointer_type
JTreeScanner(const JMultipleFileScanner_t &file_list, const JLimit &limit, const JEvaluator_t &evaluator=JEvaluator_t())
Constructor.
Type definition for counter for ROOT TTree and auxiliary methods.
JTreeScanner(const JMultipleFileScanner_t &file_list, const JEvaluator_t &evaluator=JEvaluator_t())
Constructor.
Auxialiary class to assert type conversion.
Long64_t counter_type
Type definition for counter.
friend bool operator<(const JEntry_t &entry, const double value)
Comparison between TChain entry and value.
virtual void rewind() override
Rewind.
JTreeScanner()
Default constructor.
bool is_valid() const
Check validity of pointer.
Template definition for direct access of elements in ROOT TChain.
JTreeScanner()
Default constructor.
virtual skip_type skip(const skip_type ns) override
Skip items.
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
Auxiliary class for template TChain reading.
virtual data_type * getEntry(Long64_t index) override
Get entry at given index.
virtual void configure(const JMultipleFileScanner_t &file_list, const JLimit &limit) override
Configure.
bool equals(const JTreeScanner &object) const
Check equality.
virtual Long64_t getEntries() const override
Get number of entries.
Scanning of objects from a single file according a format that follows from the extension of each fil...
virtual data_type * getEntry(Long64_t index) override
Get entry at given index.
friend bool operator<(const JEntry_t &first, const JEntry_t &second)
Comparison between two TChain entries.
std::ostream & rewind(std::ostream &out)
Rewind character.
virtual const pointer_type & next() override
Get next element.
JTreeScanner()
Default constructor.
Auxiliary class for defining the range of iterations of objects.
JTreeScannerInterface< JBase_t, JEvaluator_t >::pointer_type pointer_type
TChain reading for template data type.
JTreeScanner()
Default constructor.
Template definition of auxiliary base class for comparison of data structures.
Long64_t index
index in TChain
std::vector< JEntry_t > queue_type
Type definition of internal queue for ordering the elements in the TChain.
Auxiliary class for no type definition.
Template implementation of class that holds pointer to object(s).
Data type dependent action methods for customised ROOT version management.
virtual counter_type getCounter() const override
Get internal counter.
JMultipleFileScanner_t getFilelist() const
Get file list.
~JTreeScanner_t()
Destructor.
virtual const char * getClassName() const override
Get actual class name.
General purpose messaging.
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
JTreeScanner(const JTreeScanner &input)
Copy constructor.
static const char *const BRANCH_PATTERN
Pattern match for names of sub-branches that will not be read when ordering elements in a TTree...
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Base class for JTreeScanner.
JEntry_t()
Default constructor.
Auxiliary base class for list of file names.
General purpose class for object reading from a list of file names.
then echo Submitting reweighting and histogram comparison jobs to nikhef stbc batch queue
JTreeScanner(const JMultipleFileScanner_t &file_list, const JLimit &limit=JLimit())
Constructor.
JTreeScanner(const JTreeScanner &input)
Copy constructor.
bool equals(const JFirst_t &first, const JSecond_t &second, const double precision=std::numeric_limits< double >::min())
Check equality.
JTreeScanner(const JMultipleFileScanner_t &file_list, const JLimit &limit=JLimit())
Constructor.
double value
corresponding value
JTreeScanner_t()
Default constructor.
#define DEBUG(A)
Message macros.
Auxiliary class for handling debug parameter within a class.