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