#include <BranchMapReader.h>
Public Member Functions | |
BranchMapReader (TFile *file) | |
BranchMapReader () | |
const std::vector < edm::BranchDescription > & | getBranchDescriptions () |
Long_t | getEventEntry () const |
TTree * | getEventTree () const |
TFile * | getFile () const |
TUUID | getFileUUID () const |
int | getFileVersion () const |
int | getFileVersion (TFile *file) |
Long_t | getLuminosityBlockEntry () const |
TTree * | getLuminosityBlockTree () const |
Long_t | getRunEntry () const |
TTree * | getRunTree () const |
const edm::BranchDescription | productToBranch (const edm::ProductID &pid) |
bool | updateEvent (Long_t eventEntry) |
bool | updateFile (TFile *file) |
bool | updateLuminosityBlock (Long_t luminosityBlockEntry) |
bool | updateRun (Long_t runEntry) |
Private Member Functions | |
std::auto_ptr < internal::BMRStrategy > | newStrategy (TFile *file, int fileVersion) |
Private Attributes | |
int | fileVersion_ |
std::auto_ptr < internal::BMRStrategy > | strategy_ |
Definition at line 62 of file BranchMapReader.h.
BranchMapReader::BranchMapReader | ( | TFile * | file | ) |
Definition at line 528 of file BranchMapReader.cc.
References Exception, getFileVersion(), newStrategy(), and strategy_.
: fileVersion_(-1) { if (0==file) { throw cms::Exception("NoFile")<<"The TFile pointer is null"; } strategy_ = newStrategy(file, getFileVersion(file)); }
fwlite::BranchMapReader::BranchMapReader | ( | ) | [inline] |
Definition at line 65 of file BranchMapReader.h.
: strategy_(0),fileVersion_(0) {}
const std::vector< edm::BranchDescription > & BranchMapReader::getBranchDescriptions | ( | ) |
Definition at line 600 of file BranchMapReader.cc.
References strategy_.
Referenced by fwlite::Event::getBranchDescriptions().
{ return strategy_->getBranchDescriptions(); }
Long_t fwlite::BranchMapReader::getEventEntry | ( | ) | const [inline] |
Definition at line 85 of file BranchMapReader.h.
References strategy_.
Referenced by fwlite::Event::atEnd(), fwlite::Event::eventAuxiliary(), fwlite::Event::getByLabel(), fwlite::Event::getByProductID(), fwlite::Event::history(), fwlite::Event::isValid(), and fwlite::Event::operator++().
{ return strategy_->eventEntry_; }
TTree* fwlite::BranchMapReader::getEventTree | ( | ) | const [inline] |
Definition at line 81 of file BranchMapReader.h.
References strategy_.
Referenced by BareRootProductGetter::createNewBuffer(), fwlite::Event::draw(), fwlite::Event::Event(), fwlite::EntryFinder::fillIndex(), BareRootProductGetter::getIt(), fwlite::Event::scan(), and fwlite::Event::size().
{ return strategy_->eventTree_; }
TFile* fwlite::BranchMapReader::getFile | ( | ) | const [inline] |
Definition at line 80 of file BranchMapReader.h.
References strategy_.
Referenced by fwlite::EntryFinder::fillIndex(), fwlite::Event::fillParameterSetRegistry(), BareRootProductGetter::getIt(), fwlite::Event::getTFile(), and fwlite::Event::history().
{ return strategy_->currentFile_; }
TUUID fwlite::BranchMapReader::getFileUUID | ( | ) | const [inline] |
Definition at line 84 of file BranchMapReader.h.
References strategy_.
{ return strategy_->fileUUID_; }
int BranchMapReader::getFileVersion | ( | TFile * | file | ) |
Definition at line 540 of file BranchMapReader.cc.
References edm::poolNames::fileFormatVersionBranchName(), fileVersion_, edm::poolNames::metaDataTreeName(), v, and edm::FileFormatVersion::value().
Referenced by fwlite::Event::Event().
{ TTree* metaDataTree = dynamic_cast<TTree*>(file->Get(edm::poolNames::metaDataTreeName().c_str())); if (0==metaDataTree) { return 0; } edm::FileFormatVersion v; edm::FileFormatVersion* pV=&v; TBranch* bVer = metaDataTree->GetBranch(edm::poolNames::fileFormatVersionBranchName().c_str()); bVer->SetAddress(&pV); bVer->GetEntry(0); fileVersion_ = v.value(); return v.value(); }
int fwlite::BranchMapReader::getFileVersion | ( | ) | const [inline] |
Definition at line 78 of file BranchMapReader.h.
References fileVersion_.
Referenced by BranchMapReader(), and updateFile().
{ return fileVersion_;}
Long_t fwlite::BranchMapReader::getLuminosityBlockEntry | ( | ) | const [inline] |
Definition at line 86 of file BranchMapReader.h.
References strategy_.
{ return strategy_->luminosityBlockEntry_; }
TTree* fwlite::BranchMapReader::getLuminosityBlockTree | ( | ) | const [inline] |
Definition at line 82 of file BranchMapReader.h.
References strategy_.
{ return strategy_->luminosityBlockTree_; }
Long_t fwlite::BranchMapReader::getRunEntry | ( | ) | const [inline] |
Definition at line 87 of file BranchMapReader.h.
References strategy_.
{ return strategy_->runEntry_; }
TTree* fwlite::BranchMapReader::getRunTree | ( | ) | const [inline] |
Definition at line 83 of file BranchMapReader.h.
References strategy_.
{ return strategy_->runTree_; }
std::auto_ptr< internal::BMRStrategy > BranchMapReader::newStrategy | ( | TFile * | file, |
int | fileVersion | ||
) | [private] |
Definition at line 606 of file BranchMapReader.cc.
References asciidump::s.
Referenced by BranchMapReader(), and updateFile().
{ std::auto_ptr<internal::BMRStrategy> s; if (fileVersion >= 17) { s = std::auto_ptr<internal::BMRStrategy>(new internal::BranchMapReaderStrategyV17(file, fileVersion)); } else if (fileVersion >= 11) { s = std::auto_ptr<internal::BMRStrategy>(new internal::BranchMapReaderStrategyV11(file, fileVersion)); } else if (fileVersion >= 8) { s = std::auto_ptr<internal::BMRStrategy>(new internal::BranchMapReaderStrategyV8(file, fileVersion)); } else if (fileVersion >= 7) { s = std::auto_ptr<internal::BMRStrategy>(new internal::BranchMapReaderStrategyV7(file, fileVersion)); } else { s = std::auto_ptr<internal::BMRStrategy>(new internal::BranchMapReaderStrategyV1(file, fileVersion)); } return s; }
const edm::BranchDescription BranchMapReader::productToBranch | ( | const edm::ProductID & | pid | ) |
Definition at line 595 of file BranchMapReader.cc.
References strategy_.
Referenced by BareRootProductGetter::createNewBuffer().
{ return strategy_->productToBranch(pid); }
bool BranchMapReader::updateEvent | ( | Long_t | eventEntry | ) |
Definition at line 555 of file BranchMapReader.cc.
References strategy_.
Referenced by fwlite::Event::Event(), BareRootProductGetter::getIt(), fwlite::Event::operator++(), fwlite::Event::to(), and fwlite::Event::toBegin().
{ return strategy_->updateEvent(newevent); }
bool BranchMapReader::updateFile | ( | TFile * | file | ) |
Definition at line 567 of file BranchMapReader.cc.
References edm::poolNames::eventTreeName(), getFileVersion(), newStrategy(), and strategy_.
Referenced by BareRootProductGetter::getIt().
{ if (0 == strategy_.get()) { strategy_ = newStrategy(file, getFileVersion(file)); return true; } TFile* currentFile(strategy_->currentFile_); bool isNew(file != currentFile); if (!isNew) { //could still have a new TFile which just happens to share the same memory address as the previous file //will assume that if the Event tree's address and UUID are the same as before then we do not have // to treat this like a new file TTree* eventTreeTemp = dynamic_cast<TTree*>(currentFile->Get(edm::poolNames::eventTreeName().c_str())); isNew = eventTreeTemp != strategy_->eventTree_ || strategy_->fileUUID_ != currentFile->GetUUID(); } if (isNew) { int fileVersion = getFileVersion(file); if (fileVersion != strategy_->fileVersion_) { strategy_ = newStrategy(file, fileVersion); } else { strategy_->updateFile(file); } } return isNew; }
bool BranchMapReader::updateLuminosityBlock | ( | Long_t | luminosityBlockEntry | ) |
Definition at line 559 of file BranchMapReader.cc.
References strategy_.
{ return strategy_->updateLuminosityBlock(newlumi); }
bool BranchMapReader::updateRun | ( | Long_t | runEntry | ) |
Definition at line 563 of file BranchMapReader.cc.
References strategy_.
{ return strategy_->updateRun(newRun); }
int fwlite::BranchMapReader::fileVersion_ [private] |
Definition at line 94 of file BranchMapReader.h.
Referenced by getFileVersion().
std::auto_ptr<internal::BMRStrategy> fwlite::BranchMapReader::strategy_ [private] |
Definition at line 93 of file BranchMapReader.h.
Referenced by BranchMapReader(), getBranchDescriptions(), getEventEntry(), getEventTree(), getFile(), getFileUUID(), getLuminosityBlockEntry(), getLuminosityBlockTree(), getRunEntry(), getRunTree(), productToBranch(), updateEvent(), updateFile(), updateLuminosityBlock(), and updateRun().