CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
edm::RootTree Class Reference

#include <RootTree.h>

Inheritance diagram for edm::RootTree:

Public Types

typedef roottree::BranchMap BranchMap
 
typedef roottree::EntryNumber EntryNumber
 

Public Member Functions

void addBranch (BranchKey const &key, BranchDescription const &prod, std::string const &oldBranchName)
 
TBranch *const branchEntryInfoBranch () const
 
BranchMap const & branches () const
 
std::vector< std::string > const & branchNames () const
 
void close ()
 
bool current ()
 
void dropBranch (std::string const &oldBranchName)
 
EntryNumber const & entries () const
 
EntryNumber const & entryNumber () const
 
template<typename T >
void fillAux (T *&pAux)
 
template<typename T >
void fillBranchEntry (TBranch *branch, T *&pbuf)
 
template<typename T >
void fillBranchEntryMeta (TBranch *branch, T *&pbuf)
 
void fillStatus ()
 
void getEntry (TBranch *branch, EntryNumber entry) const
 
bool isValid () const
 
boost::shared_ptr< DelayedReadermakeDelayedReader (FileFormatVersion const &fileFormatVersion, boost::shared_ptr< RootFile > rootFilePtr=boost::shared_ptr< RootFile >()) const
 
TTree const * metaTree () const
 
bool next ()
 
bool previous ()
 
std::vector< ProductStatus >
const & 
productStatuses () const
 
void resetTraining ()
 
void rewind ()
 
 RootTree (boost::shared_ptr< InputFile > filePtr, BranchType const &branchType, unsigned int maxVirtualSize, unsigned int cacheSize, unsigned int learningEntries)
 
void setEntryNumber (EntryNumber theEntryNumber)
 
void setPresence (BranchDescription const &prod)
 
void trainCache (char const *branchNames)
 
TTree const * tree () const
 
TTree * tree ()
 
 ~RootTree ()
 

Private Member Functions

void setCacheSize (unsigned int cacheSize)
 
void setTreeMaxVirtualSize (int treeMaxVirtualSize)
 
void startTraining ()
 
void stopTraining ()
 

Private Attributes

TBranch * auxBranch_
 
TBranch * branchEntryInfoBranch_
 
boost::shared_ptr< BranchMapbranches_
 
std::vector< std::string > branchNames_
 
BranchType branchType_
 
unsigned int cacheSize_
 
EntryNumber entries_
 
EntryNumber entryNumber_
 
boost::shared_ptr< InputFilefilePtr_
 
TTree * infoTree_
 
unsigned int learningEntries_
 
TTree * metaTree_
 
std::vector< ProductStatus > * pProductStatuses_
 
std::vector< ProductStatusproductStatuses_
 
boost::shared_ptr< TTreeCache > rawTreeCache_
 
TBranch * statusBranch_
 
EntryNumber switchOverEntry_
 
bool trainNow_
 
TTree * tree_
 
boost::shared_ptr< TTreeCache > treeCache_
 

Detailed Description

Definition at line 63 of file RootTree.h.

Member Typedef Documentation

Definition at line 65 of file RootTree.h.

Definition at line 66 of file RootTree.h.

Constructor & Destructor Documentation

edm::RootTree::RootTree ( boost::shared_ptr< InputFile filePtr,
BranchType const &  branchType,
unsigned int  maxVirtualSize,
unsigned int  cacheSize,
unsigned int  learningEntries 
)

Definition at line 33 of file RootTree.cc.

References setCacheSize(), and setTreeMaxVirtualSize().

