CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
fwlite::BranchMapReader Class Reference

#include <BranchMapReader.h>

Public Member Functions

const edm::BranchDescriptionbranchIDToBranch (const edm::BranchID &bid) const
 
const edm::BranchListIndexesbranchListIndexes () const
 
 BranchMapReader (TFile *file)
 
 BranchMapReader ()
 
const std::vector< edm::BranchDescription > & getBranchDescriptions ()
 
Long_t getEventEntry () const
 
TTree const * getEventTree () const
 
TTree * getEventTree ()
 
TFile const * getFile () const
 
TFile * getFile ()
 
TUUID getFileUUID () const
 
int getFileVersion (TFile *file)
 
int getFileVersion () const
 
Long_t getLuminosityBlockEntry () const
 
TTree const * getLuminosityBlockTree () const
 
TTree * getLuminosityBlockTree ()
 
Long_t getRunEntry () const
 
TTree const * getRunTree () const
 
TTree * getRunTree ()
 
const edm::BranchDescriptionproductToBranch (const edm::ProductID &pid)
 
edm::BranchID productToBranchID (const edm::ProductID &pid)
 
const edm::ThinnedAssociationsHelperthinnedAssociationsHelper () const
 
bool updateEvent (Long_t eventEntry)
 
bool updateFile (TFile *file)
 
bool updateLuminosityBlock (Long_t luminosityBlockEntry)
 
bool updateRun (Long_t runEntry)
 

Private Member Functions

std::unique_ptr< internal::BMRStrategynewStrategy (TFile *file, int fileVersion)
 

Private Attributes

int fileVersion_
 
std::unique_ptr< internal::BMRStrategystrategy_
 

Detailed Description

Definition at line 70 of file BranchMapReader.h.

Constructor & Destructor Documentation

BranchMapReader::BranchMapReader ( TFile *  file)

Definition at line 570 of file BranchMapReader.cc.

References Exception, getFileVersion(), newStrategy(), and strategy_.

570  :
571  fileVersion_(-1) {
572  if(nullptr == file) {
573  throw cms::Exception("NoFile")<<"The TFile pointer is null";
574  }
576 }
std::unique_ptr< internal::BMRStrategy > newStrategy(TFile *file, int fileVersion)
std::unique_ptr< internal::BMRStrategy > strategy_
fwlite::BranchMapReader::BranchMapReader ( )
inline

Definition at line 73 of file BranchMapReader.h.

73 : strategy_(nullptr),fileVersion_(0) {}
std::unique_ptr< internal::BMRStrategy > strategy_

Member Function Documentation

const edm::BranchDescription& fwlite::BranchMapReader::branchIDToBranch ( const edm::BranchID bid) const
inline

Definition at line 86 of file BranchMapReader.h.

Referenced by BareRootProductGetter::createNewBuffer().

86 { return strategy_->branchIDToBranch(bid); }
std::unique_ptr< internal::BMRStrategy > strategy_
const edm::BranchListIndexes& fwlite::BranchMapReader::branchListIndexes ( ) const
inline

Definition at line 103 of file BranchMapReader.h.

103 { strategy_->updateMap(); return strategy_->branchListIndexes(); }
std::unique_ptr< internal::BMRStrategy > strategy_
std::vector< edm::BranchDescription > const & BranchMapReader::getBranchDescriptions ( )

Definition at line 642 of file BranchMapReader.cc.

References strategy_.

642  {
643  return strategy_->getBranchDescriptions();
644 }
std::unique_ptr< internal::BMRStrategy > strategy_
Long_t fwlite::BranchMapReader::getEventEntry ( ) const
inline
TTree const* fwlite::BranchMapReader::getEventTree ( ) const
inline
TTree* fwlite::BranchMapReader::getEventTree ( )
inline

Definition at line 93 of file BranchMapReader.h.

93 { return strategy_->eventTree_; }
std::unique_ptr< internal::BMRStrategy > strategy_
TFile const* fwlite::BranchMapReader::getFile ( ) const
inline

Definition at line 90 of file BranchMapReader.h.

Referenced by fwlite::EntryFinder::fillIndex(), fwlite::Event::fillParameterSetRegistry(), BareRootProductGetter::getIt(), and fwlite::Event::history().

