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_{},
52  trainNow_(false),
53  switchOverEntry_(-1),
55  performedSwitchOver_{false},
56  learningEntries_(learningEntries),
57  cacheSize_(cacheSize),
58  treeAutoFlush_(0),
59  enablePrefetching_(enablePrefetching),
61  rootDelayedReader_(new RootDelayedReader(*this, filePtr, inputType)),
62  branchEntryInfoBranch_(metaTree_ ? getProductProvenanceBranch(metaTree_, branchType_) : (tree_ ? getProductProvenanceBranch(tree_, branchType_) : nullptr)),
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  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(prod.branchID(), 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  }
223  //We are using the triggerTreeCache_ not the rawTriggerTreeCache_.
224  //The triggerTreeCache was originally told to start from an entry further in the file.
225  triggerTreeCache_->SetEntryRange(theEntryNumber, tree_->GetEntries());
226  } else if(rawTriggerTreeCache_) {
227  //move the switch point to the end of the cluster holding theEntryNumber
229  TTree::TClusterIterator clusterIter = tree_->GetClusterIterator(theEntryNumber);
230  while ((rawTriggerSwitchOverEntry_ < theEntryNumber) || (rawTriggerSwitchOverEntry_ <= 0)) {
231  rawTriggerSwitchOverEntry_ = clusterIter();
232  }
233  rawTriggerTreeCache_->SetEntryRange(theEntryNumber, rawTriggerSwitchOverEntry_);
234  }
235  }
236  if ((theEntryNumber < static_cast<EntryNumber>(entryNumber_-treeAutoFlush_)) &&
237  (treeCache_) && (!treeCache_->IsLearning()) && (entries_ > 0) && (switchOverEntry_ >= 0)) {
238  treeCache_->SetEntryRange(theEntryNumber, entries_);
239  treeCache_->FillBuffer();
240  }
241 
242  entryNumber_ = theEntryNumber;
243  tree_->LoadTree(entryNumber_);
244  filePtr_->SetCacheRead(nullptr);
245  if(treeCache_ && trainNow_ && entryNumber_ >= 0) {
246  startTraining();
247  trainNow_ = false;
248  trainedSet_.clear();
249  triggerSet_.clear();
251  }
252  if (treeCache_ && treeCache_->IsLearning() && switchOverEntry_ >= 0 && entryNumber_ >= switchOverEntry_) {
253  stopTraining();
254  }
255  }
256 
257  // The actual implementation is done below; it's split in this strange
258  // manner in order to keep a by-definition-rare code path out of the instruction cache.
259  inline TTreeCache*
261  if (!treeCache_->IsAsyncReading() && enableTriggerCache_ && (trainedSet_.find(branch) == trainedSet_.end())) {
262  return checkTriggerCacheImpl(branch, entryNumber);
263  } else {
264  return nullptr;
265  }
266  }
267 
268  // See comments in the header. If this function is called, we already know
269  // the trigger cache is active and it was a cache miss for the regular cache.
270  TTreeCache*
272  // This branch is not going to be in the cache.
273  // Assume this is a "trigger pattern".
274  // Always make sure the branch is added to the trigger set.
275  if (triggerSet_.find(branch) == triggerSet_.end()) {
276  triggerSet_.insert(branch);
277  if (triggerTreeCache_.get()) { triggerTreeCache_->AddBranch(branch, kTRUE); }
278  }
279 
280  if (rawTriggerSwitchOverEntry_ < 0) {
281  // The trigger has never fired before. Take everything not in the
282  // trainedSet and load it from disk
283 
284  // Calculate the end of the next cluster; triggers in the next cluster
285  // will use the triggerCache, not the rawTriggerCache.
286  //
287  // Guarantee that rawTriggerSwitchOverEntry_ is positive (non-zero) after completion
288  // of this if-block.
289  TTree::TClusterIterator clusterIter = tree_->GetClusterIterator(entryNumber);
290  while ((rawTriggerSwitchOverEntry_ < entryNumber) || (rawTriggerSwitchOverEntry_ <= 0)) {
291  rawTriggerSwitchOverEntry_ = clusterIter();
292  }
293 
294  // ROOT will automatically expand the cache to fit one cluster; hence, we use
295  // 5 MB as the cache size below
296  tree_->SetCacheSize(static_cast<Long64_t>(5*1024*1024));
297  rawTriggerTreeCache_.reset(dynamic_cast<TTreeCache*>(filePtr_->GetCacheRead()));
298  if(rawTriggerTreeCache_) rawTriggerTreeCache_->SetEnablePrefetching(false);
299  TObjArray *branches = tree_->GetListOfBranches();
300  int branchCount = branches->GetEntriesFast();
301 
302  // Train the rawTriggerCache to have everything not in the regular cache.
303  rawTriggerTreeCache_->SetLearnEntries(0);
304  rawTriggerTreeCache_->SetEntryRange(entryNumber, rawTriggerSwitchOverEntry_);
305  for (int i=0;i<branchCount;i++) {
306  TBranch *tmp_branch = (TBranch*)branches->UncheckedAt(i);
307  if (trainedSet_.find(tmp_branch) != trainedSet_.end()) {
308  continue;
309  }
310  rawTriggerTreeCache_->AddBranch(tmp_branch, kTRUE);
311  }
312  performedSwitchOver_ = false;
313  rawTriggerTreeCache_->StopLearningPhase();
314  filePtr_->SetCacheRead(nullptr);
315 
316  return rawTriggerTreeCache_.get();
318  // The raw trigger has fired and it contents are valid.
319  return rawTriggerTreeCache_.get();
320  } else if (rawTriggerSwitchOverEntry_ > 0) {
321  // The raw trigger has fired, but we are out of the cache. Use the
322  // triggerCache instead.
323  if (!performedSwitchOver_) {
324  rawTriggerTreeCache_.reset();
325  performedSwitchOver_ = true;
326 
327  // Train the triggerCache
328  tree_->SetCacheSize(static_cast<Long64_t>(5*1024*1024));
329  triggerTreeCache_.reset(dynamic_cast<TTreeCache*>(filePtr_->GetCacheRead()));
330  triggerTreeCache_->SetEnablePrefetching(false);
331  triggerTreeCache_->SetLearnEntries(0);
332  triggerTreeCache_->SetEntryRange(entryNumber, tree_->GetEntries());
333  for(std::unordered_set<TBranch*>::const_iterator it = triggerSet_.begin(), itEnd = triggerSet_.end();
334  it != itEnd;
335  it++)
336  {
337  triggerTreeCache_->AddBranch(*it, kTRUE);
338  }
339  triggerTreeCache_->StopLearningPhase();
340  filePtr_->SetCacheRead(nullptr);
341  }
342  return triggerTreeCache_.get();
343  }
344 
345  // By construction, this case should be impossible.
346  assert (false);
347  return nullptr;
348  }
349 
350  inline TTreeCache*
352  TTreeCache *triggerCache = nullptr;
353  if (!treeCache_) {
354  return nullptr;
355  } else if (treeCache_->IsLearning() && rawTreeCache_) {
356  treeCache_->AddBranch(branch, kTRUE);
357  trainedSet_.insert(branch);
358  return rawTreeCache_.get();
359  } else if ((triggerCache = checkTriggerCache(branch, entryNumber))) {
360  // A NULL return value from checkTriggerCache indicates the trigger cache case
361  // does not apply, and we should continue below.
362  return triggerCache;
363  } else {
364  // The "normal" TTreeCache case.
365  return treeCache_.get();
366  }
367  }
368 
369  void
370  RootTree::getEntry(TBranch* branch, EntryNumber entryNumber) const {
371  try {
372  TTreeCache * cache = selectCache(branch, entryNumber);
373  filePtr_->SetCacheRead(cache);
374  branch->GetEntry(entryNumber);
375  filePtr_->SetCacheRead(nullptr);
376  } catch(cms::Exception const& e) {
377  // We make sure the treeCache_ is detached from the file,
378  // so that ROOT does not also delete it.
379  filePtr_->SetCacheRead(nullptr);
381  t.addContext(std::string("Reading branch ")+branch->GetName());
382  throw t;
383  }
384  }
385 
386  bool
387  RootTree::skipEntries(unsigned int& offset) {
388  entryNumber_ += offset;
389  bool retval = (entryNumber_ < entries_);
390  if(retval) {
391  offset = 0;
392  } else {
393  // Not enough entries in the file to skip.
394  // The +1 is needed because entryNumber_ is -1 at the initialization of the tree, not 0.
395  long long overshoot = entryNumber_ + 1 - entries_;
397  offset = overshoot;
398  }
399  return retval;
400  }
401 
402  void
404  if (cacheSize_ == 0) {
405  return;
406  }
407  assert(treeCache_);
408  assert(branchType_ == InEvent);
409  assert(!rawTreeCache_);
410  treeCache_->SetLearnEntries(learningEntries_);
411  tree_->SetCacheSize(static_cast<Long64_t>(cacheSize_));
412  rawTreeCache_.reset(dynamic_cast<TTreeCache *>(filePtr_->GetCacheRead()));
413  rawTreeCache_->SetEnablePrefetching(false);
414  filePtr_->SetCacheRead(nullptr);
415  rawTreeCache_->SetLearnEntries(0);
417  auto rawStart = entryNumber_;
418  auto rawEnd = switchOverEntry_;
419  auto treeStart =switchOverEntry_;
420  if(switchOverEntry_ >= tree_->GetEntries()) {
421  treeStart = switchOverEntry_-tree_->GetEntries();
422  rawEnd = tree_->GetEntries();
423  }
424  rawTreeCache_->StartLearningPhase();
425  rawTreeCache_->SetEntryRange(rawStart, rawEnd);
426  rawTreeCache_->AddBranch("*", kTRUE);
427  rawTreeCache_->StopLearningPhase();
428  treeCache_->StartLearningPhase();
429  treeCache_->SetEntryRange(treeStart, tree_->GetEntries());
430  // Make sure that 'branchListIndexes' branch exist in input file
431  if (filePtr_->Get(poolNames::branchListIndexesBranchName().c_str()) != nullptr) {
432  treeCache_->AddBranch(poolNames::branchListIndexesBranchName().c_str(), kTRUE);
433  }
434  treeCache_->AddBranch(BranchTypeToAuxiliaryBranchName(branchType_).c_str(), kTRUE);
435  trainedSet_.clear();
436  triggerSet_.clear();
437  assert(treeCache_->GetTree() == tree_);
438  }
439 
440  void
442  filePtr_->SetCacheRead(treeCache_.get());
443  treeCache_->StopLearningPhase();
444  filePtr_->SetCacheRead(nullptr);
445  rawTreeCache_.reset();
446  }
447 
448  void
450  // The TFile is about to be closed, and destructed.
451  // Just to play it safe, zero all pointers to quantities that are owned by the TFile.
453  tree_ = metaTree_ = infoTree_ = nullptr;
454  // We own the treeCache_.
455  // We make sure the treeCache_ is detached from the file,
456  // so that ROOT does not also delete it.
457  filePtr_->SetCacheRead(nullptr);
458  // We *must* delete the TTreeCache here because the TFilePrefetch object
459  // references the TFile. If TFile is closed, before the TTreeCache is
460  // deleted, the TFilePrefetch may continue to do TFile operations, causing
461  // deadlocks or exceptions.
462  treeCache_.reset();
463  rawTreeCache_.reset();
464  triggerTreeCache_.reset();
465  rawTriggerTreeCache_.reset();
466  // We give up our shared ownership of the TFile itself.
467  filePtr_.reset();
468  }
469 
470  void
472  if (cacheSize_ == 0) {
473  return;
474  }
475  tree_->LoadTree(0);
476  assert(treeCache_);
477  filePtr_->SetCacheRead(treeCache_.get());
478  treeCache_->StartLearningPhase();
479  treeCache_->SetEntryRange(0, tree_->GetEntries());
480  treeCache_->AddBranch(branchNames, kTRUE);
481  treeCache_->StopLearningPhase();
482  assert(treeCache_->GetTree() == tree_);
483  // We own the treeCache_.
484  // We make sure the treeCache_ is detached from the file,
485  // so that ROOT does not also delete it.
486  filePtr_->SetCacheRead(nullptr);
487 
488  // Must also manually add things to the trained set.
489  TObjArray *branches = tree_->GetListOfBranches();
490  int branchCount = branches->GetEntriesFast();
491  for (int i=0;i<branchCount;i++) {
492  TBranch *branch = (TBranch*)branches->UncheckedAt(i);
493  if ((branchNames[0] == '*') || (strcmp(branchNames, branch->GetName()) == 0)) {
494  trainedSet_.insert(branch);
495  }
496  }
497 
498  }
499 
500  void
501  RootTree::setSignals(signalslot::Signal<void(StreamContext const&, ModuleCallingContext const&)> const* preEventReadSource,
502  signalslot::Signal<void(StreamContext const&, ModuleCallingContext const&)> const* postEventReadSource) {
503  rootDelayedReader_->setSignals(preEventReadSource,
504  postEventReadSource);
505  }
506 
507 
508  namespace roottree {
509  Int_t
510  getEntry(TBranch* branch, EntryNumber entryNumber) {
511  Int_t n = 0;
512  try {
513  n = branch->GetEntry(entryNumber);
514  }
515  catch(cms::Exception const& e) {
516  throw Exception(errors::FileReadError, "", e);
517  }
518  return n;
519  }
520 
521  Int_t
523  Int_t n = 0;
524  try {
525  n = tree->GetEntry(entryNumber);
526  }
527  catch(cms::Exception const& e) {
528  throw Exception (errors::FileReadError, "", e);
529  }
530  return n;
531  }
532 
533  std::unique_ptr<TTreeCache>
534  trainCache(TTree* tree, InputFile& file, unsigned int cacheSize, char const* branchNames) {
535  tree->LoadTree(0);
536  tree->SetCacheSize(cacheSize);
537  std::unique_ptr<TTreeCache> treeCache(dynamic_cast<TTreeCache*>(file.GetCacheRead()));
538  if (nullptr != treeCache.get()) {
539  treeCache->StartLearningPhase();
540  treeCache->SetEntryRange(0, tree->GetEntries());
541  treeCache->AddBranch(branchNames, kTRUE);
542  treeCache->StopLearningPhase();
543  }
544  // We own the treeCache_.
545  // We make sure the treeCache_ is detached from the file,
546  // so that ROOT does not also delete it.
547  file.SetCacheRead(nullptr);
548  return treeCache;
549  }
550  }
551 }
EntryNumber entryNumber_
Definition: RootTree.h:221
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:229
InputType
Definition: InputType.h:5
static const TGPicture * info(bool iBackgroundIsBlack)
TTreeCache * checkTriggerCache(TBranch *branch, EntryNumber entryNumber) const
Definition: RootTree.cc:260
std::shared_ptr< TTreeCache > rawTriggerTreeCache_
Definition: RootTree.h:217
void dropBranch(std::string const &oldBranchName)
Definition: RootTree.cc:155
std::vector< std::string > branchNames_
Definition: RootTree.h:223
std::vector< std::string > const & branchNames() const
Definition: RootTree.h:136
std::shared_ptr< TTreeCache > treeCache_
Definition: RootTree.h:214
TTree * tree_
Definition: RootTree.h:207
bool trainNow_
Definition: RootTree.h:225
EntryNumber rawTriggerSwitchOverEntry_
Definition: RootTree.h:227
TFileCacheRead * GetCacheRead() const
Definition: InputFile.h:47
BranchMap branches_
Definition: RootTree.h:224
EntryNumber const & entries() const
Definition: RootTree.h:133
void setSignals(signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const *preEventReadSource, signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const *postEventReadSource)
Definition: RootTree.cc:501
TTree * metaTree_
Definition: RootTree.h:208
std::unordered_set< TBranch * > trainedSet_
Definition: RootTree.h:218
void stopTraining()
Definition: RootTree.cc:441
TBranch * branchEntryInfoBranch_
Definition: RootTree.h:238
void setPresence(BranchDescription &prod, std::string const &oldBranchName)
Definition: RootTree.cc:129
EntryNumber entries_
Definition: RootTree.h:220
#define nullptr
bool enablePrefetching_
Definition: RootTree.h:234
void trainCache(char const *branchNames)
Definition: RootTree.cc:471
std::unique_ptr< RootDelayedReader > rootDelayedReader_
Definition: RootTree.h:236
void setTreeMaxVirtualSize(int treeMaxVirtualSize)
Definition: RootTree.cc:191
BranchType
Definition: BranchType.h:11
void insertEntryForIndex(unsigned int index)
Definition: RootTree.cc:100
DelayedReader * resetAndGetRootDelayedReader() const
Definition: RootTree.cc:118
T const & get(Event const &event, InputTag const &tag)
Definition: Event.h:690
TTreeCache * selectCache(TBranch *branch, EntryNumber entryNumber) const
Definition: RootTree.cc:351
unsigned long treeAutoFlush_
Definition: RootTree.h:231
void addBranch(BranchDescription const &prod, std::string const &oldBranchName)
Definition: RootTree.cc:137
BranchID const & branchID() const
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:50
TTreeCache * checkTriggerCacheImpl(TBranch *branch, EntryNumber entryNumber) const
Definition: RootTree.cc:271
TBranch * auxBranch_
Definition: RootTree.h:210
def cache(function)
EntryNumber const & entryNumber() const
Definition: RootTree.h:131
std::string const & BranchTypeToInfoTreeName(BranchType const &branchType)
Definition: BranchType.cc:111
TBranch * provenanceBranch_
Definition: RootTree.h:60
bool enableTriggerCache_
Definition: RootTree.h:235
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:215
void close()
Definition: RootTree.cc:449
void getEntry(TBranch *branch, EntryNumber entry) const
Definition: RootTree.cc:370
void insert(edm::BranchID const &iKey, BranchInfo const &iInfo)
Definition: RootTree.h:74
void startTraining()
Definition: RootTree.cc:403
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:203
TBranch * productBranch_
Definition: RootTree.h:59
void setCacheSize(unsigned int cacheSize)
Definition: RootTree.cc:181
bool performedSwitchOver_
Definition: RootTree.h:228
std::unique_ptr< std::vector< EntryNumber > > entryNumberForIndex_
Definition: RootTree.h:222
HLT enums.
unsigned int cacheSize_
Definition: RootTree.h:230
bool skipEntries(unsigned int &offset)
Definition: RootTree.cc:387
std::unordered_set< TBranch * > triggerSet_
Definition: RootTree.h:219
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:226
std::shared_ptr< TTreeCache > triggerTreeCache_
Definition: RootTree.h:216
def branchType(schema, name)
Definition: revisionDML.py:112
BranchType branchType_
Definition: RootTree.h:209
TTree * infoTree_
Definition: RootTree.h:240
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:205
roottree::EntryNumber EntryNumber
Definition: RootTree.h:100