179 fDirectory =
nullptr;
181 fLastIndexQueried = -1;
182 fLastIndexReturned = 0;
205 if (fDirectory) fDirectory->Append(
this);
207 fLastIndexQueried = -1;
208 fLastIndexReturned = 0;
227 if (fDirectory) fDirectory->Append(
this);
229 fLastIndexQueried = -1;
230 fLastIndexReturned = 0;
244 SetTree(treename, filename);
249 if (fDirectory) fDirectory->Append(
this);
251 fLastIndexQueried = -1;
252 fLastIndexReturned = 0;
272 if (fDirectory) fDirectory->Append(
this);
274 fLastIndexQueried = -1;
275 fLastIndexReturned = 0;
289 fLastIndexQueried = -1;
290 fLastIndexReturned = 0;
299 fLists = new TList();
300 TEntryList *el1 = nullptr;
301 TEntryList *el2 = nullptr;
302 TIter next(elist.fLists);
303 while((el1 = (TEntryList*)next())){
304 el2 = new TEntryList(*el1);
305 if (el1==elist.fCurrent)
315 for (
Int_t i=0; i<fNBlocks; i++){
318 fBlocks->Add(block2);
323 fDirectory =
nullptr;
383 TIter next(elist->
fLists);
392 TEntryListBlock *block1 =
nullptr;
393 TEntryListBlock *block2 =
nullptr;
397 block2 =
new TEntryListBlock(*block1);
416 TEntryListBlock *block1 =
nullptr;
417 TEntryListBlock *block2 =
nullptr;
423 block2 =
new TEntryListBlock(*block1);
429 TEntryListBlock *block1=
nullptr;
430 TEntryListBlock *block2=
nullptr;
434 for (i=0; i<nmin; i++){
435 block1 = (TEntryListBlock*)
fBlocks->UncheckedAt(i);
438 nnew = block1->
Merge(block2);
439 fN =
fN - nold + nnew;
443 for (i=nmin; i<nmax; i++){
445 block1 =
new TEntryListBlock(*block2);
479 TIter next(elist->
fLists);
514 TIter next(elist->
fLists);
523 TEntryListBlock *block = (TEntryListBlock*)
fCurrent->fBlocks->UncheckedAt(currentblock);
596 TEntryListBlock *block =
nullptr;
599 block = (TEntryListBlock*)
fBlocks->UncheckedAt(nblock);
611 return fCurrent->Contains(localEntry);
637 TEntryListBlock *block =
nullptr;
642 if (!block)
return false;
646 block =
new TEntryListBlock();
651 block = (TEntryListBlock*)
fBlocks->UncheckedAt(nblock);
706 for (
auto entry =
start; entry < end; entry += step) {
707 this->
Enter(entry, tree);
725 TEntryListBlock *block =
nullptr;
727 block = (TEntryListBlock*)
fBlocks->UncheckedAt(nblock);
728 if (!block)
return false;
730 if (block->
Remove(blockindex)){
763 if ((index>=
fN) || (index<0)) {
771 TEntryListBlock *block =
nullptr;
774 while (total_passed<=index && i<
fNBlocks){
775 block=(TEntryListBlock*)
fBlocks->UncheckedAt(i);
784 block = (TEntryListBlock*)
fBlocks->UncheckedAt(i);
787 Long64_t localindex = index - total_passed;
789 if (blockindex < 0)
return -1;
804 TEntryListBlock *block = (TEntryListBlock*)
fCurrent->fBlocks->UncheckedAt(currentblock);
812 ntotal += templist->
GetN();
815 ntotal += templist->
GetN();
873 TUrl u(filename,
true);
874 if (local) *local = (!strcmp(u.GetProtocol(),
"file")) ?
true : false;
875 if (strlen(u.GetAnchor()) > 0) {
876 fn.
Form(
"%s#%s", u.GetFile(), u.GetAnchor());
893 Info(
"GetEntryList",
"tree: %s, file: %s",
894 (treename ? treename :
"-"), (filename ? filename :
"-"));
896 if (!treename || !filename)
return nullptr;
897 TString option = opt;
904 if (nexp) local =
false;
907 Info(
"GetEntryList",
"file: %s, local? %d", filename, local);
917 if (!
gSystem->IsAbsoluteFileName(fn))
919 fn =
gSystem->UnixPathName(fn);
927 TString stotal = treename;
939 Info(
"GetEntryList",
"file: %s (fn: %s), hash: %lu, element hash: %lu",
950 TString longname = fn;
951 gSystem->ExpandPathName(longname);
952 if (!
gSystem->IsAbsoluteFileName(longname))
954 longname =
gSystem->UnixPathName(longname);
957 newhash = stotal.
Hash();
965 Info(
"GetEntryList",
"file: %s (longname: %s), hash: %lu, element hash: %lu",
982 if (!list)
return -1;
987 Error(
"Add",
"Attempt to add object of class: %s to a %s",elist->
ClassName(),this->ClassName());
1007 TEntryListBlock *current_block = (TEntryListBlock*)
fBlocks->UncheckedAt(iblock);
1008 result = current_block->
Next();
1015 while (result<0 && iblock<
fNBlocks-1) {
1018 current_block = (TEntryListBlock*)
fBlocks->UncheckedAt(iblock);
1020 result = current_block->
Next();
1037 while (
fCurrent->GetTreeNumber()<0) {
1053 TEntryListBlock *block = (TEntryListBlock*)
fCurrent->fBlocks->UncheckedAt(currentblock);
1072 if (
fCurrent->GetTreeNumber() >= 0)
1089 TEntryListBlock *block =
nullptr;
1091 block = (TEntryListBlock*)
fBlocks->UncheckedAt(i);
1104 TString opt = option;
1109 TEntryListBlock* block =
nullptr;
1111 block = (TEntryListBlock*)
fBlocks->UncheckedAt(i);
1122 elist->
Print(option);
1192 TString stotal = treename;
1203 if (newhash ==
fCurrent->fStringHash){
1218 TEntryListBlock *block = (TEntryListBlock*)
fCurrent->fBlocks->UncheckedAt(currentblock);
1300 auto thisTree = tree->
GetTree();
1301 if (!thisTree)
return;
1305 treename = thisTree->GetName();
1313 TUrl url(filename.
Data(),
true);
1314 if (!strcmp(url.GetProtocol(),
"file")){
1315 filename = url.GetFile();
1316 gSystem->ExpandPathName(filename);
1317 if (!
gSystem->IsAbsoluteFileName(filename))
1319 filename =
gSystem->UnixPathName(filename);
1320 url.SetFile(filename);
1322 filename = url.GetUrl();
1347 for (
Int_t i=0; i<n2; i++){
1377 oldn = templist->
GetN();
1392 eresult.
Print(
"all");
1393 eresult.
Add(&elist2);
1395 eresult.
Print(
"all");
1411 if (!newroot || (newroot && strlen(newroot) <= 0)) {
1412 Warning(
"RelocatePaths",
"the new location must be given!");
1417 Info(
"RelocatePaths",
"'%s': relocating paths '%s' to '%s'",
1418 GetName(), oldroot ? oldroot :
"*", newroot);
1420 Int_t nrl = 0, xnrl = 0;
1427 Warning(
"RelocatePaths",
"problems relocating '%s'", enl->
GetName());
1436 if (oldroot && (lo = strlen(oldroot)) > 0) {
1443 if (ilst !=
kNPOS) {
1468 const char *newroot,
const char *oldroot,
const char *enlnm)
1472 if (!fl || (fl&& fl->
IsZombie())) {
1473 ::Error(
"TEntryList::Relocate",
"file '%s' cannot be open for updating", fn);
1480 if (nm.IsNull()) nm =
"*";
1481 TRegexp nmrg(nm,
true);
1483 TKey *key =
nullptr;
1484 while ((key = (TKey *) nxk())) {
1487 if (knm.Index(nmrg) !=
kNPOS) {
1495 ::Error(
"TEntryList::Relocate",
"problems relocating '%s' ...", enl->
GetName());
1532 bool ashort = (
a.Length() >
b.Length()) ? false :
true;
1533 Ssiz_t len = (ashort) ?
a.Length() :
b.Length();
1535 for (
Int_t i = 0; i < len; i++) {
1536 if (
a[i] !=
b[i])
break;
1541 return ashort ? 1 : 2;
1566 bool newobjs =
true;
1568 TObjString *objs =
nullptr;
1570 while ((objs = (TObjString *) nxr())) {
1572 if ((rc = GetCommonString(path, objs->
GetString(), com)) != 2) {
1574 if (strlen(ucom.GetFile()) > 0 && strcmp(ucom.GetFile(),
"/")) {
1581 if (newobjs) xrl->
Add(
new TObjString(path));
1586 Printf(
" * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *");
1588 Printf(
" * %d common root paths found", nrl);
1590 while ((objs = (TObjString *) nxr())) {
1593 Printf(
" * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *");
1614 if (!fl || (fl&& fl->
IsZombie())) {
1615 ::Error(
"TEntryList::Relocate",
"file '%s' cannot be open for reading", fn);
1622 TKey *key =
nullptr;
1623 while ((key = (TKey *) nxk())) {
1629 ::Error(
"TEntryList::Scan",
"object entry-list '%s' not found or not loadable!", key->
GetName());
1647 if (
b.IsReading()) {
1649 Version_t R__v =
b.ReadVersion(&R__s, &R__c);
int Int_t
Signed integer 4 bytes (int).
short Version_t
Class version identifier (short).
int Ssiz_t
String size (currently int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
long long Long64_t
Portable signed long integer 8 bytes.
const char Option_t
Option string (const char).
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
Buffer base class used for serializing objects.
Collection abstract base class.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
TList * GetListOfKeys() const override
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
Describe directory structure in memory.
virtual TObject * Remove(TObject *)
Remove an object from the in-memory list.
void PrintWithShift(Int_t shift) const
Int_t Contains(Int_t entry)
Int_t GetEntry(Int_t entry)
Int_t Merge(TEntryListBlock *block)
bool fReapply
If true, TTree::Draw will 'reapply' the original cut.
Long64_t fLastIndexQueried
! used to optimize GetEntry() function from a loop
Long64_t fEntriesToProcess
used on proof to set the number of entries to process in a packet
virtual Int_t GetTreeNumber() const
TString fFileName
name of the file, where the tree is
virtual TList * GetLists() const
virtual Int_t RelocatePaths(const char *newloc, const char *oldloc=nullptr)
virtual Int_t ScanPaths(TList *roots, bool notify=true)
TDirectory * fDirectory
! Pointer to directory holding this tree
virtual Int_t Merge(TCollection *list)
virtual TDirectory * GetDirectory() const
TObjArray * fBlocks
blocks with indices of passing events (TEntryListBlocks)
virtual Int_t Contains(Long64_t entry, TTree *tree=nullptr)
virtual void OptimizeStorage()
virtual bool Enter(Long64_t entry, TTree *tree=nullptr)
virtual const char * GetFileName() const
virtual bool Remove(Long64_t entry, TTree *tree=nullptr)
static Int_t Relocate(const char *fn, const char *newroot, const char *oldroot=nullptr, const char *enlnm=nullptr)
virtual void DirectoryAutoAdd(TDirectory *)
virtual Long64_t GetEntry(Long64_t index)
static Int_t Scan(const char *fn, TList *roots)
Long64_t fN
number of entries in the list
virtual void SetTree(const TTree *tree)
Long64_t fLastIndexReturned
! used to optimize GetEntry() function from a loop
void EnterRange(Long64_t start, Long64_t end, TTree *tree=nullptr, UInt_t step=1U)
virtual void Subtract(const TEntryList *elist)
Int_t fNBlocks
number of TEntryListBlocks
void Streamer(TBuffer &) override
Stream an object of class TObject.
virtual void SetDirectory(TDirectory *dir)
virtual const char * GetTreeName() const
virtual void Add(const TEntryList *elist)
TEntryList * fCurrent
! currently filled entry list
virtual TEntryList * GetEntryList(const char *treename, const char *filename, Option_t *opt="")
void Print(const Option_t *option="") const override
ULong_t fStringHash
! Hash value of a string of treename and filename
TList * fLists
a list of underlying entry lists for each tree of a chain
void GetFileName(const char *filename, TString &fn, bool *=nullptr)
TString fTreeName
name of the tree
void AddSubList(TEntryList *elist)
virtual Long64_t GetEntryAndTree(Long64_t index, Int_t &treenum)
virtual Long64_t GetN() const
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
void Close(Option_t *option="") override
Close a file.
virtual const char * GetClassName() const
void Add(TObject *obj) override
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
TObject * UncheckedAt(Int_t i) const
const TString & GetString() const
void SetString(const char *s)
const char * GetName() const override
Returns name of object.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
@ kOverwrite
overwrite existing object with same name
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
const char * Data() const
void ToUpper()
Change string to upper case.
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
TString & Append(const char *cs)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
A TTree represents a columnar dataset.
TFile * GetCurrentFile() const
Return pointer to the current file.
TDirectory * GetDirectory() const
virtual TTree * GetTree() const
virtual Long64_t LoadTree(Long64_t entry)
Set current entry.
TMatrixT< Element > operator||(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
Logical OR.