37  :
38  filePtr_(filePtr),
39  tree_(dynamic_cast<TTree*>(filePtr_.get() != 0 ? filePtr->Get(BranchTypeToProductTreeName(branchType).c_str()) : 0)),
40  metaTree_(dynamic_cast<TTree*>(filePtr_.get() != 0 ? filePtr->Get(BranchTypeToMetaDataTreeName(branchType).c_str()) : 0)),
42  auxBranch_(tree_ ? getAuxiliaryBranch(tree_, branchType_) : 0),
43  branchEntryInfoBranch_(metaTree_ ? getProductProvenanceBranch(metaTree_, branchType_) : getProductProvenanceBranch(tree_, branchType_)),
44  treeCache_(),
45  rawTreeCache_(),
46  entries_(tree_ ? tree_->GetEntries() : 0),
47  entryNumber_(-1),
48  branchNames_(),
49  branches_(new BranchMap),
50  trainNow_(false),
51  switchOverEntry_(-1),
52  learningEntries_(learningEntries),
53  cacheSize_(cacheSize),
54  productStatuses_(), // backward compatibility
55  pProductStatuses_(&productStatuses_), // backward compatibility
56  infoTree_(dynamic_cast<TTree*>(filePtr_.get() != 0 ? filePtr->Get(BranchTypeToInfoTreeName(branchType).c_str()) : 0)), // backward compatibility
57  statusBranch_(infoTree_ ? getStatusBranch(infoTree_, branchType_) : 0) { // backward compatibility
58  setTreeMaxVirtualSize(maxVirtualSize);
59  setCacheSize(cacheSize);
60  }
EntryNumber entryNumber_
Definition: RootTree.h:150
TBranch * statusBranch_
Definition: RootTree.h:162
boost::shared_ptr< TTreeCache > treeCache_
Definition: RootTree.h:147
std::string const & BranchTypeToMetaDataTreeName(BranchType const &branchType)
Definition: BranchType.cc:100
unsigned int learningEntries_
Definition: RootTree.h:155
std::vector< std::string > branchNames_
Definition: RootTree.h:151
TTree * tree_
Definition: RootTree.h:139
bool trainNow_
Definition: RootTree.h:153
roottree::BranchMap BranchMap
Definition: RootTree.h:65
TTree * metaTree_
Definition: RootTree.h:140
TBranch * branchEntryInfoBranch_
Definition: RootTree.h:143
EntryNumber entries_
Definition: RootTree.h:149
boost::shared_ptr< TTreeCache > rawTreeCache_
Definition: RootTree.h:148
void setTreeMaxVirtualSize(int treeMaxVirtualSize)
Definition: RootTree.cc:149
std::vector< ProductStatus > productStatuses_
Definition: RootTree.h:159
std::string const & BranchTypeToProductTreeName(BranchType const &branchType)
Definition: BranchType.cc:96
TBranch * auxBranch_
Definition: RootTree.h:142
std::string const & BranchTypeToInfoTreeName(BranchType const &branchType)
Definition: BranchType.cc:104
boost::shared_ptr< BranchMap > branches_
Definition: RootTree.h:152
void setCacheSize(unsigned int cacheSize)
Definition: RootTree.cc:140
unsigned int cacheSize_
Definition: RootTree.h:156
std::vector< ProductStatus > * pProductStatuses_
Definition: RootTree.h:160
boost::shared_ptr< InputFile > filePtr_
Definition: RootTree.h:135
EntryNumber switchOverEntry_
Definition: RootTree.h:154
BranchType branchType_
Definition: RootTree.h:141
TTree * infoTree_
Definition: RootTree.h:161
edm::RootTree::~RootTree ( )

Definition at line 62 of file RootTree.cc.

62  {
63  }

Member Function Documentation

void edm::RootTree::addBranch ( BranchKey const &  key,
BranchDescription const &  prod,
std::string const &  oldBranchName 
)

Definition at line 87 of file RootTree.cc.

References branches_, edm::BranchDescription::branchName(), branchNames_, info, edm::BranchDescription::init(), isValid(), metaTree_, edm::BranchDescription::present(), edm::roottree::BranchInfo::productBranch_, edm::roottree::BranchInfo::provenanceBranch_, and tree_.

