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

 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::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_
 

Detailed Description

Definition at line 62 of file BranchMapReader.h.

Constructor & Destructor Documentation

BranchMapReader::BranchMapReader ( TFile *  file)

Definition at line 528 of file BranchMapReader.cc.

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

528  :
529  fileVersion_(-1) {
530  if (0==file) {
531  throw cms::Exception("NoFile")<<"The TFile pointer is null";
532  }
534 }
std::auto_ptr< internal::BMRStrategy > newStrategy(TFile *file, int fileVersion)
std::auto_ptr< internal::BMRStrategy > strategy_
fwlite::BranchMapReader::BranchMapReader ( )
inline

Definition at line 65 of file BranchMapReader.h.

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

Member Function Documentation

const std::vector< edm::BranchDescription > & BranchMapReader::getBranchDescriptions ( )

Definition at line 600 of file BranchMapReader.cc.

References strategy_.

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

600  {
601  return strategy_->getBranchDescriptions();
602 }
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 80 of file BranchMapReader.h.

References strategy_.

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

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

Definition at line 84 of file BranchMapReader.h.

References strategy_.

84 { return strategy_->fileUUID_; }
std::auto_ptr< internal::BMRStrategy > strategy_
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().

540  {
541  TTree* metaDataTree = dynamic_cast<TTree*>(file->Get(edm::poolNames::metaDataTreeName().c_str()));
542  if (0==metaDataTree) {
543  return 0;
544  }
545 
548  TBranch* bVer = metaDataTree->GetBranch(edm::poolNames::fileFormatVersionBranchName().c_str());
549  bVer->SetAddress(&pV);
550  bVer->GetEntry(0);
551  fileVersion_ = v.value();
552  return v.value();
553 }
std::string const & fileFormatVersionBranchName()
Definition: BranchType.cc:202
std::string const & metaDataTreeName()
Definition: BranchType.cc:157
mathSSE::Vec4< T > v
int fwlite::BranchMapReader::getFileVersion ( ) const
inline

Definition at line 78 of file BranchMapReader.h.

References fileVersion_.

Referenced by BranchMapReader(), and updateFile().

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

Definition at line 86 of file BranchMapReader.h.

References strategy_.

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

Definition at line 82 of file BranchMapReader.h.

References strategy_.

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

Definition at line 87 of file BranchMapReader.h.

References strategy_.

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

Definition at line 83 of file BranchMapReader.h.

References strategy_.

83 { return strategy_->runTree_; }
std::auto_ptr< internal::BMRStrategy > strategy_
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().

606  {
607  std::auto_ptr<internal::BMRStrategy> s;
608 
609  if (fileVersion >= 17) {
610  s = std::auto_ptr<internal::BMRStrategy>(new internal::BranchMapReaderStrategyV17(file, fileVersion));
611  } else if (fileVersion >= 11) {
612  s = std::auto_ptr<internal::BMRStrategy>(new internal::BranchMapReaderStrategyV11(file, fileVersion));
613  } else if (fileVersion >= 8) {
614  s = std::auto_ptr<internal::BMRStrategy>(new internal::BranchMapReaderStrategyV8(file, fileVersion));
615  } else if (fileVersion >= 7) {
616  s = std::auto_ptr<internal::BMRStrategy>(new internal::BranchMapReaderStrategyV7(file, fileVersion));
617  } else {
618  s = std::auto_ptr<internal::BMRStrategy>(new internal::BranchMapReaderStrategyV1(file, fileVersion));
619  }
620  return s;
621 }
string s
Definition: asciidump.py:422
const edm::BranchDescription BranchMapReader::productToBranch ( const edm::ProductID pid)

Definition at line 595 of file BranchMapReader.cc.

References strategy_.

Referenced by BareRootProductGetter::createNewBuffer().

595  {
596  return strategy_->productToBranch(pid);
597 }
std::auto_ptr< internal::BMRStrategy > strategy_
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().

555  {
556  return strategy_->updateEvent(newevent);
557 }
std::auto_ptr< internal::BMRStrategy > strategy_
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().

567  {
568  if (0 == strategy_.get()) {
570  return true;
571  }
572 
573  TFile* currentFile(strategy_->currentFile_);
574  bool isNew(file != currentFile);
575 
576  if (!isNew) {
577  //could still have a new TFile which just happens to share the same memory address as the previous file
578  //will assume that if the Event tree's address and UUID are the same as before then we do not have
579  // to treat this like a new file
580  TTree* eventTreeTemp = dynamic_cast<TTree*>(currentFile->Get(edm::poolNames::eventTreeName().c_str()));
581  isNew = eventTreeTemp != strategy_->eventTree_ || strategy_->fileUUID_ != currentFile->GetUUID();
582  }
583  if (isNew) {
584  int fileVersion = getFileVersion(file);
585  if (fileVersion != strategy_->fileVersion_) {
586  strategy_ = newStrategy(file, fileVersion);
587  } else {
588  strategy_->updateFile(file);
589  }
590  }
591  return isNew;
592 }
std::auto_ptr< internal::BMRStrategy > newStrategy(TFile *file, int fileVersion)
std::auto_ptr< internal::BMRStrategy > strategy_
std::string const & eventTreeName()
Definition: BranchType.cc:244
bool BranchMapReader::updateLuminosityBlock ( Long_t  luminosityBlockEntry)

Definition at line 559 of file BranchMapReader.cc.

References strategy_.

559  {
560  return strategy_->updateLuminosityBlock(newlumi);
561 }
std::auto_ptr< internal::BMRStrategy > strategy_
bool BranchMapReader::updateRun ( Long_t  runEntry)

Definition at line 563 of file BranchMapReader.cc.

References strategy_.

563  {
564  return strategy_->updateRun(newRun);
565 }
std::auto_ptr< internal::BMRStrategy > strategy_

Member Data Documentation

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