172 fLastIndexQueried = -1;
173 fLastIndexReturned = 0;
196 if (fDirectory) fDirectory->Append(
this);
198 fLastIndexQueried = -1;
199 fLastIndexReturned = 0;
218 if (fDirectory) fDirectory->Append(
this);
220 fLastIndexQueried = -1;
221 fLastIndexReturned = 0;
411 for (i=0; i<nmin; i++){
415 nnew = block1->
Merge(block2);
416 fN =
fN - nold + nnew;
420 for (i=nmin; i<nmax; i++){
568 if (!block)
return 0;
621 if (!block)
return 0;
623 if (block->
Remove(blockindex)){
667 while (total_passed<=index && i<
fNBlocks){
680 Long64_t localindex = index - total_passed;
682 if (blockindex < 0)
return -1;
705 ntotal += templist->
GetN();
708 ntotal += templist->
GetN();
745 if (treenum<0)
return -1;
761 if (local) *local = (!strcmp(u.GetProtocol(),
"file")) ?
kTRUE :
kFALSE;
762 if (strlen(u.GetAnchor()) > 0) {
763 fn.
Form(
"%s#%s", u.GetFile(), u.GetAnchor());
780 Info(
"GetEntryList",
"tree: %s, file: %s",
781 (treename ? treename :
"-"), (filename ? filename :
"-"));
783 if (!treename || !filename)
return 0;
794 Info(
"GetEntryList",
"file: %s, local? %d", filename, local);
826 Info(
"GetEntryList",
"file: %s (fn: %s), hash: %lu, element hash: %lu",
844 newhash = stotal.
Hash();
852 Info(
"GetEntryList",
"file: %s (longname: %s), hash: %lu, element hash: %lu",
869 if (!list)
return -1;
895 result = current_block->
Next();
902 while (result<0 && iblock<
fNBlocks-1) {
907 result = current_block->
Next();
1009 elist->
Print(option);
1187 auto thisTree = tree->
GetTree();
1188 if (!thisTree)
return;
1192 treename = thisTree->GetName();
1201 if (!strcmp(url.GetProtocol(),
"file")){
1206 url.SetFile(filename);
1208 filename = url.GetUrl();
1233 for (
Int_t i=0; i<n2; i++){
1234 entry = (
const_cast<TEntryList*
>(elist))->GetEntry(i);
1248 !strcmp(templist->fFileName.Data(),fFileName.Data())){
1263 oldn = templist->
GetN();
1278 eresult.
Print(
"all");
1279 eresult.
Add(&elist2);
1281 eresult.
Print(
"all");
1297 if (!newroot || (newroot && strlen(newroot) <= 0)) {
1298 Warning(
"RelocatePaths",
"the new location must be given!");
1303 Info(
"RelocatePaths",
"'%s': relocating paths '%s' to '%s'",
1304 GetName(), oldroot ? oldroot :
"*", newroot);
1306 Int_t nrl = 0, xnrl = 0;
1313 Warning(
"RelocatePaths",
"problems relocating '%s'", enl->
GetName());
1322 if (oldroot && (lo = strlen(oldroot)) > 0) {
1323 if (fFileName.BeginsWith(oldroot)) {
1324 fFileName.
Replace(0, lo, newroot);
1329 if (ilst !=
kNPOS) {
1330 fFileName.Replace(0, ilst, newroot);
1354 const char *newroot,
const char *oldroot,
const char *enlnm)
1358 if (!fl || (fl&& fl->
IsZombie())) {
1359 ::Error(
"TEntryList::Relocate",
"file '%s' cannot be open for updating", fn);
1366 if (nm.
IsNull()) nm =
"*";
1370 while ((key = (
TKey *) nxk())) {
1371 if (!strcmp(key->GetClassName(),
"TEntryList")) {
1373 if (knm.Index(nmrg) !=
kNPOS) {
1381 ::Error(
"TEntryList::Relocate",
"problems relocating '%s' ...", enl->
GetName());
1421 for (
Int_t i = 0; i < len; i++) {
1422 if (a[i] != b[i])
break;
1427 return ashort ? 1 : 2;
1472 Printf(
" * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *");
1474 Printf(
" * %d commont root paths found", nrl);
1479 Printf(
" * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *");
1500 if (!fl || (fl&& fl->
IsZombie())) {
1501 ::Error(
"TEntryList::Relocate",
"file '%s' cannot be open for reading", fn);
1509 while ((key = (
TKey *) nxk())) {
1510 if (!strcmp(key->GetClassName(),
"TEntryList")) {
1515 ::Error(
"TEntryList::Scan",
"object entry-list '%s' not found or not loadable!", key->GetName());
1531 void TEntryList::Streamer(
TBuffer &b)
virtual const char * GetName() const
Returns name of object.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Long64_t fEntriesToProcess
used on proof to set the number of entries to process in a packet
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
virtual Long64_t Next()
Return the next non-zero entry index (next after fLastIndexQueried) this function is faster than GetE...
virtual TDirectory * GetDirectory() const
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
virtual Long64_t GetN() const
Collectable string class.
virtual const char * GetFileName() const
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
virtual Int_t GetTreeNumber() const
void OptimizeStorage()
If there are < kBlockSize or >kBlockSize*15 entries, change to an array representation.
This class represents a WWW compatible URL.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual TList * GetLists() const
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
void ToUpper()
Change string to upper case.
Buffer base class used for serializing objects.
Regular expression class.
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
Int_t Merge(TEntryListBlock *block)
Merge with the other block Returns the resulting number of entries in the block.
virtual ~TEntryList()
Destructor.
Short_t Min(Short_t a, Short_t b)
virtual void OptimizeStorage()
Checks if the array representation is more economical and if so, switches to it.
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
Int_t fNBlocks
number of TEntryListBlocks
TList * fLists
a list of underlying entry lists for each tree of a chain
static Int_t Scan(const char *fn, TList *roots)
Scan TEntryList in 'fn' to find the common parts of paths.
Long64_t fLastIndexQueried
! used to optimize GetEntry() function from a loop
ULong_t fStringHash
! Hash value of a string of treename and filename
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...
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
Bool_t fShift
! true when some sub-lists don't correspond to trees (when the entry list is used as input in TChain)...
overwrite existing object with same name
virtual const char * UnixPathName(const char *unixpathname)
Convert from a Unix pathname to a local pathname.
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
virtual void SetDirectory(TDirectory *dir)
Add reference to directory dir. dir can be 0.
const char * GetFile() const
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...
virtual const char * ClassName() const
Returns name of class to which the object belongs.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
The TNamed class is the base class for all named ROOT classes.
static Int_t GetCommonString(TString a, TString b, TString &c)
Get in 'c' the string in common at the beginning of 'a' and 'b'.
virtual Long64_t LoadTree(Long64_t entry)
Set current entry.
TString & Append(const char *cs)
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
Int_t GetEntry(Int_t entry)
Return entry #entry.
void PrintWithShift(Int_t shift) const
Print the indices of this block + shift (used from TEntryList::Print()) to print the corrent values...
Book space in a file, create I/O buffers, to fill them, (un)compress them.
TDirectory * fDirectory
! Pointer to directory holding this tree
virtual TTree * GetTree() const
Bool_t fReapply
If true, TTree::Draw will 'reapply' the original cut.
const char * GetName() const
Returns name of object.
virtual void Add(const TEntryList *elist)
Add 2 entry lists.
TString fTreeName
name of the tree
friend TEntryList operator||(TEntryList &elist1, TEntryList &elist2)
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
R__EXTERN TSystem * gSystem
TEntryList * fCurrent
! currently filled entry list
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Collection abstract base class.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
TFile * GetCurrentFile() const
Return pointer to the current file.
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()...
virtual void Append(TObject *obj, Bool_t replace=kFALSE)
Append object to this directory.
Int_t Contains(Int_t entry)
True if the block contains entry #entry.
virtual TObject * After(const TObject *obj) const
Returns the object after object obj.
Int_t GetNPassed()
Returns the number of entries, passing the selection.
virtual Int_t Contains(Long64_t entry, TTree *tree=0)
virtual void DirectoryAutoAdd(TDirectory *)
Called by TKey and others to automatically add us to a directory when we are read from a file...
TString GetString() const
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 Int_t ScanPaths(TList *roots, Bool_t notify=kTRUE)
Scan the paths to find the common roots.
Long64_t fN
number of entries in the list
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
Int_t Next()
Return the next non-zero entry Faster than GetEntry() function.
TObject * UncheckedAt(Int_t i) const
virtual TObject * Remove(TObject *)
Remove an object from the in-memory 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...
Ssiz_t Last(char c) const
Find last occurrence of a character c.
virtual Int_t Merge(TCollection *list)
Merge this list with the lists from the collection.
Long64_t fLastIndexReturned
! used to optimize GetEntry() function from a loop
Describe directory structure in memory.
TDirectory * GetDirectory() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
TEntryList()
default c-tor
virtual Bool_t Enter(Long64_t entry, TTree *tree=0)
Add entry #entry to the list.
TObjArray * fBlocks
blocks with indices of passing events (TEntryListBlocks)
Int_t fTreeNumber
! the index of the tree in the chain (used when the entry list is used as input (TTree::SetEntryList(...
virtual void Print(const Option_t *option="") const
Print this list.
virtual void Add(TObject *obj)
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 ...
virtual void Reset()
Reset this list.
virtual const char * GetTreeName() const
virtual Bool_t Remove(Long64_t entry, TTree *tree=0)
Remove entry #entry from the list.
virtual TList * GetListOfKeys() const
virtual TEntryList * GetEntryList(const char *treename, const char *filename, Option_t *opt="")
Return the entry list, correspoding to treename and filename By default, the filename is first tried ...
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
A TTree object has a header with a name and a title.
Used by TEntryList to store the entry numbers.
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
TString fFileName
name of the file, where the tree is
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.
virtual Int_t GetSize() const
void SetString(const char *s)
A List of entry numbers in a TTree or TChain.
virtual void Subtract(const TEntryList *elist)
Remove all the entries of this entry list, that are contained in elist.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual Int_t RelocatePaths(const char *newloc, const char *oldloc=0)
Relocate the file paths.
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual void Close(Option_t *option="")
Close a file.
const char * Data() const