89  {
90  assert(isValid());
91  prod.init();
92  //use the translated branch name
93  TBranch* branch = tree_->GetBranch(oldBranchName.c_str());
94  roottree::BranchInfo info = roottree::BranchInfo(ConstBranchDescription(prod));
95  info.productBranch_ = 0;
96  if (prod.present()) {
97  info.productBranch_ = branch;
98  //we want the new branch name for the JobReport
99  branchNames_.push_back(prod.branchName());
100  }
101  TTree* provTree = (metaTree_ != 0 ? metaTree_ : tree_);
102  info.provenanceBranch_ = provTree->GetBranch(oldBranchName.c_str());
103  branches_->insert(std::make_pair(key, info));
104  }
std::vector< std::string > branchNames_
Definition: RootTree.h:151
TTree * tree_
Definition: RootTree.h:139
TTree * metaTree_
Definition: RootTree.h:140
boost::shared_ptr< BranchMap > branches_
Definition: RootTree.h:152
bool isValid() const
Definition: RootTree.cc:66
list key
Definition: combine.py:13
TBranch* const edm::RootTree::branchEntryInfoBranch ( ) const
inline

Definition at line 125 of file RootTree.h.

References branchEntryInfoBranch_.

Referenced by edm::BranchMapperWithReader::readProvenance_().

125 {return branchEntryInfoBranch_;}
TBranch * branchEntryInfoBranch_
Definition: RootTree.h:143
roottree::BranchMap const & edm::RootTree::branches ( ) const

Definition at line 130 of file RootTree.cc.

References branches_.

130 {return *branches_;}
boost::shared_ptr< BranchMap > branches_
Definition: RootTree.h:152
std::vector<std::string> const& edm::RootTree::branchNames ( ) const
inline

Definition at line 89 of file RootTree.h.

References branchNames_.

Referenced by edm::RootFile::reportOpened().

89 {return branchNames_;}
std::vector< std::string > branchNames_
Definition: RootTree.h:151
void edm::RootTree::close ( void  )

Definition at line 217 of file RootTree.cc.

References auxBranch_, branchEntryInfoBranch_, filePtr_, infoTree_, metaTree_, statusBranch_, and tree_.

Referenced by python.Vispa.Gui.BoxContentDialog.BoxContentDialog::keyPressEvent(), and python.Vispa.Gui.FindDialog.FindDialog::keyPressEvent().

217  {
218  // The TFile is about to be closed, and destructed.
219  // Just to play it safe, zero all pointers to quantities that are owned by the TFile.
221  tree_ = metaTree_ = infoTree_ = 0;
222  // We own the treeCache_.
223  // We make sure the treeCache_ is detached from the file,
224  // so that ROOT does not also delete it.
225  filePtr_->SetCacheRead(0);
226  // We give up our shared ownership of the TFile itself.
227  filePtr_.reset();
228  }
TBranch * statusBranch_
Definition: RootTree.h:162
TTree * tree_
Definition: RootTree.h:139
TTree * metaTree_
Definition: RootTree.h:140
TBranch * branchEntryInfoBranch_
Definition: RootTree.h:143
TBranch * auxBranch_
Definition: RootTree.h:142
boost::shared_ptr< InputFile > filePtr_
Definition: RootTree.h:135
TTree * infoTree_
Definition: RootTree.h:161
bool edm::RootTree::current ( )
inline

Definition at line 83 of file RootTree.h.

Referenced by edm::RootFile::readCurrentEvent().

83 {return entryNumber_ < entries_ && entryNumber_ >= 0;}
void edm::RootTree::dropBranch ( std::string const &  oldBranchName)

Definition at line 107 of file RootTree.cc.

References beamvalidation::br, entries(), i, python.Node::leaf, and tree_.

107  {
108  //use the translated branch name
109  TBranch* branch = tree_->GetBranch(oldBranchName.c_str());
110  if (branch != 0) {
111  TObjArray* leaves = tree_->GetListOfLeaves();
112  int entries = leaves->GetEntries();
113  for (int i = 0; i < entries; ++i) {
114  TLeaf* leaf = (TLeaf*)(*leaves)[i];
115  if (leaf == 0) continue;
116  TBranch* br = leaf->GetBranch();
117  if (br == 0) continue;
118  if (br->GetMother() == branch) {
119  leaves->Remove(leaf);
120  }
121  }
122  leaves->Compress();
123  tree_->GetListOfBranches()->Remove(branch);
124  tree_->GetListOfBranches()->Compress();
125  delete branch;
126  }
127  }
int i
Definition: DBlmapReader.cc:9
TTree * tree_
Definition: RootTree.h:139
EntryNumber const & entries() const
Definition: RootTree.h:87
tuple leaf
Definition: Node.py:62
EntryNumber const& edm::RootTree::entries ( ) const
inline