90 { return strategy_->currentFile_; }
std::unique_ptr< internal::BMRStrategy > strategy_
TFile* fwlite::BranchMapReader::getFile ( )
inline

Definition at line 91 of file BranchMapReader.h.

91 { return strategy_->currentFile_; }
std::unique_ptr< internal::BMRStrategy > strategy_
TUUID fwlite::BranchMapReader::getFileUUID ( ) const
inline

Definition at line 98 of file BranchMapReader.h.

98 { return strategy_->fileUUID_; }
std::unique_ptr< internal::BMRStrategy > strategy_
int BranchMapReader::getFileVersion ( TFile *  file)

Definition at line 582 of file BranchMapReader.cc.

References edm::poolNames::fileFormatVersionBranchName(), fileVersion_, edm::poolNames::metaDataTreeName(), findQualityFiles::v, and edm::FileFormatVersion::value().

Referenced by fwlite::Event::Event().

582  {
583  TTree* metaDataTree = dynamic_cast<TTree*>(file->Get(edm::poolNames::metaDataTreeName().c_str()));
584  if(nullptr == metaDataTree) {
585  return 0;
586  }
587 
590  TBranch* bVer = metaDataTree->GetBranch(edm::poolNames::fileFormatVersionBranchName().c_str());
591  bVer->SetAddress(&pV);
592  bVer->GetEntry(0);
593  fileVersion_ = v.value();
594  return v.value();
595 }
std::string const & fileFormatVersionBranchName()
Definition: BranchType.cc:219
std::string const & metaDataTreeName()
Definition: BranchType.cc:169
int fwlite::BranchMapReader::getFileVersion ( ) const
inline

Definition at line 88 of file BranchMapReader.h.

Referenced by BranchMapReader(), and updateFile().

Long_t fwlite::BranchMapReader::getLuminosityBlockEntry ( ) const
inline

Definition at line 100 of file BranchMapReader.h.

100 { return strategy_->luminosityBlockEntry_; }
std::unique_ptr< internal::BMRStrategy > strategy_
TTree const* fwlite::BranchMapReader::getLuminosityBlockTree ( ) const
inline

Definition at line 94 of file BranchMapReader.h.

94 { return strategy_->luminosityBlockTree_; }
std::unique_ptr< internal::BMRStrategy > strategy_
TTree* fwlite::BranchMapReader::getLuminosityBlockTree ( )
inline

Definition at line 95 of file BranchMapReader.h.

95 { return strategy_->luminosityBlockTree_; }
std::unique_ptr< internal::BMRStrategy > strategy_
Long_t fwlite::BranchMapReader::getRunEntry ( ) const
inline

Definition at line 101 of file BranchMapReader.h.

101 { return strategy_->runEntry_; }
std::unique_ptr< internal::BMRStrategy > strategy_
TTree const* fwlite::BranchMapReader::getRunTree ( ) const
inline

Definition at line 96 of file BranchMapReader.h.

96 { return strategy_->runTree_; }
std::unique_ptr< internal::BMRStrategy > strategy_
TTree* fwlite::BranchMapReader::getRunTree ( )
inline

Definition at line 97 of file BranchMapReader.h.

97 { return strategy_->runTree_; }
std::unique_ptr< internal::BMRStrategy > strategy_
std::unique_ptr< internal::BMRStrategy > BranchMapReader::newStrategy ( TFile *  file,
int  fileVersion 
)
private

Definition at line 648 of file BranchMapReader.cc.

References FrontierConditions_GlobalTag_cff::file, and alignCSCRings::s.

Referenced by BranchMapReader(), and updateFile().

648  {
649  std::unique_ptr<internal::BMRStrategy> s;
650 
651  if(fileVersion >= 17) {
652  s = std::make_unique<internal::BranchMapReaderStrategyV17>(file, fileVersion);
653  } else if(fileVersion >= 11) {
654  s = std::make_unique<internal::BranchMapReaderStrategyV11>(file, fileVersion);
655  } else if(fileVersion >= 8) {
656  s = std::make_unique<internal::BranchMapReaderStrategyV8>(file, fileVersion);
657  } else if(fileVersion >= 7) {
658  s = std::make_unique<internal::BranchMapReaderStrategyV7>(file, fileVersion);
659  } else {
660  s = std::make_unique<internal::BranchMapReaderStrategyV1>(file, fileVersion);
661  }
662  return s;
663 }
edm::BranchDescription const & BranchMapReader::productToBranch ( const edm::ProductID pid)

