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

virtual edm::BranchListIndexes const & branchListIndexes () const override
 
 BranchMapReaderStrategyV17 (TFile *file, int fileVersion)
 
virtual edm::BranchID productToBranchID (edm::ProductID const &pid) override
 
virtual bool updateEvent (Long_t eventEntry) override
 
virtual bool updateFile (TFile *file) override
 
virtual bool updateLuminosityBlock (Long_t luminosityBlockEntry) override
 
virtual bool updateMap () override
 
virtual bool updateRun (Long_t runEntry) override
 
- Public Member Functions inherited from fwlite::internal::Strategy
virtual edm::BranchDescription const & branchIDToBranch (edm::BranchID const &bid) const override
 
virtual std::vector< edm::BranchDescription > const & getBranchDescriptions () override
 
TBranch * getBranchRegistry (edm::ProductRegistry **pReg)
 
virtual edm::BranchDescription const & productToBranch (edm::ProductID const &pid) override
 
 Strategy (TFile *file, int fileVersion)
 
virtual edm::ThinnedAssociationsHelper const & thinnedAssociationsHelper () const override
 
virtual ~Strategy ()
 
- 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 433 of file BranchMapReader.cc.

Constructor & Destructor Documentation

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

Definition at line 450 of file BranchMapReader.cc.

References updateFile().

451  : Strategy(file, fileVersion), eventsTree_(nullptr), pBranchListIndexes_(&branchListIndexes_) {
452  updateFile(file);
453  }
virtual bool updateFile(TFile *file) override
Strategy(TFile *file, int fileVersion)
edm::propagate_const< edm::BranchListIndexes * > pBranchListIndexes_
edm::propagate_const< TTree * > eventsTree_

Member Function Documentation

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

Implements fwlite::internal::BMRStrategy.

Definition at line 442 of file BranchMapReader.cc.

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

Reimplemented from fwlite::internal::Strategy.

Definition at line 552 of file BranchMapReader.cc.

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

552  {
553  updateMap();
555  }
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 455 of file BranchMapReader.cc.

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

455  {
456 // std::cout << "v11 updateevent " << newevent << std::endl;
457  if(newevent != eventEntry_) {
458  eventEntry_ = newevent;
459  mapperFilled_ = false;
460  }
461  return true;
462  }
bool fwlite::internal::BranchMapReaderStrategyV17::updateFile ( TFile *  file)
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 480 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().

480  {
482  mapperFilled_ = false;
483  TTree* metaDataTree = dynamic_cast<TTree*>(currentFile_->Get(edm::poolNames::metaDataTreeName().c_str()));
484  if(nullptr == metaDataTree) {
486  }
487 
488  thinnedAssociationsHelper_ = std::make_unique<edm::ThinnedAssociationsHelper>();
489  edm::ThinnedAssociationsHelper* thinnedAssociationsHelperPtr = thinnedAssociationsHelper_.get();
490  if(metaDataTree->FindBranch(edm::poolNames::thinnedAssociationsHelperBranchName().c_str()) != nullptr) {
491  TBranch* b = metaDataTree->GetBranch(edm::poolNames::thinnedAssociationsHelperBranchName().c_str());
492  b->SetAddress(&thinnedAssociationsHelperPtr);
493  b->GetEntry(0);
494  }
495 
496  branchIDLists_ = std::make_unique<edm::BranchIDLists>();
497  edm::BranchIDLists* branchIDListsPtr = branchIDLists_.get();
498  if(metaDataTree->FindBranch(edm::poolNames::branchIDListBranchName().c_str()) != 0) {
499  TBranch* b = metaDataTree->GetBranch(edm::poolNames::branchIDListBranchName().c_str());
500  b->SetAddress(&branchIDListsPtr);
501  b->GetEntry(0);
502 // std::cout << "--> " << branchIDLists_->size() << std::endl;
503  } else {
505  << "FindBranch of branchIDList failed";
506  return false;
507  }
508 
509  eventsTree_ = dynamic_cast<TTree*>(currentFile_->Get(edm::poolNames::eventTreeName().c_str()));
510 
511  branchDescriptionMap_.clear();
512  bDesc_.clear();
513 
515  edm::ProductRegistry* pReg = &reg;
516  TBranch *br = getBranchRegistry(&pReg);
517 
518  if(nullptr != br) {
520 
521  for(auto& item : prodList) {
522  edm::BranchDescription& prod = item.second;
523  if(edm::InEvent == prod.branchType()) {
524  // call to regenerate branchName
525  prod.init();
527 // std::cout << "v11 updatefile " << prod.branchID() << std::endl;
528  }
529  }
530  }
531  reg.setFrozen(false);
532  return nullptr != br;
533  }
BranchType const & branchType() const
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
edm::propagate_const< TFile * > currentFile_
std::map< BranchKey, BranchDescription > ProductList
virtual 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:168
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:213
std::string const & eventTreeName()
Definition: BranchType.cc:260
std::string const & branchIDListBranchName()
Definition: BranchType.cc:208
bool fwlite::internal::BranchMapReaderStrategyV17::updateLuminosityBlock ( Long_t  luminosityBlockEntry)
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 464 of file BranchMapReader.cc.

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

464  {
465  if(newlumi != luminosityBlockEntry_) {
466  luminosityBlockEntry_ = newlumi;
467  mapperFilled_ = false;
468  }
469  return true;
470  }
bool fwlite::internal::BranchMapReaderStrategyV17::updateMap ( )
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 535 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().

535  {
536  if(!mapperFilled_) {
537  TBranch* branchListIndexesBranch = eventsTree_->GetBranch(edm::poolNames::branchListIndexesBranchName().c_str());
538  if(!branchListIndexesBranch) {
540  << "Failed to find branch list indexes branch in event tree";
541  return false;
542  }
543  // yes, SetAddress really does need to be called every time...
544  branchListIndexesBranch->SetAddress(&pBranchListIndexes_);
545  branchListIndexesBranch->GetEntry(eventEntry_);
546  mapperFilled_ = true;
547  }
548  return true;
549  }
edm::propagate_const< edm::BranchListIndexes * > pBranchListIndexes_
edm::propagate_const< TTree * > eventsTree_
std::string const & branchListIndexesBranchName()
Definition: BranchType.cc:247
bool fwlite::internal::BranchMapReaderStrategyV17::updateRun ( Long_t  runEntry)
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 472 of file BranchMapReader.cc.

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

472  {
473  if(newRun != runEntry_) {
474  runEntry_ = newRun;
475  mapperFilled_ = false;
476  }
477  return true;
478  }

Member Data Documentation

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

Definition at line 444 of file BranchMapReader.cc.

Referenced by productToBranchID(), and updateFile().

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

Definition at line 446 of file BranchMapReader.cc.

Referenced by productToBranchID().

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

Definition at line 445 of file BranchMapReader.cc.

Referenced by updateFile(), and updateMap().

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

Definition at line 447 of file BranchMapReader.cc.

Referenced by updateMap().