Definition at line 87 of file RootTree.h.

References entries_.

Referenced by dropBranch(), edm::RootFile::fillIndexIntoFile(), edm::RootFile::setIfFastClonable(), and edm::RootFile::validateFile().

87 {return entries_;}
EntryNumber entries_
Definition: RootTree.h:149
EntryNumber const& edm::RootTree::entryNumber ( ) const
inline
template<typename T >
void edm::RootTree::fillAux ( T *&  pAux)
inline

Definition at line 92 of file RootTree.h.

References auxBranch_, entryNumber_, and getEntry().

Referenced by edm::RootFile::fillLumiAuxiliary(), edm::RootFile::fillRunAuxiliary(), edm::RootFile::fillThisEventAuxiliary(), and edm::RootFileEventFinder::getEventNumberOfEntry().

92  {
93  auxBranch_->SetAddress(&pAux);
95  }
EntryNumber entryNumber_
Definition: RootTree.h:150
TBranch * auxBranch_
Definition: RootTree.h:142
void getEntry(TBranch *branch, EntryNumber entry) const
Definition: RootTree.cc:169
template<typename T >
void edm::RootTree::fillBranchEntry ( TBranch *  branch,
T *&  pbuf 
)
inline

Definition at line 108 of file RootTree.h.

References entryNumber_, and getEntry().

Referenced by edm::RootFile::fillHistory().

108  {
109  branch->SetAddress(&pbuf);
110  getEntry(branch, entryNumber_);
111  }
EntryNumber entryNumber_
Definition: RootTree.h:150
void getEntry(TBranch *branch, EntryNumber entry) const
Definition: RootTree.cc:169
template<typename T >
void edm::RootTree::fillBranchEntryMeta ( TBranch *  branch,
T *&  pbuf 
)
inline

Definition at line 97 of file RootTree.h.

References entryNumber_, edm::roottree::getEntry(), and metaTree_.

Referenced by edm::BranchMapperWithReader::readProvenance_().

97  {
98  if (metaTree_ != 0) {
99  // Metadata was in separate tree. Not cached.
100  branch->SetAddress(&pbuf);
102  } else {
103  fillBranchEntry<T>(branch, pbuf);
104  }
105  }
EntryNumber entryNumber_
Definition: RootTree.h:150
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: RootTree.cc:251
TTree * metaTree_
Definition: RootTree.h:140
void edm::RootTree::fillStatus ( )
inline

Definition at line 120 of file RootTree.h.

References entryNumber_, edm::roottree::getEntry(), pProductStatuses_, and statusBranch_.

120  { // backward compatibility
121  statusBranch_->SetAddress(&pProductStatuses_); // backward compatibility
122  roottree::getEntry(statusBranch_, entryNumber_); // backward compatibility
123  } // backward compatibility
EntryNumber entryNumber_
Definition: RootTree.h:150
TBranch * statusBranch_
Definition: RootTree.h:162
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: RootTree.cc:251
std::vector< ProductStatus > * pProductStatuses_
Definition: RootTree.h:160
void edm::RootTree::getEntry ( TBranch *  branch,
EntryNumber  entry 
) const

Definition at line 169 of file RootTree.cc.

References filePtr_, edm::roottree::getEntry(), rawTreeCache_, and treeCache_.

Referenced by fillAux(), fillBranchEntry(), and edm::RootDelayedReader::getProduct_().

