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 {
53 : branchDescription_(prod),
57 offsetToWrapperBase_(0) {}
72 void reserve(
size_t iSize) { map_.reserve(iSize); }
75 auto itFound = map_.find(iKey.
id());
76 if (itFound == map_.end()) {
79 return &itFound->second;
82 auto itFound = map_.find(iKey.
id());
83 if (itFound == map_.end()) {
86 return &itFound->second;
90 std::unordered_map<unsigned int, BranchInfo>
map_;
97 unsigned int cacheSize,
105 RootTree(std::shared_ptr<InputFile> filePtr,
107 unsigned int nIndexes,
108 unsigned int maxVirtualSize,
109 unsigned int cacheSize,
110 unsigned int learningEntries,
111 bool enablePrefetching,
118 bool isValid()
const;
125 bool next() {
return ++entryNumber_ < entries_; }
126 bool nextWithCache();
128 bool current()
const {
return entryNumber_ < entries_ && entryNumber_ >= 0; }
129 bool current(EntryNumber entry)
const {
return entry < entries_ && entry >= 0; }
132 bool skipEntries(
unsigned int&
offset);
134 EntryNumber
const& entryNumberForIndex(
unsigned int index)
const;
135 EntryNumber
const&
entries()
const {
return entries_; }
136 void setEntryNumber(EntryNumber theEntryNumber);
137 void insertEntryForIndex(
unsigned int index);
138 std::vector<std::string>
const&
branchNames()
const {
return branchNames_; }
141 template <
typename T>
143 auxBranch_->SetAddress(&pAux);
146 template <
typename T>
148 if (metaTree_ !=
nullptr) {
150 branch->SetAddress(&pbuf);
153 fillBranchEntry<T>(
branch, pbuf);
157 template <
typename T>
159 branch->SetAddress(&pbuf);
163 template <
typename T>
165 if (metaTree_ !=
nullptr) {
167 branch->SetAddress(&pbuf);
170 fillBranchEntry<T>(
branch, entryNumber, pbuf);
174 template <
typename T>
176 branch->SetAddress(&pbuf);
180 TTree
const*
tree()
const {
return tree_; }
181 TTree*
tree() {
return tree_; }
182 TTree
const*
metaTree()
const {
return metaTree_; }
183 BranchMap
const& branches()
const;
188 inline TTreeCache* checkTriggerCache(TBranch* branch, EntryNumber entryNumber)
const;
189 TTreeCache* checkTriggerCacheImpl(TBranch* branch, EntryNumber entryNumber)
const;
190 inline TTreeCache* selectCache(TBranch* branch, EntryNumber entryNumber)
const;
201 void setCacheSize(
unsigned int cacheSize);
202 void setTreeMaxVirtualSize(
int treeMaxVirtualSize);
203 void startTraining();
bool current(EntryNumber entry) const
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
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
std::unordered_map< unsigned int, BranchInfo > map_
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