8 #include "TTreeIndex.h"
9 #include "TTreeCache.h"
22 TBranch* getProductProvenanceBranch(TTree* tree,
BranchType const& branchType) {
29 unsigned int maxVirtualSize,
30 unsigned int cacheSize,
31 unsigned int learningEntries) :
35 branchType_(branchType),
36 auxBranch_(tree_ ? getAuxiliaryBranch(tree_, branchType_) : 0),
39 entries_(tree_ ? tree_->GetEntries() : 0),
45 learningEntries_(learningEntries),
46 cacheSize_(cacheSize),
47 treeAutoFlush_(tree_ ? tree_->GetAutoFlush() : 0),
49 branchEntryInfoBranch_(metaTree_ ? getProductProvenanceBranch(metaTree_, branchType_) : (tree_ ? getProductProvenanceBranch(tree_, branchType_) : 0)),
57 Long64_t averageEventSizeBytes =
tree_->GetZipBytes() / (
tree_->GetEntries()+1) + 1;
89 if(
tree_->GetBranch(oldBranchName.c_str()) == 0){
97 std::string
const& oldBranchName) {
101 TBranch* branch =
tree_->GetBranch(oldBranchName.c_str());
111 branches_->insert(std::make_pair(key, info));
117 TBranch* branch =
tree_->GetBranch(oldBranchName.c_str());
119 TObjArray* leaves =
tree_->GetListOfLeaves();
120 int entries = leaves->GetEntries();
122 TLeaf*
leaf = (TLeaf*)(*leaves)[
i];
123 if (leaf == 0)
continue;
124 TBranch*
br = leaf->GetBranch();
125 if (br == 0)
continue;
126 if (br->GetMother() == branch) {
127 leaves->Remove(leaf);
131 tree_->GetListOfBranches()->Remove(branch);
132 tree_->GetListOfBranches()->Compress();
143 tree_->SetCacheSize(static_cast<Long64_t>(cacheSize));
151 if (treeMaxVirtualSize >= 0)
tree_->SetMaxVirtualSize(static_cast<Long64_t>(treeMaxVirtualSize));
186 branch->GetEntry(entryNumber);
190 branch->GetEntry(entryNumber);
194 branch->GetEntry(entryNumber);
202 t.
addContext(std::string(
"Reading branch ")+branch->GetName());
276 n = branch->GetEntry(entryNumber);
288 n = tree->GetEntry(entryNumber);
296 std::unique_ptr<TTreeCache>
299 tree->SetCacheSize(cacheSize);
300 std::unique_ptr<TTreeCache> treeCache(dynamic_cast<TTreeCache*>(file.
GetCacheRead()));
301 if (0 != treeCache.get()) {
302 treeCache->StartLearningPhase();
303 treeCache->SetEntryRange(0, tree->GetEntries());
304 treeCache->AddBranch(branchNames, kTRUE);
305 treeCache->StopLearningPhase();
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
boost::shared_ptr< TTreeCache > treeCache_
std::string const & BranchTypeToMetaDataTreeName(BranchType const &branchType)
std::string const & BranchTypeToAuxiliaryBranchName(BranchType const &branchType)
unsigned int learningEntries_
void addBranch(BranchKey const &key, BranchDescription const &prod, std::string const &oldBranchName)
void dropBranch(std::string const &oldBranchName)
std::vector< std::string > branchNames_
void setPresence(BranchDescription const &prod, std::string const &oldBranchName)
std::string & branchName() const
roottree::BranchMap BranchMap
EntryNumber const & entries() const
TBranch * branchEntryInfoBranch_
boost::shared_ptr< TTreeCache > rawTreeCache_
void trainCache(char const *branchNames)
void setTreeMaxVirtualSize(int treeMaxVirtualSize)
std::map< BranchKey const, BranchInfo > BranchMap
RootTree(boost::shared_ptr< InputFile > filePtr, BranchType const &branchType, unsigned int maxVirtualSize, unsigned int cacheSize, unsigned int learningEntries)
std::string const & BranchTypeToBranchEntryInfoBranchName(BranchType const &branchType)
std::string const & BranchTypeToProductTreeName(BranchType const &branchType)
std::string const & BranchTypeToInfoTreeName(BranchType const &branchType)
TBranch * provenanceBranch_
DelayedReader * rootDelayedReader() const
void getEntry(TBranch *branch, EntryNumber entry) const
boost::shared_ptr< BranchMap > branches_
void addContext(std::string const &context)
void setCacheSize(unsigned int cacheSize)
std::string const & BranchTypeToAuxBranchName(BranchType const &branchType)
BranchMap const & branches() const
std::unique_ptr< DelayedReader > rootDelayedReader_
boost::shared_ptr< InputFile > filePtr_
std::string const & branchListIndexesBranchName()
std::unique_ptr< TTreeCache > trainCache(TTree *tree, InputFile &file, unsigned int cacheSize, char const *branchNames)
EntryNumber switchOverEntry_
T get(const Candidate &c)
void setEntryNumber(EntryNumber theEntryNumber)
roottree::EntryNumber EntryNumber