169  {
170  if (!treeCache_) {
171  filePtr_->SetCacheRead(0);
173  } else if (treeCache_->IsLearning() && rawTreeCache_) {
174  treeCache_->AddBranch(branch, kTRUE);
175  filePtr_->SetCacheRead(rawTreeCache_.get());
177  filePtr_->SetCacheRead(0);
178  } else {
179  filePtr_->SetCacheRead(treeCache_.get());
181  filePtr_->SetCacheRead(0);
182  }
183  }
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: RootTree.cc:251
boost::shared_ptr< TTreeCache > treeCache_
Definition: RootTree.h:147
boost::shared_ptr< TTreeCache > rawTreeCache_
Definition: RootTree.h:148
EntryNumber const & entryNumber() const
Definition: RootTree.h:86
boost::shared_ptr< InputFile > filePtr_
Definition: RootTree.h:135
bool edm::RootTree::isValid ( void  ) const

Definition at line 66 of file RootTree.cc.

References auxBranch_, branchEntryInfoBranch_, entries_, metaTree_, statusBranch_, and tree_.

Referenced by addBranch(), edm::RootFile::fillIndexIntoFile(), edm::RootFile::readLumi(), edm::RootFile::readLuminosityBlockAuxiliary_(), edm::RootFile::readRun_(), edm::RootFile::readRunAuxiliary_(), setPresence(), and edm::RootFile::validateFile().

66  {
67  if (metaTree_ == 0 || metaTree_->GetNbranches() == 0) {
68  return tree_ != 0 && auxBranch_ != 0;
69  }
70  if (tree_ != 0 && auxBranch_ != 0 && metaTree_ != 0) { // backward compatibility
71  if (branchEntryInfoBranch_ != 0 || statusBranch_ != 0) return true; // backward compatibility
72  return (entries_ == metaTree_->GetEntries() && tree_->GetNbranches() <= metaTree_->GetNbranches() + 1); // backward compatibility
73  } // backward compatibility
74  return false;
75  }
TBranch * statusBranch_
Definition: RootTree.h:162
TTree * tree_
Definition: RootTree.h:139
TTree * metaTree_
Definition: RootTree.h:140
TBranch * branchEntryInfoBranch_
Definition: RootTree.h:143
EntryNumber entries_
Definition: RootTree.h:149
TBranch * auxBranch_
Definition: RootTree.h:142
boost::shared_ptr< DelayedReader > edm::RootTree::makeDelayedReader ( FileFormatVersion const &  fileFormatVersion,
boost::shared_ptr< RootFile rootFilePtr = boost::shared_ptr<RootFile>() 
) const

Definition at line 133 of file RootTree.cc.

References branches_, and entryNumber_.

Referenced by edm::RootFile::readCurrentEvent(), edm::RootFile::readLumi(), and edm::RootFile::readRun_().

133  {
134  boost::shared_ptr<DelayedReader>
135  store(new RootDelayedReader(entryNumber_, branches_, *this, fileFormatVersion, rootFilePtr));
136  return store;
137  }
EntryNumber entryNumber_
Definition: RootTree.h:150
boost::shared_ptr< BranchMap > branches_
Definition: RootTree.h:152
TTree const* edm::RootTree::metaTree ( ) const
inline

Definition at line 115 of file RootTree.h.

References metaTree_.

Referenced by edm::RootFile::createFileBlock().

115 {return metaTree_;}
TTree * metaTree_
Definition: RootTree.h:140
bool edm::RootTree::next ( void  )
inline
bool edm::RootTree::previous ( )
inline

Definition at line 82 of file RootTree.h.

References entryNumber_.

Referenced by edm::RootFile::readLuminosityBlockAuxiliary_(), and edm::RootFile::readRunAuxiliary_().

82 {return --entryNumber_ >= 0;}
EntryNumber entryNumber_
Definition: RootTree.h:150
std::vector<ProductStatus> const& edm::RootTree::productStatuses ( ) const
inline

Definition at line 117 of file RootTree.h.

References productStatuses_.

117 {return productStatuses_;} // backward compatibility
std::vector< ProductStatus > productStatuses_
Definition: RootTree.h:159
void edm::RootTree::resetTraining ( )
inline

Definition at line 127 of file RootTree.h.

