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