CMS 3D CMS Logo

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

#include <BranchMapReader.h>

Public Member Functions

const edm::BranchListIndexesbranchListIndexes () const
 
 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 (TFile *file)
 
int getFileVersion () const
 
Long_t getLuminosityBlockEntry () const
 
TTree * getLuminosityBlockTree () const
 
Long_t getRunEntry () const
 
TTree * getRunTree () const
 
const edm::BranchDescriptionproductToBranch (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_
 

Detailed Description

Definition at line 63 of file BranchMapReader.h.

Constructor & Destructor Documentation

BranchMapReader::BranchMapReader ( TFile *  file)

Definition at line 549 of file BranchMapReader.cc.

References edm::hlt::Exception, getFileVersion(), newStrategy(), and strategy_.

549  :
550  fileVersion_(-1) {
551  if(0==file) {
552  throw cms::Exception("NoFile")<<"The TFile pointer is null";
553  }
555 }
std::auto_ptr< internal::BMRStrategy > newStrategy(TFile *file, int fileVersion)
std::auto_ptr< internal::BMRStrategy > strategy_
fwlite::BranchMapReader::BranchMapReader ( )
inline

Definition at line 66 of file BranchMapReader.h.

66 : strategy_(0),fileVersion_(0) {}
std::auto_ptr< internal::BMRStrategy > strategy_

Member Function Documentation

const edm::BranchListIndexes& fwlite::BranchMapReader::branchListIndexes ( ) const
inline

Definition at line 90 of file BranchMapReader.h.

References strategy_.

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

Definition at line 621 of file BranchMapReader.cc.

References strategy_.

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

621  {
622  return strategy_->getBranchDescriptions();
623 }
std::auto_ptr< internal::BMRStrategy > strategy_
Long_t fwlite::BranchMapReader::getEventEntry ( ) const
inline
TTree* fwlite::BranchMapReader::getEventTree ( ) const
inline
TFile* fwlite::BranchMapReader::getFile ( ) const
inline

Definition at line 81 of file BranchMapReader.h.

References strategy_.

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

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

Definition at line 85 of file BranchMapReader.h.

References strategy_.

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

Definition at line 561 of file BranchMapReader.cc.

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

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

561  {
562  TTree* metaDataTree = dynamic_cast<TTree*>(file->Get(edm::poolNames::metaDataTreeName().c_str()));
563  if(0==metaDataTree) {
564  return 0;
565  }
566 
569  TBranch* bVer = metaDataTree->GetBranch(edm::poolNames::fileFormatVersionBranchName().c_str());
570  bVer->SetAddress(&pV);
571  bVer->GetEntry(0);
572  fileVersion_ = v.value();
573  return v.value();
574 }
std::string const & fileFormatVersionBranchName()
Definition: BranchType.cc:212
std::string const & metaDataTreeName()
Definition: BranchType.cc:167
int fwlite::BranchMapReader::getFileVersion ( ) const
inline

Definition at line 79 of file BranchMapReader.h.

References fileVersion_.

Referenced by BranchMapReader(), and updateFile().

79 { return fileVersion_;}
Long_t fwlite::BranchMapReader::getLuminosityBlockEntry ( ) const
inline

Definition at line 87 of file BranchMapReader.h.

References strategy_.

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

Definition at line 83 of file BranchMapReader.h.

References strategy_.

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

Definition at line 88 of file BranchMapReader.h.

References strategy_.

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

Definition at line 84 of file BranchMapReader.h.

References strategy_.

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

Definition at line 627 of file BranchMapReader.cc.

References alignCSCRings::s.

Referenced by BranchMapReader(), and updateFile().

627  {
628  std::auto_ptr<internal::BMRStrategy> s;
629 
630  if(fileVersion >= 17) {
631  s = std::auto_ptr<internal::BMRStrategy>(new internal::BranchMapReaderStrategyV17(file, fileVersion));
632  } else if(fileVersion >= 11) {
633  s = std::auto_ptr<internal::BMRStrategy>(new internal::BranchMapReaderStrategyV11(file, fileVersion));
634  } else if(fileVersion >= 8) {
635  s = std::auto_ptr<internal::BMRStrategy>(new internal::BranchMapReaderStrategyV8(file, fileVersion));
636  } else if(fileVersion >= 7) {
637  s = std::auto_ptr<internal::BMRStrategy>(new internal::BranchMapReaderStrategyV7(file, fileVersion));
638  } else {
639  s = std::auto_ptr<internal::BMRStrategy>(new internal::BranchMapReaderStrategyV1(file, fileVersion));
640  }
641  return s;
642 }
edm::BranchDescription const & BranchMapReader::productToBranch ( const edm::ProductID pid)

Definition at line 616 of file BranchMapReader.cc.

References strategy_.

Referenced by BareRootProductGetter::createNewBuffer().

616  {
617  return strategy_->productToBranch(pid);
618 }
std::auto_ptr< internal::BMRStrategy > strategy_
bool BranchMapReader::updateEvent ( Long_t  eventEntry)

Definition at line 576 of file BranchMapReader.cc.

References strategy_.

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

576  {
577  return strategy_->updateEvent(newevent);
578 }
std::auto_ptr< internal::BMRStrategy > strategy_
bool BranchMapReader::updateFile ( TFile *  file)

Definition at line 588 of file BranchMapReader.cc.

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

Referenced by BareRootProductGetter::getIt().

588  {
589  if(0 == strategy_.get()) {
591  return true;
592  }
593 
594  TFile* currentFile(strategy_->currentFile_);
595  bool isNew(file != currentFile);
596 
597  if(!isNew) {
598  //could still have a new TFile which just happens to share the same memory address as the previous file
599  //will assume that if the Event tree's address and UUID are the same as before then we do not have
600  // to treat this like a new file
601  TTree* eventTreeTemp = dynamic_cast<TTree*>(currentFile->Get(edm::poolNames::eventTreeName().c_str()));
602  isNew = eventTreeTemp != strategy_->eventTree_ || strategy_->fileUUID_ != currentFile->GetUUID();
603  }
604  if(isNew) {
605  int fileVersion = getFileVersion(file);
606  if(fileVersion != strategy_->fileVersion_) {
607  strategy_ = newStrategy(file, fileVersion);
608  } else {
609  strategy_->updateFile(file);
610  }
611  }
612  return isNew;
613 }
std::auto_ptr< internal::BMRStrategy > newStrategy(TFile *file, int fileVersion)
std::auto_ptr< internal::BMRStrategy > strategy_
std::string const & eventTreeName()
Definition: BranchType.cc:254
bool BranchMapReader::updateLuminosityBlock ( Long_t  luminosityBlockEntry)

Definition at line 580 of file BranchMapReader.cc.

References strategy_.

580  {
581  return strategy_->updateLuminosityBlock(newlumi);
582 }
std::auto_ptr< internal::BMRStrategy > strategy_
bool BranchMapReader::updateRun ( Long_t  runEntry)

Definition at line 584 of file BranchMapReader.cc.

References strategy_.

584  {
585  return strategy_->updateRun(newRun);
586 }
std::auto_ptr< internal::BMRStrategy > strategy_

Member Data Documentation

int fwlite::BranchMapReader::fileVersion_
private

Definition at line 96 of file BranchMapReader.h.

Referenced by getFileVersion().

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