References trainNow_.

Referenced by edm::RootFile::RootFile().

127 {trainNow_ = true;}
bool trainNow_
Definition: RootTree.h:153
void edm::RootTree::rewind ( )
inline

Definition at line 84 of file RootTree.h.

References entryNumber_.

Referenced by edm::RootFile::rewind().

84 {entryNumber_ = 0;}
EntryNumber entryNumber_
Definition: RootTree.h:150
void edm::RootTree::setCacheSize ( unsigned int  cacheSize)
private

Definition at line 140 of file RootTree.cc.

References cacheSize_, filePtr_, rawTreeCache_, tree_, and treeCache_.

Referenced by RootTree().

140  {
141  cacheSize_ = cacheSize;
142  tree_->SetCacheSize(static_cast<Long64_t>(cacheSize));
143  treeCache_.reset(dynamic_cast<TTreeCache*>(filePtr_->GetCacheRead()));
144  filePtr_->SetCacheRead(0);
145  rawTreeCache_.reset();
146  }
boost::shared_ptr< TTreeCache > treeCache_
Definition: RootTree.h:147
TTree * tree_
Definition: RootTree.h:139
boost::shared_ptr< TTreeCache > rawTreeCache_
Definition: RootTree.h:148
unsigned int cacheSize_
Definition: RootTree.h:156
boost::shared_ptr< InputFile > filePtr_
Definition: RootTree.h:135
void edm::RootTree::setEntryNumber ( EntryNumber  theEntryNumber)

Definition at line 154 of file RootTree.cc.

References entryNumber_, filePtr_, startTraining(), stopTraining(), switchOverEntry_, trainNow_, tree_, and treeCache_.

Referenced by edm::RootFile::fillEventAuxiliary(), edm::RootFile::fillIndexIntoFile(), edm::RootFileEventFinder::getEventNumberOfEntry(), edm::RootFile::initializeDuplicateChecker(), edm::RootFile::readEvent(), edm::RootFile::readLumi(), edm::RootFile::readLuminosityBlockAuxiliary_(), edm::RootFile::readRunAuxiliary_(), edm::RootFile::setAtEventEntry(), edm::RootFile::setEntryAtEvent(), edm::RootFile::setEntryAtLumi(), edm::RootFile::setEntryAtRun(), and edm::RootFile::skipEvents().

154  {
155  filePtr_->SetCacheRead(treeCache_.get());
156  entryNumber_ = theEntryNumber;
157  tree_->LoadTree(entryNumber_);
158  filePtr_->SetCacheRead(0);
159  if(treeCache_ && trainNow_ && entryNumber_ >= 0) {
160  startTraining();
161  trainNow_ = false;
162  }
163  if (treeCache_ && treeCache_->IsLearning() && switchOverEntry_ >= 0 && entryNumber_ >= switchOverEntry_) {
164  stopTraining();
165  }
166  }
EntryNumber entryNumber_
Definition: RootTree.h:150
boost::shared_ptr< TTreeCache > treeCache_
Definition: RootTree.h:147
TTree * tree_
Definition: RootTree.h:139
bool trainNow_
Definition: RootTree.h:153
void stopTraining()
Definition: RootTree.cc:210
void startTraining()
Definition: RootTree.cc:186
boost::shared_ptr< InputFile > filePtr_
Definition: RootTree.h:135
EntryNumber switchOverEntry_
Definition: RootTree.h:154
void edm::RootTree::setPresence ( BranchDescription const &  prod)

Definition at line 78 of file RootTree.cc.

References edm::BranchDescription::branchName(), edm::BranchDescription::init(), isValid(), edm::BranchDescription::setDropped(), and tree_.

78  {
79  assert(isValid());
80  prod.init();
81  if(tree_->GetBranch(prod.branchName().c_str()) == 0){
82  prod.setDropped();
83  }
84  }
TTree * tree_
Definition: RootTree.h:139
bool isValid() const
Definition: RootTree.cc:66
void edm::RootTree::setTreeMaxVirtualSize ( int  treeMaxVirtualSize)
private

