CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
fwlite::internal::BranchMapReaderStrategyV17 Class Reference
Inheritance diagram for fwlite::internal::BranchMapReaderStrategyV17:
fwlite::internal::Strategy fwlite::internal::BMRStrategy

Public Member Functions

edm::BranchListIndexes const & branchListIndexes () const override
 
 BranchMapReaderStrategyV17 (TFile *file, int fileVersion)
 
edm::BranchID productToBranchID (edm::ProductID const &pid) override
 
bool updateEvent (Long_t eventEntry) override
 
bool updateFile (TFile *file) override
 
bool updateLuminosityBlock (Long_t luminosityBlockEntry) override
 
bool updateMap () override
 
bool updateRun (Long_t runEntry) override
 
- Public Member Functions inherited from fwlite::internal::Strategy
edm::BranchDescription const & branchIDToBranch (edm::BranchID const &bid) const override
 
std::vector< edm::BranchDescription > const & getBranchDescriptions () override
 
TBranch * getBranchRegistry (edm::ProductRegistry **pReg)
 
edm::BranchDescription const & productToBranch (edm::ProductID const &pid) override
 
edm::BranchID productToBranchID (edm::ProductID const &pid) override
 
 Strategy (TFile *file, int fileVersion)
 
edm::ThinnedAssociationsHelper const & thinnedAssociationsHelper () const override
 
 ~Strategy () override
 
- Public Member Functions inherited from fwlite::internal::BMRStrategy
 BMRStrategy (TFile *file, int fileVersion)
 
virtual const edm::BranchDescriptionbranchIDToBranch (const edm::BranchID &bid) const =0
 
virtual const edm::BranchDescriptionproductToBranch (const edm::ProductID &pid)=0
 
virtual edm::BranchID productToBranchID (const edm::ProductID &pid)=0
 
virtual ~BMRStrategy ()
 

Private Attributes

edm::propagate_const< std::unique_ptr< edm::BranchIDLists > > branchIDLists_
 
edm::BranchListIndexes branchListIndexes_
 
edm::propagate_const< TTree * > eventsTree_
 
edm::propagate_const< edm::BranchListIndexes * > pBranchListIndexes_
 

Additional Inherited Members

- Public Types inherited from fwlite::internal::Strategy
typedef std::map< edm::BranchID, edm::BranchDescriptionbidToDesc
 
- Public Attributes inherited from fwlite::internal::Strategy
std::vector< edm::BranchDescriptionbDesc_
 
bidToDesc branchDescriptionMap_
 
bool mapperFilled_
 
edm::propagate_const< std::unique_ptr< edm::ThinnedAssociationsHelper > > thinnedAssociationsHelper_
 
- Public Attributes inherited from fwlite::internal::BMRStrategy
edm::propagate_const< TFile * > currentFile_
 
Long_t eventEntry_
 
edm::propagate_const< TTree * > eventTree_
 
TUUID fileUUID_
 
int fileVersion_
 
Long_t luminosityBlockEntry_
 
edm::propagate_const< TTree * > luminosityBlockTree_
 
Long_t runEntry_
 
edm::propagate_const< TTree * > runTree_
 

Detailed Description

Definition at line 440 of file BranchMapReader.cc.

Constructor & Destructor Documentation

fwlite::internal::BranchMapReaderStrategyV17::BranchMapReaderStrategyV17 ( TFile *  file,
int  fileVersion 
)

Definition at line 458 of file BranchMapReader.cc.

References updateFile().

459  : Strategy(file, fileVersion), eventsTree_(nullptr), pBranchListIndexes_(&branchListIndexes_) {
460  updateFile(file);
461  }
Strategy(TFile *file, int fileVersion)
edm::propagate_const< edm::BranchListIndexes * > pBranchListIndexes_
edm::propagate_const< TTree * > eventsTree_

Member Function Documentation

edm::BranchListIndexes const& fwlite::internal::BranchMapReaderStrategyV17::branchListIndexes ( ) const
inlineoverridevirtual

Implements fwlite::internal::BMRStrategy.

Definition at line 449 of file BranchMapReader.cc.

449 { return branchListIndexes_; }
edm::BranchID fwlite::internal::BranchMapReaderStrategyV17::productToBranchID ( edm::ProductID const &  pid)
override

