10 #include "TTreeIndex.h"
11 #include "TTreeCache.h"
24 TBranch* getProductProvenanceBranch(TTree* tree,
BranchType const& branchType) {
28 TBranch* getStatusBranch(TTree* tree,
BranchType const& branchType) {
35 unsigned int maxVirtualSize,
36 unsigned int cacheSize,
37 unsigned int learningEntries) :
41 branchType_(branchType),
42 auxBranch_(tree_ ? getAuxiliaryBranch(tree_, branchType_) : 0),
43 branchEntryInfoBranch_(metaTree_ ? getProductProvenanceBranch(metaTree_, branchType_) : getProductProvenanceBranch(tree_, branchType_)),
46 entries_(tree_ ? tree_->GetEntries() : 0),
52 learningEntries_(learningEntries),
53 cacheSize_(cacheSize),
55 pProductStatuses_(&productStatuses_),
57 statusBranch_(infoTree_ ? getStatusBranch(infoTree_, branchType_) : 0) {
89 std::string
const& oldBranchName) {
93 TBranch* branch =
tree_->GetBranch(oldBranchName.c_str());
103 branches_->insert(std::make_pair(key, info));
109 TBranch* branch =
tree_->GetBranch(oldBranchName.c_str());
111 TObjArray* leaves =
tree_->GetListOfLeaves();
112 int entries = leaves->GetEntries();
114 TLeaf*
leaf = (TLeaf*)(*leaves)[
i];
115 if (leaf == 0)
continue;
116 TBranch*
br = leaf->GetBranch();
117 if (br == 0)
continue;
118 if (br->GetMother() == branch) {
119 leaves->Remove(leaf);
123 tree_->GetListOfBranches()->Remove(branch);
124 tree_->GetListOfBranches()->Compress();
132 boost::shared_ptr<DelayedReader>
134 boost::shared_ptr<DelayedReader>
142 tree_->SetCacheSize(static_cast<Long64_t>(cacheSize));
150 if (treeMaxVirtualSize >= 0)
tree_->SetMaxVirtualSize(static_cast<Long64_t>(treeMaxVirtualSize));
254 n = branch->GetEntry(entryNumber);
266 n = tree->GetEntry(entryNumber);
274 std::auto_ptr<TTreeCache>
277 tree->SetCacheSize(cacheSize);
278 std::auto_ptr<TTreeCache> treeCache(dynamic_cast<TTreeCache*>(file.
GetCacheRead()));
279 if (0 != treeCache.get()) {
280 treeCache->StartLearningPhase();
281 treeCache->SetEntryRange(0, tree->GetEntries());
282 treeCache->AddBranch(branchNames, kTRUE);
283 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_
std::string & branchName() const
virtual std::string explainSelf() 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
std::auto_ptr< TTreeCache > trainCache(TTree *tree, InputFile &file, unsigned int cacheSize, char const *branchNames)
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 & BranchTypeToProductStatusBranchName(BranchType const &branchType)
std::string const & BranchTypeToInfoTreeName(BranchType const &branchType)
TBranch * provenanceBranch_
boost::shared_ptr< DelayedReader > makeDelayedReader(FileFormatVersion const &fileFormatVersion, boost::shared_ptr< RootFile > rootFilePtr=boost::shared_ptr< RootFile >()) const
void getEntry(TBranch *branch, EntryNumber entry) const
boost::shared_ptr< BranchMap > branches_
void setPresence(BranchDescription const &prod)
void setCacheSize(unsigned int cacheSize)
std::string const & BranchTypeToAuxBranchName(BranchType const &branchType)
BranchMap const & branches() const
boost::shared_ptr< InputFile > filePtr_
std::string const & branchListIndexesBranchName()
EntryNumber switchOverEntry_
T get(const Candidate &c)
void setEntryNumber(EntryNumber theEntryNumber)
roottree::EntryNumber EntryNumber