415 for (i=0; i<nmin; i++){
419 nnew = block1->
Merge(block2);
420 fN =
fN - nold + nnew;
424 for (i=nmin; i<nmax; i++){
572 if (!block)
return 0;
627 if (!block)
return 0;
629 if (block->
Remove(blockindex)){
642 Int_t localentry =
tree->LoadTree(entry);
662 if ((index>=
fN) || (index<0)) {
673 while (total_passed<=index && i<
fNBlocks){
686 Long64_t localindex = index - total_passed;
688 if (blockindex < 0)
return -1;
711 ntotal += templist->
GetN();
714 ntotal += templist->
GetN();
792 Info(
"GetEntryList",
"tree: %s, file: %s",
793 (treename ? treename :
"-"), (filename ? filename :
"-"));
795 if (!treename || !filename)
return 0;
806 Info(
"GetEntryList",
"file: %s, local? %d", filename, local);
838 Info(
"GetEntryList",
"file: %s (fn: %s), hash: %lu, element hash: %lu",
856 newhash = stotal.
Hash();
864 Info(
"GetEntryList",
"file: %s (longname: %s), hash: %lu, element hash: %lu",
881 if (!list)
return -1;
886 Error(
"Add",
"Attempt to add object of class: %s to a %s",elist->
ClassName(),this->ClassName());
907 result = current_block->
Next();
914 while (result<0 && iblock<
fNBlocks-1) {
919 result = current_block->
Next();
1021 elist->
Print(option);
1199 auto thisTree =
tree->GetTree();
1200 if (!thisTree)
return;
1203 if (
tree->GetDirectory()->InheritsFrom(
"TFile")) {
1204 treename = thisTree->GetName();
1210 if (
tree->GetTree()->GetCurrentFile()){
1211 filename =
tree->GetTree()->GetCurrentFile()->GetName();
1245 for (
Int_t i=0; i<n2; i++){
1246 entry = (
const_cast<TEntryList*
>(elist))->GetEntry(i);
1275 oldn = templist->
GetN();
1290 eresult.
Print(
"all");
1291 eresult.
Add(&elist2);
1293 eresult.
Print(
"all");
1309 if (!newroot || (newroot && strlen(newroot) <= 0)) {
1310 Warning(
"RelocatePaths",
"the new location must be given!");
1315 Info(
"RelocatePaths",
"'%s': relocating paths '%s' to '%s'",
1316 GetName(), oldroot ? oldroot :
"*", newroot);
1318 Int_t nrl = 0, xnrl = 0;
1325 Warning(
"RelocatePaths",
"problems relocating '%s'", enl->
GetName());
1334 if (oldroot && (lo = strlen(oldroot)) > 0) {
1341 if (ilst !=
kNPOS) {
1366 const char *newroot,
const char *oldroot,
const char *enlnm)
1370 if (!fl || (fl&& fl->
IsZombie())) {
1371 ::Error(
"TEntryList::Relocate",
"file '%s' cannot be open for updating", fn);
1378 if (nm.
IsNull()) nm =
"*";
1382 while ((key = (
TKey *) nxk())) {
1393 ::Error(
"TEntryList::Relocate",
"problems relocating '%s' ...", enl->
GetName());
1431 Ssiz_t len = (ashort) ?
a.Length() :
b.Length();
1433 for (
Int_t i = 0; i < len; i++) {
1434 if (
a[i] !=
b[i])
break;
1439 return ashort ? 1 : 2;
1484 Printf(
" * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *");
1486 Printf(
" * %d common root paths found", nrl);
1491 Printf(
" * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *");
1512 if (!fl || (fl&& fl->
IsZombie())) {
1513 ::Error(
"TEntryList::Relocate",
"file '%s' cannot be open for reading", fn);
1521 while ((key = (
TKey *) nxk())) {
1527 ::Error(
"TEntryList::Scan",
"object entry-list '%s' not found or not loadable!", key->
GetName());
1543void TEntryList::Streamer(
TBuffer &
b)
1545 if (
b.IsReading()) {
1547 Version_t R__v =
b.ReadVersion(&R__s, &R__c);
1548 b.ReadClassBuffer(TEntryList::Class(),
this, R__v, R__s, R__c);
1555 b.WriteClassBuffer(TEntryList::Class(),
this);
static Int_t GetCommonString(TString a, TString b, TString &c)
Get in 'c' the string in common at the beginning of 'a' and 'b'.
TEntryList operator||(TEntryList &elist1, TEntryList &elist2)
void Printf(const char *fmt,...)
R__EXTERN TSystem * gSystem
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 void Append(TObject *obj, Bool_t replace=kFALSE)
Append object to this directory.
virtual TObject * Remove(TObject *)
Remove an object from the in-memory list.
Used by TEntryList to store the entry numbers.
void OptimizeStorage()
If there are < kBlockSize or >kBlockSize*15 entries, change to an array representation.
Int_t Next()
Return the next non-zero entry Faster than GetEntry() function.
Int_t GetNPassed()
Returns the number of entries, passing the selection.
void PrintWithShift(Int_t shift) const
Print the indices of this block + shift (used from TEntryList::Print()) to print the current values.
Bool_t Enter(Int_t entry)
If the block has already been optimized and the entries are stored as a list and not as bits,...
Bool_t Remove(Int_t entry)
Remove entry #entry If the block has already been optimized and the entries are stored as a list and ...
Int_t Contains(Int_t entry)
True if the block contains entry #entry.
Int_t GetEntry(Int_t entry)
Return entry #entry.
Int_t Merge(TEntryListBlock *block)
Merge with the other block Returns the resulting number of entries in the block.
A List of entry numbers in a TTree or TChain.
Long64_t fLastIndexQueried
! used to optimize GetEntry() function from a loop
virtual TEntryList * GetEntryList(const char *treename, const char *filename, Option_t *opt="")
Return the entry list, corresponding to treename and filename By default, the filename is first tried...
Long64_t fEntriesToProcess
used on proof to set the number of entries to process in a packet
Bool_t fReapply
If true, TTree::Draw will 'reapply' the original cut.
virtual Int_t GetTreeNumber() const
TString fFileName
name of the file, where the tree is
virtual void OptimizeStorage()
Checks if the array representation is more economical and if so, switches to it.
virtual TList * GetLists() const
Int_t fTreeNumber
! the index of the tree in the chain (used when the entry list is used as input (TTree::SetEntryList(...
virtual void SetTree(const TTree *tree)
If a list for a tree with such name and filename exists, sets it as the current sublist If not,...
TDirectory * fDirectory
! Pointer to directory holding this tree
virtual TDirectory * GetDirectory() const
TObjArray * fBlocks
blocks with indices of passing events (TEntryListBlocks)
virtual Int_t Contains(Long64_t entry, TTree *tree=0)
virtual const char * GetFileName() const
static Int_t Scan(const char *fn, TList *roots)
Scan TEntryList in 'fn' to find the common parts of paths.
virtual void DirectoryAutoAdd(TDirectory *)
Called by TKey and others to automatically add us to a directory when we are read from a file.
virtual ~TEntryList()
Destructor.
Long64_t fN
number of entries in the list
Long64_t fLastIndexReturned
! used to optimize GetEntry() function from a loop
virtual Long64_t Next()
Return the next non-zero entry index (next after fLastIndexQueried) this function is faster than GetE...
virtual void SetDirectory(TDirectory *dir)
Add reference to directory dir. dir can be 0.
virtual void Reset()
Reset this list.
virtual Bool_t Enter(Long64_t entry, TTree *tree=0)
Add entry #entry to the list.
virtual Long64_t GetEntry(Int_t index)
Return the number of the entry #index of this TEntryList in the TTree or TChain See also Next().
Int_t fNBlocks
number of TEntryListBlocks
virtual const char * GetTreeName() const
virtual Int_t Merge(TCollection *list)
Merge this list with the lists from the collection.
TEntryList * fCurrent
! currently filled entry list
virtual void Print(const Option_t *option="") const
Print this list.
virtual Long64_t GetEntryAndTree(Int_t index, Int_t &treenum)
Return the index of "index"-th non-zero entry in the TTree or TChain and the # of the corresponding t...
virtual Int_t RelocatePaths(const char *newloc, const char *oldloc=0)
Relocate the file paths.
virtual Bool_t Remove(Long64_t entry, TTree *tree=0)
Remove entry #entry from the list.
Bool_t fShift
! true when some sub-lists don't correspond to trees (when the entry list is used as input in TChain)
static Int_t Relocate(const char *fn, const char *newroot, const char *oldroot=0, const char *enlnm=0)
Relocate entry list 'enlnm' in file 'fn' replacing 'oldroot' with 'newroot' in filenames.
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
virtual Int_t ScanPaths(TList *roots, Bool_t notify=kTRUE)
Scan the paths to find the common roots.
TString fTreeName
name of the tree
TEntryList()
default c-tor
void GetFileName(const char *filename, TString &fn, Bool_t *=0)
To be able to re-localize the entry-list we identify the file by just the name and the anchor,...
virtual void Subtract(const TEntryList *elist)
Remove all the entries of this entry list, that are contained in elist.
virtual void Add(const TEntryList *elist)
Add 2 entry lists.
virtual Long64_t GetN() const
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
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.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
virtual const char * GetClassName() const
virtual void Add(TObject *obj)
virtual TObject * After(const TObject *obj) const
Returns the object after object obj.
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
The TNamed class is the base class for all named ROOT classes.
virtual const char * GetName() const
Returns name of object.
TObject * UncheckedAt(Int_t i) const
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
Collectable string class.
const char * GetName() const
Returns name of object.
const TString & GetString() const
void SetString(const char *s)
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
@ kOverwrite
overwrite existing object with same name
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.
R__ALWAYS_INLINE Bool_t IsZombie() const
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.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Regular expression class.
TString & Insert(Ssiz_t pos, const char *s)
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
const char * Data() const
Ssiz_t Last(char c) const
Find last occurrence of a character c.
void ToUpper()
Change string to upper case.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
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
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
A TTree represents a columnar dataset.
This class represents a WWW compatible URL.
const char * GetAnchor() const
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
const char * GetFile() const
const char * GetProtocol() const
void SetFile(const char *file)
Short_t Min(Short_t a, Short_t b)