Definition at line 560 of file BranchMapReader.cc.

References branchIDLists_, branchListIndexes_, edm::productIDToBranchID(), and updateMap().

560  {
561  updateMap();
563  }
BranchID productIDToBranchID(ProductID const &pid, BranchIDLists const &lists, BranchListIndexes const &indexes)
edm::propagate_const< std::unique_ptr< edm::BranchIDLists > > branchIDLists_
bool fwlite::internal::BranchMapReaderStrategyV17::updateEvent ( Long_t  eventEntry)
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 463 of file BranchMapReader.cc.

References fwlite::internal::BMRStrategy::eventEntry_, and fwlite::internal::Strategy::mapperFilled_.

463  {
464  // std::cout << "v11 updateevent " << newevent << std::endl;
465  if (newevent != eventEntry_) {
466  eventEntry_ = newevent;
467  mapperFilled_ = false;
468  }
469  return true;
470  }
bool fwlite::internal::BranchMapReaderStrategyV17::updateFile ( TFile *  file)
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 488 of file BranchMapReader.cc.

References b, fwlite::internal::Strategy::bDesc_, beamvalidation::br, fwlite::internal::Strategy::branchDescriptionMap_, edm::BranchDescription::branchID(), edm::poolNames::branchIDListBranchName(), branchIDLists_, edm::BranchDescription::branchType(), fwlite::internal::BMRStrategy::currentFile_, edm::errors::EventCorruption, eventsTree_, edm::poolNames::eventTreeName(), Exception, edm::propagate_const< T >::get(), fwlite::internal::Strategy::getBranchRegistry(), edm::InEvent, edm::BranchDescription::init(), fwlite::internal::Strategy::mapperFilled_, edm::poolNames::metaDataTreeName(), parseEventContent::prod, edm::ProductRegistry::productListUpdator(), edm::ProductRegistry::setFrozen(), fwlite::internal::Strategy::thinnedAssociationsHelper_, edm::poolNames::thinnedAssociationsHelperBranchName(), and fwlite::internal::Strategy::updateFile().

Referenced by BranchMapReaderStrategyV17().

488  {
490  mapperFilled_ = false;
491  TTree* metaDataTree = dynamic_cast<TTree*>(currentFile_->Get(edm::poolNames::metaDataTreeName().c_str()));
492  if (nullptr == metaDataTree) {
494  << "No " << edm::poolNames::metaDataTreeName() << " TTree in file";
495  }
496 
497  thinnedAssociationsHelper_ = std::make_unique<edm::ThinnedAssociationsHelper>();
498  edm::ThinnedAssociationsHelper* thinnedAssociationsHelperPtr = thinnedAssociationsHelper_.get();
499  if (metaDataTree->FindBranch(edm::poolNames::thinnedAssociationsHelperBranchName().c_str()) != nullptr) {
500  TBranch* b = metaDataTree->GetBranch(edm::poolNames::thinnedAssociationsHelperBranchName().c_str());
501  b->SetAddress(&thinnedAssociationsHelperPtr);
502  b->GetEntry(0);
503  }
504 
505  branchIDLists_ = std::make_unique<edm::BranchIDLists>();
506  edm::BranchIDLists* branchIDListsPtr = branchIDLists_.get();
507  if (metaDataTree->FindBranch(edm::poolNames::branchIDListBranchName().c_str()) != nullptr) {
508  TBranch* b = metaDataTree->GetBranch(edm::poolNames::branchIDListBranchName().c_str());
509  b->SetAddress(&branchIDListsPtr);
510  b->GetEntry(0);
511  // std::cout << "--> " << branchIDLists_->size() << std::endl;
512  } else {
513  throw edm::Exception(edm::errors::EventCorruption) << "FindBranch of branchIDList failed";
514  return false;
515  }
516 
517  eventsTree_ = dynamic_cast<TTree*>(currentFile_->Get(edm::poolNames::eventTreeName().c_str()));
518 
519  branchDescriptionMap_.clear();
520  bDesc_.clear();
521 
523  edm::ProductRegistry* pReg = &reg;
524  TBranch* br = getBranchRegistry(&pReg);
525 
526  if (nullptr != br) {
528 
529  for (auto& item : prodList) {
530  edm::BranchDescription& prod = item.second;
531  if (edm::InEvent == prod.branchType()) {
532  // call to regenerate branchName
533  prod.init();
535  // std::cout << "v11 updatefile " << prod.branchID() << std::endl;
536  }
537  }
538  }
539  reg.setFrozen(false);
540  return nullptr != br;
541  }
BranchType const & branchType() const
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
edm::propagate_const< TFile * > currentFile_
std::map< BranchKey, BranchDescription > ProductList
bool updateFile(TFile *file) override
std::vector< edm::BranchDescription > bDesc_
TBranch * getBranchRegistry(edm::ProductRegistry **pReg)
BranchID const & branchID() const
std::string const & metaDataTreeName()
Definition: BranchType.cc:169
void setFrozen(bool initializeLookupInfo=true)
element_type const * get() const
double b
Definition: hdecay.h:120
ProductList & productListUpdator()
edm::propagate_const< std::unique_ptr< edm::BranchIDLists > > branchIDLists_
edm::propagate_const< std::unique_ptr< edm::ThinnedAssociationsHelper > > thinnedAssociationsHelper_
edm::propagate_const< TTree * > eventsTree_
std::string const & thinnedAssociationsHelperBranchName()
Definition: BranchType.cc:214
std::string const & eventTreeName()
Definition: BranchType.cc:266
std::string const & branchIDListBranchName()
Definition: BranchType.cc:209
bool fwlite::internal::BranchMapReaderStrategyV17::updateLuminosityBlock ( Long_t  luminosityBlockEntry)
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 472 of file BranchMapReader.cc.

