CMS 3D CMS Logo

RootTree.cc
Go to the documentation of this file.
1 #include "RootTree.h"
2 #include "RootDelayedReader.h"
6 #include "InputFile.h"
7 #include "TTree.h"
8 #include "TTreeIndex.h"
9 #include "TTreeCache.h"
10 
11 #include <cassert>
12 #include <iostream>
13 
14 namespace edm {
15  namespace {
16  TBranch* getAuxiliaryBranch(TTree* tree, BranchType const& branchType) {
17  TBranch* branch = tree->GetBranch(BranchTypeToAuxiliaryBranchName(branchType).c_str());
18  if (branch == nullptr) {
19  branch = tree->GetBranch(BranchTypeToAuxBranchName(branchType).c_str());
20  }
21  return branch;
22  }
23  TBranch* getProductProvenanceBranch(TTree* tree, BranchType const& branchType) {
24  TBranch* branch = tree->GetBranch(BranchTypeToBranchEntryInfoBranchName(branchType).c_str());
25  return branch;
26  }
27  }
28  RootTree::RootTree(std::shared_ptr<InputFile> filePtr,
29  BranchType const& branchType,
30  unsigned int nIndexes,
31  unsigned int maxVirtualSize,
32  unsigned int cacheSize,
33  unsigned int learningEntries,
34  bool enablePrefetching,
35  InputType inputType) :
36  filePtr_(filePtr),
37  tree_(dynamic_cast<TTree*>(filePtr_.get() != nullptr ? filePtr_->Get(BranchTypeToProductTreeName(branchType).c_str()) : nullptr)),
38  metaTree_(dynamic_cast<TTree*>(filePtr_.get() != nullptr ? filePtr_->Get(BranchTypeToMetaDataTreeName(branchType).c_str()) : nullptr)),
39  branchType_(branchType),
40  auxBranch_(tree_ ? getAuxiliaryBranch(tree_, branchType_) : nullptr),
41  treeCache_(),
42  rawTreeCache_(),
43  triggerTreeCache_(),
44  rawTriggerTreeCache_(),
45  trainedSet_(),
46  triggerSet_(),
47  entries_(tree_ ? tree_->GetEntries() : 0),
48  entryNumber_(-1),
49  entryNumberForIndex_(new std::vector<EntryNumber>(nIndexes, IndexIntoFile::invalidEntry)),
50  branchNames_(),
51  branches_(new BranchMap),
52  trainNow_(false),
53  switchOverEntry_(-1),
54  rawTriggerSwitchOverEntry_(-1),
55  learningEntries_(learningEntries),
56  cacheSize_(cacheSize),
57  treeAutoFlush_(0),
58  enablePrefetching_(enablePrefetching),
59  enableTriggerCache_(branchType_ == InEvent),
60  rootDelayedReader_(new RootDelayedReader(*this, filePtr, inputType)),
61  branchEntryInfoBranch_(metaTree_ ? getProductProvenanceBranch(metaTree_, branchType_) : (tree_ ? getProductProvenanceBranch(tree_, branchType_) : nullptr)),
62  infoTree_(dynamic_cast<TTree*>(filePtr_.get() != nullptr ? filePtr->Get(BranchTypeToInfoTreeName(branchType).c_str()) : nullptr)) // backward compatibility
63  {
64  if(not tree_) {
65  throw cms::Exception("WrongFileFormat")<< "The ROOT file does not contain a TTree named "<<BranchTypeToProductTreeName(branchType)<<"\n This is either not an edm ROOT file or is one that has been corrupted.";
66  }
67  // On merged files in older releases of ROOT, the autoFlush setting is always negative; we must guess.
68  // TODO: On newer merged files, we should be able to get this from the cluster iterator.
69  long treeAutoFlush = (tree_ ? tree_->GetAutoFlush() : 0);
70  if (treeAutoFlush < 0) {
71  // The "+1" is here to avoid divide-by-zero in degenerate cases.
72  Long64_t averageEventSizeBytes = tree_->GetZipBytes() / (tree_->GetEntries()+1) + 1;
73  treeAutoFlush_ = cacheSize_/averageEventSizeBytes+1;
74  } else {
75  treeAutoFlush_ = treeAutoFlush;
76  }
79  }
80  setTreeMaxVirtualSize(maxVirtualSize);
81  setCacheSize(cacheSize);
82  if (tree_) {
83  Int_t branchCount = tree_->GetListOfBranches()->GetEntriesFast();
84  trainedSet_.reserve(branchCount);
85  triggerSet_.reserve(branchCount);
86  }
87  }
88 
90  }
91 
93  RootTree::entryNumberForIndex(unsigned int index) const {
94  assert(index < entryNumberForIndex_->size());
95  return (*entryNumberForIndex_)[index];
96  }
97 
98  void
100  assert(index < entryNumberForIndex_->size());
101  (*entryNumberForIndex_)[index] = entryNumber();
102  }
103 
104  bool
106  if (metaTree_ == nullptr || metaTree_->GetNbranches() == 0) {
107  return tree_ != nullptr && auxBranch_ != nullptr;
108  }
109  if (tree_ != nullptr && auxBranch_ != nullptr && metaTree_ != nullptr) { // backward compatibility
110  if (branchEntryInfoBranch_ != nullptr || infoTree_ != nullptr) return true; // backward compatibility
111  return (entries_ == metaTree_->GetEntries() && tree_->GetNbranches() <= metaTree_->GetNbranches() + 1); // backward compatibility
112  } // backward compatibility
113  return false;
114  }
115 
118  rootDelayedReader_->reset();
119  return rootDelayedReader_.get();
120  }
121 
124  return rootDelayedReader_.get();
125  }
126 
127  void
129  assert(isValid());
130  if(tree_->GetBranch(oldBranchName.c_str()) == nullptr){
131  prod.setDropped(true);
132  }
133  }
134 
135  void
137  BranchDescription const& prod,
138  std::string const& oldBranchName) {
139  assert(isValid());
140  //use the translated branch name
141  TBranch* branch = tree_->GetBranch(oldBranchName.c_str());
143  info.productBranch_ = nullptr;
144  if (prod.present()) {
145  info.productBranch_ = branch;
146  //we want the new branch name for the JobReport
147  branchNames_.push_back(prod.branchName());
148  }
149  TTree* provTree = (metaTree_ != nullptr ? metaTree_ : tree_);
150  info.provenanceBranch_ = provTree->GetBranch(oldBranchName.c_str());
151  branches_->insert(std::make_pair(key, info));
152  }
153 
154  void
155  RootTree::dropBranch(std::string const& oldBranchName) {
156  //use the translated branch name
157  TBranch* branch = tree_->GetBranch(oldBranchName.c_str());
158  if (branch != nullptr) {
159  TObjArray* leaves = tree_->GetListOfLeaves();
160  int entries = leaves->GetEntries();
161  for (int i = 0; i < entries; ++i) {
162  TLeaf* leaf = (TLeaf*)(*leaves)[i];
163  if (leaf == nullptr) continue;
164  TBranch* br = leaf->GetBranch();
165  if (br == nullptr) continue;
166  if (br->GetMother() == branch) {
167  leaves->Remove(leaf);
168  }
169  }
170  leaves->Compress();
171  tree_->GetListOfBranches()->Remove(branch);
172  tree_->GetListOfBranches()->Compress();
173  delete branch;
174  }
175  }
176 
177  roottree::BranchMap const&
178  RootTree::branches() const {return *branches_;}
179 
180  void
181  RootTree::setCacheSize(unsigned int cacheSize) {
182  cacheSize_ = cacheSize;
183  tree_->SetCacheSize(static_cast<Long64_t>(cacheSize));
184  treeCache_.reset(dynamic_cast<TTreeCache*>(filePtr_->GetCacheRead()));
185  if(treeCache_) treeCache_->SetEnablePrefetching(enablePrefetching_);
186  filePtr_->SetCacheRead(nullptr);
187  rawTreeCache_.reset();
188  }
189 
190  void
191  RootTree::setTreeMaxVirtualSize(int treeMaxVirtualSize) {
192  if (treeMaxVirtualSize >= 0) tree_->SetMaxVirtualSize(static_cast<Long64_t>(treeMaxVirtualSize));
193  }
194 
195  bool
197  bool returnValue = ++entryNumber_ < entries_;
198  if(returnValue) {
200  }
201  return returnValue;
202  }
203 
204  void
206  filePtr_->SetCacheRead(treeCache_.get());
207 
208  // Detect a backward skip. If the skip is sufficiently large, we roll the dice and reset the treeCache.
209  // This will cause some amount of over-reading: we pre-fetch all the events in some prior cluster.
210  // However, because reading one event in the cluster is supposed to be equivalent to reading all events in the cluster,
211  // we're not incurring additional over-reading - we're just doing it more efficiently.
212  // NOTE: Constructor guarantees treeAutoFlush_ is positive, even if TTree->GetAutoFlush() is negative.
213  if(theEntryNumber < entryNumber_ and theEntryNumber >=0) {
214  //We started reading the file near the end, now we need to correct for the learning length
215  if(switchOverEntry_ >tree_->GetEntries()) {
216  switchOverEntry_ = switchOverEntry_-tree_->GetEntries();
217  if(rawTreeCache_) {
218  rawTreeCache_->SetEntryRange(theEntryNumber, switchOverEntry_);
219  rawTreeCache_->FillBuffer();
220  }
221  }
222  }
223  if ((theEntryNumber < static_cast<EntryNumber>(entryNumber_-treeAutoFlush_)) &&
224  (treeCache_) && (!treeCache_->IsLearning()) && (entries_ > 0) && (switchOverEntry_ >= 0)) {
225  treeCache_->SetEntryRange(theEntryNumber, entries_);
226  treeCache_->FillBuffer();
227  }
228 
229  entryNumber_ = theEntryNumber;
230  tree_->LoadTree(entryNumber_);
231  filePtr_->SetCacheRead(nullptr);
232  if(treeCache_ && trainNow_ && entryNumber_ >= 0) {
233  startTraining();
234  trainNow_ = false;
235  trainedSet_.clear();
236  triggerSet_.clear();
238  }
239  if (treeCache_ && treeCache_->IsLearning() && switchOverEntry_ >= 0 && entryNumber_ >= switchOverEntry_) {
240  stopTraining();
241  }
242  }
243 
244  // The actual implementation is done below; it's split in this strange
245  // manner in order to keep a by-definition-rare code path out of the instruction cache.
246  inline TTreeCache*
248  if (!treeCache_->IsAsyncReading() && enableTriggerCache_ && (trainedSet_.find(branch) == trainedSet_.end())) {
249  return checkTriggerCacheImpl(branch, entryNumber);
250  } else {
251  return nullptr;
252  }
253  }
254 
255  // See comments in the header. If this function is called, we already know
256  // the trigger cache is active and it was a cache miss for the regular cache.
257  TTreeCache*
259  // This branch is not going to be in the cache.
260  // Assume this is a "trigger pattern".
261  // Always make sure the branch is added to the trigger set.
262  if (triggerSet_.find(branch) == triggerSet_.end()) {
263  triggerSet_.insert(branch);
264  if (triggerTreeCache_.get()) { triggerTreeCache_->AddBranch(branch, kTRUE); }
265  }
266 
267  if (rawTriggerSwitchOverEntry_ < 0) {
268  // The trigger has never fired before. Take everything not in the
269  // trainedSet and load it from disk
270 
271  // Calculate the end of the next cluster; triggers in the next cluster
272  // will use the triggerCache, not the rawTriggerCache.
273  //
274  // Guarantee that rawTriggerSwitchOverEntry_ is positive (non-zero) after completion
275  // of this if-block.
276  TTree::TClusterIterator clusterIter = tree_->GetClusterIterator(entryNumber);
277  while ((rawTriggerSwitchOverEntry_ < entryNumber) || (rawTriggerSwitchOverEntry_ <= 0)) {
278  rawTriggerSwitchOverEntry_ = clusterIter();
279  }
280 
281  // ROOT will automatically expand the cache to fit one cluster; hence, we use
282  // 5 MB as the cache size below
283  tree_->SetCacheSize(static_cast<Long64_t>(5*1024*1024));
284  rawTriggerTreeCache_.reset(dynamic_cast<TTreeCache*>(filePtr_->GetCacheRead()));
285  if(rawTriggerTreeCache_) rawTriggerTreeCache_->SetEnablePrefetching(false);
286  TObjArray *branches = tree_->GetListOfBranches();
287  int branchCount = branches->GetEntriesFast();
288 
289  // Train the rawTriggerCache to have everything not in the regular cache.
290  rawTriggerTreeCache_->SetLearnEntries(0);
291  rawTriggerTreeCache_->SetEntryRange(entryNumber, rawTriggerSwitchOverEntry_);
292  for (int i=0;i<branchCount;i++) {
293  TBranch *tmp_branch = (TBranch*)branches->UncheckedAt(i);
294  if (trainedSet_.find(tmp_branch) != trainedSet_.end()) {
295  continue;
296  }
297  rawTriggerTreeCache_->AddBranch(tmp_branch, kTRUE);
298  }
299  performedSwitchOver_ = false;
300  rawTriggerTreeCache_->StopLearningPhase();
301  filePtr_->SetCacheRead(nullptr);
302 
303  return rawTriggerTreeCache_.get();
305  // The raw trigger has fired and it contents are valid.
306  return rawTriggerTreeCache_.get();
307  } else if (rawTriggerSwitchOverEntry_ > 0) {
308  // The raw trigger has fired, but we are out of the cache. Use the
309  // triggerCache instead.
310  if (!performedSwitchOver_) {
311  rawTriggerTreeCache_.reset();
312  performedSwitchOver_ = true;
313 
314  // Train the triggerCache
315  tree_->SetCacheSize(static_cast<Long64_t>(5*1024*1024));
316  triggerTreeCache_.reset(dynamic_cast<TTreeCache*>(filePtr_->GetCacheRead()));
317  triggerTreeCache_->SetEnablePrefetching(false);
318  triggerTreeCache_->SetLearnEntries(0);
319  triggerTreeCache_->SetEntryRange(entryNumber, tree_->GetEntries());
320  for(std::unordered_set<TBranch*>::const_iterator it = triggerSet_.begin(), itEnd = triggerSet_.end();
321  it != itEnd;
322  it++)
323  {
324  triggerTreeCache_->AddBranch(*it, kTRUE);
325  }
326  triggerTreeCache_->StopLearningPhase();
327  filePtr_->SetCacheRead(nullptr);
328  }
329  return triggerTreeCache_.get();
330  }
331 
332  // By construction, this case should be impossible.
333  assert (false);
334  return nullptr;
335  }
336 
337  inline TTreeCache*
339  TTreeCache *triggerCache = nullptr;
340  if (!treeCache_) {
341  return nullptr;
342  } else if (treeCache_->IsLearning() && rawTreeCache_) {
343  treeCache_->AddBranch(branch, kTRUE);
344  trainedSet_.insert(branch);
345  return rawTreeCache_.get();
346  } else if ((triggerCache = checkTriggerCache(branch, entryNumber))) {
347  // A NULL return value from checkTriggerCache indicates the trigger cache case
348  // does not apply, and we should continue below.
349  return triggerCache;
350  } else {
351  // The "normal" TTreeCache case.
352  return treeCache_.get();
353  }
354  }
355 
356  void
357  RootTree::getEntry(TBranch* branch, EntryNumber entryNumber) const {
358  try {
359  TTreeCache * cache = selectCache(branch, entryNumber);
360  filePtr_->SetCacheRead(cache);
361  branch->GetEntry(entryNumber);
362  filePtr_->SetCacheRead(nullptr);
363  } catch(cms::Exception const& e) {
364  // We make sure the treeCache_ is detached from the file,
365  // so that ROOT does not also delete it.
366  filePtr_->SetCacheRead(nullptr);
368  t.addContext(std::string("Reading branch ")+branch->GetName());
369  throw t;
370  }
371  }
372 
373  bool
374  RootTree::skipEntries(unsigned int& offset) {
375  entryNumber_ += offset;
376  bool retval = (entryNumber_ < entries_);
377  if(retval) {
378  offset = 0;
379  } else {
380  // Not enough entries in the file to skip.
381  // The +1 is needed because entryNumber_ is -1 at the initialization of the tree, not 0.
382  long long overshoot = entryNumber_ + 1 - entries_;
384  offset = overshoot;
385  }
386  return retval;
387  }
388 
389  void
391  if (cacheSize_ == 0) {
392  return;
393  }
394  assert(treeCache_);
395  assert(branchType_ == InEvent);
396  assert(!rawTreeCache_);
397  treeCache_->SetLearnEntries(learningEntries_);
398  tree_->SetCacheSize(static_cast<Long64_t>(cacheSize_));
399  rawTreeCache_.reset(dynamic_cast<TTreeCache *>(filePtr_->GetCacheRead()));
400  rawTreeCache_->SetEnablePrefetching(false);
401  filePtr_->SetCacheRead(nullptr);
402  rawTreeCache_->SetLearnEntries(0);
404  auto rawStart = entryNumber_;
405  auto rawEnd = switchOverEntry_;
406  auto treeStart =switchOverEntry_;
407  if(switchOverEntry_ >= tree_->GetEntries()) {
408  treeStart = switchOverEntry_-tree_->GetEntries();
409  rawEnd = tree_->GetEntries();
410  }
411  rawTreeCache_->StartLearningPhase();
412  rawTreeCache_->SetEntryRange(rawStart, rawEnd);
413  rawTreeCache_->AddBranch("*", kTRUE);
414  rawTreeCache_->StopLearningPhase();
415  treeCache_->StartLearningPhase();
416  treeCache_->SetEntryRange(treeStart, tree_->GetEntries());
417  // Make sure that 'branchListIndexes' branch exist in input file
418  if (filePtr_->Get(poolNames::branchListIndexesBranchName().c_str()) != nullptr) {
419  treeCache_->AddBranch(poolNames::branchListIndexesBranchName().c_str(), kTRUE);
420  }
421  treeCache_->AddBranch(BranchTypeToAuxiliaryBranchName(branchType_).c_str(), kTRUE);
422  trainedSet_.clear();
423  triggerSet_.clear();
424  assert(treeCache_->GetTree() == tree_);
425  }
426 
427  void
429  filePtr_->SetCacheRead(treeCache_.get());
430  treeCache_->StopLearningPhase();
431  filePtr_->SetCacheRead(nullptr);
432  rawTreeCache_.reset();
433  }
434 
435  void
437  // The TFile is about to be closed, and destructed.
438  // Just to play it safe, zero all pointers to quantities that are owned by the TFile.
440  tree_ = metaTree_ = infoTree_ = nullptr;
441  // We own the treeCache_.
442  // We make sure the treeCache_ is detached from the file,
443  // so that ROOT does not also delete it.
444  filePtr_->SetCacheRead(nullptr);
445  // We *must* delete the TTreeCache here because the TFilePrefetch object
446  // references the TFile. If TFile is closed, before the TTreeCache is
447  // deleted, the TFilePrefetch may continue to do TFile operations, causing
448  // deadlocks or exceptions.
449  treeCache_.reset();
450  rawTreeCache_.reset();
451  triggerTreeCache_.reset();
452  rawTriggerTreeCache_.reset();
453  // We give up our shared ownership of the TFile itself.
454  filePtr_.reset();
455  }
456 
457  void
459  if (cacheSize_ == 0) {
460  return;
461  }
462  tree_->LoadTree(0);
463  assert(treeCache_);
464  filePtr_->SetCacheRead(treeCache_.get());
465  treeCache_->StartLearningPhase();
466  treeCache_->SetEntryRange(0, tree_->GetEntries());
467  treeCache_->AddBranch(branchNames, kTRUE);
468  treeCache_->StopLearningPhase();
469  assert(treeCache_->GetTree() == tree_);
470  // We own the treeCache_.
471  // We make sure the treeCache_ is detached from the file,
472  // so that ROOT does not also delete it.
473  filePtr_->SetCacheRead(nullptr);
474 
475  // Must also manually add things to the trained set.
476  TObjArray *branches = tree_->GetListOfBranches();
477  int branchCount = branches->GetEntriesFast();
478  for (int i=0;i<branchCount;i++) {
479  TBranch *branch = (TBranch*)branches->UncheckedAt(i);
480  if ((branchNames[0] == '*') || (strcmp(branchNames, branch->GetName()) == 0)) {
481  trainedSet_.insert(branch);
482  }
483  }
484 
485  }
486 
487  void
488  RootTree::setSignals(signalslot::Signal<void(StreamContext const&, ModuleCallingContext const&)> const* preEventReadSource,
489  signalslot::Signal<void(StreamContext const&, ModuleCallingContext const&)> const* postEventReadSource) {
490  rootDelayedReader_->setSignals(preEventReadSource,
491  postEventReadSource);
492  }
493 
494 
495  namespace roottree {
496  Int_t
497  getEntry(TBranch* branch, EntryNumber entryNumber) {
498  Int_t n = 0;
499  try {
500  n = branch->GetEntry(entryNumber);
501  }
502  catch(cms::Exception const& e) {
503  throw Exception(errors::FileReadError, "", e);
504  }
505  return n;
506  }
507 
508  Int_t
510  Int_t n = 0;
511  try {
512  n = tree->GetEntry(entryNumber);
513  }
514  catch(cms::Exception const& e) {
515  throw Exception (errors::FileReadError, "", e);
516  }
517  return n;
518  }
519 
520  std::unique_ptr<TTreeCache>
521  trainCache(TTree* tree, InputFile& file, unsigned int cacheSize, char const* branchNames) {
522  tree->LoadTree(0);
523  tree->SetCacheSize(cacheSize);
524  std::unique_ptr<TTreeCache> treeCache(dynamic_cast<TTreeCache*>(file.GetCacheRead()));
525  if (nullptr != treeCache.get()) {
526  treeCache->StartLearningPhase();
527  treeCache->SetEntryRange(0, tree->GetEntries());
528  treeCache->AddBranch(branchNames, kTRUE);
529  treeCache->StopLearningPhase();
530  }
531  // We own the treeCache_.
532  // We make sure the treeCache_ is detached from the file,
533  // so that ROOT does not also delete it.
534  file.SetCacheRead(nullptr);
535  return treeCache;
536  }
537  }
538 }
EntryNumber entryNumber_
Definition: RootTree.h:193
size
Write out results.
std::string const & branchName() const
std::string const & BranchTypeToMetaDataTreeName(BranchType const &branchType)
Definition: BranchType.cc:107
std::string const & BranchTypeToAuxiliaryBranchName(BranchType const &branchType)
Definition: BranchType.cc:115
unsigned int learningEntries_
Definition: RootTree.h:201
InputType
Definition: InputType.h:5
static const TGPicture * info(bool iBackgroundIsBlack)
TTreeCache * checkTriggerCache(TBranch *branch, EntryNumber entryNumber) const
Definition: RootTree.cc:247
void addBranch(BranchKey const &key, BranchDescription const &prod, std::string const &oldBranchName)
Definition: RootTree.cc:136
std::shared_ptr< TTreeCache > rawTriggerTreeCache_
Definition: RootTree.h:189
void dropBranch(std::string const &oldBranchName)
Definition: RootTree.cc:155
std::vector< std::string > branchNames_
Definition: RootTree.h:195
std::vector< std::string > const & branchNames() const
Definition: RootTree.h:108
std::shared_ptr< TTreeCache > treeCache_
Definition: RootTree.h:186
TTree * tree_
Definition: RootTree.h:179
bool trainNow_
Definition: RootTree.h:197
std::shared_ptr< BranchMap > branches_
Definition: RootTree.h:196
EntryNumber rawTriggerSwitchOverEntry_
Definition: RootTree.h:199
TFileCacheRead * GetCacheRead() const
Definition: InputFile.h:47
roottree::BranchMap BranchMap
Definition: RootTree.h:71
EntryNumber const & entries() const
Definition: RootTree.h:105
void setSignals(signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const *preEventReadSource, signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const *postEventReadSource)
Definition: RootTree.cc:488
TTree * metaTree_
Definition: RootTree.h:180
std::unordered_set< TBranch * > trainedSet_
Definition: RootTree.h:190
void stopTraining()
Definition: RootTree.cc:428
TBranch * branchEntryInfoBranch_
Definition: RootTree.h:210
void setPresence(BranchDescription &prod, std::string const &oldBranchName)
Definition: RootTree.cc:128
EntryNumber entries_
Definition: RootTree.h:192
#define nullptr
bool enablePrefetching_
Definition: RootTree.h:206
void trainCache(char const *branchNames)
Definition: RootTree.cc:458
std::unique_ptr< RootDelayedReader > rootDelayedReader_
Definition: RootTree.h:208
void setTreeMaxVirtualSize(int treeMaxVirtualSize)
Definition: RootTree.cc:191
std::map< BranchKey const, BranchInfo > BranchMap
Definition: RootTree.h:63
BranchType
Definition: BranchType.h:11
void insertEntryForIndex(unsigned int index)
Definition: RootTree.cc:99
DelayedReader * resetAndGetRootDelayedReader() const
Definition: RootTree.cc:117
TTreeCache * selectCache(TBranch *branch, EntryNumber entryNumber) const
Definition: RootTree.cc:338
unsigned long treeAutoFlush_
Definition: RootTree.h:203
std::string const & BranchTypeToBranchEntryInfoBranchName(BranchType const &branchType)
Definition: BranchType.cc:127
void setDropped(bool isDropped)
std::string const & BranchTypeToProductTreeName(BranchType const &branchType)
Definition: BranchType.cc:103
IndexIntoFile::EntryNumber_t EntryNumber
Definition: RootTree.h:49
TTreeCache * checkTriggerCacheImpl(TBranch *branch, EntryNumber entryNumber) const
Definition: RootTree.cc:258
TBranch * auxBranch_
Definition: RootTree.h:182
def cache(function)
EntryNumber const & entryNumber() const
Definition: RootTree.h:103
std::string const & BranchTypeToInfoTreeName(BranchType const &branchType)
Definition: BranchType.cc:111
TBranch * provenanceBranch_
Definition: RootTree.h:59
bool enableTriggerCache_
Definition: RootTree.h:207
DelayedReader * rootDelayedReader() const
Definition: RootTree.cc:123
EntryNumber const & entryNumberForIndex(unsigned int index) const
Definition: RootTree.cc:93
std::shared_ptr< TTreeCache > rawTreeCache_
Definition: RootTree.h:187
void close()
Definition: RootTree.cc:436
void getEntry(TBranch *branch, EntryNumber entry) const
Definition: RootTree.cc:357
void startTraining()
Definition: RootTree.cc:390
void addContext(std::string const &context)
Definition: Exception.cc:227
bool isValid() const
Definition: RootTree.cc:105
std::shared_ptr< InputFile > filePtr_
Definition: RootTree.h:175
TBranch * productBranch_
Definition: RootTree.h:58
void setCacheSize(unsigned int cacheSize)
Definition: RootTree.cc:181
bool performedSwitchOver_
Definition: RootTree.h:200
std::unique_ptr< std::vector< EntryNumber > > entryNumberForIndex_
Definition: RootTree.h:194
HLT enums.
unsigned int cacheSize_
Definition: RootTree.h:202
bool skipEntries(unsigned int &offset)
Definition: RootTree.cc:374
std::unordered_set< TBranch * > triggerSet_
Definition: RootTree.h:191
RootTree(std::shared_ptr< InputFile > filePtr, BranchType const &branchType, unsigned int nIndexes, unsigned int maxVirtualSize, unsigned int cacheSize, unsigned int learningEntries, bool enablePrefetching, InputType inputType)
Definition: RootTree.cc:28
std::string const & BranchTypeToAuxBranchName(BranchType const &branchType)
Definition: BranchType.cc:119
BranchMap const & branches() const
Definition: RootTree.cc:178
std::string const & branchListIndexesBranchName()
Definition: BranchType.cc:247
bool nextWithCache()
Definition: RootTree.cc:196
Definition: tree.py:1
void SetCacheRead(TFileCacheRead *tfcr)
Definition: InputFile.h:48
EntryNumber switchOverEntry_
Definition: RootTree.h:198
std::shared_ptr< TTreeCache > triggerTreeCache_
Definition: RootTree.h:188
T get(const Candidate &c)
Definition: component.h:55
def branchType(schema, name)
Definition: revisionDML.py:112
BranchType branchType_
Definition: RootTree.h:181
TTree * infoTree_
Definition: RootTree.h:212
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:205
roottree::EntryNumber EntryNumber
Definition: RootTree.h:72