Definition at line 149 of file RootTree.cc.

References tree_.

Referenced by RootTree().

149  {
150  if (treeMaxVirtualSize >= 0) tree_->SetMaxVirtualSize(static_cast<Long64_t>(treeMaxVirtualSize));
151  }
TTree * tree_
Definition: RootTree.h:139
void edm::RootTree::startTraining ( )
private

Definition at line 186 of file RootTree.cc.

References edm::poolNames::branchListIndexesBranchName(), branchType_, edm::BranchTypeToAuxiliaryBranchName(), cacheSize_, entryNumber_, filePtr_, edm::InEvent, learningEntries_, rawTreeCache_, switchOverEntry_, tree_, and treeCache_.

Referenced by setEntryNumber().

186  {
187  if (cacheSize_ == 0) {
188  return;
189  }
190  assert(treeCache_ && treeCache_->GetOwner() == tree_);
191  assert(branchType_ == InEvent);
192  assert(!rawTreeCache_);
193  treeCache_->SetLearnEntries(learningEntries_);
194  tree_->SetCacheSize(static_cast<Long64_t>(cacheSize_));
195  rawTreeCache_.reset(dynamic_cast<TTreeCache *>(filePtr_->GetCacheRead()));
196  filePtr_->SetCacheRead(0);
197  rawTreeCache_->SetLearnEntries(0);
199  rawTreeCache_->StartLearningPhase();
201  rawTreeCache_->AddBranch("*", kTRUE);
202  rawTreeCache_->StopLearningPhase();
203  treeCache_->StartLearningPhase();
204  treeCache_->SetEntryRange(switchOverEntry_, tree_->GetEntries());
205  treeCache_->AddBranch(poolNames::branchListIndexesBranchName().c_str(), kTRUE);
206  treeCache_->AddBranch(BranchTypeToAuxiliaryBranchName(branchType_).c_str(), kTRUE);
207  }
EntryNumber entryNumber_
Definition: RootTree.h:150
boost::shared_ptr< TTreeCache > treeCache_
Definition: RootTree.h:147
std::string const & BranchTypeToAuxiliaryBranchName(BranchType const &branchType)
Definition: BranchType.cc:108
unsigned int learningEntries_
Definition: RootTree.h:155
TTree * tree_
Definition: RootTree.h:139
boost::shared_ptr< TTreeCache > rawTreeCache_
Definition: RootTree.h:148
unsigned int cacheSize_
Definition: RootTree.h:156
boost::shared_ptr< InputFile > filePtr_
Definition: RootTree.h:135
std::string const & branchListIndexesBranchName()
Definition: BranchType.cc:231
EntryNumber switchOverEntry_
Definition: RootTree.h:154
BranchType branchType_
Definition: RootTree.h:141
void edm::RootTree::stopTraining ( )
private

Definition at line 210 of file RootTree.cc.

References filePtr_, rawTreeCache_, and treeCache_.

Referenced by setEntryNumber().

210  {
211  filePtr_->SetCacheRead(treeCache_.get());
212  treeCache_->StopLearningPhase();
213  rawTreeCache_.reset();
214  }
boost::shared_ptr< TTreeCache > treeCache_
Definition: RootTree.h:147
boost::shared_ptr< TTreeCache > rawTreeCache_
Definition: RootTree.h:148
boost::shared_ptr< InputFile > filePtr_
Definition: RootTree.h:135
void edm::RootTree::trainCache ( char const *  branchNames)

Definition at line 231 of file RootTree.cc.

References cacheSize_, filePtr_, tree_, and treeCache_.

Referenced by edm::RootFile::RootFile().

