1 #ifndef IOPool_Input_RootTree_h 2 #define IOPool_Input_RootTree_h 23 #include <unordered_set> 24 #include <unordered_map> 33 class RootDelayedReader;
38 class ModuleCallingContext;
40 namespace signalslot {
41 template <
typename T>
class Signal;
53 branchDescription_(prod),
57 offsetToWrapperBase_(0) {}
75 map_.emplace(iKey.
id(),iInfo);
78 auto itFound =
map_.find(iKey.
id());
79 if(itFound ==
map_.end()) {
return nullptr;}
80 return &itFound->second;
83 auto itFound =
map_.find(iKey.
id());
84 if(itFound ==
map_.end()) {
return nullptr;}
85 return &itFound->second;
89 std::unordered_map<unsigned int,BranchInfo>
map_;
101 RootTree(std::shared_ptr<InputFile> filePtr,
103 unsigned int nIndexes,
104 unsigned int maxVirtualSize,
105 unsigned int cacheSize,
106 unsigned int learningEntries,
107 bool enablePrefetching,
114 bool isValid()
const;
123 bool next() {
return ++entryNumber_ < entries_;}
124 bool nextWithCache();
126 bool current()
const {
return entryNumber_ < entries_ && entryNumber_ >= 0;}
127 bool current(EntryNumber entry)
const {
return entry < entries_ && entry >= 0;}
130 bool skipEntries(
unsigned int&
offset);
132 EntryNumber
const& entryNumberForIndex(
unsigned int index)
const;
133 EntryNumber
const&
entries()
const {
return entries_;}
134 void setEntryNumber(EntryNumber theEntryNumber);
135 void insertEntryForIndex(
unsigned int index);
136 std::vector<std::string>
const&
branchNames()
const {
return branchNames_;}
139 template <
typename T>
141 auxBranch_->SetAddress(&pAux);
144 template <
typename T>
146 if (metaTree_ !=
nullptr) {
148 branch->SetAddress(&pbuf);
151 fillBranchEntry<T>(
branch, pbuf);
155 template <
typename T>
157 branch->SetAddress(&pbuf);
161 template <
typename T>
163 if (metaTree_ !=
nullptr) {
165 branch->SetAddress(&pbuf);
168 fillBranchEntry<T>(
branch, entryNumber, pbuf);
172 template <
typename T>
174 branch->SetAddress(&pbuf);
178 TTree
const*
tree()
const {
return tree_;}
181 BranchMap
const& branches()
const;
186 inline TTreeCache* checkTriggerCache(TBranch* branch, EntryNumber entryNumber)
const;
187 TTreeCache* checkTriggerCacheImpl(TBranch* branch, EntryNumber entryNumber)
const;
188 inline TTreeCache* selectCache(TBranch* branch, EntryNumber entryNumber)
const;
198 void setCacheSize(
unsigned int cacheSize);
199 void setTreeMaxVirtualSize(
int treeMaxVirtualSize);
200 void startTraining();
bool current(EntryNumber entry) const
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
std::unordered_map< unsigned int, BranchInfo > map_
unsigned int const defaultNonEventLearningEntries
unsigned int learningEntries_
std::shared_ptr< TTreeCache > rawTriggerTreeCache_
void fillBranchEntryMeta(TBranch *branch, EntryNumber entryNumber, T *&pbuf)
std::vector< std::string > branchNames_
std::vector< std::string > const & branchNames() const
BranchInfo * find(BranchID const &iKey)
std::shared_ptr< TTreeCache > treeCache_
EntryNumber rawTriggerSwitchOverEntry_
roottree::BranchMap BranchMap
EntryNumber const & entries() const
std::unordered_set< TBranch * > trainedSet_
TBranch * branchEntryInfoBranch_
void fillBranchEntryMeta(TBranch *branch, T *&pbuf)
unsigned int const defaultCacheSize
std::unique_ptr< RootDelayedReader > rootDelayedReader_
TBranch * branchEntryInfoBranch() const
TTree const * metaTree() const
Int_t offsetToWrapperBase_
TTree const * tree() const
BranchInfo const * find(BranchID const &iKey) const
BranchDescription const branchDescription_
BranchType branchType() const
unsigned long treeAutoFlush_
IndexIntoFile::EntryNumber_t EntryNumber
EntryNumber const & entryNumber() const
TBranch * provenanceBranch_
std::shared_ptr< TTreeCache > rawTreeCache_
BranchInfo(BranchDescription const &prod)
void fillBranchEntry(TBranch *branch, T *&pbuf)
void insert(edm::BranchID const &iKey, BranchInfo const &iInfo)
std::shared_ptr< InputFile > filePtr_
bool performedSwitchOver_
std::unique_ptr< std::vector< EntryNumber > > entryNumberForIndex_
unsigned int const defaultNonEventCacheSize
std::unordered_set< TBranch * > triggerSet_
void numberOfBranchesToAdd(size_t iSize)
void reserve(size_t iSize)
std::unique_ptr< TTreeCache > trainCache(TTree *tree, InputFile &file, unsigned int cacheSize, char const *branchNames)
unsigned int const defaultLearningEntries
EntryNumber switchOverEntry_
std::shared_ptr< TTreeCache > triggerTreeCache_
void fillBranchEntry(TBranch *branch, EntryNumber entryNumber, T *&pbuf)
def branchType(schema, name)
roottree::EntryNumber EntryNumber