References fwlite::internal::BMRStrategy::luminosityBlockEntry_, and fwlite::internal::Strategy::mapperFilled_.

472  {
473  if (newlumi != luminosityBlockEntry_) {
474  luminosityBlockEntry_ = newlumi;
475  mapperFilled_ = false;
476  }
477  return true;
478  }
bool fwlite::internal::BranchMapReaderStrategyV17::updateMap ( )
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 543 of file BranchMapReader.cc.

References edm::poolNames::branchListIndexesBranchName(), edm::errors::EventCorruption, fwlite::internal::BMRStrategy::eventEntry_, eventsTree_, Exception, fwlite::internal::Strategy::mapperFilled_, and pBranchListIndexes_.

Referenced by productToBranchID().

543  {
544  if (!mapperFilled_) {
545  TBranch* branchListIndexesBranch =
547  if (!branchListIndexesBranch) {
549  << "Failed to find branch list indexes branch in event tree";
550  return false;
551  }
552  // yes, SetAddress really does need to be called every time...
553  branchListIndexesBranch->SetAddress(&pBranchListIndexes_);
554  branchListIndexesBranch->GetEntry(eventEntry_);
555  mapperFilled_ = true;
556  }
557  return true;
558  }
edm::propagate_const< edm::BranchListIndexes * > pBranchListIndexes_
edm::propagate_const< TTree * > eventsTree_
std::string const & branchListIndexesBranchName()
Definition: BranchType.cc:253
bool fwlite::internal::BranchMapReaderStrategyV17::updateRun ( Long_t  runEntry)
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 480 of file BranchMapReader.cc.

References fwlite::internal::Strategy::mapperFilled_, and fwlite::internal::BMRStrategy::runEntry_.

480  {
481  if (newRun != runEntry_) {
482  runEntry_ = newRun;
483  mapperFilled_ = false;
484  }
485  return true;
486  }

Member Data Documentation

edm::propagate_const<std::unique_ptr<edm::BranchIDLists> > fwlite::internal::BranchMapReaderStrategyV17::branchIDLists_
private

Definition at line 452 of file BranchMapReader.cc.

Referenced by productToBranchID(), and updateFile().

edm::BranchListIndexes fwlite::internal::BranchMapReaderStrategyV17::branchListIndexes_
private

Definition at line 454 of file BranchMapReader.cc.

Referenced by productToBranchID().

edm::propagate_const<TTree*> fwlite::internal::BranchMapReaderStrategyV17::eventsTree_
private

Definition at line 453 of file BranchMapReader.cc.

Referenced by updateFile(), and updateMap().

edm::propagate_const<edm::BranchListIndexes*> fwlite::internal::BranchMapReaderStrategyV17::pBranchListIndexes_
private

Definition at line 455 of file BranchMapReader.cc.

Referenced by updateMap().