231  {
232  if (cacheSize_ == 0) {
233  return;
234  }
235  tree_->LoadTree(0);
236  assert(treeCache_);
237  filePtr_->SetCacheRead(treeCache_.get());
238  assert(treeCache_->GetOwner() == tree_);
239  treeCache_->StartLearningPhase();
240  treeCache_->SetEntryRange(0, tree_->GetEntries());
241  treeCache_->AddBranch(branchNames, kTRUE);
242  treeCache_->StopLearningPhase();
243  // We own the treeCache_.
244  // We make sure the treeCache_ is detached from the file,
245  // so that ROOT does not also delete it.
246  filePtr_->SetCacheRead(0);
247  }
boost::shared_ptr< TTreeCache > treeCache_
Definition: RootTree.h:147
std::vector< std::string > const & branchNames() const
Definition: RootTree.h:89
TTree * tree_
Definition: RootTree.h:139
unsigned int cacheSize_
Definition: RootTree.h:156
boost::shared_ptr< InputFile > filePtr_
Definition: RootTree.h:135
TTree const* edm::RootTree::tree ( ) const
inline

Definition at line 113 of file RootTree.h.

References tree_.

Referenced by edm::RootFile::createFileBlock(), edm::RootFile::fillHistory(), and python.cmstools.EventTree::SetAlias().

113 {return tree_;}
TTree * tree_
Definition: RootTree.h:139
TTree* edm::RootTree::tree ( )
inline

Definition at line 114 of file RootTree.h.

References tree_.

Referenced by python.cmstools.EventTree::SetAlias().

114 {return tree_;}
TTree * tree_
Definition: RootTree.h:139

Member Data Documentation

TBranch* edm::RootTree::auxBranch_
private

Definition at line 142 of file RootTree.h.

Referenced by close(), fillAux(), and isValid().

TBranch* edm::RootTree::branchEntryInfoBranch_
private

Definition at line 143 of file RootTree.h.

Referenced by branchEntryInfoBranch(), close(), and isValid().

boost::shared_ptr<BranchMap> edm::RootTree::branches_
private

Definition at line 152 of file RootTree.h.

Referenced by addBranch(), branches(), and makeDelayedReader().

std::vector<std::string> edm::RootTree::branchNames_
private

Definition at line 151 of file RootTree.h.

Referenced by addBranch(), and branchNames().

BranchType edm::RootTree::branchType_
private

Definition at line 141 of file RootTree.h.

Referenced by startTraining().

unsigned int edm::RootTree::cacheSize_
private

Definition at line 156 of file RootTree.h.

Referenced by setCacheSize(), startTraining(), and trainCache().

EntryNumber edm::RootTree::entries_
private

Definition at line 149 of file RootTree.h.

Referenced by entries(), isValid(), and next().

EntryNumber edm::RootTree::entryNumber_
private
boost::shared_ptr<InputFile> edm::RootTree::filePtr_
private
TTree* edm::RootTree::infoTree_
private

Definition at line 161 of file RootTree.h.

Referenced by close().

unsigned int edm::RootTree::learningEntries_
private

Definition at line 155 of file RootTree.h.

Referenced by startTraining().

TTree* edm::RootTree::metaTree_
private

Definition at line 140 of file RootTree.h.

Referenced by addBranch(), close(), fillBranchEntryMeta(), isValid(), and metaTree().

std::vector<ProductStatus>* edm::RootTree::pProductStatuses_
private

Definition at line 160 of file RootTree.h.

Referenced by fillStatus().

std::vector<ProductStatus> edm::RootTree::productStatuses_
private

Definition at line 159 of file RootTree.h.

Referenced by productStatuses().

boost::shared_ptr<TTreeCache> edm::RootTree::rawTreeCache_
private

Definition at line 148 of file RootTree.h.

Referenced by getEntry(), setCacheSize(), startTraining(), and stopTraining().

TBranch* edm::RootTree::statusBranch_
private

Definition at line 162 of file RootTree.h.

Referenced by close(), fillStatus(), and isValid().

EntryNumber edm::RootTree::switchOverEntry_
private

Definition at line 154 of file RootTree.h.

Referenced by setEntryNumber(), and startTraining().

bool edm::RootTree::trainNow_
private

Definition at line 153 of file RootTree.h.

Referenced by resetTraining(), and setEntryNumber().

TTree* edm::RootTree::tree_
private
boost::shared_ptr<TTreeCache> edm::RootTree::treeCache_
private