Definition at line 637 of file BranchMapReader.cc.

References strategy_.

637  {
638  return strategy_->productToBranch(pid);
639 }
std::unique_ptr< internal::BMRStrategy > strategy_
edm::BranchID fwlite::BranchMapReader::productToBranchID ( const edm::ProductID pid)
inline

Definition at line 84 of file BranchMapReader.h.

References sysUtil::pid.

Referenced by BareRootProductGetter::getIt(), BareRootProductGetter::getThinnedProduct(), and BareRootProductGetter::getThinnedProducts().

84 { return strategy_->productToBranchID(pid); }
std::unique_ptr< internal::BMRStrategy > strategy_
const edm::ThinnedAssociationsHelper& fwlite::BranchMapReader::thinnedAssociationsHelper ( ) const
inline

Definition at line 104 of file BranchMapReader.h.

Referenced by BareRootProductGetter::getThinnedProduct(), and BareRootProductGetter::getThinnedProducts().

104 { return strategy_->thinnedAssociationsHelper(); }
std::unique_ptr< internal::BMRStrategy > strategy_
bool BranchMapReader::updateEvent ( Long_t  eventEntry)

Definition at line 597 of file BranchMapReader.cc.

References strategy_.

Referenced by fwlite::Event::Event(), BareRootProductGetter::getIt(), fwlite::Event::operator++(), fwlite::Event::to(), and fwlite::Event::toBegin().

597  {
598  return strategy_->updateEvent(newevent);
599 }
std::unique_ptr< internal::BMRStrategy > strategy_
bool BranchMapReader::updateFile ( TFile *  file)

Definition at line 609 of file BranchMapReader.cc.

References edm::poolNames::eventTreeName(), getFileVersion(), newStrategy(), and strategy_.

Referenced by BareRootProductGetter::getIt().

609  {
610  if(nullptr == strategy_.get()) {
612  return true;
613  }
614 
615  TFile* currentFile(strategy_->currentFile_);
616  bool isNew(file != currentFile);
617 
618  if(!isNew) {
619  //could still have a new TFile which just happens to share the same memory address as the previous file
620  //will assume that if the Event tree's address and UUID are the same as before then we do not have
621  // to treat this like a new file
622  TTree* eventTreeTemp = dynamic_cast<TTree*>(currentFile->Get(edm::poolNames::eventTreeName().c_str()));
623  isNew = eventTreeTemp != strategy_->eventTree_ || strategy_->fileUUID_ != currentFile->GetUUID();
624  }
625  if(isNew) {
626  int fileVersion = getFileVersion(file);
627  if(fileVersion != strategy_->fileVersion_) {
628  strategy_ = newStrategy(file, fileVersion);
629  } else {
630  strategy_->updateFile(file);
631  }
632  }
633  return isNew;
634 }
std::unique_ptr< internal::BMRStrategy > newStrategy(TFile *file, int fileVersion)
std::unique_ptr< internal::BMRStrategy > strategy_
std::string const & eventTreeName()
Definition: BranchType.cc:266
bool BranchMapReader::updateLuminosityBlock ( Long_t  luminosityBlockEntry)

Definition at line 601 of file BranchMapReader.cc.

References strategy_.

601  {
602  return strategy_->updateLuminosityBlock(newlumi);
603 }
std::unique_ptr< internal::BMRStrategy > strategy_
bool BranchMapReader::updateRun ( Long_t  runEntry)

Definition at line 605 of file BranchMapReader.cc.

References strategy_.

605  {
606  return strategy_->updateRun(newRun);
607 }
std::unique_ptr< internal::BMRStrategy > strategy_

Member Data Documentation

int fwlite::BranchMapReader::fileVersion_
private

Definition at line 110 of file BranchMapReader.h.

Referenced by getFileVersion().

std::unique_ptr<internal::BMRStrategy> fwlite::BranchMapReader::strategy_
private