diff --git a/tree/tree/src/TTree.cxx b/tree/tree/src/TTree.cxx index 30d73aaf25b34e544c923fa54677ec335c362632..80e00bd163dd00ce7d5179d2fba800bf653251ac 100644 --- a/tree/tree/src/TTree.cxx +++ b/tree/tree/src/TTree.cxx @@ -9,9 +9,7 @@ * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ - -//////////////////////////////////////////////////////////////////////////////// -/*! \class TTree +/** \class TTree A TTree object has a header with a name and a title. It consists of a list of independent branches (TBranch). Each branch has its own @@ -311,7 +309,6 @@ We encourage you to use TTree::AddFriend rather than adding a branch manually. </pre> */ - #include "RConfig.h" #include "TTree.h" @@ -383,12 +380,10 @@ Long64_t TTree::fgMaxTreeSize = 100000000000LL; ClassImp(TTree) - //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// - static char DataTypeToChar(EDataType datatype) { // Return the leaflist 'char' for a given datatype. @@ -423,12 +418,10 @@ static char DataTypeToChar(EDataType datatype) return 0; } - //////////////////////////////////////////////////////////////////////////////// /// \class TTree::TFriendLock /// Helper class to prevent infinite recursion in the usage of TTree Friends. - //////////////////////////////////////////////////////////////////////////////// /// Record in tree that it has been used while recursively looks through the friends. @@ -446,7 +439,6 @@ TTree::TFriendLock::TFriendLock(TTree* tree, UInt_t methodbit) } } - //////////////////////////////////////////////////////////////////////////////// /// Copy constructor. @@ -457,7 +449,6 @@ TTree::TFriendLock::TFriendLock(const TFriendLock& tfl) : { } - //////////////////////////////////////////////////////////////////////////////// /// Assignment operator. @@ -471,7 +462,6 @@ TTree::TFriendLock& TTree::TFriendLock::operator=(const TTree::TFriendLock& tfl) return *this; } - //////////////////////////////////////////////////////////////////////////////// /// Restore the state of tree the same as before we set the lock. @@ -484,12 +474,10 @@ TTree::TFriendLock::~TFriendLock() } } - //////////////////////////////////////////////////////////////////////////////// /// \class TTree::TClusterIterator /// Helper class to iterate over cluster of baskets. - //////////////////////////////////////////////////////////////////////////////// /// Regular constructor. /// TTree is not set as const, since we might modify if it is a TChain. @@ -532,7 +520,6 @@ TTree::TClusterIterator::TClusterIterator(TTree *tree, Long64_t firstEntry) : fT fNextEntry = fStartEntry; // Position correctly for the first call to Next() } - //////////////////////////////////////////////////////////////////////////////// /// In the case where the cluster size was not fixed (old files and /// case where autoflush was explicitly set to zero, we need estimate @@ -565,7 +552,6 @@ Long64_t TTree::TClusterIterator::GetEstimatedClusterSize() } } - //////////////////////////////////////////////////////////////////////////////// /// Move on to the next cluster and return the starting entry /// of this next cluster @@ -611,12 +597,10 @@ Long64_t TTree::TClusterIterator::Next() return fStartEntry; } - //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// /// Default constructor and I/O constructor. /// @@ -689,7 +673,6 @@ TTree::TTree() fBranches.SetOwner(kTRUE); } - //////////////////////////////////////////////////////////////////////////////// /// Normal tree constructor. /// @@ -796,7 +779,6 @@ TTree::TTree(const char* name, const char* title, Int_t splitlevel /* = 99 */) } } - //////////////////////////////////////////////////////////////////////////////// /// Destructor. @@ -886,7 +868,6 @@ TTree::~TTree() } } - //////////////////////////////////////////////////////////////////////////////// /// Returns the transient buffer currently used by this TTree for reading/writing baskets. @@ -902,7 +883,6 @@ TBuffer* TTree::GetTransientBuffer(Int_t size) return fTransientBuffer; } - //////////////////////////////////////////////////////////////////////////////// /// Add branch with name bname to the Tree cache. /// If bname="*" all branches are added to the cache. @@ -943,7 +923,6 @@ Int_t TTree::AddBranchToCache(const char*bname, Bool_t subbranches) return tc->AddBranch(bname,subbranches); } - //////////////////////////////////////////////////////////////////////////////// /// Add branch b to the Tree cache. /// if subbranches is true all the branches of the subbranches are @@ -987,7 +966,6 @@ Int_t TTree::AddBranchToCache(TBranch *b, Bool_t subbranches) return tc->AddBranch(b,subbranches); } - //////////////////////////////////////////////////////////////////////////////// /// Remove the branch with name 'bname' from the Tree cache. /// If bname="*" all branches are removed from the cache. @@ -1028,7 +1006,6 @@ Int_t TTree::DropBranchFromCache(const char*bname, Bool_t subbranches) return tc->DropBranch(bname,subbranches); } - //////////////////////////////////////////////////////////////////////////////// /// Remove the branch b from the Tree cache. /// if subbranches is true all the branches of the subbranches are @@ -1072,7 +1049,6 @@ Int_t TTree::DropBranchFromCache(TBranch *b, Bool_t subbranches) return tc->DropBranch(b,subbranches); } - //////////////////////////////////////////////////////////////////////////////// /// Add a cloned tree to our list of trees to be notified whenever we change /// our branch addresses or when we are deleted. @@ -1091,7 +1067,6 @@ void TTree::AddClone(TTree* clone) } } - //////////////////////////////////////////////////////////////////////////////// /// Add a TFriendElement to the list of friends. /// @@ -1181,7 +1156,6 @@ TFriendElement* TTree::AddFriend(const char* treename, const char* filename) return fe; } - //////////////////////////////////////////////////////////////////////////////// /// Add a TFriendElement to the list of friends. /// @@ -1210,7 +1184,6 @@ TFriendElement* TTree::AddFriend(const char* treename, TFile* file) return fe; } - //////////////////////////////////////////////////////////////////////////////// /// Add a TFriendElement to the list of friends. /// @@ -1236,7 +1209,6 @@ TFriendElement* TTree::AddFriend(TTree* tree, const char* alias, Bool_t warn) return fe; } - //////////////////////////////////////////////////////////////////////////////// /// AutoSave tree header every fAutoSave bytes. /// @@ -1364,7 +1336,6 @@ namespace { " Please generate the dictionary for this collection (%s) to avoid to write corrupted data."; } - //////////////////////////////////////////////////////////////////////////////// /// Same as TTree::Branch() with added check that addobj matches className. /// @@ -1415,7 +1386,6 @@ TBranch* TTree::BranchImp(const char* branchname, const char* classname, TClass* return Branch(branchname, classname, (void*) addobj, bufsize, splitlevel); } - //////////////////////////////////////////////////////////////////////////////// /// Same as TTree::Branch but automatic detection of the class name. /// See TTree::Branch for other details. @@ -1449,7 +1419,6 @@ TBranch* TTree::BranchImp(const char* branchname, TClass* ptrClass, void* addobj return Branch(branchname, actualClass->GetName(), (void*) addobj, bufsize, splitlevel); } - //////////////////////////////////////////////////////////////////////////////// /// Same as TTree::Branch but automatic detection of the class name. /// See TTree::Branch for other details. @@ -1510,7 +1479,6 @@ TBranch* TTree::BranchImpRef(const char* branchname, const char *classname, TCla return BronchExec(branchname, actualClass->GetName(), (void*) addobj, kFALSE, bufsize, splitlevel); } - //////////////////////////////////////////////////////////////////////////////// /// Same as TTree::Branch but automatic detection of the class name. /// See TTree::Branch for other details. @@ -1548,7 +1516,6 @@ TBranch* TTree::BranchImpRef(const char* branchname, TClass* ptrClass, EDataType return BronchExec(branchname, actualClass->GetName(), (void*) addobj, kFALSE, bufsize, splitlevel); } - //////////////////////////////////////////////////////////////////////////////// /// Deprecated function. Use next function instead. @@ -1557,7 +1524,6 @@ Int_t TTree::Branch(TList* li, Int_t bufsize /* = 32000 */ , Int_t splitlevel /* return Branch((TCollection*) li, bufsize, splitlevel); } - //////////////////////////////////////////////////////////////////////////////// /// Create one branch for each element in the collection. /// @@ -1679,7 +1645,6 @@ Int_t TTree::Branch(TCollection* li, Int_t bufsize /* = 32000 */, Int_t splitlev return GetListOfBranches()->GetEntries() - nbranches; } - //////////////////////////////////////////////////////////////////////////////// /// Create one branch for each element in the folder. /// Returns the total number of branches created. @@ -1726,7 +1691,6 @@ Int_t TTree::Branch(const char* foldername, Int_t bufsize /* = 32000 */, Int_t s return GetListOfBranches()->GetEntries() - nbranches; } - //////////////////////////////////////////////////////////////////////////////// /// Create a new TTree Branch. /// @@ -1795,7 +1759,6 @@ TBranch* TTree::Branch(const char* name, void* address, const char* leaflist, In return branch; } - //////////////////////////////////////////////////////////////////////////////// /// Create a new branch with the object of class classname at address addobj. /// @@ -1831,7 +1794,6 @@ TBranch* TTree::Branch(const char* name, const char* classname, void* addobj, In } } - //////////////////////////////////////////////////////////////////////////////// /// Create a new TTree BranchObject. /// @@ -2116,7 +2078,6 @@ TBranch* TTree::BranchOld(const char* name, const char* classname, void* addobj, return branch; } - //////////////////////////////////////////////////////////////////////////////// /// Build the optional branch supporting the TRefTable. /// This branch will keep all the information to find the branches @@ -2136,7 +2097,6 @@ TBranch* TTree::BranchRef() return fBranchRef; } - //////////////////////////////////////////////////////////////////////////////// /// Create a new TTree BranchElement. /// @@ -2210,7 +2170,6 @@ TBranch* TTree::Bronch(const char* name, const char* classname, void* addr, Int_ return BronchExec(name, classname, addr, kTRUE, bufsize, splitlevel); } - //////////////////////////////////////////////////////////////////////////////// /// Helper function implementing TTree::Bronch and TTree::Branch(const char *name, T &obj); @@ -2500,7 +2459,6 @@ TBranch* TTree::BronchExec(const char* name, const char* classname, void* addr, return branch; } - //////////////////////////////////////////////////////////////////////////////// /// Browse content of the TTree. @@ -2518,7 +2476,6 @@ void TTree::Browse(TBrowser* b) } } - //////////////////////////////////////////////////////////////////////////////// /// Build a Tree Index (default is TTreeIndex). /// See a description of the parameters and functionality in @@ -2541,7 +2498,6 @@ Int_t TTree::BuildIndex(const char* majorname, const char* minorname /* = "0" */ return fTreeIndex->GetN(); } - //////////////////////////////////////////////////////////////////////////////// /// Build StreamerInfo for class cl. /// pointer is an optional argument that may contain a pointer to an object of cl. @@ -2570,7 +2526,6 @@ TStreamerInfo* TTree::BuildStreamerInfo(TClass* cl, void* pointer /* = 0 */, Boo return sinfo; } - //////////////////////////////////////////////////////////////////////////////// /// Called by TTree::Fill() when file has reached its maximum fgMaxTreeSize. /// Create a new file. If the original file is named "myfile.root", @@ -2716,7 +2671,6 @@ TFile* TTree::ChangeFile(TFile* file) return newfile; } - //////////////////////////////////////////////////////////////////////////////// /// Check whether or not the address described by the last 3 parameters /// matches the content of the branch. If a Data Model Evolution conversion @@ -2920,7 +2874,6 @@ Int_t TTree::CheckBranchAddressType(TBranch* branch, TClass* ptrClass, EDataType return kMatch; } - //////////////////////////////////////////////////////////////////////////////// /// Create a clone of this tree and copy nentries. /// @@ -3135,7 +3088,6 @@ TTree* TTree::CloneTree(Long64_t nentries /* = -1 */, Option_t* option /* = "" * return newtree; } - //////////////////////////////////////////////////////////////////////////////// /// Set branch addresses of passed tree equal to ours. /// If undo is true, reset the branch address instead of copying them. @@ -3312,7 +3264,6 @@ namespace { } } - //////////////////////////////////////////////////////////////////////////////// /// Copy nentries from given tree to this tree. /// This routines assumes that the branches that intended to be copied are @@ -3464,7 +3415,6 @@ Long64_t TTree::CopyEntries(TTree* tree, Long64_t nentries /* = -1 */, Option_t* return nbytes; } - //////////////////////////////////////////////////////////////////////////////// /// Copy a tree with selection. /// @@ -3509,7 +3459,6 @@ TTree* TTree::CopyTree(const char* selection, Option_t* option /* = 0 */, Long64 return 0; } - //////////////////////////////////////////////////////////////////////////////// /// Create a basket for this tree and given branch. @@ -3521,7 +3470,6 @@ TBasket* TTree::CreateBasket(TBranch* branch) return new TBasket(branch->GetName(), GetName(), branch); } - //////////////////////////////////////////////////////////////////////////////// /// Delete this tree from memory or/and disk. /// @@ -3623,7 +3571,6 @@ void TTree::DirectoryAutoAdd(TDirectory* dir) if (fDirectory) fDirectory->Append(this); } - //////////////////////////////////////////////////////////////////////////////// /// Draw expression varexp for specified entries. /// Returns -1 in case of error or number of selected events in case of success. @@ -3640,7 +3587,6 @@ Long64_t TTree::Draw(const char* varexp, const TCut& selection, Option_t* option return TTree::Draw(varexp, selection.GetTitle(), option, nentries, firstentry); } - //////////////////////////////////////////////////////////////////////////////// /// Draw expression varexp for specified entries. /// Returns -1 in case of error or number of selected events in case of success. @@ -4254,7 +4200,6 @@ Long64_t TTree::Draw(const char* varexp, const char* selection, Option_t* option return -1; } - //////////////////////////////////////////////////////////////////////////////// /// Remove some baskets from memory. @@ -4268,7 +4213,6 @@ void TTree::DropBaskets() } } - //////////////////////////////////////////////////////////////////////////////// /// Drop branch buffers to accommodate nbytes below MaxVirtualsize. @@ -4296,7 +4240,6 @@ void TTree::DropBuffers(Int_t) } } - //////////////////////////////////////////////////////////////////////////////// /// Fill all branches. /// @@ -4475,7 +4418,6 @@ Int_t TTree::Fill() return nbytes; } - //////////////////////////////////////////////////////////////////////////////// /// Search in the array for a branch matching the branch name, /// with the branch possibly expressed as a 'full' path name (with dots). @@ -4523,7 +4465,6 @@ static TBranch *R__FindBranchHelper(TObjArray *list, const char *branchname) { return 0; } - //////////////////////////////////////////////////////////////////////////////// /// Return the branch that correspond to the path 'branchname', which can /// include the name of the tree or the omitted name of the parent branches. @@ -4598,7 +4539,6 @@ TBranch* TTree::FindBranch(const char* branchname) return 0; } - //////////////////////////////////////////////////////////////////////////////// /// Find leaf.. @@ -4730,7 +4670,6 @@ TLeaf* TTree::FindLeaf(const char* searchname) return 0; } - //////////////////////////////////////////////////////////////////////////////// /// Fit a projected item(s) from a tree. /// @@ -4768,7 +4707,6 @@ Int_t TTree::Fit(const char* funcname, const char* varexp, const char* selection return -1; } - //////////////////////////////////////////////////////////////////////////////// /// Write to disk all the basket that have not yet been individually written. /// @@ -4799,7 +4737,6 @@ Int_t TTree::FlushBaskets() const } } - //////////////////////////////////////////////////////////////////////////////// /// Returns the expanded value of the alias. Search in the friends if any. @@ -4841,7 +4778,6 @@ const char* TTree::GetAlias(const char* aliasName) const return 0; } - //////////////////////////////////////////////////////////////////////////////// /// Return pointer to the branch with the given name in this tree or its friends. @@ -4935,7 +4871,6 @@ TBranch* TTree::GetBranch(const char* name) return 0; } - //////////////////////////////////////////////////////////////////////////////// /// Return status of branch with name branchname. /// @@ -4951,7 +4886,6 @@ Bool_t TTree::GetBranchStatus(const char* branchname) const return 0; } - //////////////////////////////////////////////////////////////////////////////// /// Static function returning the current branch style. /// @@ -4963,7 +4897,6 @@ Int_t TTree::GetBranchStyle() return fgBranchStyle; } - //////////////////////////////////////////////////////////////////////////////// /// Used for automatic sizing of the cache. /// @@ -5009,7 +4942,6 @@ Long64_t TTree::GetCacheAutoSize(Bool_t withDefault /* = kFALSE */ ) const return cacheSize; } - //////////////////////////////////////////////////////////////////////////////// /// Return an iterator over the cluster of baskets starting at firstentry. /// @@ -5029,7 +4961,6 @@ TTree::TClusterIterator TTree::GetClusterIterator(Long64_t firstentry) return TClusterIterator(this,firstentry); } - //////////////////////////////////////////////////////////////////////////////// /// Return pointer to the current file. @@ -5041,7 +4972,6 @@ TFile* TTree::GetCurrentFile() const return fDirectory->GetFile(); } - //////////////////////////////////////////////////////////////////////////////// /// Return the number of entries matching the selection. /// Return -1 in case of errors. @@ -5063,7 +4993,6 @@ Long64_t TTree::GetEntries(const char *selection) return -1; } - //////////////////////////////////////////////////////////////////////////////// /// Return pointer to the 1st Leaf named name in any Branch of this Tree or /// any branch in the list of friend trees. @@ -5079,7 +5008,6 @@ Long64_t TTree::GetEntriesFriend() const return t->GetEntriesFriend(); } - //////////////////////////////////////////////////////////////////////////////// /// Read all branches of entry and return total number of bytes read. /// @@ -5240,7 +5168,6 @@ Int_t TTree::GetEntry(Long64_t entry, Int_t getall) return nbytes; } - //////////////////////////////////////////////////////////////////////////////// ///Returns the entry list, set to this tree @@ -5249,7 +5176,6 @@ TEntryList* TTree::GetEntryList() return fEntryList; } - //////////////////////////////////////////////////////////////////////////////// /// Return entry number corresponding to entry. /// @@ -5265,7 +5191,6 @@ Long64_t TTree::GetEntryNumber(Long64_t entry) const return fEntryList->GetEntry(entry); } - //////////////////////////////////////////////////////////////////////////////// /// Return entry number corresponding to major and minor number. /// Note that this function returns only the entry number, not the data @@ -5290,7 +5215,6 @@ Long64_t TTree::GetEntryNumberWithBestIndex(Long64_t major, Long64_t minor) cons return fTreeIndex->GetEntryNumberWithBestIndex(major, minor); } - //////////////////////////////////////////////////////////////////////////////// /// Return entry number corresponding to major and minor number. /// Note that this function returns only the entry number, not the data @@ -5311,7 +5235,6 @@ Long64_t TTree::GetEntryNumberWithIndex(Long64_t major, Long64_t minor) const return fTreeIndex->GetEntryNumberWithIndex(major, minor); } - //////////////////////////////////////////////////////////////////////////////// /// Read entry corresponding to major and minor number. /// @@ -5365,7 +5288,6 @@ Int_t TTree::GetEntryWithIndex(Int_t major, Int_t minor) return nbytes; } - //////////////////////////////////////////////////////////////////////////////// /// Return a pointer to the TTree friend whose name or alias is 'friendname. @@ -5402,7 +5324,6 @@ TTree* TTree::GetFriend(const char *friendname) const return 0; } - //////////////////////////////////////////////////////////////////////////////// /// If the 'tree' is a friend, this method returns its alias name. /// @@ -5467,7 +5388,6 @@ const char* TTree::GetFriendAlias(TTree* tree) const return 0; } - //////////////////////////////////////////////////////////////////////////////// /// Creates a new iterator that will go through all the leaves on the tree itself and its friend. @@ -5476,7 +5396,6 @@ TIterator* TTree::GetIteratorOnAllLeaves(Bool_t dir) return new TTreeFriendLeafIter(this, dir); } - //////////////////////////////////////////////////////////////////////////////// /// Return pointer to the 1st Leaf named name in any Branch of this /// Tree or any branch in the list of friend trees. @@ -5567,7 +5486,6 @@ TLeaf* TTree::GetLeafImpl(const char* branchname, const char *leafname) return 0; } - //////////////////////////////////////////////////////////////////////////////// /// Return pointer to the 1st Leaf named name in any Branch of this /// Tree or any branch in the list of friend trees. @@ -5591,7 +5509,6 @@ TLeaf* TTree::GetLeaf(const char* branchname, const char *leafname) return GetLeafImpl(branchname,leafname); } - //////////////////////////////////////////////////////////////////////////////// /// Return pointer to the 1st Leaf named name in any Branch of this /// Tree or any branch in the list of friend trees. @@ -5620,7 +5537,6 @@ TLeaf* TTree::GetLeaf(const char* aname) } } - //////////////////////////////////////////////////////////////////////////////// /// Return maximum of column with name columname. /// if the Tree has an associated TEventList or TEntryList, the maximum @@ -5652,7 +5568,6 @@ Double_t TTree::GetMaximum(const char* columname) return cmax; } - //////////////////////////////////////////////////////////////////////////////// /// Static function which returns the tree file size limit in bytes. @@ -5661,7 +5576,6 @@ Long64_t TTree::GetMaxTreeSize() return fgMaxTreeSize; } - //////////////////////////////////////////////////////////////////////////////// /// Return minimum of column with name columname. /// if the Tree has an associated TEventList or TEntryList, the minimum @@ -5693,7 +5607,6 @@ Double_t TTree::GetMinimum(const char* columname) return cmin; } - //////////////////////////////////////////////////////////////////////////////// /// Load the TTreePlayer (if not already done). @@ -5706,7 +5619,6 @@ TVirtualTreePlayer* TTree::GetPlayer() return fPlayer; } - //////////////////////////////////////////////////////////////////////////////// /// Find and return the TTreeCache registered with the file and which may /// contain branches for us. If create is true and there is no cache @@ -5724,7 +5636,6 @@ TTreeCache *TTree::GetReadCache(TFile *file, Bool_t create /* = kFALSE */ ) return pe; } - //////////////////////////////////////////////////////////////////////////////// /// Return a pointer to the list containing user objects associated to this tree. /// @@ -5747,7 +5658,6 @@ TList* TTree::GetUserInfo() return fUserInfo; } - //////////////////////////////////////////////////////////////////////////////// /// Appends the cluster range information stored in 'fromtree' to this tree, /// including the value of fAutoFlush. @@ -5791,7 +5701,6 @@ void TTree::ImportClusterRanges(TTree *fromtree) } } - //////////////////////////////////////////////////////////////////////////////// /// Keep a maximum of fMaxEntries in memory. @@ -5819,7 +5728,6 @@ void TTree::KeepCircular() fReadEntry = -1; } - //////////////////////////////////////////////////////////////////////////////// /// Read in memory all baskets from all branches up to the limit of maxmemory bytes. /// @@ -5845,7 +5753,6 @@ Int_t TTree::LoadBaskets(Long64_t maxmemory) return nimported; } - //////////////////////////////////////////////////////////////////////////////// /// Set current entry. /// @@ -5932,7 +5839,6 @@ Long64_t TTree::LoadTree(Long64_t entry) return fReadEntry; } - //////////////////////////////////////////////////////////////////////////////// /// Load entry on behalf of our master tree, we may use an index. /// @@ -5955,7 +5861,6 @@ Long64_t TTree::LoadTreeFriend(Long64_t entry, TTree* masterTree) return LoadTree(fTreeIndex->GetEntryNumberFriend(masterTree)); } - //////////////////////////////////////////////////////////////////////////////// /// Generate a skeleton analysis class for this tree. /// @@ -6007,7 +5912,6 @@ Int_t TTree::MakeClass(const char* classname, Option_t* option) return fPlayer->MakeClass(classname, option); } - //////////////////////////////////////////////////////////////////////////////// /// Generate a skeleton function for this tree. /// @@ -6041,7 +5945,6 @@ Int_t TTree::MakeCode(const char* filename) return fPlayer->MakeCode(filename); } - //////////////////////////////////////////////////////////////////////////////// /// Generate a skeleton analysis class for this Tree using TBranchProxy. /// @@ -6168,7 +6071,6 @@ Int_t TTree::MakeProxy(const char* proxyClassname, const char* macrofilename, co return fPlayer->MakeProxy(proxyClassname,macrofilename,cutfilename,option,maxUnrolling); } - //////////////////////////////////////////////////////////////////////////////// /// Generate skeleton selector class for this tree. /// @@ -6227,7 +6129,6 @@ Int_t TTree::MakeSelector(const char* selector, Option_t* option) } } - //////////////////////////////////////////////////////////////////////////////// /// Check if adding nbytes to memory we are still below MaxVirtualsize. @@ -6239,7 +6140,6 @@ Bool_t TTree::MemoryFull(Int_t nbytes) return kTRUE; } - //////////////////////////////////////////////////////////////////////////////// /// Static function merging the trees in the TList into a new tree. /// @@ -6284,7 +6184,6 @@ TTree* TTree::MergeTrees(TList* li, Option_t* options) return newtree; } - //////////////////////////////////////////////////////////////////////////////// /// Merge the trees in the TList into this tree. /// @@ -6322,7 +6221,6 @@ Long64_t TTree::Merge(TCollection* li, Option_t *options) return GetEntries(); } - //////////////////////////////////////////////////////////////////////////////// /// Merge the trees in the TList into this tree. /// If info->fIsFirst is true, first we clone this TTree info the directory @@ -6376,7 +6274,6 @@ Long64_t TTree::Merge(TCollection* li, TFileMergeInfo *info) return GetEntries(); } - //////////////////////////////////////////////////////////////////////////////// /// Move a cache from a file to the current file in dir. /// if src is null no operation is done, if dir is null or there is no @@ -6401,7 +6298,6 @@ void TTree::MoveReadCache(TFile *src, TDirectory *dir) } } - //////////////////////////////////////////////////////////////////////////////// /// Function called when loading a new class library. @@ -6416,7 +6312,6 @@ Bool_t TTree::Notify() return kTRUE; } - //////////////////////////////////////////////////////////////////////////////// /// This function may be called after having filled some entries in a Tree /// Using the information in the existing branch buffers, it will reassign @@ -6529,7 +6424,6 @@ void TTree::OptimizeBaskets(ULong64_t maxMemory, Float_t minComp, Option_t *opti } } - //////////////////////////////////////////////////////////////////////////////// /// Interface to the Principal Components Analysis class. /// @@ -6565,7 +6459,6 @@ TPrincipal* TTree::Principal(const char* varexp, const char* selection, Option_t return 0; } - //////////////////////////////////////////////////////////////////////////////// /// Print a summary of the tree contents. /// @@ -6680,7 +6573,6 @@ void TTree::Print(Option_t* option) const } } - //////////////////////////////////////////////////////////////////////////////// /// print statistics about the TreeCache for this tree, like /// @@ -6699,7 +6591,6 @@ void TTree::PrintCacheStats(Option_t* option) const if (tc) tc->Print(option); } - //////////////////////////////////////////////////////////////////////////////// /// Process this tree executing the TSelector code in the specified filename. /// The return value is -1 in case of error and TSelector::GetStatus() in @@ -6778,7 +6669,6 @@ Long64_t TTree::Process(const char* filename, Option_t* option, Long64_t nentrie return -1; } - //////////////////////////////////////////////////////////////////////////////// /// Process this tree executing the code in the specified selector. /// The return value is -1 in case of error and TSelector::GetStatus() in @@ -6810,7 +6700,6 @@ Long64_t TTree::Process(TSelector* selector, Option_t* option, Long64_t nentries return -1; } - //////////////////////////////////////////////////////////////////////////////// /// Make a projection of a tree using selections. /// @@ -6831,7 +6720,6 @@ Long64_t TTree::Project(const char* hname, const char* varexp, const char* selec return nsel; } - //////////////////////////////////////////////////////////////////////////////// /// Loop over entries and return a TSQLResult object containing entries following selection. @@ -6844,7 +6732,6 @@ TSQLResult* TTree::Query(const char* varexp, const char* selection, Option_t* op return 0; } - //////////////////////////////////////////////////////////////////////////////// /// Create or simply read branches from filename. /// @@ -6901,7 +6788,6 @@ Long64_t TTree::ReadFile(const char* filename, const char* branchDescriptor, cha return ReadStream(in, branchDescriptor, delimiter); } - //////////////////////////////////////////////////////////////////////////////// /// Determine which newline this file is using. /// Return '\\r' for Windows '\\r\\n' as that already terminates. @@ -6928,7 +6814,6 @@ char TTree::GetNewlineValue(std::istream &inputStream) return newline; } - //////////////////////////////////////////////////////////////////////////////// /// Create or simply read branches from an input stream. /// @@ -7181,7 +7066,6 @@ Long64_t TTree::ReadStream(std::istream& inputStream, const char *branchDescript return nGoodLines; } - //////////////////////////////////////////////////////////////////////////////// /// Make sure that obj (which is being deleted or will soon be) is no /// longer referenced by this TTree. @@ -7211,7 +7095,6 @@ void TTree::RecursiveRemove(TObject *obj) } } - //////////////////////////////////////////////////////////////////////////////// /// Refresh contents of this tree and its branches from the current status on disk. /// @@ -7254,7 +7137,6 @@ void TTree::Refresh() tree = 0; } - //////////////////////////////////////////////////////////////////////////////// /// Remove a friend from the list of friends. @@ -7281,7 +7163,6 @@ void TTree::RemoveFriend(TTree* oldFriend) } } - //////////////////////////////////////////////////////////////////////////////// /// Reset baskets, buffers and entries count in all branches and leaves. @@ -7312,7 +7193,6 @@ void TTree::Reset(Option_t* option) } } - //////////////////////////////////////////////////////////////////////////////// /// Resets the state of this TTree after a merge (keep the customization but /// forget the data). @@ -7343,7 +7223,6 @@ void TTree::ResetAfterMerge(TFileMergeInfo *info) } } - //////////////////////////////////////////////////////////////////////////////// /// Tell all of our branches to set their addresses to zero. /// @@ -7356,7 +7235,6 @@ void TTree::ResetBranchAddress(TBranch *br) } } - //////////////////////////////////////////////////////////////////////////////// /// Tell all of our branches to drop their current objects and allocate new ones. @@ -7370,7 +7248,6 @@ void TTree::ResetBranchAddresses() } } - //////////////////////////////////////////////////////////////////////////////// /// Loop over tree entries and print entries passing selection. /// @@ -7389,7 +7266,6 @@ Long64_t TTree::Scan(const char* varexp, const char* selection, Option_t* option return -1; } - //////////////////////////////////////////////////////////////////////////////// /// Set a tree variable alias. /// @@ -7444,7 +7320,6 @@ Bool_t TTree::SetAlias(const char* aliasName, const char* aliasFormula) return kTRUE; } - //////////////////////////////////////////////////////////////////////////////// /// This function may be called at the start of a program to change /// the default value for fAutoFlush. @@ -7551,7 +7426,6 @@ void TTree::SetAutoFlush(Long64_t autof /* = -30000000 */ ) fAutoFlush = autof; } - //////////////////////////////////////////////////////////////////////////////// /// This function may be called at the start of a program to change /// the default value for fAutoSave (and for SetAutoSave) is -300000000, ie 300 MBytes @@ -7569,7 +7443,6 @@ void TTree::SetAutoSave(Long64_t autos) fAutoSave = autos; } - //////////////////////////////////////////////////////////////////////////////// /// Set a branch's basket size. /// @@ -7601,7 +7474,6 @@ void TTree::SetBasketSize(const char* bname, Int_t buffsize) } } - //////////////////////////////////////////////////////////////////////////////// /// Change branch address, dealing with clone trees properly. /// See TTree::CheckBranchAddressType for the semantic of the return value. @@ -7620,7 +7492,6 @@ Int_t TTree::SetBranchAddress(const char* bname, void* addr, TBranch** ptr) return SetBranchAddressImp(branch,addr,ptr); } - //////////////////////////////////////////////////////////////////////////////// /// Verify the validity of the type of addr before calling SetBranchAddress. /// See TTree::CheckBranchAddressType for the semantic of the return value. @@ -7633,7 +7504,6 @@ Int_t TTree::SetBranchAddress(const char* bname, void* addr, TClass* ptrClass, E return SetBranchAddress(bname, addr, 0, ptrClass, datatype, isptr); } - //////////////////////////////////////////////////////////////////////////////// /// Verify the validity of the type of addr before calling SetBranchAddress. /// See TTree::CheckBranchAddressType for the semantic of the return value. @@ -7661,7 +7531,6 @@ Int_t TTree::SetBranchAddress(const char* bname, void* addr, TBranch** ptr, TCla return res; } - //////////////////////////////////////////////////////////////////////////////// /// Change branch address, dealing with clone trees properly. /// See TTree::CheckBranchAddressType for the semantic of the return value. @@ -7690,7 +7559,6 @@ Int_t TTree::SetBranchAddressImp(TBranch *branch, void* addr, TBranch** ptr) return kVoidPtr; } - //////////////////////////////////////////////////////////////////////////////// /// Set branch status to Process or DoNotProcess. /// @@ -7868,7 +7736,6 @@ void TTree::SetBranchStatus(const char* bname, Bool_t status, UInt_t* found) } } - //////////////////////////////////////////////////////////////////////////////// /// Set the current branch style. (static function) /// @@ -7880,7 +7747,6 @@ void TTree::SetBranchStyle(Int_t style) fgBranchStyle = style; } - //////////////////////////////////////////////////////////////////////////////// /// Set maximum size of the file cache . // @@ -7900,7 +7766,6 @@ Int_t TTree::SetCacheSize(Long64_t cacheSize) return SetCacheSizeAux(kFALSE, cacheSize); } - //////////////////////////////////////////////////////////////////////////////// /// Set the size of the file cache and create it if possible. /// @@ -8029,7 +7894,6 @@ Int_t TTree::SetCacheSizeAux(Bool_t autocache /* = kTRUE */, Long64_t cacheSize return 0; } - //////////////////////////////////////////////////////////////////////////////// ///interface to TTreeCache to set the cache entry range /// @@ -8068,7 +7932,6 @@ Int_t TTree::SetCacheEntryRange(Long64_t first, Long64_t last) return 0; } - //////////////////////////////////////////////////////////////////////////////// /// Interface to TTreeCache to set the number of entries for the learning phase @@ -8077,7 +7940,6 @@ void TTree::SetCacheLearnEntries(Int_t n) TTreeCache::SetLearnEntries(n); } - //////////////////////////////////////////////////////////////////////////////// /// Enable/Disable circularity for this tree. /// @@ -8129,7 +7991,6 @@ void TTree::SetCircular(Long64_t maxEntries) } } - //////////////////////////////////////////////////////////////////////////////// /// Set the debug level and the debug range. /// @@ -8144,7 +8005,6 @@ void TTree::SetDebug(Int_t level, Long64_t min, Long64_t max) fDebugMax = max; } - //////////////////////////////////////////////////////////////////////////////// /// Update the default value for the branch's fEntryOffsetLen. /// If updateExisting is true, also update all the existing branches. @@ -8168,7 +8028,6 @@ void TTree::SetDefaultEntryOffsetLen(Int_t newdefault, Bool_t updateExisting) } } - //////////////////////////////////////////////////////////////////////////////// /// Change the tree's directory. /// @@ -8207,7 +8066,6 @@ void TTree::SetDirectory(TDirectory* dir) } } - //////////////////////////////////////////////////////////////////////////////// /// Change number of entries in the tree. /// @@ -8252,7 +8110,6 @@ Long64_t TTree::SetEntries(Long64_t n) return fEntries; } - //////////////////////////////////////////////////////////////////////////////// /// Set an EntryList @@ -8274,7 +8131,6 @@ void TTree::SetEntryList(TEntryList *enlist, Option_t * /*opt*/) } - //////////////////////////////////////////////////////////////////////////////// /// This function transfroms the given TEventList into a TEntryList /// The new TEntryList is owned by the TTree and gets deleted when the tree @@ -8315,7 +8171,6 @@ void TTree::SetEventList(TEventList *evlist) fEntryList->SetBit(kCanDelete, kTRUE); } - //////////////////////////////////////////////////////////////////////////////// /// Set number of entries to estimate variable limits. /// If n is -1, the estimate is set to be the current maximum @@ -8336,7 +8191,6 @@ void TTree::SetEstimate(Long64_t n /* = 1000000 */) } } - //////////////////////////////////////////////////////////////////////////////// /// Set fFileNumber to number. /// fFileNumber is used by TTree::Fill to set the file name @@ -8355,7 +8209,6 @@ void TTree::SetFileNumber(Int_t number) fFileNumber = number; } - //////////////////////////////////////////////////////////////////////////////// /// Set all the branches in this TTree to be in decomposed object mode /// (also known as MakeClass mode). @@ -8371,7 +8224,6 @@ void TTree::SetMakeClass(Int_t make) } } - //////////////////////////////////////////////////////////////////////////////// /// Set the maximum size in bytes of a Tree file (static function). /// The default size is 100000000000LL, ie 100 Gigabytes. @@ -8386,7 +8238,6 @@ void TTree::SetMaxTreeSize(Long64_t maxsize) fgMaxTreeSize = maxsize; } - //////////////////////////////////////////////////////////////////////////////// /// Change the name of this tree. @@ -8416,7 +8267,6 @@ void TTree::SetName(const char* name) } } - //////////////////////////////////////////////////////////////////////////////// /// Change the name and title of this tree. @@ -8448,7 +8298,6 @@ void TTree::SetObject(const char* name, const char* title) } } - //////////////////////////////////////////////////////////////////////////////// /// Enable or disable parallel unzipping of Tree buffers. @@ -8463,7 +8312,6 @@ void TTree::SetParallelUnzip(Bool_t opt, Float_t RelSize) } - //////////////////////////////////////////////////////////////////////////////// /// Set perf stats @@ -8472,7 +8320,6 @@ void TTree::SetPerfStats(TVirtualPerfStats *perf) fPerfStats = perf; } - //////////////////////////////////////////////////////////////////////////////// /// The current TreeIndex is replaced by the new index. /// Note that this function does not delete the previous index. @@ -8492,7 +8339,6 @@ void TTree::SetTreeIndex(TVirtualIndex* index) fTreeIndex = index; } - //////////////////////////////////////////////////////////////////////////////// /// Set tree weight. /// @@ -8518,7 +8364,6 @@ void TTree::SetWeight(Double_t w, Option_t*) fWeight = w; } - //////////////////////////////////////////////////////////////////////////////// /// Print values of all active leaves for entry. /// @@ -8593,7 +8438,6 @@ void TTree::Show(Long64_t entry, Int_t lenmax) } } - //////////////////////////////////////////////////////////////////////////////// /// Start the TTreeViewer on this tree. /// @@ -8608,7 +8452,6 @@ void TTree::StartViewer() } } - //////////////////////////////////////////////////////////////////////////////// /// Stop the cache learning phase /// @@ -8647,7 +8490,6 @@ Int_t TTree::StopCacheLearningPhase() return 0; } - //////////////////////////////////////////////////////////////////////////////// /// Set the fTree member for all branches and sub branches. @@ -8672,7 +8514,6 @@ static void TBranch__SetTree(TTree *tree, TObjArray &branches) } } - //////////////////////////////////////////////////////////////////////////////// /// Set the fTree member for all friend elements. @@ -8688,7 +8529,6 @@ void TFriendElement__SetTree(TTree *tree, TList *frlist) } } - //////////////////////////////////////////////////////////////////////////////// /// Stream a class object. @@ -8801,7 +8641,6 @@ void TTree::Streamer(TBuffer& b) } } - //////////////////////////////////////////////////////////////////////////////// /// Unbinned fit of one or more variable(s) from a tree. /// @@ -8872,7 +8711,6 @@ Int_t TTree::UnbinnedFit(const char* funcname, const char* varexp, const char* s return -1; } - //////////////////////////////////////////////////////////////////////////////// /// Replace current attributes by current style. @@ -8899,7 +8737,6 @@ void TTree::UseCurrentStyle() } } - //////////////////////////////////////////////////////////////////////////////// /// Write this object to the current directory. For more see TObject::Write /// Write calls TTree::FlushBaskets before writing the tree. @@ -8910,7 +8747,6 @@ Int_t TTree::Write(const char *name, Int_t option, Int_t bufsize) const return TObject::Write(name, option, bufsize); } - //////////////////////////////////////////////////////////////////////////////// /// Write this object to the current directory. For more see TObject::Write /// If option & kFlushBasket, call FlushBasket before writing the tree. @@ -8927,7 +8763,6 @@ Int_t TTree::Write(const char *name, Int_t option, Int_t bufsize) ClassImp(TTreeFriendLeafIter) - //////////////////////////////////////////////////////////////////////////////// /// Create a new iterator. By default the iteration direction /// is kIterForward. To go backward use kIterBackward. @@ -8940,7 +8775,6 @@ TTreeFriendLeafIter::TTreeFriendLeafIter(const TTree* tree, Bool_t dir) { } - //////////////////////////////////////////////////////////////////////////////// /// Copy constructor. Does NOT copy the 'cursor' location! @@ -8953,7 +8787,6 @@ TTreeFriendLeafIter::TTreeFriendLeafIter(const TTreeFriendLeafIter& iter) { } - //////////////////////////////////////////////////////////////////////////////// /// Overridden assignment operator. Does NOT copy the 'cursor' location! @@ -8966,7 +8799,6 @@ TIterator& TTreeFriendLeafIter::operator=(const TIterator& rhs) return *this; } - //////////////////////////////////////////////////////////////////////////////// /// Overridden assignment operator. Does NOT copy the 'cursor' location! @@ -8978,7 +8810,6 @@ TTreeFriendLeafIter& TTreeFriendLeafIter::operator=(const TTreeFriendLeafIter& r return *this; } - //////////////////////////////////////////////////////////////////////////////// /// Go the next friend element @@ -9018,7 +8849,6 @@ TObject* TTreeFriendLeafIter::Next() return next; } - //////////////////////////////////////////////////////////////////////////////// /// Returns the object option stored in the list. diff --git a/tree/tree/src/TTreeCache.cxx b/tree/tree/src/TTreeCache.cxx index c0201cb6ca3fc25d545eca3b308643eeb65a5237..615d2279fd79e8390f762f6230838f647dd7b584 100644 --- a/tree/tree/src/TTreeCache.cxx +++ b/tree/tree/src/TTreeCache.cxx @@ -9,224 +9,221 @@ * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ -//////////////////////////////////////////////////////////////////////////////// -/// \class TTreeCache -/// A specialized TFileCacheRead object for a TTree. -/// -/// This class acts as a file cache, registering automatically the baskets from -/// the branches being processed (TTree::Draw or TTree::Process and TSelectors) -/// when in the learning phase. The learning phase is by default 100 entries. -/// It can be changed via TTreeCache::SetLearnEntries. -/// -/// This cache speeds-up considerably the performance, in particular -/// when the Tree is accessed remotely via a high latency network. -/// -/// The default cache size (10 Mbytes) may be changed via the function -/// TTree::SetCacheSize -/// -/// Only the baskets for the requested entry range are put in the cache -/// -/// For each Tree being processed a TTreeCache object is created. -/// This object is automatically deleted when the Tree is deleted or -/// when the file is deleted. -/// -/// - Special case of a TChain -/// Once the training is done on the first Tree, the list of branches -/// in the cache is kept for the following files. -/// -/// - Special case of a TEventlist -/// if the Tree or TChain has a TEventlist, only the buffers -/// referenced by the list are put in the cache. -/// -/// The learning period is started or restarted when: -/// - TTree automatically creates a cache. This feature can be -/// controlled with an env. variable or the TTreeCache.Size option. -/// - TTree::SetCacheSize is called with a non-zero size and a cache -/// did not previously exist -/// - TTreeCache::StartLearningPhase is called. -/// - TTree[Cache]::SetEntryRange is called -/// * and the learning is not yet finished -/// * and has not been set to manual -/// * and the new minimun entry is different. -/// -/// The learning period is stopped (and prefetching is actually started) when: -/// - TTree[Cache]::StopLearningPhase is called. -/// - An entry outside the 'learning' range is requested -/// The 'learning range is from fEntryMin (default to 0) to -/// fEntryMin + fgLearnEntries (default to 100). -/// - A 'cached' TChain switches over to a new file. -/// -/// ## WHY DO WE NEED the TreeCache when doing data analysis? -/// -/// When writing a TTree, the branch buffers are kept in memory. -/// A typical branch buffersize (before compression) is typically 32 KBytes. -/// After compression, the zipped buffer may be just a few Kbytes. -/// The branch buffers cannot be much larger in case of Trees with several -/// hundred or thousand branches. -/// -/// When writing, this does not generate a performance problem because branch -/// buffers are always written sequentially and the OS is in general clever enough -/// to flush the data to the output file when a few MBytes of data have to be written. -/// When reading at the contrary, one may hit a performance problem when reading -/// across a network (LAN or WAN) and the network latency is high. -/// For example in a WAN with 10ms latency, reading 1000 buffers of 10 KBytes each -/// with no cache will imply 10s penalty where a local read of the 10 MBytes would -/// take about 1 second. -/// -/// The TreeCache will try to prefetch all the buffers for the selected branches -/// such that instead of transfering 1000 buffers of 10 Kbytes, it will be able -/// to transfer one single large buffer of 10 Mbytes in one single transaction. -/// Not only the TreeCache minimizes the number of transfers, but in addition -/// it can sort the blocks to be read in increasing order such that the file -/// is read sequentially. -/// -/// Systems like xrootd, dCache or httpd take advantage of the TreeCache in -/// reading ahead as much data as they can and return to the application -/// the maximum data specified in the cache and have the next chunk of data ready -/// when the next request comes. -/// -/// -/// ## HOW TO USE the TreeCache -/// -/// A few use cases are discussed below. A cache may be created with automatic sizing -/// when a TTree is used: -/// -/// Caches are created and automatically sized for TTrees when TTreeCache.Size or -/// the environment variable ROOT_TTREECACHE_SIZE is set to a sizing factor. -/// -/// But there are many possible configurations where manual control may be wanted. -/// In some applications you know a priori the list of branches to read. In other -/// applications the analysis loop calls several layers of user functions where it -/// is impossible to predict a priori which branches will be used. This -/// is probably the most frequent case. In this case ROOT I/O will flag used -/// branches automatically when a branch buffer is read during the learning phase. -/// The TreeCache interface provides functions to instruct the cache about the used -/// branches if they are known a priori. In the examples below, portions of analysis -/// code are shown. The few statements involving the TreeCache are marked with `//<<<` -/// -/// ### 1. with TTree::Draw -/// -/// the TreeCache is automatically used by TTree::Draw. The function knows -/// which branches are used in the query and it puts automatically these branches -/// in the cache. The entry range is also known automatically. -/// -/// ### 2. with TTree::Process and TSelectors -/// -/// You must enable the cache and tell the system which branches to cache -/// and also specify the entry range. It is important to specify the entry range -/// in case you process only a subset of the events, otherwise you run the risk -/// to store in the cache entries that you do not need. -/// -/// #### example 2a -/// -/// TTree *T = (TTree*)f->Get("mytree"); -/// Long64_t nentries = T->GetEntries(); -/// Int_t cachesize = 10000000; //10 MBytes -/// T->SetCacheSize(cachesize); //<<< -/// T->AddBranchToCache("*",kTRUE); //<<< add all branches to the cache -/// T->Process('myselector.C+"); -/// //in the TSelector::Process function we read all branches -/// T->GetEntry(i); -/// ... here you process your entry -/// -/// -/// #### example 2b -/// -/// in the Process function we read a subset of the branches. -/// Only the branches used in the first entry will be put in the cache -/// -/// TTree *T = (TTree*)f->Get("mytree"); -/// //we want to process only the 200 first entries -/// Long64_t nentries=200; -/// int efirst= 0; -/// int elast = efirst+nentries; -/// Int_t cachesize = 10000000; //10 MBytes -/// TTreeCache::SetLearnEntries(1); //<<< we can take the decision after 1 entry -/// T->SetCacheSize(cachesize); //<<< -/// T->SetCacheEntryRange(efirst,elast); //<<< -/// T->Process('myselector.C+","",nentries,efirst); -/// // in the TSelector::Process we read only 2 branches -/// TBranch *b1 = T->GetBranch("branch1"); -/// b1->GetEntry(i); -/// if (somecondition) return; -/// TBranch *b2 = T->GetBranch("branch2"); -/// b2->GetEntry(i); -/// ... here you process your entry -/// -/// ### 3. with your own event loop -/// -/// #### example 3a -/// -/// in your analysis loop, you always use 2 branches. You want to prefetch -/// the branch buffers for these 2 branches only. -/// -/// TTree *T = (TTree*)f->Get("mytree"); -/// TBranch *b1 = T->GetBranch("branch1"); -/// TBranch *b2 = T->GetBranch("branch2"); -/// Long64_t nentries = T->GetEntries(); -/// Int_t cachesize = 10000000; //10 MBytes -/// T->SetCacheSize(cachesize); //<<< -/// T->AddBranchToCache(b1,kTRUE); //<<<add branch1 and branch2 to the cache -/// T->AddBranchToCache(b2,kTRUE); //<<< -/// T->StopCacheLearningPhase(); //<<< -/// for (Long64_t i=0;i<nentries;i++) { -/// T->LoadTree(i); //<<< important call when calling TBranch::GetEntry after -/// b1->GetEntry(i); -/// if (some condition not met) continue; -/// b2->GetEntry(i); -/// if (some condition not met) continue; -/// //here we read the full event only in some rare cases. -/// //there is no point in caching the other branches as it might be -/// //more economical to read only the branch buffers really used. -/// T->GetEntry(i); -/// .. process the rare but interesting cases. -/// ... here you process your entry -/// } -/// -/// #### example 3b -/// -/// in your analysis loop, you always use 2 branches in the main loop. -/// you also call some analysis functions where a few more branches will be read. -/// but you do not know a priori which ones. There is no point in prefetching -/// branches that will be used very rarely. -/// -/// TTree *T = (TTree*)f->Get("mytree"); -/// Long64_t nentries = T->GetEntries(); -/// Int_t cachesize = 10000000; //10 MBytes -/// T->SetCacheSize(cachesize); //<<< -/// T->SetCacheLearnEntries(5); //<<< we can take the decision after 5 entries -/// TBranch *b1 = T->GetBranch("branch1"); -/// TBranch *b2 = T->GetBranch("branch2"); -/// for (Long64_t i=0;i<nentries;i++) { -/// T->LoadTree(i); -/// b1->GetEntry(i); -/// if (some condition not met) continue; -/// b2->GetEntry(i); -/// //at this point we may call a user function where a few more branches -/// //will be read conditionally. These branches will be put in the cache -/// //if they have been used in the first 10 entries -/// if (some condition not met) continue; -/// //here we read the full event only in some rare cases. -/// //there is no point in caching the other branches as it might be -/// //more economical to read only the branch buffers really used. -/// T->GetEntry(i); -/// .. process the rare but interesting cases. -/// ... here you process your entry -/// } -/// -/// ## SPECIAL CASES WHERE TreeCache should not be activated -/// -/// When reading only a small fraction of all entries such that not all branch -/// buffers are read, it might be faster to run without a cache. -/// -/// -/// ## HOW TO VERIFY That the TreeCache has been used and check its performance -/// -/// Once your analysis loop has terminated, you can access/print the number -/// of effective system reads for a given file with a code like -/// (where TFile* f is a pointer to your file) -/// -/// printf("Reading %lld bytes in %d transactions\n",f->GetBytesRead(), f->GetReadCalls()); +/** \class TTreeCache +A specialized TFileCacheRead object for a TTree. + +This class acts as a file cache, registering automatically the baskets from +the branches being processed (TTree::Draw or TTree::Process and TSelectors) +when in the learning phase. The learning phase is by default 100 entries. +It can be changed via TTreeCache::SetLearnEntries. + +This cache speeds-up considerably the performance, in particular +when the Tree is accessed remotely via a high latency network. + +The default cache size (10 Mbytes) may be changed via the function +TTree::SetCacheSize + +Only the baskets for the requested entry range are put in the cache + +For each Tree being processed a TTreeCache object is created. +This object is automatically deleted when the Tree is deleted or +when the file is deleted. + +- Special case of a TChain + Once the training is done on the first Tree, the list of branches + in the cache is kept for the following files. + +- Special case of a TEventlist + if the Tree or TChain has a TEventlist, only the buffers + referenced by the list are put in the cache. + +The learning period is started or restarted when: + - TTree automatically creates a cache. This feature can be + controlled with an env. variable or the TTreeCache.Size option. + - TTree::SetCacheSize is called with a non-zero size and a cache + did not previously exist + - TTreeCache::StartLearningPhase is called. + - TTree[Cache]::SetEntryRange is called + * and the learning is not yet finished + * and has not been set to manual + * and the new minimun entry is different. + +The learning period is stopped (and prefetching is actually started) when: + - TTree[Cache]::StopLearningPhase is called. + - An entry outside the 'learning' range is requested + The 'learning range is from fEntryMin (default to 0) to + fEntryMin + fgLearnEntries (default to 100). + - A 'cached' TChain switches over to a new file. + +## WHY DO WE NEED the TreeCache when doing data analysis? + +When writing a TTree, the branch buffers are kept in memory. +A typical branch buffersize (before compression) is typically 32 KBytes. +After compression, the zipped buffer may be just a few Kbytes. +The branch buffers cannot be much larger in case of Trees with several +hundred or thousand branches. + +When writing, this does not generate a performance problem because branch +buffers are always written sequentially and the OS is in general clever enough +to flush the data to the output file when a few MBytes of data have to be written. +When reading at the contrary, one may hit a performance problem when reading +across a network (LAN or WAN) and the network latency is high. +For example in a WAN with 10ms latency, reading 1000 buffers of 10 KBytes each +with no cache will imply 10s penalty where a local read of the 10 MBytes would +take about 1 second. + +The TreeCache will try to prefetch all the buffers for the selected branches +such that instead of transfering 1000 buffers of 10 Kbytes, it will be able +to transfer one single large buffer of 10 Mbytes in one single transaction. +Not only the TreeCache minimizes the number of transfers, but in addition +it can sort the blocks to be read in increasing order such that the file +is read sequentially. + +Systems like xrootd, dCache or httpd take advantage of the TreeCache in +reading ahead as much data as they can and return to the application +the maximum data specified in the cache and have the next chunk of data ready +when the next request comes. + +## HOW TO USE the TreeCache + +A few use cases are discussed below. A cache may be created with automatic sizing +when a TTree is used: + +Caches are created and automatically sized for TTrees when TTreeCache.Size or +the environment variable ROOT_TTREECACHE_SIZE is set to a sizing factor. + +But there are many possible configurations where manual control may be wanted. +In some applications you know a priori the list of branches to read. In other +applications the analysis loop calls several layers of user functions where it +is impossible to predict a priori which branches will be used. This +is probably the most frequent case. In this case ROOT I/O will flag used +branches automatically when a branch buffer is read during the learning phase. +The TreeCache interface provides functions to instruct the cache about the used +branches if they are known a priori. In the examples below, portions of analysis +code are shown. The few statements involving the TreeCache are marked with `//<<<` + +### 1. with TTree::Draw + +the TreeCache is automatically used by TTree::Draw. The function knows +which branches are used in the query and it puts automatically these branches +in the cache. The entry range is also known automatically. + +### 2. with TTree::Process and TSelectors + +You must enable the cache and tell the system which branches to cache +and also specify the entry range. It is important to specify the entry range +in case you process only a subset of the events, otherwise you run the risk +to store in the cache entries that you do not need. + +#### example 2a + + TTree *T = (TTree*)f->Get("mytree"); + Long64_t nentries = T->GetEntries(); + Int_t cachesize = 10000000; //10 MBytes + T->SetCacheSize(cachesize); //<<< + T->AddBranchToCache("*",kTRUE); //<<< add all branches to the cache + T->Process('myselector.C+"); + //in the TSelector::Process function we read all branches + T->GetEntry(i); + ... here you process your entry + +#### example 2b + +in the Process function we read a subset of the branches. +Only the branches used in the first entry will be put in the cache + + TTree *T = (TTree*)f->Get("mytree"); + //we want to process only the 200 first entries + Long64_t nentries=200; + int efirst= 0; + int elast = efirst+nentries; + Int_t cachesize = 10000000; //10 MBytes + TTreeCache::SetLearnEntries(1); //<<< we can take the decision after 1 entry + T->SetCacheSize(cachesize); //<<< + T->SetCacheEntryRange(efirst,elast); //<<< + T->Process('myselector.C+","",nentries,efirst); + // in the TSelector::Process we read only 2 branches + TBranch *b1 = T->GetBranch("branch1"); + b1->GetEntry(i); + if (somecondition) return; + TBranch *b2 = T->GetBranch("branch2"); + b2->GetEntry(i); + ... here you process your entry + +### 3. with your own event loop + +#### example 3a + +in your analysis loop, you always use 2 branches. You want to prefetch +the branch buffers for these 2 branches only. + + TTree *T = (TTree*)f->Get("mytree"); + TBranch *b1 = T->GetBranch("branch1"); + TBranch *b2 = T->GetBranch("branch2"); + Long64_t nentries = T->GetEntries(); + Int_t cachesize = 10000000; //10 MBytes + T->SetCacheSize(cachesize); //<<< + T->AddBranchToCache(b1,kTRUE); //<<<add branch1 and branch2 to the cache + T->AddBranchToCache(b2,kTRUE); //<<< + T->StopCacheLearningPhase(); //<<< + for (Long64_t i=0;i<nentries;i++) { + T->LoadTree(i); //<<< important call when calling TBranch::GetEntry after + b1->GetEntry(i); + if (some condition not met) continue; + b2->GetEntry(i); + if (some condition not met) continue; + //here we read the full event only in some rare cases. + //there is no point in caching the other branches as it might be + //more economical to read only the branch buffers really used. + T->GetEntry(i); + .. process the rare but interesting cases. + ... here you process your entry + } + +#### example 3b + +in your analysis loop, you always use 2 branches in the main loop. +you also call some analysis functions where a few more branches will be read. +but you do not know a priori which ones. There is no point in prefetching +branches that will be used very rarely. + + TTree *T = (TTree*)f->Get("mytree"); + Long64_t nentries = T->GetEntries(); + Int_t cachesize = 10000000; //10 MBytes + T->SetCacheSize(cachesize); //<<< + T->SetCacheLearnEntries(5); //<<< we can take the decision after 5 entries + TBranch *b1 = T->GetBranch("branch1"); + TBranch *b2 = T->GetBranch("branch2"); + for (Long64_t i=0;i<nentries;i++) { + T->LoadTree(i); + b1->GetEntry(i); + if (some condition not met) continue; + b2->GetEntry(i); + //at this point we may call a user function where a few more branches + //will be read conditionally. These branches will be put in the cache + //if they have been used in the first 10 entries + if (some condition not met) continue; + //here we read the full event only in some rare cases. + //there is no point in caching the other branches as it might be + //more economical to read only the branch buffers really used. + T->GetEntry(i); + .. process the rare but interesting cases. + ... here you process your entry + } + +## SPECIAL CASES WHERE TreeCache should not be activated + +When reading only a small fraction of all entries such that not all branch +buffers are read, it might be faster to run without a cache. + +## HOW TO VERIFY That the TreeCache has been used and check its performance + +Once your analysis loop has terminated, you can access/print the number +of effective system reads for a given file with a code like +(where TFile* f is a pointer to your file) + + printf("Reading %lld bytes in %d transactions\n",f->GetBytesRead(), f->GetReadCalls()); +*/ #include "TSystem.h" #include "TEnv.h" diff --git a/tree/tree/src/TTreeCacheUnzip.cxx b/tree/tree/src/TTreeCacheUnzip.cxx index 3ae4cdc0d2b214166fa23c2b7012653326eed3b6..b3462f97fb5fd1171d77c3e7e3f28eccff258dac 100644 --- a/tree/tree/src/TTreeCacheUnzip.cxx +++ b/tree/tree/src/TTreeCacheUnzip.cxx @@ -8,42 +8,37 @@ * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ -////////////////////////////////////////////////////////////////////////// -// // -// TTreeCacheUnzip // -// // -// Specialization of TTreeCache for parallel Unzipping // -// // -// Fabrizio Furano (CERN) Aug 2009 // -// Core TTree-related code borrowed from the previous version // -// by Leandro Franco and Rene Brun // -// // -////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////// -// Parallel Unzipping // -// // -// TTreeCache has been specialised in order to let additional threads // -// free to unzip in advance its content. In this implementation we // -// support up to 10 threads, but right now it makes more sense to // -// limit their number to 1-2 // -// // -// The application reading data is carefully synchronized, in order to: // -// - if the block it wants is not unzipped, it self-unzips it without // -// waiting // -// - if the block is being unzipped in parallel, it waits only // -// for that unzip to finish // -// - if the block has already been unzipped, it takes it // -// // -// This is supposed to cancel a part of the unzipping latency, at the // -// expenses of cpu time. // -// // -// The default parameters are the same of the prev version, i.e. 20% // -// of the TTreeCache cache size. To change it use // -// TTreeCache::SetUnzipBufferSize(Long64_t bufferSize) // -// where bufferSize must be passed in bytes. // -// // -////////////////////////////////////////////////////////////////////////// + +/** \class TTreeCacheUnzip + +Specialization of TTreeCache for parallel Unzipping. + +Fabrizio Furano (CERN) Aug 2009 +Core TTree-related code borrowed from the previous version + by Leandro Franco and Rene Brun + +## Parallel Unzipping + +TTreeCache has been specialised in order to let additional threads +free to unzip in advance its content. In this implementation we +support up to 10 threads, but right now it makes more sense to +limit their number to 1-2 + +The application reading data is carefully synchronized, in order to: + - if the block it wants is not unzipped, it self-unzips it without + waiting + - if the block is being unzipped in parallel, it waits only + for that unzip to finish + - if the block has already been unzipped, it takes it + +This is supposed to cancel a part of the unzipping latency, at the +expenses of cpu time. + +The default parameters are the same of the prev version, i.e. 20% +of the TTreeCache cache size. To change it use +TTreeCache::SetUnzipBufferSize(Long64_t bufferSize) +where bufferSize must be passed in bytes. +*/ #include "TTreeCacheUnzip.h" #include "TChain.h" @@ -121,7 +116,7 @@ TTreeCacheUnzip::TTreeCacheUnzip(TTree *tree, Int_t buffersize) : TTreeCache(tre } //////////////////////////////////////////////////////////////////////////////// -/// Initialization procedure common to all the constructors +/// Initialization procedure common to all the constructors. void TTreeCacheUnzip::Init() { @@ -168,8 +163,7 @@ void TTreeCacheUnzip::Init() } //////////////////////////////////////////////////////////////////////////////// -/// destructor. (in general called by the TFile destructor -/// destructor. (in general called by the TFile destructor) +/// Destructor. (in general called by the TFile destructor) TTreeCacheUnzip::~TTreeCacheUnzip() { @@ -178,13 +172,11 @@ TTreeCacheUnzip::~TTreeCacheUnzip() if (IsActiveThread()) StopThreadUnzip(); - delete [] fUnzipLen; delete fUnzipStartCondition; delete fUnzipDoneCondition; - delete fMutexList; delete fIOMutex; @@ -193,10 +185,11 @@ TTreeCacheUnzip::~TTreeCacheUnzip() } //////////////////////////////////////////////////////////////////////////////// -///add a branch to the list of branches to be stored in the cache -///this function is called by TBranch::GetBasket -/// Returns 0 branch added or already included -/// -1 on error +/// Add a branch to the list of branches to be stored in the cache +/// this function is called by TBranch::GetBasket +/// Returns: +/// - 0 branch added or already included +/// - -1 on error Int_t TTreeCacheUnzip::AddBranch(TBranch *b, Bool_t subbranches /*= kFALSE*/) { @@ -206,10 +199,11 @@ Int_t TTreeCacheUnzip::AddBranch(TBranch *b, Bool_t subbranches /*= kFALSE*/) } //////////////////////////////////////////////////////////////////////////////// -///add a branch to the list of branches to be stored in the cache -///this function is called by TBranch::GetBasket -/// Returns 0 branch added or already included -/// -1 on error +/// Add a branch to the list of branches to be stored in the cache +/// this function is called by TBranch::GetBasket +/// Returns: +/// - 0 branch added or already included +/// - -1 on error Int_t TTreeCacheUnzip::AddBranch(const char *branch, Bool_t subbranches /*= kFALSE*/) { @@ -298,7 +292,6 @@ Bool_t TTreeCacheUnzip::FillBuffer() if (gDebug > 0) printf("Entry: %lld, registering baskets branch %s, fEntryNext=%lld, fNseek=%d, fNtot=%d\n",entry,((TBranch*)fBranches->UncheckedAt(i))->GetName(),fEntryNext,fNseek,fNtot); } - // Now fix the size of the status arrays ResetCache(); @@ -309,12 +302,12 @@ Bool_t TTreeCacheUnzip::FillBuffer() return kTRUE; } - //////////////////////////////////////////////////////////////////////////////// /// Change the underlying buffer size of the cache. -/// Returns 0 if the buffer content is still available -/// 1 if some or all of the buffer content has been made unavailable -/// -1 on error +/// Returns: +/// - 0 if the buffer content is still available +/// - 1 if some or all of the buffer content has been made unavailable +/// - -1 on error Int_t TTreeCacheUnzip::SetBufferSize(Int_t buffersize) { @@ -329,7 +322,6 @@ Int_t TTreeCacheUnzip::SetBufferSize(Int_t buffersize) return 1; } - //////////////////////////////////////////////////////////////////////////////// /// Set the minimum and maximum entry number to be processed /// this information helps to optimize the number of baskets to read @@ -350,7 +342,6 @@ void TTreeCacheUnzip::StopLearningPhase() { R__LOCKGUARD(fMutexList); - TTreeCache::StopLearningPhase(); } @@ -365,11 +356,11 @@ void TTreeCacheUnzip::UpdateBranches(TTree *tree) TTreeCache::UpdateBranches(tree); } -/////////////////////////////////////////////////////////////////////////////// -// // -// From now on we have the method concerning the threading part of the cache // -// // -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// // +// From now on we have the methods concerning the threading part of the cache // +// // +//////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// /// Static function that returns the parallel option @@ -381,8 +372,7 @@ TTreeCacheUnzip::EParUnzipMode TTreeCacheUnzip::GetParallelUnzip() } //////////////////////////////////////////////////////////////////////////////// -/// Static function that tells wether the multithreading unzipping -/// is activated +/// Static function that tells wether the multithreading unzipping is activated Bool_t TTreeCacheUnzip::IsParallelUnzip() { @@ -405,8 +395,7 @@ Bool_t TTreeCacheUnzip::IsActiveThread() } //////////////////////////////////////////////////////////////////////////////// -/// It says if the queue is empty... useful to see if we have to process -/// it. +/// It says if the queue is empty... useful to see if we have to process it. Bool_t TTreeCacheUnzip::IsQueueEmpty() { @@ -425,6 +414,7 @@ void TTreeCacheUnzip::WaitUnzipStartSignal() fUnzipStartCondition->TimedWaitRelative(2000); } + //////////////////////////////////////////////////////////////////////////////// /// This will send the signal corresponfing to the queue... normally used /// when we want to start processing the list of buffers. @@ -440,14 +430,17 @@ void TTreeCacheUnzip::SendUnzipStartSignal(Bool_t broadcast) } //////////////////////////////////////////////////////////////////////////////// -/// Static function that(de)activates multithreading unzipping +/// Static function that (de)activates multithreading unzipping +/// /// The possible options are: -/// kEnable _Enable_ it, which causes an automatic detection and launches the -/// additional thread if the number of cores in the machine is greater than one -/// kDisable _Disable_ will not activate the additional thread. -/// kForce _Force_ will start the additional thread even if there is only one core. -/// the default will be taken as kEnable. -/// returns 0 if there was an error, 1 otherwise. +/// - kEnable _Enable_ it, which causes an automatic detection and launches the +/// additional thread if the number of cores in the machine is greater than +/// one +/// - kDisable _Disable_ will not activate the additional thread. +/// - kForce _Force_ will start the additional thread even if there is only one +/// core. the default will be taken as kEnable. +/// +/// Returns 0 if there was an error, 1 otherwise. Int_t TTreeCacheUnzip::SetParallelUnzip(TTreeCacheUnzip::EParUnzipMode option) { @@ -458,7 +451,6 @@ Int_t TTreeCacheUnzip::SetParallelUnzip(TTreeCacheUnzip::EParUnzipMode option) return 0; } - class TTreeCacheUnzipData { public: TTreeCacheUnzip *fInstance; @@ -510,6 +502,7 @@ Int_t TTreeCacheUnzip::StartThreadUnzip(Int_t nthreads) /// To stop the thread we only need to change the value of the variable /// fActiveThread to false and the loop will stop (of course, we will have) /// to do the cleaning after that. +/// /// Note: The syncronization part is important here or we will try to delete /// teh object while it's still processing the queue @@ -533,13 +526,13 @@ Int_t TTreeCacheUnzip::StopThreadUnzip() return 1; } - - //////////////////////////////////////////////////////////////////////////////// /// This is a static function. +/// /// This is the call that will be executed in the Thread generated by /// StartThreadTreeCacheUnzip... what we want to do is to inflate the next /// series of buffers leaving them in the second cache. +/// /// Returns 0 when it finishes void* TTreeCacheUnzip::UnzipLoop(void *arg) @@ -568,7 +561,6 @@ void* TTreeCacheUnzip::UnzipLoop(void *arg) else startindex = -1; } - if (startindex >= 0) res = unzipMng->UnzipCache(startindex, locbuffsz, locbuff); @@ -583,7 +575,6 @@ void* TTreeCacheUnzip::UnzipLoop(void *arg) } } - } delete d; @@ -591,11 +582,11 @@ void* TTreeCacheUnzip::UnzipLoop(void *arg) return (void *)0; } -/////////////////////////////////////////////////////////////////////////////// -// // -// From now on we have the method concerning the unzipping part of the cache // -// // -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// // +// From now on we have the methods concerning the unzipping part of the cache // +// // +//////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// /// Read the logical record header from the buffer buf. @@ -690,17 +681,13 @@ void TTreeCacheUnzip::ResetCache() fNseekMax = fNseek; } - - fLastReadPos = 0; fTotalUnzipBytes = 0; fBlocksToGo = fNseek; } - SendUnzipStartSignal(kTRUE); - } //////////////////////////////////////////////////////////////////////////////// @@ -721,7 +708,6 @@ Int_t TTreeCacheUnzip::GetUnzipBuffer(char **buf, Long64_t pos, Int_t len, Bool_ { R__LOCKGUARD(fMutexList); - // We go straight to TTreeCache/TfileCacheRead, in order to get the info we need // pointer to the original zipped chunk // its index in the original unsorted offsets lists @@ -734,10 +720,8 @@ Int_t TTreeCacheUnzip::GetUnzipBuffer(char **buf, Long64_t pos, Int_t len, Bool_ // And now loc is the position of the chunk in the array of the sorted chunks Int_t myCycle = fCycle; - if (fParallel && !fIsLearning) { - if(fNseekMax < fNseek){ if (gDebug > 0) Info("GetUnzipBuffer", "Changing fNseekMax from:%d to:%d", fNseekMax, fNseek); @@ -768,12 +752,6 @@ Int_t TTreeCacheUnzip::GetUnzipBuffer(char **buf, Long64_t pos, Int_t len, Bool_ fNseekMax = fNseek; } - - - - - - loc = (Int_t)TMath::BinarySearch(fNseek,fSeekSort,pos); if ( (fCycle == myCycle) && (loc >= 0) && (loc < fNseek) && (pos == fSeekSort[loc]) ) { @@ -785,9 +763,6 @@ Int_t TTreeCacheUnzip::GetUnzipBuffer(char **buf, Long64_t pos, Int_t len, Bool_ do { - - - // If the block is ready we get it immediately. // And also we don't have to alloc the blks. This is supposed to be // the main thread of the app. @@ -864,7 +839,6 @@ Int_t TTreeCacheUnzip::GetUnzipBuffer(char **buf, Long64_t pos, Int_t len, Bool_ *free = kFALSE; } - fNStalls++; return fUnzipLen[seekidx]; @@ -882,8 +856,6 @@ Int_t TTreeCacheUnzip::GetUnzipBuffer(char **buf, Long64_t pos, Int_t len, Bool_ // Info("GetUnzipBuffer", "++++++++++++++++++++ CacheMISS Block wanted: %d len:%d fNseek:%d", seekidx, len, fNseek); } - - } else { loc = -1; //fLastReadPos = 0; @@ -910,7 +882,6 @@ Int_t TTreeCacheUnzip::GetUnzipBuffer(char **buf, Long64_t pos, Int_t len, Bool_ } } - { R__LOCKGUARD(fIOMutex); // Here we know that the async unzip of the wanted chunk @@ -923,7 +894,6 @@ Int_t TTreeCacheUnzip::GetUnzipBuffer(char **buf, Long64_t pos, Int_t len, Bool_ res = fFile->ReadBuffer(fCompBuffer, len); } - if (res) res = -1; } // scope of the lock! @@ -933,7 +903,6 @@ Int_t TTreeCacheUnzip::GetUnzipBuffer(char **buf, Long64_t pos, Int_t len, Bool_ *free = kTRUE; } - if (!fIsLearning) { fNMissed++; } @@ -942,7 +911,6 @@ Int_t TTreeCacheUnzip::GetUnzipBuffer(char **buf, Long64_t pos, Int_t len, Bool_ } - //////////////////////////////////////////////////////////////////////////////// /// static function: Sets the unzip relatibe buffer size /// FABRIZIO: PLEASE DOCUMENT and also in TTree::Set... @@ -952,7 +920,6 @@ void TTreeCacheUnzip::SetUnzipRelBufferSize(Float_t relbufferSize) fgRelBuffSize = relbufferSize; } - //////////////////////////////////////////////////////////////////////////////// /// Sets the size for the unzipping cache... by default it should be /// two times the size of the prefetching cache @@ -1036,8 +1003,6 @@ Int_t TTreeCacheUnzip::UnzipBuffer(char **dest, char *src) R__unzip(&nin, bufcur, &nbuf, objbuf, &nout); - - if (gDebug > 2) Info("UnzipBuffer", "R__unzip nin:%d, bufcur:%p, nbuf:%d, objbuf:%p, nout:%d", nin, bufcur, nbuf, objbuf, nout); @@ -1118,7 +1083,6 @@ Int_t TTreeCacheUnzip::UnzipCache(Int_t &startindex, Int_t &locbuffsz, char *&lo rdlen = 0; if (fTotalUnzipBytes < fUnzipBufferSize) { - if (fBlocksToGo > 0) { for (Int_t ii=0; ii < fNseek; ii++) { Int_t reqi = (startindex+ii) % fNseek; @@ -1138,8 +1102,6 @@ Int_t TTreeCacheUnzip::UnzipCache(Int_t &startindex, Int_t &locbuffsz, char *&lo } // lock scope - - if (idxtounzip < 0) { if (gDebug > 0) Info("UnzipCache", "Nothing to do... startindex:%d fTotalUnzipBytes:%lld fUnzipBufferSize:%lld fNseek:%d", @@ -1147,11 +1109,9 @@ Int_t TTreeCacheUnzip::UnzipCache(Int_t &startindex, Int_t &locbuffsz, char *&lo return 1; } - // And here we have a new blk to unzip startindex = idxtounzip+THREADCNT; - if (!IsActiveThread() || !fNseek || fIsLearning ) { if (gDebug > 0) Info("UnzipCache", "Sudden Break!!! IsActiveThread(): %d, fNseek: %d, fIsLearning:%d", @@ -1175,7 +1135,6 @@ Int_t TTreeCacheUnzip::UnzipCache(Int_t &startindex, Int_t &locbuffsz, char *&lo //memset(locbuff, 0, locbuffsz); } - if (gDebug > 0) Info("UnzipCache", "Going to unzip block %d", idxtounzip); @@ -1198,7 +1157,6 @@ Int_t TTreeCacheUnzip::UnzipCache(Int_t &startindex, Int_t &locbuffsz, char *&lo return 1; } - if (readbuf <= 0) { fUnzipStatus[idxtounzip] = 2; // Set it as not done fUnzipChunks[idxtounzip] = 0; @@ -1208,7 +1166,6 @@ Int_t TTreeCacheUnzip::UnzipCache(Int_t &startindex, Int_t &locbuffsz, char *&lo return -1; } - GetRecordHeader(locbuff, hlen, nbytes, objlen, keylen); Int_t len = (objlen > nbytes-keylen)? keylen+objlen : nbytes; @@ -1276,7 +1233,6 @@ Int_t TTreeCacheUnzip::UnzipCache(Int_t &startindex, Int_t &locbuffsz, char *&lo fUnzipLen[idxtounzip] = 0; } - fUnzipDoneCondition->Signal(); delete [] ptr; @@ -1295,7 +1251,6 @@ void TTreeCacheUnzip::Print(Option_t* option) const { TTreeCache::Print(option); } - //////////////////////////////////////////////////////////////////////////////// Int_t TTreeCacheUnzip::ReadBufferExt(char *buf, Long64_t pos, Int_t len, Int_t &loc) { diff --git a/tree/tree/src/TTreeResult.cxx b/tree/tree/src/TTreeResult.cxx index 3b03e9c4b6fd7c19ce240431dde5ea35b73f6653..dc4a4754bd4bf4d58295a23d0c5b2507f80efa24 100644 --- a/tree/tree/src/TTreeResult.cxx +++ b/tree/tree/src/TTreeResult.cxx @@ -26,7 +26,6 @@ #include "TString.h" #include "TObjArray.h" - ClassImp(TTreeResult) //////////////////////////////////////////////////////////////////////////////// diff --git a/tree/tree/src/TTreeSQL.cxx b/tree/tree/src/TTreeSQL.cxx index 8c32b2b449e95782f5cb1e93c91b64df9126ab59..9874e7a94dcee90261d3eb4d4b0b1bf727dcb92a 100644 --- a/tree/tree/src/TTreeSQL.cxx +++ b/tree/tree/src/TTreeSQL.cxx @@ -800,5 +800,3 @@ void TTreeSQL::ResetQuery() { fInsertQuery = "INSERT INTO " + fTable + " VALUES ("; } - - diff --git a/tree/tree/src/TreeUtils.cxx b/tree/tree/src/TreeUtils.cxx index 94da459fee2b4061236d3cadb2e9d5bac05e743b..994d3eba1ae893e87d2d7aef331e3ebaab44eb4f 100644 --- a/tree/tree/src/TreeUtils.cxx +++ b/tree/tree/src/TreeUtils.cxx @@ -228,8 +228,6 @@ template Long64_t FillNtupleFromStream<Double_t, TNtupleD>(std::istream &, TNtup // tuple // empty-line - - //comment: // '#' non-newline-character-sequence newline-character //