CMS 3D CMS Logo

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