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
 
 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 ~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

◆ BranchMapReaderStrategyV17()

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

Definition at line 458 of file BranchMapReader.cc.

459  : Strategy(file, fileVersion), eventsTree_(nullptr), pBranchListIndexes_(&branchListIndexes_) {
460  updateFile(file);
461  }

References FrontierConditions_GlobalTag_cff::file, and updateFile().

Member Function Documentation

◆ branchListIndexes()

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

Implements fwlite::internal::BMRStrategy.

Definition at line 449 of file BranchMapReader.cc.

449 { return branchListIndexes_; }

References branchListIndexes_.

◆ productToBranchID()

edm::BranchID fwlite::internal::BranchMapReaderStrategyV17::productToBranchID ( edm::ProductID const &  pid)
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 560 of file BranchMapReader.cc.

560  {
561  updateMap();
563  }

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

◆ updateEvent()

bool fwlite::internal::BranchMapReaderStrategyV17::updateEvent ( Long_t  eventEntry)
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 463 of file BranchMapReader.cc.

463  {
464  // std::cout << "v11 updateevent " << newevent << std::endl;
465  if (newevent != eventEntry_) {
466  eventEntry_ = newevent;
467  mapperFilled_ = false;
468  }
469  return true;
470  }

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

◆ updateFile()

bool fwlite::internal::BranchMapReaderStrategyV17::updateFile ( TFile *  file)
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 488 of file BranchMapReader.cc.

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  }

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

Referenced by BranchMapReaderStrategyV17().

◆ updateLuminosityBlock()

bool fwlite::internal::BranchMapReaderStrategyV17::updateLuminosityBlock ( Long_t  luminosityBlockEntry)
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 472 of file BranchMapReader.cc.

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

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

◆ updateMap()

bool fwlite::internal::BranchMapReaderStrategyV17::updateMap ( )
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 543 of file BranchMapReader.cc.

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  }

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

Referenced by productToBranchID().

◆ updateRun()

bool fwlite::internal::BranchMapReaderStrategyV17::updateRun ( Long_t  runEntry)
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 480 of file BranchMapReader.cc.

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

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

Member Data Documentation

◆ branchIDLists_

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().

◆ branchListIndexes_

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

Definition at line 454 of file BranchMapReader.cc.

Referenced by branchListIndexes(), and productToBranchID().

◆ eventsTree_

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

Definition at line 453 of file BranchMapReader.cc.

Referenced by updateFile(), and updateMap().

◆ pBranchListIndexes_

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

Definition at line 455 of file BranchMapReader.cc.

Referenced by updateMap().

fwlite::internal::Strategy::updateFile
bool updateFile(TFile *file) override
Definition: BranchMapReader.cc:105
edm::poolNames::branchIDListBranchName
std::string const & branchIDListBranchName()
Definition: BranchType.cc:186
fwlite::internal::BranchMapReaderStrategyV17::updateMap
bool updateMap() override
Definition: BranchMapReader.cc:543
edm::poolNames::eventTreeName
std::string const & eventTreeName()
Definition: BranchType.cc:218
fwlite::internal::Strategy::branchDescriptionMap_
bidToDesc branchDescriptionMap_
Definition: BranchMapReader.cc:87
edm::ProductRegistry::setFrozen
void setFrozen(bool initializeLookupInfo=true)
Definition: ProductRegistry.cc:165
fwlite::internal::Strategy::mapperFilled_
bool mapperFilled_
Definition: BranchMapReader.cc:89
fwlite::internal::BranchMapReaderStrategyV17::updateFile
bool updateFile(TFile *file) override
Definition: BranchMapReader.cc:488
fwlite::internal::Strategy::bDesc_
std::vector< edm::BranchDescription > bDesc_
Definition: BranchMapReader.cc:88
edm::errors::EventCorruption
Definition: EDMException.h:43
fwlite::internal::BMRStrategy::eventEntry_
Long_t eventEntry_
Definition: BranchMapReader.h:63
fwlite::internal::Strategy::Strategy
Strategy(TFile *file, int fileVersion)
Definition: BranchMapReader.cc:93
edm::poolNames::branchListIndexesBranchName
std::string const & branchListIndexesBranchName()
Definition: BranchType.cc:212
edm::ProductRegistry
Definition: ProductRegistry.h:34
edm::propagate_const::get
element_type const * get() const
Definition: propagate_const.h:64
edm::ProductRegistry::productListUpdator
ProductList & productListUpdator()
Definition: ProductRegistry.h:78
fwlite::internal::BranchMapReaderStrategyV17::branchIDLists_
edm::propagate_const< std::unique_ptr< edm::BranchIDLists > > branchIDLists_
Definition: BranchMapReader.cc:452
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
edm::InEvent
Definition: BranchType.h:11
b
double b
Definition: hdecay.h:118
edm::BranchIDLists
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
fwlite::internal::BMRStrategy::luminosityBlockEntry_
Long_t luminosityBlockEntry_
Definition: BranchMapReader.h:64
edm::ThinnedAssociationsHelper
Definition: ThinnedAssociationsHelper.h:35
edm::ProductRegistry::ProductList
std::map< BranchKey, BranchDescription > ProductList
Definition: ProductRegistry.h:36
fwlite::internal::BMRStrategy::currentFile_
edm::propagate_const< TFile * > currentFile_
Definition: BranchMapReader.h:58
fwlite::internal::BranchMapReaderStrategyV17::eventsTree_
edm::propagate_const< TTree * > eventsTree_
Definition: BranchMapReader.cc:453
beamvalidation.br
br
Definition: beamvalidation.py:398
fwlite::internal::Strategy::thinnedAssociationsHelper_
edm::propagate_const< std::unique_ptr< edm::ThinnedAssociationsHelper > > thinnedAssociationsHelper_
Definition: BranchMapReader.cc:90
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
fwlite::internal::Strategy::getBranchRegistry
TBranch * getBranchRegistry(edm::ProductRegistry **pReg)
Definition: BranchMapReader.cc:116
edm::poolNames::metaDataTreeName
std::string const & metaDataTreeName()
Definition: BranchType.cc:162
Exception
Definition: hltDiff.cc:246
edm::poolNames::thinnedAssociationsHelperBranchName
std::string const & thinnedAssociationsHelperBranchName()
Definition: BranchType.cc:189
edm::productIDToBranchID
BranchID productIDToBranchID(ProductID const &pid, BranchIDLists const &lists, BranchListIndexes const &indexes)
Definition: ProductIDToBranchID.cc:11
fwlite::internal::BranchMapReaderStrategyV17::branchListIndexes_
edm::BranchListIndexes branchListIndexes_
Definition: BranchMapReader.cc:454
edm::BranchDescription
Definition: BranchDescription.h:32
fwlite::internal::BMRStrategy::runEntry_
Long_t runEntry_
Definition: BranchMapReader.h:65
fwlite::internal::BranchMapReaderStrategyV17::pBranchListIndexes_
edm::propagate_const< edm::BranchListIndexes * > pBranchListIndexes_
Definition: BranchMapReader.cc:455